@vuu-ui/vuu-layout 0.7.6 → 0.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cjs/index.js +3 -3
- package/cjs/index.js.map +3 -3
- package/esm/index.js +3 -3
- package/esm/index.js.map +3 -3
- package/index.css +1 -1
- package/index.css.map +2 -2
- package/package.json +3 -3
- package/types/flexbox/Splitter.d.ts +3 -3
- package/types/layout-action.d.ts +1 -0
- package/types/layout-reducer/layoutTypes.d.ts +22 -1
- package/types/layout-reducer/resize-flex-children.d.ts +3 -2
package/esm/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{partition as yo}from"@vuu-ui/vuu-utils";import Mr from"classnames";var co={},po={},te={};function $(e){return co[e]===!0}function Tr(e){return po[e]===!0}var uo=e=>$(e)||Tr(e),ll=e=>!!te[e];function z(e,t,o="component"){te[e]=t,o==="container"?co[e]=!0:o==="view"&&(po[e]=!0)}import{Button as mo,useControlled as wr}from"@salt-ds/core";import fo from"classnames";import{useCallback as Pr}from"react";import{jsx as Ee,jsxs as vr}from"react/jsx-runtime";var oe="vuuDrawer",ho=e=>typeof e=="string"?e:e+"px",Lr=(e,t,o)=>{let n=t!==void 0,r=o!==void 0;if(!(!e&&!r&&!n))return!r&&!n?e:{...e,"--drawer-size":n?ho(t):void 0,"--drawer-peek-size":r?ho(o):void 0}},go=({children:e,className:t,clickToOpen:o,defaultOpen:n,sizeOpen:r,sizeClosed:i,style:s,open:a,position:l="left",inline:c,onClick:p,peekaboo:m=!1,toggleButton:u,...f})=>{let[h,g]=wr({controlled:a,default:n!=null?n:!1,name:"Drawer",state:"open"}),y=fo(oe,t,`${oe}-${l}`,{[`${oe}-open`]:h,[`${oe}-inline`]:c,[`${oe}-over`]:!c,[`${oe}-peekaboo`]:m}),d=Pr(()=>{g(!h)},[h,g]),b=Lr(s,r,i),E=o?d:p,R=()=>Ee("div",{className:fo("vuuToggleButton-container"),children:h?Ee(mo,{"aria-label":"close",onClick:d,"data-icon":"close",variant:"secondary"}):Ee(mo,{"aria-label":"open",onClick:d,"data-icon":"close",variant:"secondary"})});return vr("div",{...f,className:y,onClick:E,style:b,children:[u=="start"?R():null,Ee("div",{className:`${oe}-liner`,children:Ee("div",{className:`${oe}-content`,children:e})}),u=="end"?R():null]})};go.displayName="Drawer";var gt=go;import{jsx as zr,jsxs as Ir}from"react/jsx-runtime";var Cr=e=>e.type===gt,Ar=({props:{position:e="left"}})=>e.match(/top|bottom/),yt=e=>{let{children:t,className:o,id:n,style:r}=e,i="vuuDockLayout",[s,a]=yo(t,Cr),[l,c]=yo(s,Ar),p=l.length===0?"horizontal":c.length===0?"vertical":"both",m=Mr(i,o,`${i}-${p}`);return Ir("div",{className:m,id:n,style:r,children:[s,zr("div",{className:`${i}-content`,children:a})]})};yt.displayName="DockLayout";var kr=yt;z("DockLayout",yt,"container");import{forwardRef as Br}from"react";import{jsx as Or}from"react/jsx-runtime";var bt=Br(function({resizeable:t,...o},n){return Or("div",{...o,className:"Component",ref:n})});bt.displayName="Component";var xt=bt;z("Component",bt);import le from"react";var Hr={},w=(e,t)=>{var n;let o=T(e);return(n=o[t])!=null?n:o[`data-${t}`]},T=e=>(e==null?void 0:e.props)||e||Hr,bo=e=>{let t=T(e);if(t.children){let{children:[o,...n]}=t;return n.length>0&&console.warn(`getChild expected a single child, found ${n.length+1}`),o}};function P(e){var t;if(e){let o=e.type;if(typeof o=="function"||typeof o=="object"){let n=o.displayName||o.name||((t=o.type)==null?void 0:t.name);if(typeof n=="string")return n}if(typeof e.type=="string")return e.type;if(e.constructor)return e.constructor.displayName;throw Error("typeOf unable to determine type of element")}}var Wl=(e,t)=>P(e)===t;var $r=e=>{let t=e.lastIndexOf(".");return t===-1?e:e.slice(0,t)};function q(e,t){let{"data-path":o,path:n=o}=T(e);return t==="0"||t===n?null:V(e,$r(t),!0)}function Q(e,t){let{children:o,...n}=T(e);if(t(n))return e;if(le.Children.count(o)>0){let r=le.isValidElement(o)?[o]:o;for(let i of r){let s=Q(i,t);if(s)return s}}}function Fr(e,t){if(t===e)return null;let{path:o,children:n}=T(e),{idx:r,finalStep:i}=Z(o,w(t,"path"));return i?e:n===void 0||n[r]===void 0?null:Fr(n[r],t)}var Nr=(e,t)=>{if(le.isValidElement(e)&&t==0)return e;if(Array.isArray(e))return e[t]};function xo(e,t){let o=t.split("."),n=[e],r=i=>le.isValidElement(i.props.children)?[i.props.children]:i.props.children;for(let i=0;i<o.length;i++){let s=parseInt(o[i]),a=n[s];if(i===o.length-1)return a;n=r(a)}}function V(e,t,o=!1){let{"data-path":n,path:r=n}=T(e);if(t.indexOf(r)!==0)throw Error(`pathUtils.followPath path ${t} is not within source path ${r}`);let i=t.slice(r.length+1);if(i==="")return e;let s=e,a=i.split(".");for(let l=0;l<a.length;l++){if(le.Children.count(s.props.children)===0){let c=`element at 0.${a.slice(0,l).join(".")} has no children, so cannot fulfill rest of path ${a.slice(l).join(".")}`;if(o)throw Error(c);console.warn(c);return}if(s=Nr(s.props.children,parseInt(a[l])),s===void 0){let c=`model at 0.${a.slice(0,l).join(".")} has no children that fulfill next step of path ${a.slice(l).join(".")}`;if(o)throw Error(c);console.warn(c)}}return s}function Jl(e,t){let o=q(e,t),n=t.split(".").map(r=>parseInt(r,10));if(o){let r=n.pop(),{children:i}=o.props;if(i.length-1>r)return Fe(i[r+1]);{let s=n.pop(),a=q(e,w(o,"path"));if(a&&typeof s=="number"&&(n=a.props.path.split(".").map(l=>parseInt(l,10)),a.props.children.length-1>s)){let l=a.props.children[s+1];return $(P(l))?Fe(l):l}}}return Fe(e)}function jl(e,t){let o=t.split(".").map(i=>parseInt(i,10)),n=o.pop(),r=q(e,t);if(r!=null&&typeof n=="number"){let{children:i}=r.props;if(n>0)return Ne(i[n-1]);for(;o.length>1;)if(n=o.pop(),r=q(e,w(r,"path")),n>0){let s=r.props.children[n-1];return $(P(s))?Ne(s):s}}return Ne(e)}function Fe(e){if($(P(e))){let{children:t}=e.props||e;return Fe(t[0])}return e}function Ne(e){if($(P(e))){let{children:t}=e.props||e;return Ne(t[t.length-1])}return e}function Z(e,t,o=!1){if(e===t)return{idx:-1,finalStep:!0};let n=`${e}.`;if(!t.startsWith(n))throw Error("pathUtils nextStep has strayed from the path");let r=o?0:1,i=t.replace(n,"").split(".").map(s=>parseInt(s,10));return{idx:i[0],finalStep:i.length===r}}function B(e,t,o){if(w(e,"path")===t)return e;let n=[];le.Children.forEach(e.props.children,(i,s)=>{w(i,"path")?n.push(B(i,`${t}.${s}`)):n.push(i)});let r=e.props["data-path"]?"data-path":"path";return le.cloneElement(e,{[r]:t,...o},n)}function ql(e,t){typeof e=="function"?e(t):e&&(e.current=t)}var Rt=e=>{if(typeof e!="number")throw Error(`"no support yet for flex value ${e}`);return{flexBasis:0,flexGrow:1,flexShrink:1}};var pe={north:1,east:2,south:4,west:8,header:16,centre:32,absolute:64},Se={AFTER:"after",BEFORE:"before"},F=Object.freeze({North:ce("north"),East:ce("east"),South:ce("south"),West:ce("west"),Header:ce("header"),Centre:ce("centre"),Absolute:ce("absolute")});function ce(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 Ro=F.North,Eo=F.South,Et=F.East,St=F.West,Vr=F.Header,Wr=F.Centre,fe=class{static measure(t,o=[]){let n={};return Ur(t,n,o),n}static allBoxesContainingPoint(t,o,n,r,i){return wo(t,o,n,r,i).reverse()}};function Dt(e,t,o,n=30){let r=o.right-o.left,i=o.bottom-o.top,s=e-o.left,a=t-o.top,l=0;return s<n&&(l+=8),s>r-n&&(l+=2),a<n&&(l+=1),a>i-n&&(l+=4),{pctX:s/r,pctY:a/i,closeToTheEdge:l}}function Tt(e,t,o,n){let{BEFORE:r,AFTER:i}=Se,{pctX:s,pctY:a,closeToTheEdge:l}=Dt(e,t,o),c,p;if(n==="row")c=s<.5?St:Et;else if(o.header&&Ve(o.header,e,t))if(c=Vr,o.Stack){let m=o.Stack.length;if(m===0)p={index:-1,left:o.left,positionRelativeToTab:i,width:0};else{let u=o.Stack.find(({left:f,right:h})=>e>=f&&e<=h);if(u){let f=u.right-u.left;p={index:o.Stack.indexOf(u),left:u.left,positionRelativeToTab:(e-u.left)/f<.5?r:i,width:f}}else p={left:o.Stack[m-1].right,width:0,index:m,positionRelativeToTab:i}}}else if(o.header.titleWidth){let m=o.header.titleWidth;p={index:-1,left:o.left,positionRelativeToTab:(e-o.left)/m<.5?r:i,width:m}}else p={left:o.left,width:0,positionRelativeToTab:r,index:-1};else c=_r(e,t,o,s,a);return{position:c,x:e,y:t,closeToTheEdge:l,tab:p}}function _r(e,t,o,n,r){let i=Gr(o,.2);if(Ve(i,e,t))return Wr;switch(`${r<.5?"north":"south"}${n<.5?"west":"east"}`){case"northwest":return n>r?Ro:St;case"northeast":return 1-n>r?Ro:Et;case"southeast":return n>r?Et:Eo;case"southwest":return 1-n>r?St:Eo;default:}}function Gr({right:e,left:t,top:o,bottom:n},r){let i=(1-r)/2,s=(e-t)*i,a=(n-o)*i;return{left:t+s,top:o+a,right:e-s,bottom:n-a}}function Ur(e,t,o){let{id:n,"data-path":r,path:i=r}=T(e),s=P(e);if(n&&i){let[a,l]=To(e);So(e,a,l,t),$(s)&&Do(e,t,o)}}function So(e,t,o,n){let{"data-path":r,path:i=r,header:s}=T(e);n[i]=t;let a=P(e);if(s||a==="Stack"){let l=o.querySelector(".vuuHeader");if(l){let{top:c,left:p,right:m,bottom:u}=l.getBoundingClientRect();if(n[i].header={top:Math.round(c),left:Math.round(p),right:Math.round(m),bottom:Math.round(u)},a==="Stack")n[i].Stack=Array.from(l.querySelectorAll(".saltTab")).map(f=>f.getBoundingClientRect()).map(({left:f,right:h})=>({left:f,right:h}));else{let f=l.querySelector('[class^="vuuHeader-title"]'),{header:h}=n[i];f&&h&&(h.titleWidth=f.clientWidth)}}}return n[i]}function Do(e,t,o,n=0,r=0,i=0,s=0){let{children:a,"data-path":l,path:c=l,style:p,active:m=0}=T(e),u=P(e),f=u==="Flexbox",h=u==="Stack",g=f&&p.flexDirection==="column",y=f&&p.flexDirection==="row",b=(h?a.filter((R,D)=>D===m):a.filter(Xr)).map(R=>{let[D,x]=To(R);return[{...D,top:D.top-i,right:D.right+r,bottom:D.bottom+s,left:D.left-n},x,R]}),E=b.map(([R,D,x],S,L)=>{let C,H,v,I,M,A,k=L.length-1;y?(M=S===0?0:R.left-L[S-1][0].right,A=S===k?0:L[S+1][0].left-R.right,C=S===0||M===0?0:M,H=S===k||A===0?0:A-A/2,R.left-=C,R.right+=H,v=i,I=s):g&&(M=S===0?0:R.top-L[S-1][0].bottom,A=S===k?0:L[S+1][0].top-R.bottom,v=S===0||M===0?0:M,I=S===k||A===0?0:A-A/2,R.top-=v,R.bottom+=I,C=n,H=r);let j=So(x,R,D,t),W=P(x);return $(W)&&Do(x,t,o,C,H,v,I),j});b.length&&(t[c].children=E)}function Xr(e){let{id:t}=T(e),o=document.getElementById(t);return o?o.dataset.dragging!=="true":(console.warn(`BoxModel: no element found with id #${t}`),!1)}function To(e){let{id:t}=T(e);if(t===void 0)throw Error("`BoxModel.measureComponentElement, component has no id");let o=document.getElementById(t);if(!o)throw Error("BoxModel.measureComponentElement, no DOM element found for component");let{top:n,left:r,right:i,bottom:s,height:a,width:l}=o.getBoundingClientRect(),c,p=P(e);if($(p)){let m=o.scrollHeight;m>a&&(c={id:t,scrollHeight:m,scrollTop:o.scrollTop})}return[{top:Math.round(n),left:Math.round(r),right:Math.round(i),bottom:Math.round(s),height:Math.round(a),width:Math.round(l),scrolling:c},o,e]}function wo(e,t,o,n,r,i=[]){let{children:s,"data-path":a,path:l=a}=T(e),c=P(e),p=t[l];if(!Ve(p,o,n))return i;if(r&&r.length){if(r.includes(l))i.push(e);else if(!r.some(m=>m.startsWith(l)))return i}else i.push(e);if(!$(c)||p.header&&Ve(p.header,o,n))return i;p.scrolling&&Zr(p,o,n);for(let m=0;m<s.length;m++){if(c==="Stack"&&e.props.active!==m)continue;let u=wo(s[m],t,o,n,r);if(u.length)return i.concat(u)}return i}function Ve(e,t,o){if(e)return t>=e.left&&t<e.right&&o>=e.top&&o<e.bottom}function Zr({top:e,bottom:t,scrolling:o},n,r){if(o){let{id:i,scrollTop:s,scrollHeight:a}=o,l=t-e;if(s===0&&t-r<50){let c=a-l;document.getElementById(i).scrollTo({left:0,top:c,behavior:"smooth"}),o.scrollTop=c}else if(s>0&&r-e<50)document.getElementById(i).scrollTo({left:0,top:0,behavior:"smooth"}),o.scrollTop=0;else return!1}else return!1}var Yr=.4,We=class{constructor(t,o,n,r,i){this.init(t,o,n,r,i)}init(t,o,n,r,i){let{left:s,top:a}=r,{pctX:l,pctY:c}=Dt(o,n,r),p=Yr,m=l*r.width,u=r.width-m,f=c*r.height,h=r.height-f,g=r.width*p,y=r.height*p,d=1-p,b=m*d,E=f*d,R=u*d,D=h*d;this.intrinsicSize=i,this.constraint={zone:{x:{lo:t.left,hi:t.right},y:{lo:t.top,hi:t.bottom}},pos:{x:{lo:t.left-b,hi:t.right-r.width+R},y:{lo:t.top-E,hi:t.bottom-r.height+D}},mouse:{x:{lo:t.left+g*l,hi:t.right-g*(1-l)},y:{lo:t.top+y*c,hi:t.bottom-y*(1-c)}}},this.x={pos:s,lo:!1,hi:!1,mousePos:o,mousePct:l},this.y={pos:a,lo:!1,hi:!1,mousePos:n,mousePct:c}}outOfBounds(){return this.x.lo||this.x.hi||this.y.lo||this.y.hi}inBounds(){return!this.outOfBounds()}dropX(){return this.dropXY("x")}dropY(){return this.dropXY("y")}hasIntrinsicSize(){var t,o;return((t=this==null?void 0:this.intrinsicSize)==null?void 0:t.height)&&((o=this==null?void 0:this.intrinsicSize)==null?void 0:o.width)}update(t,o){let n=this[t],r=this.constraint.mouse[t],i=this.constraint.pos[t],s=n.pos,a=o-n.mousePos;return a<0?n.lo||(o<r.lo?(n.lo=!0,n.pos=i.lo):n.hi?o<r.hi&&(n.hi=!1,n.pos+=a):n.pos+=a):a>0&&(n.hi||(o>r.hi?(n.hi=!0,n.pos=i.hi):n.lo?o>r.lo&&(n.lo=!1,n.pos+=a):n.pos+=a)),n.mousePos=o,s!==n.pos}dropXY(t){let o=this[t],n=this.constraint.zone[t];return o.lo?Math.max(n.lo,o.mousePos):o.hi?Math.min(o.mousePos,Math.round(n.hi)-1):o.mousePos}};var hc=e=>e.pos.tab&&P(e.component)==="Stack"&&e.pos.position.Header,{north:Jr,south:jr,east:Kr,west:qr}=pe,Qr=Kr+qr,ei=Jr+jr,ne=class{constructor({component:t,pos:o,clientRect:n,nextDropTarget:r}){this.component=t,this.pos=o,this.clientRect=n,this.nextDropTarget=r,this.active=!1,this.dropRect=void 0}targetTabPos(t){let{left:o,width:n,positionRelativeToTab:r}=t;return r===Se.BEFORE?o:o+n}getTargetDropOutline(t,o){if(this.pos.tab)return this.getDropTabOutline(t,this.pos.tab);if(o&&o.hasIntrinsicSize())return this.getIntrinsicDropRect(o);{let[n,r,i,s]=this.getDropRectOutline(t,o);return{l:n,t:r,r:i,b:s}}}getDropTabOutline(t,o){var d,b;let{clientRect:{top:n,left:r,right:i,bottom:s,header:a}}=this,l=0,c=Math.round(t/2)+l,p=Math.round(n),m=Math.round(r+c),u=Math.round(i-c),f=Math.round(s-c),h=this.targetTabPos(o),g=60,y=((d=a==null?void 0:a.bottom)!=null?d:0)-((b=a==null?void 0:a.top)!=null?b:0);return{l:m,t:p,r:u,b:f,tabLeft:h,tabWidth:g,tabHeight:y}}getIntrinsicDropRect(t){var g,y,d,b;let{pos:o,clientRect:n}=this,{x:r,y:i}=t,s=(y=(g=t.intrinsicSize)==null?void 0:g.height)!=null?y:0,a=(b=(d=t.intrinsicSize)==null?void 0:d.height)!=null?b:0;s&&s>n.height?(console.log("DropTarget: we're going to blow the gaff"),s=n.height):a&&a>n.width&&(console.log("DropTarget: we're going to blow the gaff"),a=n.width);let l=Math.min(n.right-a,Math.max(n.left,Math.round(o.x-r.mousePct*a))),c=Math.min(n.bottom-s,Math.max(n.top,Math.round(o.y-i.mousePct*s))),[p,m,u,f]=this.dropRect=[l,c,l+a,c+s],h=o.position.EastOrWest?[p,n.top,p,n.bottom,u,n.top,u,n.bottom]:[n.left,m,n.right,m,n.left,f,n.right,f];return{l:p,r:u,t:m,b:f,guideLines:h}}getDropRectOutline(t,o){var b,E,R;let{pos:n,clientRect:r}=this,{width:i,height:s,position:a}=n,{width:l,height:c}=(b=o==null?void 0:o.intrinsicSize)!=null?b:{},p=(E=c!=null?c:s)!=null?E:0,m=(R=l!=null?l:i)!=null?R:0;this.dropRect=void 0;let{top:u,left:f,right:h,bottom:g}=r,y=0,d=Math.round(t/2)+y;switch(a){case F.North:case F.Header:{let D=Math.round((g-u)/2),x=p?Math.min(D,Math.round(p)):D;return m&&f+m<h?[f+d,u+d,f+m-d,u+d+x]:[f+d,u+d,h-d,u+d+x]}case F.West:{let D=Math.round((h-f)/2),x=m?Math.min(D,Math.round(m)):D;return p&&u+p<g?[f+d,u+d,f-d+x,u+p+d]:[f+d,u+d,f-d+x,g-d]}case F.East:{let D=Math.round((h-f)/2),x=m?Math.min(D,Math.round(m)):D;return p&&u+p<g?[h-d-x,u+d,h-d,u+p+d]:[h-d-x,u+d,h-d,g-d]}case F.South:{let D=Math.round((g-u)/2),x=p?Math.min(D,Math.round(p)):D;return m&&f+m<h?[f+d,g-d-x,f+m-d,g-d]:[f+d,g-d-x,h-d,g-d]}case F.Centre:return[f+d,u+d,h-d,g-d];default:return console.warn(`DropTarget does not recognize position ${a}`),null}}activate(){return this.active=!0,this}toArray(){let t=this,o=[t];for(;t=t.nextDropTarget;)o.push(t);return o}static getActiveDropTarget(t){return t===null?null:t!=null&&t.active?t:ne.getActiveDropTarget(t.nextDropTarget)}};function wt(e,t,o,n,r,i){var l;let s=null,a=fe.allBoxesContainingPoint(o,n,e,t,i);if(a.length){let[c,...p]=a,{"data-path":m,path:u=m,"data-row-placeholder":f}=T(c),h=n[u],y=Tt(e,t,h,r&&f?"row":void 0),d=n[u],b=([E,...R])=>{var D,x;if((D=y.position)!=null&&D.Header||y.closeToTheEdge){let S=ti(E,y,d,n,e,t);if(S){let[L,C]=S;return new ne({component:E,pos:L,clientRect:C,nextDropTarget:(x=b(R))!=null?x:null})}else if(R.length)return b(R)}};s=new ne({component:c,pos:y,clientRect:h,nextDropTarget:(l=b(p))!=null?l:null}).activate()}return s}function ti(e,{closeToTheEdge:t,position:o},n,r,i,s){if(!e||e.type==="DraggableLayout")return;let a=r[e.props.path],l=t&pe.north,c=t&pe.east,p=t&pe.south,m=t&pe.west,u=(l||o.Header)&&Math.round(n.top)===Math.round(a.top),f=c&&Math.round(n.right)===Math.round(a.right),h=p&&Math.round(n.bottom)===Math.round(a.bottom),g=m&&Math.round(n.left)===Math.round(a.left);if(u||f||h||g){let{"data-path":y,path:d=y}=e.props,b=r[d],E=Tt(i,s,b);if((oi(e)||Po(e))&&t&Qr)return E.width=120,[E,b];if((ni(e)||Po(e))&&(o.Header||t&ei))return E.height=120,[E,b]}}function Po(e){return P(e)==="Stack"}function oi(e){return P(e)==="Flexbox"&&e.props.style.flexDirection==="column"}function ni(e){return P(e)==="Flexbox"&&e.props.style.flexDirection==="row"}import{PopupService as Lt}from"@vuu-ui/vuu-popups";import ri from"classnames";import{jsx as Lo}from"react/jsx-runtime";function vo(e,t=0,o=0){let{pos:n,clientRect:r}=e,i=20;return n.position.West?[r.left-o+i,n.y-t,"left"]:n.position.South?[n.x-o,r.bottom-t-i,"bottom"]:n.position.East?[r.right-o-i,n.y-t,"right"]:[n.x-o,r.top-t+i,"top"]}var Pt="vuuDropMenu",Mo=({className:e,dropTarget:t,onHover:o,orientation:n})=>{let r=t.toArray();return Lo("div",{className:ri(Pt,e,`${Pt}-${n}`),onMouseLeave:()=>o(null),children:r.map((i,s)=>Lo("div",{className:`${Pt}-item`,"data-icon":s===0?"column-2A":"column-2B",onMouseEnter:()=>o(i)},s))})};import{jsx as ui}from"react/jsx-runtime";var vt=!1,De=null,Y=null,ii=e=>De=e,si=([e,t])=>`M${e},${t}`,ai=([e,t])=>`L${e},${t}`,Co=([e,...t])=>`${si(e)} ${t.map(ai)}Z`,li=e=>{if(e){let[t,o,n,r,i,s,a,l]=e;return`M${t},${o} L${n},${r} M${i},${s} L${a},${l}`}else return""};function ci(){if(document.getElementById("hw-drag-canvas")===null){let e=document.getElementById("root"),t=document.createElement("div");t.id="hw-drag-canvas",t.innerHTML=`
|
|
1
|
+
import{partition as xo}from"@vuu-ui/vuu-utils";import kr from"classnames";var uo={},mo={},te={};function F(e){return uo[e]===!0}function vr(e){return mo[e]===!0}var fo=e=>F(e)||vr(e),ml=e=>!!te[e];function k(e,t,o="component"){te[e]=t,o==="container"?uo[e]=!0:o==="view"&&(mo[e]=!0)}import{Button as ho,useControlled as Mr}from"@salt-ds/core";import go from"classnames";import{useCallback as Cr}from"react";import{jsx as Ee,jsxs as zr}from"react/jsx-runtime";var oe="vuuDrawer",yo=e=>typeof e=="string"?e:e+"px",Ar=(e,t,o)=>{let n=t!==void 0,r=o!==void 0;if(!(!e&&!r&&!n))return!r&&!n?e:{...e,"--drawer-size":n?yo(t):void 0,"--drawer-peek-size":r?yo(o):void 0}},bo=({children:e,className:t,clickToOpen:o,defaultOpen:n,sizeOpen:r,sizeClosed:i,style:s,open:a,position:l="left",inline:c,onClick:p,peekaboo:m=!1,toggleButton:u,...f})=>{let[h,g]=Mr({controlled:a,default:n!=null?n:!1,name:"Drawer",state:"open"}),y=go(oe,t,`${oe}-${l}`,{[`${oe}-open`]:h,[`${oe}-inline`]:c,[`${oe}-over`]:!c,[`${oe}-peekaboo`]:m}),d=Cr(()=>{g(!h)},[h,g]),b=Ar(s,r,i),E=o?d:p,R=()=>Ee("div",{className:go("vuuToggleButton-container"),children:h?Ee(ho,{"aria-label":"close",onClick:d,"data-icon":"close",variant:"secondary"}):Ee(ho,{"aria-label":"open",onClick:d,"data-icon":"close",variant:"secondary"})});return zr("div",{...f,className:y,onClick:E,style:b,children:[u=="start"?R():null,Ee("div",{className:`${oe}-liner`,children:Ee("div",{className:`${oe}-content`,children:e})}),u=="end"?R():null]})};bo.displayName="Drawer";var gt=bo;import{jsx as Hr,jsxs as $r}from"react/jsx-runtime";var Ir=e=>e.type===gt,Br=({props:{position:e="left"}})=>e.match(/top|bottom/),yt=e=>{let{children:t,className:o,id:n,style:r}=e,i="vuuDockLayout",[s,a]=xo(t,Ir),[l,c]=xo(s,Br),p=l.length===0?"horizontal":c.length===0?"vertical":"both",m=kr(i,o,`${i}-${p}`);return $r("div",{className:m,id:n,style:r,children:[s,Hr("div",{className:`${i}-content`,children:a})]})};yt.displayName="DockLayout";var Or=yt;k("DockLayout",yt,"container");import{forwardRef as Fr}from"react";import{jsx as Nr}from"react/jsx-runtime";var bt=Fr(function({resizeable:t,...o},n){return Nr("div",{...o,className:"Component",ref:n})});bt.displayName="Component";var xt=bt;k("Component",bt);import ne,{isValidElement as Eo}from"react";var Vr={},P=(e,t)=>{var n;let o=D(e);return(n=o[t])!=null?n:o[`data-${t}`]},D=e=>(e==null?void 0:e.props)||e||Vr,Ro=e=>{let t=D(e);if(t.children){let{children:[o,...n]}=t;return n.length>0&&console.warn(`getChild expected a single child, found ${n.length+1}`),o}};function w(e){var t;if(e){let o=e.type;if(typeof o=="function"||typeof o=="object"){let n=o.displayName||o.name||((t=o.type)==null?void 0:t.name);if(typeof n=="string")return n}if(typeof e.type=="string")return e.type;if(e.constructor)return e.constructor.displayName;throw Error("typeOf unable to determine type of element")}}var Zl=(e,t)=>w(e)===t;var _r=e=>{let t=e.lastIndexOf(".");return t===-1?e:e.slice(0,t)};function q(e,t){let{"data-path":o,path:n=o}=D(e);return t==="0"||t===n?null:$(e,_r(t),!0)}function Q(e,t){let{children:o,...n}=D(e);if(t(n))return e;if(ne.Children.count(o)>0){let r=ne.isValidElement(o)?[o]:o;for(let i of r){let s=Q(i,t);if(s)return s}}}function Wr(e,t){if(t===e)return null;let{path:o,children:n}=D(e),{idx:r,finalStep:i}=X(o,P(t,"path"));return i?e:n===void 0||n[r]===void 0?null:Wr(n[r],t)}var Gr=(e,t)=>{if(ne.isValidElement(e)&&t==0)return e;if(Array.isArray(e))return e[t]};function So(e,t){let o=t.split("."),n=[e],r=i=>ne.isValidElement(i.props.children)?[i.props.children]:i.props.children;for(let i=0;i<o.length;i++){let s=parseInt(o[i]),a=n[s];if(i===o.length-1)return a;n=r(a)}}var To=(e,t,o=!0)=>{let{children:n,id:r}=e.props;if(r===t)return e;if(ne.Children.count(n)>0){let i=Eo(n)?[n]:n;for(let s of i)if(Eo(s)){let a=To(s,t,!1);if(a)return a}}if(o===!0)throw Error(`pathUtils.findTargetById id #${t} not found in source`)};function $(e,t,o=!1){if(t.startsWith("#"))return To(e,t.slice(1),o);let{"data-path":n,path:r=n}=D(e);if(t.indexOf(r)!==0)throw Error(`pathUtils.followPath path ${t} is not within source path ${r}`);let i=t.slice(r.length+1);if(i==="")return e;let s=e,a=i.split(".");for(let l=0;l<a.length;l++){if(ne.Children.count(s.props.children)===0){let c=`element at 0.${a.slice(0,l).join(".")} has no children, so cannot fulfill rest of path ${a.slice(l).join(".")}`;if(o)throw Error(c);console.warn(c);return}if(s=Gr(s.props.children,parseInt(a[l])),s===void 0){let c=`model at 0.${a.slice(0,l).join(".")} has no children that fulfill next step of path ${a.slice(l).join(".")}`;if(o)throw Error(c);console.warn(c)}}return s}function Ql(e,t){let o=q(e,t),n=t.split(".").map(r=>parseInt(r,10));if(o){let r=n.pop(),{children:i}=o.props;if(i.length-1>r)return Fe(i[r+1]);{let s=n.pop(),a=q(e,P(o,"path"));if(a&&typeof s=="number"&&(n=a.props.path.split(".").map(l=>parseInt(l,10)),a.props.children.length-1>s)){let l=a.props.children[s+1];return F(w(l))?Fe(l):l}}}return Fe(e)}function ec(e,t){let o=t.split(".").map(i=>parseInt(i,10)),n=o.pop(),r=q(e,t);if(r!=null&&typeof n=="number"){let{children:i}=r.props;if(n>0)return Ne(i[n-1]);for(;o.length>1;)if(n=o.pop(),r=q(e,P(r,"path")),n>0){let s=r.props.children[n-1];return F(w(s))?Ne(s):s}}return Ne(e)}function Fe(e){if(F(w(e))){let{children:t}=e.props||e;return Fe(t[0])}return e}function Ne(e){if(F(w(e))){let{children:t}=e.props||e;return Ne(t[t.length-1])}return e}function X(e,t,o=!1){if(e===t)return{idx:-1,finalStep:!0};let n=`${e}.`;if(!t.startsWith(n))throw Error("pathUtils nextStep has strayed from the path");let r=o?0:1,i=t.replace(n,"").split(".").map(s=>parseInt(s,10));return{idx:i[0],finalStep:i.length===r}}function B(e,t,o){if(P(e,"path")===t)return e;let n=[];ne.Children.forEach(e.props.children,(i,s)=>{P(i,"path")?n.push(B(i,`${t}.${s}`)):n.push(i)});let r=e.props["data-path"]?"data-path":"path";return ne.cloneElement(e,{[r]:t,...o},n)}function oc(e,t){typeof e=="function"?e(t):e&&(e.current=t)}var Rt=e=>{if(typeof e!="number")throw Error(`"no support yet for flex value ${e}`);return{flexBasis:0,flexGrow:1,flexShrink:1}};var pe={north:1,east:2,south:4,west:8,header:16,centre:32,absolute:64},Se={AFTER:"after",BEFORE:"before"},N=Object.freeze({North:ce("north"),East:ce("east"),South:ce("south"),West:ce("west"),Header:ce("header"),Centre:ce("centre"),Absolute:ce("absolute")});function ce(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 Do=N.North,Po=N.South,Et=N.East,St=N.West,Ur=N.Header,Zr=N.Centre,fe=class{static measure(t,o=[]){let n={};return Jr(t,n,o),n}static allBoxesContainingPoint(t,o,n,r,i){return Mo(t,o,n,r,i).reverse()}};function Tt(e,t,o,n=30){let r=o.right-o.left,i=o.bottom-o.top,s=e-o.left,a=t-o.top,l=0;return s<n&&(l+=8),s>r-n&&(l+=2),a<n&&(l+=1),a>i-n&&(l+=4),{pctX:s/r,pctY:a/i,closeToTheEdge:l}}function Dt(e,t,o,n){let{BEFORE:r,AFTER:i}=Se,{pctX:s,pctY:a,closeToTheEdge:l}=Tt(e,t,o),c,p;if(n==="row")c=s<.5?St:Et;else if(o.header&&Ve(o.header,e,t))if(c=Ur,o.Stack){let m=o.Stack.length;if(m===0)p={index:-1,left:o.left,positionRelativeToTab:i,width:0};else{let u=o.Stack.find(({left:f,right:h})=>e>=f&&e<=h);if(u){let f=u.right-u.left;p={index:o.Stack.indexOf(u),left:u.left,positionRelativeToTab:(e-u.left)/f<.5?r:i,width:f}}else p={left:o.Stack[m-1].right,width:0,index:m,positionRelativeToTab:i}}}else if(o.header.titleWidth){let m=o.header.titleWidth;p={index:-1,left:o.left,positionRelativeToTab:(e-o.left)/m<.5?r:i,width:m}}else p={left:o.left,width:0,positionRelativeToTab:r,index:-1};else c=Yr(e,t,o,s,a);return{position:c,x:e,y:t,closeToTheEdge:l,tab:p}}function Yr(e,t,o,n,r){let i=Xr(o,.2);if(Ve(i,e,t))return Zr;switch(`${r<.5?"north":"south"}${n<.5?"west":"east"}`){case"northwest":return n>r?Do:St;case"northeast":return 1-n>r?Do:Et;case"southeast":return n>r?Et:Po;case"southwest":return 1-n>r?St:Po;default:}}function Xr({right:e,left:t,top:o,bottom:n},r){let i=(1-r)/2,s=(e-t)*i,a=(n-o)*i;return{left:t+s,top:o+a,right:e-s,bottom:n-a}}function Jr(e,t,o){let{id:n,"data-path":r,path:i=r}=D(e),s=w(e);if(n&&i){let[a,l]=vo(e);wo(e,a,l,t),F(s)&&Lo(e,t,o)}}function wo(e,t,o,n){let{"data-path":r,path:i=r,header:s}=D(e);n[i]=t;let a=w(e);if(s||a==="Stack"){let l=o.querySelector(".vuuHeader");if(l){let{top:c,left:p,right:m,bottom:u}=l.getBoundingClientRect();if(n[i].header={top:Math.round(c),left:Math.round(p),right:Math.round(m),bottom:Math.round(u)},a==="Stack")n[i].Stack=Array.from(l.querySelectorAll(".saltTab")).map(f=>f.getBoundingClientRect()).map(({left:f,right:h})=>({left:f,right:h}));else{let f=l.querySelector('[class^="vuuHeader-title"]'),{header:h}=n[i];f&&h&&(h.titleWidth=f.clientWidth)}}}return n[i]}function Lo(e,t,o,n=0,r=0,i=0,s=0){let{children:a,"data-path":l,path:c=l,style:p,active:m=0}=D(e),u=w(e),f=u==="Flexbox",h=u==="Stack",g=f&&p.flexDirection==="column",y=f&&p.flexDirection==="row",b=(h?a.filter((R,T)=>T===m):a.filter(jr)).map(R=>{let[T,x]=vo(R);return[{...T,top:T.top-i,right:T.right+r,bottom:T.bottom+s,left:T.left-n},x,R]}),E=b.map(([R,T,x],S,L)=>{let C,H,v,I,M,A,z=L.length-1;y?(M=S===0?0:R.left-L[S-1][0].right,A=S===z?0:L[S+1][0].left-R.right,C=S===0||M===0?0:M,H=S===z||A===0?0:A-A/2,R.left-=C,R.right+=H,v=i,I=s):g&&(M=S===0?0:R.top-L[S-1][0].bottom,A=S===z?0:L[S+1][0].top-R.bottom,v=S===0||M===0?0:M,I=S===z||A===0?0:A-A/2,R.top-=v,R.bottom+=I,C=n,H=r);let j=wo(x,R,T,t),W=w(x);return F(W)&&Lo(x,t,o,C,H,v,I),j});b.length&&(t[c].children=E)}function jr(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 vo(e){let{id:t}=D(e);if(t===void 0)throw Error("`BoxModel.measureComponentElement, component has no id");let o=document.getElementById(t);if(!o)throw Error("BoxModel.measureComponentElement, no DOM element found for component");let{top:n,left:r,right:i,bottom:s,height:a,width:l}=o.getBoundingClientRect(),c,p=w(e);if(F(p)){let m=o.scrollHeight;m>a&&(c={id:t,scrollHeight:m,scrollTop:o.scrollTop})}return[{top:Math.round(n),left:Math.round(r),right:Math.round(i),bottom:Math.round(s),height:Math.round(a),width:Math.round(l),scrolling:c},o,e]}function Mo(e,t,o,n,r,i=[]){let{children:s,"data-path":a,path:l=a}=D(e),c=w(e),p=t[l];if(!Ve(p,o,n))return i;if(r&&r.length){if(r.includes(l))i.push(e);else if(!r.some(m=>m.startsWith(l)))return i}else i.push(e);if(!F(c)||p.header&&Ve(p.header,o,n))return i;p.scrolling&&Kr(p,o,n);for(let m=0;m<s.length;m++){if(c==="Stack"&&e.props.active!==m)continue;let u=Mo(s[m],t,o,n,r);if(u.length)return i.concat(u)}return i}function Ve(e,t,o){if(e)return t>=e.left&&t<e.right&&o>=e.top&&o<e.bottom}function Kr({top:e,bottom:t,scrolling:o},n,r){if(o){let{id:i,scrollTop:s,scrollHeight:a}=o,l=t-e;if(s===0&&t-r<50){let c=a-l;document.getElementById(i).scrollTo({left:0,top:c,behavior:"smooth"}),o.scrollTop=c}else if(s>0&&r-e<50)document.getElementById(i).scrollTo({left:0,top:0,behavior:"smooth"}),o.scrollTop=0;else return!1}else return!1}var qr=.4,_e=class{constructor(t,o,n,r,i){this.init(t,o,n,r,i)}init(t,o,n,r,i){let{left:s,top:a}=r,{pctX:l,pctY:c}=Tt(o,n,r),p=qr,m=l*r.width,u=r.width-m,f=c*r.height,h=r.height-f,g=r.width*p,y=r.height*p,d=1-p,b=m*d,E=f*d,R=u*d,T=h*d;this.intrinsicSize=i,this.constraint={zone:{x:{lo:t.left,hi:t.right},y:{lo:t.top,hi:t.bottom}},pos:{x:{lo:t.left-b,hi:t.right-r.width+R},y:{lo:t.top-E,hi:t.bottom-r.height+T}},mouse:{x:{lo:t.left+g*l,hi:t.right-g*(1-l)},y:{lo:t.top+y*c,hi:t.bottom-y*(1-c)}}},this.x={pos:s,lo:!1,hi:!1,mousePos:o,mousePct:l},this.y={pos:a,lo:!1,hi:!1,mousePos:n,mousePct:c}}outOfBounds(){return this.x.lo||this.x.hi||this.y.lo||this.y.hi}inBounds(){return!this.outOfBounds()}dropX(){return this.dropXY("x")}dropY(){return this.dropXY("y")}hasIntrinsicSize(){var t,o;return((t=this==null?void 0:this.intrinsicSize)==null?void 0:t.height)&&((o=this==null?void 0:this.intrinsicSize)==null?void 0:o.width)}update(t,o){let n=this[t],r=this.constraint.mouse[t],i=this.constraint.pos[t],s=n.pos,a=o-n.mousePos;return a<0?n.lo||(o<r.lo?(n.lo=!0,n.pos=i.lo):n.hi?o<r.hi&&(n.hi=!1,n.pos+=a):n.pos+=a):a>0&&(n.hi||(o>r.hi?(n.hi=!0,n.pos=i.hi):n.lo?o>r.lo&&(n.lo=!1,n.pos+=a):n.pos+=a)),n.mousePos=o,s!==n.pos}dropXY(t){let o=this[t],n=this.constraint.zone[t];return o.lo?Math.max(n.lo,o.mousePos):o.hi?Math.min(o.mousePos,Math.round(n.hi)-1):o.mousePos}};var xc=e=>e.pos.tab&&w(e.component)==="Stack"&&e.pos.position.Header,{north:Qr,south:ei,east:ti,west:oi}=pe,ni=ti+oi,ri=Qr+ei,re=class{constructor({component:t,pos:o,clientRect:n,nextDropTarget:r}){this.component=t,this.pos=o,this.clientRect=n,this.nextDropTarget=r,this.active=!1,this.dropRect=void 0}targetTabPos(t){let{left:o,width:n,positionRelativeToTab:r}=t;return r===Se.BEFORE?o:o+n}getTargetDropOutline(t,o){if(this.pos.tab)return this.getDropTabOutline(t,this.pos.tab);if(o&&o.hasIntrinsicSize())return this.getIntrinsicDropRect(o);{let[n,r,i,s]=this.getDropRectOutline(t,o);return{l:n,t:r,r:i,b:s}}}getDropTabOutline(t,o){var d,b;let{clientRect:{top:n,left:r,right:i,bottom:s,header:a}}=this,l=0,c=Math.round(t/2)+l,p=Math.round(n),m=Math.round(r+c),u=Math.round(i-c),f=Math.round(s-c),h=this.targetTabPos(o),g=60,y=((d=a==null?void 0:a.bottom)!=null?d:0)-((b=a==null?void 0:a.top)!=null?b:0);return{l:m,t:p,r:u,b:f,tabLeft:h,tabWidth:g,tabHeight:y}}getIntrinsicDropRect(t){var g,y,d,b;let{pos:o,clientRect:n}=this,{x:r,y:i}=t,s=(y=(g=t.intrinsicSize)==null?void 0:g.height)!=null?y:0,a=(b=(d=t.intrinsicSize)==null?void 0:d.height)!=null?b:0;s&&s>n.height?(console.log("DropTarget: we're going to blow the gaff"),s=n.height):a&&a>n.width&&(console.log("DropTarget: we're going to blow the gaff"),a=n.width);let l=Math.min(n.right-a,Math.max(n.left,Math.round(o.x-r.mousePct*a))),c=Math.min(n.bottom-s,Math.max(n.top,Math.round(o.y-i.mousePct*s))),[p,m,u,f]=this.dropRect=[l,c,l+a,c+s],h=o.position.EastOrWest?[p,n.top,p,n.bottom,u,n.top,u,n.bottom]:[n.left,m,n.right,m,n.left,f,n.right,f];return{l:p,r:u,t:m,b:f,guideLines:h}}getDropRectOutline(t,o){var b,E,R;let{pos:n,clientRect:r}=this,{width:i,height:s,position:a}=n,{width:l,height:c}=(b=o==null?void 0:o.intrinsicSize)!=null?b:{},p=(E=c!=null?c:s)!=null?E:0,m=(R=l!=null?l:i)!=null?R:0;this.dropRect=void 0;let{top:u,left:f,right:h,bottom:g}=r,y=0,d=Math.round(t/2)+y;switch(a){case N.North:case N.Header:{let T=Math.round((g-u)/2),x=p?Math.min(T,Math.round(p)):T;return m&&f+m<h?[f+d,u+d,f+m-d,u+d+x]:[f+d,u+d,h-d,u+d+x]}case N.West:{let T=Math.round((h-f)/2),x=m?Math.min(T,Math.round(m)):T;return p&&u+p<g?[f+d,u+d,f-d+x,u+p+d]:[f+d,u+d,f-d+x,g-d]}case N.East:{let T=Math.round((h-f)/2),x=m?Math.min(T,Math.round(m)):T;return p&&u+p<g?[h-d-x,u+d,h-d,u+p+d]:[h-d-x,u+d,h-d,g-d]}case N.South:{let T=Math.round((g-u)/2),x=p?Math.min(T,Math.round(p)):T;return m&&f+m<h?[f+d,g-d-x,f+m-d,g-d]:[f+d,g-d-x,h-d,g-d]}case N.Centre:return[f+d,u+d,h-d,g-d];default:return console.warn(`DropTarget does not recognize position ${a}`),null}}activate(){return this.active=!0,this}toArray(){let t=this,o=[t];for(;t=t.nextDropTarget;)o.push(t);return o}static getActiveDropTarget(t){return t===null?null:t!=null&&t.active?t:re.getActiveDropTarget(t.nextDropTarget)}};function Pt(e,t,o,n,r,i){var l;let s=null,a=fe.allBoxesContainingPoint(o,n,e,t,i);if(a.length){let[c,...p]=a,{"data-path":m,path:u=m,"data-row-placeholder":f}=D(c),h=n[u],y=Dt(e,t,h,r&&f?"row":void 0),d=n[u],b=([E,...R])=>{var T,x;if((T=y.position)!=null&&T.Header||y.closeToTheEdge){let S=ii(E,y,d,n,e,t);if(S){let[L,C]=S;return new re({component:E,pos:L,clientRect:C,nextDropTarget:(x=b(R))!=null?x:null})}else if(R.length)return b(R)}};s=new re({component:c,pos:y,clientRect:h,nextDropTarget:(l=b(p))!=null?l:null}).activate()}return s}function ii(e,{closeToTheEdge:t,position:o},n,r,i,s){if(!e||e.type==="DraggableLayout")return;let a=r[e.props.path],l=t&pe.north,c=t&pe.east,p=t&pe.south,m=t&pe.west,u=(l||o.Header)&&Math.round(n.top)===Math.round(a.top),f=c&&Math.round(n.right)===Math.round(a.right),h=p&&Math.round(n.bottom)===Math.round(a.bottom),g=m&&Math.round(n.left)===Math.round(a.left);if(u||f||h||g){let{"data-path":y,path:d=y}=e.props,b=r[d],E=Dt(i,s,b);if((si(e)||Co(e))&&t&ni)return E.width=120,[E,b];if((ai(e)||Co(e))&&(o.Header||t&ri))return E.height=120,[E,b]}}function Co(e){return w(e)==="Stack"}function si(e){return w(e)==="Flexbox"&&e.props.style.flexDirection==="column"}function ai(e){return w(e)==="Flexbox"&&e.props.style.flexDirection==="row"}import{PopupService as Lt}from"@vuu-ui/vuu-popups";import li from"classnames";import{jsx as Ao}from"react/jsx-runtime";function zo(e,t=0,o=0){let{pos:n,clientRect:r}=e,i=20;return n.position.West?[r.left-o+i,n.y-t,"left"]:n.position.South?[n.x-o,r.bottom-t-i,"bottom"]:n.position.East?[r.right-o-i,n.y-t,"right"]:[n.x-o,r.top-t+i,"top"]}var wt="vuuDropMenu",ko=({className:e,dropTarget:t,onHover:o,orientation:n})=>{let r=t.toArray();return Ao("div",{className:li(wt,e,`${wt}-${n}`),onMouseLeave:()=>o(null),children:r.map((i,s)=>Ao("div",{className:`${wt}-item`,"data-icon":s===0?"column-2A":"column-2B",onMouseEnter:()=>o(i)},s))})};import{jsx as hi}from"react/jsx-runtime";var vt=!1,Te=null,J=null,ci=e=>Te=e,pi=([e,t])=>`M${e},${t}`,ui=([e,t])=>`L${e},${t}`,Io=([e,...t])=>`${pi(e)} ${t.map(ui)}Z`,mi=e=>{if(e){let[t,o,n,r,i,s,a,l]=e;return`M${t},${o} L${n},${r} M${i},${s} L${a},${l}`}else return""};function di(){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 @@ import{partition as yo}from"@vuu-ui/vuu-utils";import Mr from"classnames";var co
|
|
|
14
14
|
/>
|
|
15
15
|
</path>
|
|
16
16
|
</svg>
|
|
17
|
-
`,document.body.insertBefore(t,e)}}var Te=class{constructor(){this.currentPath=null;this.tabMode=null;ci()}prepare(t,o="full-view"){document.body.classList.add("drawing"),this.currentPath=null,this.tabMode=o;let n=this.getPoints(0,0,0,0),r=Co(n),i=document.getElementById("vuu-drop-outline");i==null||i.setAttribute("d",r),this.currentPath=r}clear(){De=null,_e(),document.body.classList.remove("drawing"),Lt.hidePopup()}get hoverDropTarget(){return De}getPoints(t,o,n,r,i=0,s=0,a=0){let l=this.tabMode==="tab-only";if(s===0)return[[t,o+a],[t,o+a],[t,o],[t+s,o],[t+s,o],[t+n,o],[t+n,o+r],[t,o+r]];if(l){let c=i;return[[c,o],[c,o],[c+s,o],[c+s,o],[c+s,o+a],[c+s,o+a],[c,o+a],[c,o+a]]}else return i===0?[[t,o+a],[t,o+a],[t,o],[t+s,o],[t+s,o+a],[t+n,o+a],[t+n,o+r],[t,o+r]]:[[t,o+a],[t+i,o+a],[t+i,o],[t+i,o],[t+i,o+a],[t+n,o+a],[t+n,o+r],[t,o+r]]}draw(t,o){let r=vt;if(De!==null)this.drawTarget(De);else if(vt=t.nextDropTarget!=null,t.pos.tab?pi(t):Y&&_e(),this.drawTarget(t,o),vt){let[i,s,a]=vo(t);{let l=ui(Mo,{dropTarget:t,onHover:ii,orientation:a});Lt.showPopup({left:i,top:s,component:l})}}else Lt.hidePopup()}drawTarget(t,o){let r=t.getTargetDropOutline(6,o);if(r){let{l:i,t:s,r:a,b:l,tabLeft:c,tabWidth:p,tabHeight:m,guideLines:u}=r,f=a-i,h=l-s;if(this.currentPath){let E=document.getElementById("vuu-drop-outline");E==null||E.setAttribute("d",this.currentPath)}let g=this.getPoints(i,s,f,h,c,p,m),y=Co(g),d=document.getElementById("hw-drop-outline-animate");d==null||d.setAttribute("to",y),d==null||d.beginElement(),this.currentPath=y;let b=document.getElementById("hw-drop-guides");b==null||b.setAttribute("d",li(u))}}},Ao="transition:margin-left .4s ease-out;margin-left: 63px",ko="transition:margin-left .4s ease-out;margin-left: 0px";function pi(e){var a,l;let{AFTER:t,BEFORE:o}=Se,{clientRect:{Stack:n},pos:{tab:r}}=e,{id:i}=e.component.props,s=null;if(n&&r&&r.positionRelativeToTab!==t){let c=r.positionRelativeToTab===o?1:2,p=`:scope .hwTabstrip > .hwTabstrip-inner > .hwTab:nth-child(${r.index+c})`;s=(a=document.getElementById(i))==null?void 0:a.querySelector(p),s?(Y===null||Y!==s)&&(s.style.cssText=Ao,Y&&(Y.style.cssText=ko),Y=s):_e()}else if((r==null?void 0:r.positionRelativeToTab)===o){if(Y===null){let c=".vuuHeader-title";s=(l=document.getElementById(i))==null?void 0:l.querySelector(c),s.style.cssText=Ao,Y=s}}else _e()}function _e(){Y&&(Y.style.cssText=ko,Y=null)}var ee,we,re,Io,Bo,ie,Ge,he=null,Ct,Oo,Pe,Ho,Mt,Ue=null,mi=3,Xe=new Te,zo=.4;function di(e,t){return t?V(e,t):Q(e,o=>o.dropTarget)}var At={handleMousedown(e,t,o={}){ee=t,Oo=o,Io=e.clientX,Bo=e.clientY,Mt=o.dragThreshold===void 0?mi:o.dragThreshold,Mt===0?ee(e,0,0):(window.addEventListener("mousemove",Ze,!1),window.addEventListener("mouseup",Ye,!1),Ue=window.setTimeout(()=>{console.log("mousedownTimer fires"),window.removeEventListener("mousemove",Ze,!1),window.removeEventListener("mouseup",Ye,!1),ee==null||ee(e,0,0)},500)),e.preventDefault()},initDrag(e,t,{top:o,left:n,right:r,bottom:i},s,a,l,c){return{drag:we,drop:re}=a,fi(e,t,{top:o,left:n,right:r,bottom:i},s,l,c)}};function Ze(e){let n=e.clientX-Io,r=e.clientY-Bo;Math.max(Math.abs(n),Math.abs(r))>Mt&&(window.removeEventListener("mousemove",Ze,!1),window.removeEventListener("mouseup",Ye,!1),ee==null||ee(e,n,r),ee=null)}function Ye(){Ue&&(window.clearTimeout(Ue),Ue=null),window.removeEventListener("mousemove",Ze,!1),window.removeEventListener("mouseup",Ye,!1)}function fi(e,t,o,n,r,i){ie=di(e,t);let{"data-path":s,path:a=s}=T(ie);i&&(Ct=i.map(u=>Q(e,f=>f.id===u)).map(u=>u.props.path)),Pe=fe.measure(ie,i),console.log({_measurements:Pe});let l=Pe[a];Ge=new We(l,n.x,n.y,o,r);let c=Math.round(Ge.x.mousePct*100),p=Math.round(Ge.y.mousePct*100);return window.addEventListener("mousemove",$o,!1),window.addEventListener("mouseup",Fo,!1),Ho=!1,Xe.prepare(o,"tab-only"),Oo.DoNotTransform?"transform:none":`transform:scale(${zo},${zo});transform-origin:${c}% ${p}%;`}function $o(e){let t=e.clientX,o=e.clientY,n=Ge,r=he,i,s,a;n.update("x",t)&&(s=n.x.pos),n.update("y",o)&&(a=n.y.pos),s===void 0&&a===void 0||we==null||we(s,a),!(Ho||ie===void 0)&&(n.inBounds()?i=wt(t,o,ie,Pe,n.hasIntrinsicSize(),Ct):i=wt(n.dropX(),n.dropY(),ie,Pe),r&&(i==null||i.box!==r.box)&&(he=null),i&&(Xe.draw(i,n),he=i))}function Fo(){hi()}function hi(){if(he){let e=Xe.hoverDropTarget||ne.getActiveDropTarget(he);re==null||re(e),he=null}else re==null||re({component:ie,pos:{position:F.Absolute}});we=null,re=null,ie=void 0,Xe.clear(),Ct=void 0,window.removeEventListener("mousemove",$o,!1),window.removeEventListener("mouseup",Fo,!1)}import gi from"classnames";import{forwardRef as yi}from"react";import{jsx as bi}from"react/jsx-runtime";var No=yi(function({children:t,className:o,dropTarget:n,resizeable:r,...i},s){let a=gi("DraggableLayout",o);return bi("div",{className:a,ref:s,...i,children:t})}),Vo="DraggableLayout";No.displayName=Vo;z(Vo,No,"container");import{useForkRef as Vi}from"@salt-ds/core";import Wi from"classnames";import{forwardRef as _i}from"react";import{getUniqueId as Ii}from"@vuu-ui/vuu-utils";import Ae,{useCallback as Qe,useMemo as Qo,useRef as et,useState as Bi}from"react";import xi from"classnames";import{jsx as Ri}from"react/jsx-runtime";var Wo="vuuPlaceholder",Je=({className:e,closeable:t,flexFill:o,resizeable:n,shim:r,...i})=>Ri("div",{className:xi(Wo,e,{[`${Wo}-shim`]:r}),...i,"data-placeholder":!0,"data-resizeable":!0});Je.displayName="Placeholder";z("Placeholder",Je);import Ei from"classnames";import Si,{useCallback as Le,useRef as je,useState as Di}from"react";import{jsx as _o}from"react/jsx-runtime";var Go=Si.memo(function({column:t,index:o,onDrag:n,onDragEnd:r,onDragStart:i,style:s}){let a=je(),l=je(null),c=je(0),[p,m]=Di(!1),u=Le(({key:x,shiftKey:S})=>{let L=S?10:1;t&&x==="ArrowDown"?n(o,L):t&&x==="ArrowUp"||!t&&x==="ArrowLeft"?n(o,-L):!t&&x==="ArrowRight"&&n(o,L)},[t,o,n]),f=Le(x=>{let{key:S}=x;(t&&(S==="ArrowUp"||S==="ArrowDown")||!t&&(S==="ArrowLeft"||S==="ArrowRIght"))&&(i(o),u(x),h.current=u)},[t,u,o,i]),h=je(f),g=x=>h.current(x),y=Le(x=>{a.current=!0;let S=x[t?"clientY":"clientX"],L=S-c.current;S&&S!==c.current&&n(o,L),c.current=S},[t,o,n]),d=Le(()=>{var x;window.removeEventListener("mousemove",y,!1),window.removeEventListener("mouseup",d,!1),r(),m(!1),(x=l.current)==null||x.focus()},[y,r,m]),b=Le(x=>{c.current=t?x.clientY:x.clientX,i(o),window.addEventListener("mousemove",y,!1),window.addEventListener("mouseup",d,!1),x.preventDefault(),m(!0)},[t,y,d,o,i,m]),E=()=>{var x;a.current?a.current=!1:(x=l.current)==null||x.focus()},R=()=>{h.current=f},D=Ei("Splitter","focusable",{active:p,column:t});return _o("div",{className:D,"data-splitter":!0,ref:l,role:"separator",style:s,onBlur:R,onClick:E,onKeyDown:g,onMouseDown:b,tabIndex:0,children:_o("div",{className:"grab-zone"})})});import{uuid as Uo}from"@vuu-ui/vuu-utils";import Xo from"react";var Ti={"data-placeholder":!0,"data-resizeable":!0},Ke={},se="auto",kt={flexBasis:0,flexGrow:1,flexShrink:1,height:se,width:se},Zo={height:"width",width:"height"},Yo=(e="row")=>e==="row"?["width","height","column"]:["height","width","row"],wi=e=>typeof e=="string"&&e.endsWith("%"),_=e=>{let{style:{width:t=se,height:o=se}=Ke}=e.props,n=typeof o=="number",r=typeof t=="number";return n&&r?{height:o,width:t}:n?{height:o}:r?{width:t}:void 0};function zt(e,t,o){let n=Zo[t],{style:{[n]:r=se,...i}=Ke}=e.props;return o&&o[t]?{...i,...kt,flexBasis:o[t],flexGrow:0,flexShrink:0}:{...i,...kt,[n]:r}}function Jo(e){let{style:{flex:t,flexGrow:o,flexShrink:n,flexBasis:r}=Ke}=e.props;return typeof t=="number"||r===0&&o===1&&n===1?!0:typeof r!="number"}function It(e,t,o){let n=Zo[t],{style:{[t]:r=se,[n]:i=se,...s}=Ke}=e.props;return r!==se?wi(r)?{flexBasis:0,flexGrow:1,flexShrink:1,[t]:void 0,[n]:i}:{flexBasis:r,flexGrow:0,flexShrink:0,[t]:r,[n]:i}:o&&o[t]?{...s,...kt,flexBasis:o[t],flexGrow:0,flexShrink:0}:{...s,[n]:i}}function ve(e,t,o,n,r){let i=[],s=0,a;if(n&&r){let p,[m,u,f,h]=r;[p,a]=t==="column"?[u-n.top,n.bottom-h]:[m-n.left,n.right-f],p&&i.push(K(`${o}.${s++}`,p,{flexGrow:0,flexShrink:0}))}else a=!0;let{version:l=0,style:c}=T(e);return i.push(B(e,`${o}.${s++}`,{version:l+1,style:{...c,flexBasis:"auto",flexGrow:0,flexShrink:0}})),a&&i.push(K(`${o}.${s++}`,0,void 0,{[`data-${t}-placeholder`]:!0})),Bt(t,{resizeable:!1,style:{flexBasis:"auto"}},i,o)}var Pi=(e,t)=>{if(!t)return e===0?1:0};function Bt(e,t,o,n){let r=Uo(),{flexFill:i,style:s,resizeable:a=!0}=t,{flexBasis:l=i?void 0:"auto"}=s,c=Pi(l,i);return Xo.createElement(te.Flexbox,{id:r,key:r,path:n,flexFill:i,style:{...s,flexDirection:e,flexBasis:l,flexGrow:c,flexShrink:c},resizeable:a},o)}var Li={flexGrow:1,flexShrink:1};function K(e,t,o,n){let r=Uo();return Xo.createElement("div",{...Ti,...n,"data-path":e,id:r,key:r,style:{...Li,...o,flexBasis:t}})}var vi={},Me=1,Ce=2,Mi=e=>typeof e.intrinsicSize=="number",Ci=(e,t)=>{let o={};return e.forEach(n=>{o[n]=w(t,n)}),o},qe=(e,t,o)=>e.map((n,r)=>{var l;let i=w(n,"resizeable"),{[t]:s}=(l=_(n))!=null?l:vi,a=Jo(n);return o?{index:r,flexOpen:a,intrinsicSize:s,resizeable:i,...Ci(o,n)}:{index:r,flexOpen:a,intrinsicSize:s,resizeable:i}}),jo=e=>{let t=e.length,o=e.every(Mi),n=Array(t).fill(0);if(o&&(n[0]=Ce,n[t-1]=Ce),t<2)return n;for(let r=0,i=0;r<t-1;r++)e[r].resizeable&&!i&&(i=Me),n[r]+=i;for(let r=t-1;r>0&&(n[r]&Me&&(n[r]-=Me),!e[r].resizeable);r--);return n},Ko=(e,t)=>{let o=ki(e,t),n=zi(e,t),r=o!==-1&&n!==-1?[o,n]:void 0,i=Ai(e,r);return[r,i]};function Ai(e,t){if(t){let o=[];for(let n=0;n<e.length;n++)e[n].flexOpen&&!t.includes(n)&&o.push(n);return o}}function ki(e,t){let o=t,n=!1;for(;o>=1&&!n;)o=o-1,n=qo(e,o);return o}function zi(e,t){let o=t,n=!1,r=e.length;for(;o<r-1&&!n;)o=o+1,n=qo(e,o);return o===r?-1:o}function qo(e,t){let{placeholder:o,splitter:n,resizeable:r,intrinsicSize:i}=e[t];return!!(!n&&!i&&(o||r))}var Oi=e=>!e.splitter&&!e.placeholder,tn=({children:e,onSplitterMoved:t,style:o})=>{let n=et(null),r=et(),i=et(),s=et([]),[,a]=Bi({}),l=y=>{i.current=y,a({})},c=(o==null?void 0:o.flexDirection)==="column",p=c?"height":"width",m=Qo(()=>Array.isArray(e)?e:Ae.isValidElement(e)?[e]:[],[e]),u=Qe(y=>{let{current:d}=r;if(d){let[b,E]=Ko(d,y);b&&(b.forEach(R=>{var x;let D=(x=n.current)==null?void 0:x.childNodes[R];if(D){let{size:S,minSize:L}=Ni(D,p);d[R].currentSize=S,d[R].minSize=L}}),E&&E.forEach(R=>{var x;let D=(x=n.current)==null?void 0:x.childNodes[R];if(D){let{[p]:S}=D.getBoundingClientRect();d[R].flexBasis=S}}))}},[p]),f=Qe((y,d)=>{i.current&&r.current&&l($i(i.current,r.current,d,p))},[p]),h=Qe(()=>{let y=r.current;y&&(t==null||t(y.filter(Oi))),y==null||y.forEach(d=>{d.currentSize=void 0,d.flexBasis=void 0,d.flexOpen=!1})},[t]),g=Qe(y=>Ae.createElement(Go,{column:c,index:y,key:`splitter-${y}`,onDrag:f,onDragEnd:h,onDragStart:u}),[f,h,u,c]);return Qo(()=>{let[y,d]=Hi(m,p,g,s.current);r.current=d,i.current=y},[m,g,p]),{content:i.current||[],rootRef:n}};function Hi(e,t,o,n){let r=qe(e,t),i=jo(r),s=[],a=[];for(let l=0;l<e.length;l++){let c=e[l];if(l===0&&i[l]&Ce&&(s.push(en(l)),a.push({placeholder:!0,shim:!0})),c.key==null){let p=n[l]||(n[l]=Ii());s.push(Ae.cloneElement(c,{key:p}))}else s.push(c);a.push(r[l]),l>0&&i[l]&Ce?(s.push(en(l)),a.push({placeholder:!0})):i[l]&Me&&(s.push(o(s.length)),a.push({splitter:!0}))}return[s,a]}function $i(e,t,o,n){return Fi(t,o)?e.map((i,s)=>{let a=t[s],{currentSize:l,flexOpen:c,flexBasis:p}=a,m=l!==void 0;if(m||c){let{flexBasis:u}=i.props.style||{},f=m?a.currentSize:p;return f!==u?Ae.cloneElement(i,{style:{...i.props.style,flexBasis:f,[n]:"auto"}}):i}else return i}):e}function Fi(e,t){let o=[];e.forEach((p,m)=>{p.currentSize!==void 0&&o.push(m)});let n=t<0?o[0]:o[1],{currentSize:r=0,minSize:i=0}=e[n];if(r===i)return!1;if(Math.abs(t)>r-i){let p=t<0?-1:1;t=Math.max(0,r-i)*p}let s=e[o[0]],{currentSize:a=0}=s;s.currentSize=a+t;let l=e[o[1]],{currentSize:c=0}=l;return l.currentSize=c-t,!0}function en(e){return Ae.createElement(Je,{shim:e===0,key:`placeholder-${e}`})}function Ni(e,t){let{[t]:o}=e.getBoundingClientRect(),r=getComputedStyle(e).getPropertyValue(`min-${t}`),i=r.endsWith("px")?parseInt(r,10):0;return{size:o,minSize:i}}import{jsx as Gi}from"react/jsx-runtime";var Ot="hwFlexbox",on=_i(function(t,o){let{breakPoints:n,children:r,column:i,className:s,flexFill:a,gap:l,fullPage:c,id:p,onSplitterMoved:m,resizeable:u,row:f,spacing:h,splitterSize:g,style:y,...d}=t,{content:b,rootRef:E}=tn({children:r,onSplitterMoved:m,style:y}),R=Wi(Ot,s,{[`${Ot}-column`]:i,[`${Ot}-row`]:f,"flex-fill":a,"full-page":c});return Gi("div",{...d,className:R,"data-resizeable":u||void 0,id:p,ref:Vi(E,o),style:{...y,gap:l,"--spacing":h},children:b})});on.displayName="Flexbox";var Ht=on;import{useCallback as As}from"react";var ge={ADD:"add",BLUR:"blur",BLUR_SPLITTER:"blur-splitter",DRAG_START:"drag-start",DRAG_STARTED:"drag-started",DRAG_DROP:"drag-drop",FOCUS:"focus",FOCUS_SPLITTER:"focus-splitter",INITIALIZE:"initialize",MAXIMIZE:"maximize",MINIMIZE:"minimize",REMOVE:"remove",REPLACE:"replace",RESTORE:"restore",SAVE:"save",SET_TITLE:"set-title",SPLITTER_RESIZE:"splitter-resize",SWITCH_TAB:"switch-tab",TEAR_OUT:"tear-out"};import{useCallback as Gt,useContext as In,useEffect as Ls,useRef as kn,useState as vs}from"react";import vn from"react";import{uuid as un}from"@vuu-ui/vuu-utils";import Ie from"react";import{uuid as an}from"@vuu-ui/vuu-utils";import ke,{cloneElement as Ui}from"react";import{useCallback as ye}from"react";var N=new Map,G=new Map,nn=e=>N.get(e),rn=e=>N.has(e),sn=(e,t)=>N.set(e,t),be=()=>{let e=ye((s,a)=>{let l=G.get(s);if(l)return a!==void 0&&l[a]!==void 0?l[a]:a!==void 0?void 0:l},[]),t=ye((s,a,l)=>{if(a===void 0)G.set(s,l);else if(G.has(s)){let c=G.get(s);G.set(s,{...c,[a]:l})}else G.set(s,{[a]:l})},[]),o=ye((s,a)=>{if(G.has(s)){if(a===void 0)G.delete(s);else if(G.get(s)[a]){let{[a]:c,...p}=G.get(s);Object.keys(p).length>0?G.set(s,p):G.delete(s)}}},[]),n=ye((s,a)=>{let l=N.get(s);if(l)return a!==void 0?l[a]:l},[]),r=ye((s,a,l)=>{if(a===void 0)N.set(s,l);else if(N.has(s)){let c=N.get(s);N.set(s,{...c,[a]:l})}else N.set(s,{[a]:l})},[]),i=ye((s,a)=>{if(N.has(s)){if(a===void 0)N.delete(s);else if(N.get(s)[a]){let{[a]:c,...p}=N.get(s);Object.keys(p).length>0?N.set(s,p):N.delete(s)}}},[]);return{loadSessionState:e,loadState:n,saveSessionState:t,saveState:r,purgeState:i,purgeSessionState:o}};var ln=e=>e.flexDirection==="column"?["height","width"]:["width","height"],Xi={},ze=(e,t="0")=>{let[o,n]=Nt(P(e),e.props,t);return ke.cloneElement(e,o,n)},Ft=(e,t)=>{let o=P(e),[n,r]=Nt(o,e.props,"0",void 0,t);return Ui(e,n,r)};function Zi(e,t,o="0",n=null,r){var g,y;let{active:i=0,"data-path":s,path:a=s,id:l,style:c}=T(r),p=P(r)===e&&o===a,m=p?l:(g=t.id)!=null?g:an(),u=e==="Stack"?(y=t.active)!=null?y:i:void 0,f=m,h=p?c:Ji(e,t,n);return uo(e)?{id:m,key:f,path:o,style:h,type:e,active:u}:{id:m,key:f,style:h,"data-path":o}}function Nt(e,t,o,n=null,r){var c,p;let i=Zi(e,t,o,n,r);if(t.layout&&!r)return[i,[tt(t.layout,`${o}.0`)]];let s=(p=r==null?void 0:r.children)!=null?p:(c=r==null?void 0:r.props)==null?void 0:c.children,l=t.dropTarget&&s?s:Yi(e,t.children,o,s);return[i,l]}function Yi(e,t,o="0",n){let r=Array.isArray(t)?t:ke.isValidElement(t)?[t]:[];return $(e)?r.map((i,s)=>{let a=P(i),l=P(n==null?void 0:n[s]);if(!l||a===l){let[c,p]=Nt(a,i.props,`${o}.${s}`,e,n==null?void 0:n[s]);return ke.cloneElement(i,c,p)}return n==null?void 0:n[s]}):t}var Ji=(e,t,o)=>{let{style:n=Xi}=t;if(e==="Flexbox"&&(n={flexDirection:t.column?"column":"row",...n,display:"flex"}),n.flex){let{flex:r,...i}=n;n={...i,...Rt(typeof r=="number"?r:0)}}else o==="Stack"?n={...n,...Rt(1)}:o==="Flexbox"&&(n.width||n.height)&&n.flexBasis===void 0&&(n={...n,flexBasis:"auto",flexGrow:0,flexShrink:0});return n};function tt({id:e=an(),type:t,children:o,props:n,state:r},i){let s=t.match(/^[a-z]/)?t:te[t];if(s===void 0)throw Error(`layoutUtils unable to create component from JSON, unknown type ${t}`);return r&&sn(e,r),ke.createElement(s,{id:e,...n,key:e,path:i},o?o.map((a,l)=>tt(a,`${i}.${l}`)):void 0)}function cn(e){return pn(e)}function pn(e){let t=P(e),{id:o,children:n,type:r,...i}=T(e),s=rn(o)?nn(o):void 0;return{id:o,type:t,props:ji(i),state:s,children:ke.Children.map(n,pn)}}function ji(e){if(e){let{path:t,...o}=e,n={};for(let[r,i]of Object.entries(o))n[r]=$t(i);return n}}function $t(e){if(typeof e=="string"||typeof e=="number"||typeof e=="boolean")return e;if(Array.isArray(e))return e.map($t);if(typeof e=="object"&&e!==null){let t={};for(let[o,n]of Object.entries(e))t[o]=$t(n);return t}}function mn(e,t){var s;let o=e.props.children,n=o.length,{index:r=-1,positionRelativeToTab:i="after"}=t.tab||{};return r===-1||r>=n?[o[n-1],"after"]:[(s=o[r])!=null?s:null,i]}function ot(e,t,o){let{active:n,children:r=[],path:i}=T(e),s=w(t,"path"),{idx:a,finalStep:l}=Z(i,s,!0),[c,p]=l?Ki(e,r,o):[n,r==null?void 0:r.map((u,f)=>f===a?ot(u,t,o):u)],m=P(e)==="Stack"?Array.isArray(c)?c[0]:c:n;return Ie.cloneElement(e,{active:m},p)}function Ki(e,t,o){let n=w(e,"path"),r=t==null?void 0:t.length,{id:i=un()}=T(o);return r?[r,t.concat(B(o,`${n}.${r}`,{id:i,key:i}))]:[0,[B(o,`${n}.0`,{id:i})]]}function nt(e,t,o,n,r,i,s){let{active:a,children:l,path:c}=T(e),p=w(t,"path"),{idx:m,finalStep:u}=Z(c,p),[f,h]=u?qi(e,l,m,o,n,r,i,s):[a,l.map((y,d)=>d===m?nt(y,t,o,n,r,i,s):y)],g=P(e)==="Stack"?f:a;return Ie.cloneElement(e,{active:g},h)}function qi(e,t,o,n,r,i,s,a){let l=_(n);return l!=null&&l.width&&(l!=null&&l.height)?es(e,t,o,n,r,s,a):dn(e,t,o,n,r,(i==null?void 0:i.width)||(i==null?void 0:i.height),s)}var Qi=(e,t,{top:o,right:n,bottom:r,left:i},[s,a,l,c])=>{if(e==="column"&&t==="before")return a-o;if(e==="column")return r-c;if(e==="row"&&t==="before")return s-i;if(e==="row")return n-l};function es(e,t,o,n,r,i,s){let{style:{flexDirection:a}}=T(e),[l,c,p]=Yo(a),{[c]:m,[l]:u}=_(n),f=w(t[o],"path"),h=Qi(a,r,i,s),[g,y]=m<i[c]?[ve(n,p,f,i,s),u]:[n,void 0],d=h?K(f,h,{flexGrow:0,flexShrink:0}):void 0;return m>i[c]&&(t=t.map(b=>{if(w(b,"placeholder"))return b;{let{[c]:E}=_(b);return E&&E<m?ve(b,p,w(b,"path")):b}})),dn(e,t,o,g,r,y,i,d)}function dn(e,t,o,n,r,i,s,a){let l=w(e,"path"),c=0,p=!t||t.length===0?[n]:t.reduce((m,u,f)=>{if(o===f){let[h,g]=ts(e,u,n,s);r==="before"?a?m.push(a,g,h):m.push(g,h):a?m.push(h,g,a):m.push(h,g),c=m.indexOf(g)}else m.push(u);return m},[]).map((m,u)=>u<c?m:B(m,`${l}.${u}`));return[c,p]}function ts(e,t,o,n){let r=un(),{version:i=0}=T(o);if(i+=1,P(e)==="Flexbox"){let[s]=ln(e.props.style),a=6,l={[s]:(n[s]-a)/2},c=It(t,s,l),p=It(o,s,l);return[Ie.cloneElement(t,{style:c}),Ie.cloneElement(o,{id:r,version:i,style:p})]}else{let{style:{left:s,top:a,flex:l,...c}={left:void 0,top:void 0,flex:void 0}}=T(o);return[t,Ie.cloneElement(o,{id:r,version:i,style:c})]}}var U={ADD:"add",DRAG_START:"drag-start",DRAG_DROP:"drag-drop",MAXIMIZE:"maximize",MINIMIZE:"minimize",REMOVE:"remove",REPLACE:"replace",RESTORE:"restore",SAVE:"save",SET_TITLE:"set-title",SPLITTER_RESIZE:"splitter-resize",SWITCH_TAB:"switch-tab",TEAROUT:"tearout"};import ue from"react";import rt from"react";function fn(e,{target:t,replacement:o}){return Vt(e,t,o)}function Vt(e,t,o){let n=w(t,"path"),r=w(t,"resizeable"),{style:i}=T(t),s=ze(rt.cloneElement(o,{resizeable:r,style:{...i,...o.props.style}}),n);return J(e,t,s)}function J(e,t,o,n){if(e===t)return o;let{idx:r,finalStep:i}=Z(w(e,"path"),w(t,"path")),s=e.props.children.slice();return i?n?n===ge.MINIMIZE?s[r]=os(e,s[r]):n===ge.RESTORE&&(s[r]=ns(s[r])):s[r]=o:s[r]=J(s[r],t,o,n),rt.cloneElement(e,void 0,s)}function os(e,t){let{style:o}=T(e),{style:n}=T(t),{width:r,height:i,flexBasis:s,flexShrink:a,flexGrow:l,...c}=n,p={width:r,height:i,flexBasis:s,flexShrink:a,flexGrow:l},m={...c,flexBasis:0,flexGrow:0,flexShrink:0},u=o.flexDirection==="row"?"vertical":o.flexDirection==="column"?"horizontal":!1;return u?rt.cloneElement(t,{collapsed:u,restoreStyle:p,style:m}):t}function ns(e){let{style:t,restoreStyle:o}=T(e),{flexBasis:n,flexShrink:r,flexGrow:i,...s}=t,a={...s,...o};return rt.cloneElement(e,{collapsed:!1,style:a,restoreStyle:void 0})}function Wt(e,{path:t}){let o=V(e,t),n=q(e,t);if(n===null)return e;let{children:r}=T(n);if(r.length>1&&gn(r,t)){let{style:{flexBasis:i,display:s,flexDirection:a,...l}}=T(n),c=w(n,"path"),p=J(e,n,K(c,i,l));for(;(n=q(p,c))&&w(n,"path")!=="0";){let{children:m}=T(n);if(gn(m)){c=w(n,"path");let{style:{flexBasis:u,display:f,flexDirection:h,...g}}=T(n);p=J(e,n,K(c,u,g))}else if(as(m))p=xn(e,n);else break}return p}return yn(e,o)}function yn(e,t){let o=T(e),{children:n,path:r,preserve:i}=o,{active:s}=o,{idx:a,finalStep:l}=Z(r,w(t,"path")),c=P(e),p=n.slice();if(l){if(p.splice(a,1),s!==void 0&&s>=a&&(s=Math.max(0,s-1)),p.length===1&&!i&&r!=="0"&&c.match(/Flexbox|Stack/))return rs(e,p[0]);!p.some(is)&&p.some(bn)&&(p=ss(p))}else p[a]=yn(p[a],t);return p=p.map((m,u)=>B(m,`${r}.${u}`)),ue.cloneElement(e,{active:s},p)}function rs(e,t){let o=P(e),{path:n,style:{flexBasis:r,flexGrow:i,flexShrink:s,width:a,height:l}}=T(e),c=B(t,n);if(n==="0")c=ue.cloneElement(c,{style:{...t.props.style,width:a,height:l}});else if(o==="Flexbox"){let p=e.props.style.flexDirection==="column"?"height":"width",{style:{[p]:m,...u}}=c.props;c=ue.cloneElement(c,{flexFill:void 0,style:{...u,flexGrow:i,flexShrink:s,flexBasis:r,width:a,height:l}})}return c}var is=e=>e.props.style.flexGrow>0,bn=e=>{let{width:t,height:o,flexGrow:n}=e.props.style;return n===0&&typeof t!="number"&&typeof o!="number"},ss=e=>e.map(t=>bn(t)?ue.cloneElement(t,{style:{...t.props.style,flexGrow:1}}):t),as=e=>{if(e&&e.length>0){let t=w(e[0],"placeholder"),o=!1;for(let n=1;n<e.length;n++){if(o=w(e[n],"placeholder"),t&&o)return!0;t=o}}},xn=(e,t)=>{let{children:o,path:n}=T(e),{idx:r,finalStep:i}=Z(n,w(t,"path")),s=o.slice();return i?s[r]=ls(t):s[r]=xn(s[r],t),s=s.map((a,l)=>B(a,`${n}.${l}`)),ue.cloneElement(e,void 0,s)},ls=e=>{let{children:t}=T(e),o=[],n=[];for(let i=0;i<t.length;i++)w(t[i],"placeholder")?n.push(t[i]):(n.length===1?o.push(n.pop()):n.length>0&&(o.push(hn(n)),n.length=0),o.push(t[i]));n.length===1?o.push(n.pop()):n.length>0&&o.push(hn(n));let r=w(e,"path");return ue.cloneElement(e,void 0,o.map((i,s)=>B(i,`${r}.${s}`)))},hn=([e,...t])=>{let o=w(e,"style"),{flexBasis:n,flexGrow:r,flexShrink:i}=o;for(let{props:{style:s}}of t)n+=s.flexBasis,r=Math.max(r,s.flexGrow),i=Math.max(i,s.flexShrink);return ue.cloneElement(e,{style:{...o,flexBasis:n,flexGrow:r,flexShrink:i}})},gn=(e,t)=>e.every(o=>w(o,"placeholder")||t&&w(o,"path")===t);import Rn from"react";function En(e,{path:t,sizes:o}){let n=V(e,t,!0),{children:r,style:i}=T(n),s=i.flexDirection==="column"?"height":"width",a=cs(r,o,s),l=Rn.cloneElement(n,void 0,a);return J(e,n,l)}function cs(e,t,o){return e.map((n,r)=>{let{style:{[o]:i,flexBasis:s}}=T(n),a=t[r],{currentSize:l,flexBasis:c}=a,m=l!==void 0?a.currentSize:c;return m===void 0||i===m||s===m?n:Rn.cloneElement(n,{style:ps(n.props.style,o,m)})})}function ps(e,t,o){let n=typeof e[t]=="number",{flexShrink:r=1,flexGrow:i=1}=e;return{...e,[t]:n?o:"auto",flexBasis:n?"auto":o,flexShrink:r,flexGrow:i}}import{uuid as us}from"@vuu-ui/vuu-utils";import it from"react";var Sn=e=>{let[t]=P(e);return t===t.toLowerCase()};function Be(e,t,o,n,r,i){let{children:s,path:a}=T(e),l=w(t,"path"),{idx:c,finalStep:p}=Z(a,l),m=p?ms(e,s,t,o,n,r,i):s.map((u,f)=>f===c?Be(u,t,o,n,r,i):u);return it.cloneElement(e,void 0,m)}function ms(e,t,o,n,r,i,s){let a=_(n);if(a!=null&&a.width&&(a!=null&&a.height)){if(i===void 0||s===void 0)throw Error("wrap-layout-element, updateChildren clientRect and dropRect must both be available");return fs(t,o,n,r,i,s)}return ds(e,t,o,n,r)}function ds(e,t,o,n,r){var x;let{version:i=0}=T(n),s=w(o,"path"),{type:a,flexDirection:l,showTabs:c}=Tn(r),[p,m,u]=hs(a,o,n,l,r),f=Dn(r),h=f?1:0,g={resizeable:!0,style:u,version:i+1},d={[Sn(o)?"data-resizeable":"resizeable"]:!0,style:m},b=a==="Stack"?{showTabs:c}:void 0,E=a==="Flexbox"?{splitterSize:(x=P(e)==="Flexbox"&&e.props.splitterSize)!=null?x:void 0}:void 0,R=us(),D=it.createElement(te[a],{active:h,id:R,key:R,path:w(o,"path"),flexFill:w(o,"flexFill"),...E,...b,style:p,resizeable:w(o,"resizeable")},f?[B(o,`${s}.0`,d),ze(it.cloneElement(n,g),`${s}.1`)]:[ze(it.cloneElement(n,g),`${s}.0`),B(o,`${s}.1`,d)]);return t.map(S=>S===o?D:S)}function fs(e,t,o,n,r,i){let{flexDirection:s}=Tn(n),a=s==="column"?"row":"column",l=Dn(n),[c,p,m,u]=i,[f,h]=s==="column"?[p-r.top,r.bottom-u]:[c-r.left,r.right-m],g=w(t,"path"),y=0,d=Sn(t)?"data-resizeable":"resizeable",b=[];f&&b.push(l?B(t,`${g}.${y++}`,{[d]:!0,style:{flexBasis:f,flexGrow:1,flexShrink:1}}):K(`${g}.${y++}`,f,{flexGrow:0,flexShrink:0})),b.push(ve(o,a,`${g}.${y++}`,r,i)),h&&b.push(l?K(`${g}.${y++}`,0):B(t,`${g}.${y++}`,{[d]:!0,style:{flexBasis:0,flexGrow:1,flexShrink:1}}));let E=Bt(s,t.props,b,g);return e.map(R=>R===t?E:R)}function hs(e,t,o,n,r){let i={...t.props.style,flexDirection:n},s=e==="Flexbox"&&n==="column"?"height":"width",a=zt(o,s,r),l=zt(t,s);return[i,l,a]}var Dn=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 Tn(e){return e.position.Header?{type:"Stack",flexDirection:"column",showTabs:!0}:{type:"Flexbox",flexDirection:e.position.EastOrWest?"row":"column"}}var Mn=(e,t)=>{switch(t.type){case U.ADD:return Rs(e,t);case U.DRAG_DROP:return xs(e,t);case U.MAXIMIZE:return bs(e,t);case U.REMOVE:return Wt(e,t);case U.REPLACE:return fn(e,t);case U.SET_TITLE:return ys(e,t);case U.SPLITTER_RESIZE:return En(e,t);case U.SWITCH_TAB:return gs(e,t);default:return e}},gs=(e,{path:t,nextIdx:o})=>{let n=V(e,t,!0),r=vn.cloneElement(n,{active:o});return J(e,n,r)},ys=(e,{path:t,title:o})=>{let n=V(e,t,!0),r=vn.cloneElement(n,{title:o});return J(e,n,r)},bs=(e,{path:t,type:o})=>{if(t){let n=V(e,t,!0);return J(e,n,n,o)}else return e},xs=(e,t)=>{var h,g;let{draggedReactElement:o,dragInstructions:n,dropTarget:r}=t,i=r.component,{pos:s}=r,a=((h=s==null?void 0:s.position)==null?void 0:h.Header)&&P(i)==="Stack",{id:l,version:c}=T(o),p=_(o),m;if(a){let[y,d]=mn(i,s);y===void 0?m=ot(e,i,o):m=nt(e,y,o,d)}else!p&&((g=s==null?void 0:s.position)!=null&&g.Centre)?m=Vt(e,i,o):m=Es(e,r,o);if(n.DoNotRemove)return m;let u=Q(m,y=>y.id===l&&y.version===c),f=w(u,"path");return Wt(m,{path:f,type:"remove"})},Rs=(e,{path:t,component:o})=>ot(e,V(e,t),o),Es=(e,t,o)=>{let{component:n,pos:r,clientRect:i,dropRect:s}=t,a=w(n,"path");if(a==="0.0")return Be(e,n,o,r);let l=q(e,a);if(wn(r,l)){let c=r.position.SouthOrEast?"after":"before";return nt(e,n,o,c,r,i,s)}if(!wn(r,l))return Be(e,n,o,r,i,s);if($(P(l)))return Be(e,n,o,r);throw Error(`no support right now for position = ${r.position}`)},wn=(e,t)=>e.position.Centre?Ln(t)||Pn(t):e.position.NorthOrSouth?Pn(t):e.position.EastOrWest?Ln(t):!1,Pn=e=>P(e)==="Flexbox"&&e.props.style.flexDirection==="column",Ln=e=>P(e)==="Flexbox"&&e.props.style.flexDirection!=="column";import{createContext as Ss}from"react";var Ds=e=>console.log(`dispatch ${e.type}, have you forgotten to provide a LayoutProvider ?`),Oe=Ss({dispatchLayoutProvider:Ds,version:-1});import{useCallback as st,useRef as _t}from"react";var Ts={},Cn=[0,0],ws=(e,t,o)=>{let n=document.createElement("div");n.className="vuuSimpleDraggableWrapper",n.classList.add("vuuSimpleDraggableWrapper","salt-theme","salt-density-medium"),n.dataset.dragging="true";let r=o!=null?o:document.createElement("div");r.id=t,n.appendChild(r),document.body.appendChild(n);let i=`top:${e.top}px;left:${e.left}px;width:${e.width}px;height:${e.height}px;`;return[n,i,e.left,e.top]},Ps=e=>{let{offsetParent:t}=e;if(t===null)return Cn;{let{left:o,top:n}=t.getBoundingClientRect();return[o,n]}},An=(e,t)=>{let o=_t(),n=_t(),r=_t(),i=st((c,p)=>{if(n.current&&r.current){let{dragOffsets:[m,u],targetPosition:f}=n.current,h=typeof c=="number"?c-m:f.left,g=typeof p=="number"?p-u:f.top;(h!==f.left||g!==f.top)&&(n.current.targetPosition.left=h,n.current.targetPosition.top=g,r.current.style.top=g+"px",r.current.style.left=h+"px")}},[]),s=st(c=>{if(n.current){let{dragInstructions:p,payload:m,originalCSS:u}=n.current;t({type:"drag-drop",draggedReactElement:m,dragInstructions:p,dropTarget:c}),console.log("[useLayoutDragDrop]",{dragInstructions:p}),r.current&&(p.RemoveDraggableOnDragEnd?document.body.removeChild(r.current):(r.current.style.cssText=u,delete r.current.dataset.dragging)),o.current=void 0,n.current=void 0,r.current=void 0}},[t]),a=st(c=>{if(o.current){let{payload:p,dragContainerPath:m,dragElement:u,dragRect:f,instructions:h=Ts,path:g}=o.current,{current:y}=e,d={x:c.clientX,y:c.clientY},b=p!=null?p:V(y,g,!0),{id:E}=b.props,R=_(b),D="",x="",S="",L=-1,C=-1,H=Cn,v=document.getElementById(E);if(v===null)[v,x,L,C]=ws(f,E,u);else{H=Ps(v);let[I,M]=H,{width:A,height:k,left:j,top:W}=v.getBoundingClientRect();L=j-I,C=W-M,x=`width:${A}px;height:${k}px;left:${L}px;top:${C}px;z-index: 100;background-color:#ccc;opacity: 0.6;`,v.dataset.dragging="true",D=v.style.cssText}S=At.initDrag(e.current,m,f,d,{drag:i,drop:s},R),v.style.cssText=x+S,r.current=v,n.current={payload:b,originalCSS:D,dragRect:f,dragOffsets:H,dragInstructions:h,targetPosition:{left:L,top:C}}}},[i,s,e]);return st(c=>{let{evt:p,...m}=c;console.log("prepare to drag",{options:m}),o.current={...m,dragContainerPath:""},At.handleMousedown(p,a,m.instructions)},[a])};import{jsx as Bn}from"react/jsx-runtime";var zn=e=>e.dropTarget,Ms=e=>["drag-drop","remove","set-title","splitter-resize","switch-tab"].includes(e.type),Om=()=>{let e=Cs();return Bn("div",{children:`Context: ${e} `})},Hm=e=>{let{children:t,layout:o,onLayoutChange:n}=e,r=kn(void 0),i=kn(t),[,s]=vs(null),a=Gt(m=>{if(n){let u=Q(m,zn)||r.current,h=P(u)==="DraggableLayout"?T(u).children[0]:u,g=cn(h);n(g,"drag-root")}},[n]),l=Gt((m,u=!1)=>{let f=Mn(r.current,m);f!==r.current&&(r.current=f,s({}),!u&&Ms(m)&&a(f))},[a]),c=Gt(m=>{switch(m.type){case"drag-start":{p(m);break}case"save":{a(r.current);break}default:{l(m);break}}},[l,a]),p=An(r,c);return Ls(()=>{if(o){let m=Q(r.current,zn),u=bo(m),f=tt(o,`${m.props.path}.0`),h=u?{type:U.REPLACE,target:u,replacement:f}:{type:U.ADD,path:m.props.path,component:f};l(h,!0)}},[l,o]),r.current===void 0?r.current=Ft(t):t!==i.current&&(r.current=Ft(t,r.current),i.current=t),Bn(Oe.Provider,{value:{dispatchLayoutProvider:c,version:0},children:r.current})},X=()=>{let{dispatchLayoutProvider:e}=In(Oe);return e},Cs=()=>{console.log({LayoutProviderContext:Oe});let{version:e}=In(Oe);return e};import{jsx as ks}from"react/jsx-runtime";var On=function(t){let{path:o}=t,n=X(),r=As(i=>{n({type:ge.SPLITTER_RESIZE,path:o,sizes:i})},[n,o]);return ks(Ht,{...t,onSplitterMoved:r})};On.displayName="Flexbox";z("Flexbox",On,"container");import{useForkRef as qs}from"@salt-ds/core";import Qs from"classnames";import{forwardRef as ea}from"react";import{useCallback as Wn,useEffect as $s,useRef as Zt,useState as Fs}from"react";import{useCallback as zs,useLayoutEffect as Hn,useRef as Is}from"react";var qm=["height","width"],Qm=["height"],ed=["width"],me=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}},$n=new ResizeObserver(e=>{for(let t of e){let{target:o,contentRect:n}=t,r=me.get(o);if(r){let{onResize:i,measurements:s}=r,a=!1;for(let[l,c]of Object.entries(s)){let p=Fn(o,n,l);p!==c&&(a=!0,s[l]=p)}a&&i&&i(s)}}});function Nn(e,t,o,n=!1){let r=Is(t),i=zs(s=>{let a=s.getBoundingClientRect();return r.current.reduce((l,c)=>(l[c]=Fn(s,a,c),l),{})},[]);Hn(()=>{let s=e.current,a=!1;async function l(){me.set(s,{measurements:{}}),a=!1;let{fonts:c}=document;if(c&&await c.ready,!a){let p=me.get(s);if(p){let m=i(s);p.measurements=m,$n.observe(s),n&&o(m)}}}if(s){if(me.has(s))throw Error("useResizeObserver attemping to observe same element twice");l()}return()=>{s&&me.has(s)&&($n.unobserve(s),me.delete(s),a=!0)}},[e,i]),Hn(()=>{let s=e.current,a=me.get(s);if(a){if(r.current!==t){r.current=t;let l=i(s);a.measurements=l}a.onResize=o}},[t,i,e,o])}function Bs(e,t){let o=document.body.querySelector(`.${e}`),n={get:function(r,i){let s=r.getPropertyValue(`--${e}-breakpoint-${i}`);return s?parseInt(s):void 0}};return o?new Proxy(getComputedStyle(o),n):t!=null?t:{}}var Os=([,e],[,t])=>t-e,Xt=e=>Object.entries(e).sort(Os).map(([t,o],n,r)=>[t,o,n<r.length-1?r[n+1][1]:9999]),Ut=null,Hs=(e="salt")=>{let{xs:t,sm:o,md:n,lg:r,xl:i}=Bs(e);return Xt({xs:t,sm:o,md:n,lg:r,xl:i})},Vn=e=>(Ut===null&&(Ut=Hs(e)),Ut);var Ns=[],_n=({breakPoints:e,smallerThan:t},o)=>{let[n,r]=Fs(t?!1:"lg"),i=Zt(document.body),s=Zt(e?Xt(e):Vn()),a=Zt("lg"),l=Wn(p=>{if(s.current){for(let[m,u]of s.current)if(p>=u)return m}},[s]),c=Wn(p=>{if(t){let m=s.current.find(([u])=>u===t);if(m){let[,,u]=m;return p<u}}else return l(p);return p},[t,l]);return Nn(o||i,s.current?["width"]:Ns,({width:p})=>{let m=c(p);m!==a.current&&(a.current=m,r(m))},!0),$s(()=>{let p=o||i;if(p.current){let m=a.current;if(s.current){let{clientWidth:u}=p.current,f=c(u);a.current=f,f!==m&&r(f)}}},[r,c,o]),n};var Gn="data-collapsible",Vs={[Gn]:!0,"data-pad-start":!0,"data-pad-end":!0},Ws=e=>{var t;return(t=Vs[e])!=null?t:!1},_s=e=>e===Gn,Gs={dynamic:"dynamic",instant:"instant",true:"instant"},Us=e=>{var t;return(t=Gs[e])!=null?t:"none"},cd=e=>Object.keys(e).reduce((t,o)=>{let[n,r]=t;if(Ws(o)){let i=_s(o)?Us(e[o]):e[o];n[o]=i,r[o]=void 0}return t},[{},{}]);import{getUniqueId as Xs}from"@vuu-ui/vuu-utils";import{cloneElement as Zs,isValidElement as Ys,useCallback as Js,useMemo as Un,useRef as Yt}from"react";var js=["xs","sm","md","lg","xl"],Ks=12,Xn=({children:e,cols:t,style:o})=>{let n=Yt(null),r=Yt(null),i=Yt(),s=t!=null?t:Ks,l=(o==null?void 0:o.flexDirection)==="column"?"height":"width",c=Un(()=>Array.isArray(e)?e:Ys(e)?[e]:[],[e]),p=Js((m,u)=>{let f=qe(m,u,js),h=[],g=[];for(let y=0;y<m.length;y++){let d=m[y],{style:{flex:b,...E}}=d.props;h.push(Zs(d,{key:Xs(),style:{...E,"--parent-col-count":s}})),g.push(f[y])}return[h,g]},[s]);return Un(()=>{let[m,u]=p(c,l);r.current=u,i.current=m},[p,c,l]),{cols:s,content:i.current,rootRef:n}};import{jsx as ta}from"react/jsx-runtime";var at="hwFluidGrid",Jt=ea(function(t,o){let{breakPoints:n,children:r,column:i,cols:s=12,className:a,flexFill:l,gap:c=3,fullPage:p,id:m,onSplitterMoved:u,resizeable:f,row:h,showGrid:g,spacing:y,splitterSize:d,style:b,...E}=t,{cols:R,content:D,rootRef:x}=Xn({children:r,cols:s,style:b}),S=_n({breakPoints:n},x),L=Qs(at,a,{[`${at}-column`]:i,[`${at}-row`]:h,[`${at}-show-grid`]:g,"flex-fill":l,"full-page":p}),C={...b,"--spacing":y,"--grid-col-count":R,"--grid-gap":c};return ta("div",{...E,className:L,"data-breakpoint":S,"data-cols":R,"data-resizeable":f||void 0,id:m,ref:qs(x,o),style:C,children:D})});Jt.displayName="FluidGrid";import{jsx as oa}from"react/jsx-runtime";var Zn=function(t){return oa(Jt,{...t})};Zn.displayName="FluidGrid";z("FluidGrid",Zn,"container");import ba from"classnames";import rr,{useRef as xa,useState as ir}from"react";import{useCallback as He,useState as na}from"react";var lt=(e,t,o,n)=>{var y;let{loadSessionState:r,purgeSessionState:i,purgeState:s,saveSessionState:a}=be(),[l,c]=na((y=r(e,"contributions"))!=null?y:[]),p=X(),m=He((d,b)=>{let E=l.concat([{location:d,content:b}]);a(e,"contributions",E),c(E)},[l,e,a]),u=He(()=>{i(e,"contributions"),c([])},[e,i]),f=He(()=>{let d=r(e,"data-source");d&&d.unsubscribe(),i(e),s(e),p({type:"remove",path:o})},[p,e,r,i,s,o]),h=He(async(d,b,E)=>{var D;d.stopPropagation();let R=(D=t.current)==null?void 0:D.getBoundingClientRect();return new Promise((x,S)=>{p({type:"drag-start",evt:d,path:b===void 0?o:`${o}.${b}`,dragRect:R,preDragActivity:E,dropTargets:n,resolveDragStart:x,rejectDragStart:S})})},[t,p,o,n]);return[He(async(d,b)=>{var R;let{type:E}=d;switch(E){case"maximize":case"minimize":case"restore":return p({type:E,path:(R=d.path)!=null?R:o});case"remove":return f();case"mousedown":return h(b,d.index,d.preDragActivity);case"add-toolbar-contribution":return m(d.location,d.content);case"remove-toolbar-contribution":return u();default:return}},[p,o,f,h,m,u]),l]};import{useForkRef as ca,useIdMemo as pa}from"@salt-ds/core";import ua from"classnames";import Kt,{forwardRef as ma,useCallback as da,useMemo as fa,useRef as tr,useState as ha}from"react";import{useCallback as de,useMemo as Yn}from"react";var Jn=({id:e,rootRef:t,path:o,dropTargets:n,title:r})=>{let i=X(),{loadState:s,loadSessionState:a,purgeState:l,saveState:c,saveSessionState:p}=be(),[m,u]=lt(e,t,o,n),f=Yn(()=>{var x;return(x=s("view-title"))!=null?x:r},[s,r]),h=de(x=>{o&&i({type:"set-title",path:o,title:x})},[i,o]),g=Yn(()=>s(e),[e,s]),y=de(x=>s(e,x),[e,s]),d=de(x=>{l(e,x),i({type:"save"})},[e,i,l]),b=de((x,S)=>{c(e,S,x),i({type:"save"})},[e,i,c]),E=de(x=>a(e,x),[e,a]),R=de((x,S)=>p(e,S,x),[e,p]),D=de(({type:x,...S})=>{let{[x]:L}=S;b(L,x)},[b]);return{contributions:u,dispatchViewAction:m,load:y,loadSession:E,onConfigChange:D,onEditTitle:h,purge:d,restoredState:g,save:b,saveSession:R,title:f}};import{useResizeObserver as ra,WidthHeight as ia}from"@heswell/salt-lab";import{useCallback as jn,useRef as Kn}from"react";var sa=[],qn=({mainRef:e,resize:t="responsive",rootRef:o})=>{let n=t==="defer",r=Kn({}),i=Kn(),s=jn(()=>{e.current&&(e.current.style.height=r.current.height+"px",e.current.style.width=r.current.width+"px"),i.current=void 0},[e]),a=jn(({height:l,width:c})=>{r.current.height=l,r.current.width=c,i.current!==null&&clearTimeout(i.current),i.current=window.setTimeout(s,40)},[s]);ra(o,n?ia:sa,a,n)};import aa,{useContext as Qn}from"react";var la={dispatch:null},ct=aa.createContext(la),er=()=>{var t;let e=Qn(ct);return(t=e==null?void 0:e.dispatch)!=null?t:null},lf=()=>Qn(ct);import{jsx as jt,jsxs as ya}from"react/jsx-runtime";var $e="vuuView",ga=(e,t)=>e&&t?{...e,...t}:e||t,or=ma(function(t,o){let{Header:n=nr,children:r,className:i,collapsed:s,closeable:a,"data-resizeable":l,dropTargets:c,expanded:p,flexFill:m,id:u,header:f,orientation:h="horizontal",path:g,resize:y="responsive",resizeable:d=l,tearOut:b,style:E={},title:R,...D}=t,x=pa(u),S=tr(null),L=tr(null),[C,H]=ha(),{contributions:v,dispatchViewAction:I,load:M,loadSession:A,onConfigChange:k,onEditTitle:j,purge:W,restoredState:Re,save:so,saveSession:ao,title:ht}=Jn({id:x,rootRef:S,path:g,dropTargets:c,title:R});qn({mainRef:L,resize:y,rootRef:S});let lo=da(Dr=>{H(Dr)},[]),Rr=()=>Kt.isValidElement(r)&&(Re||C)?Kt.cloneElement(r,ga(Re,C)):r,Er=fa(()=>({dispatch:I,id:x,path:g,title:ht,load:M,loadSession:A,onConfigChange:k,purge:W,save:so,saveSession:ao,setComponentProps:lo}),[I,x,M,A,k,g,W,so,ao,lo,ht]),Sr=typeof f=="object"?f:{};return jt("div",{...D,className:ua($e,i,{[`${$e}-collapsed`]:s,[`${$e}-expanded`]:p,[`${$e}-resize-defer`]:y==="defer"}),"data-resizeable":d,id:x,ref:ca(o,S),style:E,tabIndex:-1,children:ya(ct.Provider,{value:Er,children:[f?jt(n,{...Sr,collapsed:s,contributions:v,expanded:p,closeable:a,onEditTitle:j,orientation:h,tearOut:b,title:ht}):null,jt("div",{className:`${$e}-main`,ref:L,children:Rr()})]})})});or.displayName="View";var ae=Kt.memo(or);ae.displayName="View";z("View",ae,"view");import{EditableLabel as Ra,Toolbar as Ea,ToolbarButton as Sa,ToolbarField as Da,Tooltray as sr}from"@heswell/salt-lab";import{CloseIcon as Ta}from"@salt-ds/icons";import{jsx as xe,jsxs as wa}from"react/jsx-runtime";var nr=({className:e,contributions:t,collapsed:o,closeable:n,onEditTitle:r,orientation:i="horizontal",style:s,title:a="Untitled"})=>{let l=xa(null),[c,p]=ir(a),[m,u]=ir(!1),f=er(),h=v=>f==null?void 0:f({type:"remove"},v),g="vuuHeader",y=()=>{var v;(v=l.current)==null||v.focus()},d=v=>{v.stopPropagation()},E=ba(g,e,`${g}-${o||i}`),R=()=>{u(!0)},D=v=>{v.key==="Enter"&&u(!0)},x=(v="",I="",M=!0,A=!1)=>{var k;u(!1),A?p(v):I!==v&&(p(I),r==null||r(I)),M===!1&&((k=l.current)==null||k.focus())},S=v=>{f==null||f({type:"mousedown"},v)},L=[],C=[],H=[];return t==null||t.forEach((v,I)=>{switch(v.location){case"pre-title":L.push(rr.cloneElement(v.content,{key:I}));break;default:C.push(rr.cloneElement(v.content,{key:I}))}}),a&&L.push(xe(Da,{className:"vuuHeader-title",children:xe(Ra,{editing:m,value:c,onChange:p,onMouseDownCapture:y,onEnterEditMode:R,onExitEditMode:x,onKeyDown:D,ref:l,tabIndex:0},"title")},"title")),n&&H.push(wa(Sa,{onClick:h,onMouseDown:d,children:[xe(Ta,{})," Close"]},"close")),C.length>0&&L.push(xe(sr,{"data-align-end":!0,children:C},"contributions")),H.length>0&&L.push(xe(sr,{"data-align-end":!0,children:H},"actions")),xe(Ea,{className:E,orientation:i,style:s,onMouseDown:S,children:L})};import{uuid as Pa}from"@vuu-ui/vuu-utils";import{List as La,ListItem as va}from"@heswell/salt-lab";import ar from"classnames";import{cloneElement as Ma,memo as Ca}from"react";import{jsx as qt}from"react/jsx-runtime";var Aa=e=>{let t=e.cloneNode(!0);return t.id="",delete t.dataset.idx,t},lr=Ca(({className:e,children:t,idx:o,resizeable:n,header:r,closeable:i,...s})=>qt(va,{className:ar("vuuPaletteItem",e),"data-draggable":!0,...s}));lr.displayName="PaletteItem";var ka=({children:e,className:t,orientation:o="horizontal",ViewProps:n,...r})=>{let i=X(),s="vuuPalette";function a(l){var S;let p=l.target.closest(".vuuPaletteItem"),m=parseInt((S=p.dataset.idx)!=null?S:"-1");m!==-1&&console.log({children:e,idx:m,listItemElement:p});let{props:{caption:u,children:f,template:h,...g}}=e[m],{height:y,left:d,top:b,width:E}=p.getBoundingClientRect(),R=Pa(),x=h?f:qt(ae,{...n,...{id:R,key:R},...g,title:g.label,children:f});i({dragRect:{left:d,top:b,right:d+E,bottom:b+150,width:E,height:y},dragElement:Aa(p),evt:l.nativeEvent,instructions:{DoNotRemove:!0,DoNotTransform:!0,RemoveDraggableOnDragEnd:!0,dragThreshold:10},path:"*",payload:x,type:"drag-start"})}return qt(La,{...r,borderless:!0,className:ar(s,t,`${s}-${o}`),maxHeight:800,selected:null,children:e.map((l,c)=>l.type===lr?Ma(l,{key:c,onMouseDown:a}):l)})};z("Palette",ka,"view");import{uuid as za}from"@vuu-ui/vuu-utils";import{List as Ia,ListItem as Ba}from"@heswell/salt-lab";import Oa from"classnames";import{jsx as Qt}from"react/jsx-runtime";var Ha="vuuPalette",Sh=e=>{let{children:t,ViewProps:o,label:n,onMouseDown:r,template:i,...s}=e,a=X();return Qt(Ba,{onMouseDown:c=>{let{left:p,top:m,width:u}=c.currentTarget.getBoundingClientRect(),f=za(),g=i?t:Qt(ae,{...{id:f,key:f},...o,title:e.label,children:t});a({type:"drag-start",evt:c.nativeEvent,path:"*",payload:g,instructions:{DoNotRemove:!0,DoNotTransform:!0,RemoveDraggableOnDragEnd:!0,dragThreshold:10},dragRect:{left:p,top:m,right:p+u,bottom:m+150,width:u,height:100}})},...s,children:n})},$a=({className:e,...t})=>Qt(Ia,{...t,className:Oa(Ha,e),height:"100%",selectionStrategy:"none"});z("PaletteSalt",$a,"view");import{Tab as Fa,Tabstrip as Na,Toolbar as Va,ToolbarField as Wa}from"@heswell/salt-lab";import{useIdMemo as _a}from"@salt-ds/core";import Ga from"classnames";import ut,{forwardRef as Ua,useCallback as Xa}from"react";import{jsx as pt,jsxs as ja}from"react/jsx-runtime";var cr="Tabs",Za=()=>{},Ya=(e,t)=>{var o,n;return(n=(o=e.props)==null?void 0:o.title)!=null?n:`Tab ${t+1}`},Ja=e=>{let t=[];return ut.Children.forEach(e,o=>{ut.isValidElement(o)?t.push(o):console.warn("Stack has unexpected child element type")}),t},eo=Ua(function({active:t=0,children:o,className:n,enableAddTab:r,enableCloseTabs:i,getTabIcon:s=Za,getTabLabel:a=Ya,id:l,keyBoardActivation:c="manual",onMouseDown:p,onTabAdd:m,onTabClose:u,onTabEdit:f,onTabSelectionChanged:h,showTabs:g,style:y,TabstripProps:d},b){var I;let E=_a(l),R=M=>{h==null||h(M)},D=M=>{u==null||u(M)},x=()=>{m==null||m(ut.Children.count(o))},S=M=>{var W;let k=M.target.closest('[role^="tab"]');if((k==null?void 0:k.getAttribute("role"))==="tab"){let Re=parseInt((W=k.dataset.idx)!=null?W:"-1");if(Re===-1)throw Error("Stack: mousedown on tab with unknown index");p==null||p(M,Re)}},L=Xa((M,A,k,j)=>{f==null||f(j,A)},[f]),C=()=>{var M;return ut.isValidElement(o)?o:Array.isArray(o)&&(M=o[t])!=null?M:null},H=()=>Ja(o).map((M,A)=>{let k=`${E}-${A}`,{closeable:j,id:W}=M.props;return pt(Fa,{ariaControls:`${k}-tab`,"data-icon":s(M,A),draggable:!0,id:k,label:a(M,A),closeable:j,editable:(d==null?void 0:d.enableRenameTab)!==!1},W!=null?W:A)}),v=C();return ja("div",{className:Ga(cr,n,{[`${cr}-horizontal`]:(d==null?void 0:d.orientation)==="vertical"}),style:y,id:E,ref:b,children:[g?pt(Va,{className:"vuuTabHeader vuuHeader",orientation:d==null?void 0:d.orientation,children:pt(Wa,{disableFocusRing:!0,"data-collapsible":"dynamic","data-priority":"3",style:{alignSelf:"flex-end"},children:pt(Na,{...d,enableRenameTab:(d==null?void 0:d.enableRenameTab)!==!1,enableAddTab:r,enableCloseTab:i,keyBoardActivation:c,onActiveChange:R,onAddTab:x,onCloseTab:D,onExitEditMode:L,onMouseDown:S,activeTabIndex:(I=d==null?void 0:d.activeTabIndex)!=null?I:v===null?-1:t,children:H()})})}):null,v]})});eo.displayName="Stack";import{useIdMemo as Ka}from"@salt-ds/core";import qa,{useRef as Qa}from"react";import{jsx as to}from"react/jsx-runtime";var el=e=>to(ae,{resizeable:!0,title:`Tab ${e}`,style:{flexGrow:1,flexShrink:0,flexBasis:0},header:!0,closeable:!0,children:to(xt,{style:{flex:1}})}),pr=e=>{let t=Qa(null),o=X(),{loadState:n}=be(),{createNewChild:r=el,id:i,onTabSelectionChanged:s,path:a,...l}=e,{children:c}=e,p=Ka(i),[m]=lt(p,t,a);return to(eo,{...l,id:p,getTabLabel:(b,E)=>{let{id:R,title:D}=b.props;return n(R,"view-title")||D||`Tab ${E+1}`},onMouseDown:async(b,E)=>{let R;await m({type:"mousedown",index:E,preDragActivity:async()=>new Promise(S=>{console.log("preDragActivity: Ok, gonna release the drag"),R=S})},b)&&(R==null||R(void 0))},onTabAdd:(b,E=qa.Children.count(c))=>{if(a){console.log("[StackLayout] handleTabAdd");let R=r(E);console.log({component:R}),o({type:"add",path:a,component:R})}},onTabClose:b=>{if(Array.isArray(c)){let{props:{"data-path":E,path:R=E}}=c[b];o({type:"remove",path:R})}},onTabEdit:(b,E)=>{o({type:"set-title",path:`${a}.${b}`,title:E})},onTabSelectionChanged:b=>{console.log(`StackLayout handleTabSelection nextTab = ${b}`),a&&(o({type:"switch-tab",path:a,nextIdx:b}),s==null||s(b))},ref:t})};pr.displayName="Stack";z("Stack",pr,"container");import ur,{useState as mr}from"react";import{jsx as oo,jsxs as dr}from"react/jsx-runtime";var lg=({children:e})=>{let[o,n]=mr(e),[r,i]=mr(e),s=l=>{let c=xo(o,l);i(c)},a=(l,c)=>{console.log(`change ${l} -> ${c}`);let p=ur.cloneElement(r,{style:{...r.props.style,[l]:c}});i(p),n(ur.cloneElement(o,{},p))};return dr("div",{"data-design-mode":`${!1}`,children:[o,oo("br",{}),dr("div",{style:{display:"flex"},children:[oo(fr,{height:300,managedStyle:r.props.style,width:300,onChange:a,style:void 0}),oo(hr,{layout:o,onSelect:s,style:{width:300,height:300,backgroundColor:"#ccc"}})]})]})};import{FormField as mt,Input as dt}from"@heswell/salt-lab";import{jsx as O,jsxs as ro}from"react/jsx-runtime";var io={},tl={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"}},no=({feature:e,children:t,style:o,onChange:n})=>ro("div",{className:`LayoutBox layout-${e} layout-outer`,children:[ro("div",{className:"layout-top",children:[O("span",{className:"layout-title",children:e}),O(mt,{className:"layout-input",style:{width:30},children:O(dt,{value:o.top,onChange:(r,i)=>n(e,"top",i)})})]}),ro("div",{className:"layout-inner",children:[O("div",{className:"layout-left",children:O(mt,{className:"layout-input",style:{width:30},children:O(dt,{value:o.left,onChange:(r,i)=>n(e,"left",i)})})}),t,O("div",{className:"layout-right",children:O(mt,{className:"layout-input",style:{width:30},children:O(dt,{value:o.right,onChange:(r,i)=>n(e,"right",i)})})})]}),O("div",{className:"layout-bottom",children:O(mt,{className:"layout-input",style:{width:30},children:O(dt,{value:o.bottom,onChange:(r,i)=>n(e,"bottom",i)})})})]}),yg={margin:!0,marginTop:!0,marginRight:!0,marginBottom:!0,marginLeft:!0},bg={padding:!0,paddingTop:!0,paddingRight:!0,paddingBottom:!0,paddingLeft:!0},xg={border:!0,borderColor:!0,borderWidth:!0,borderTopWidth:!0,borderRightWidth:!0,borderBottomWidth:!0,borderLeftWidth:!0},ft="(\\d+)(?:px)?",ol=`^(?:${ft}(?:\\s${ft}(?:\\s${ft}(?:\\s${ft})?)?)?)$`,gr=new RegExp(ol),nl=/^(?:(\d+)(?:px)\ssolid\s([a-zA-Z,0-9().]+))$/,fr=({height:e,managedStyle:t,onChange:o,style:n,width:r})=>{let i=yr(t),s=(E,R,D)=>{let x=parseInt(D||"0",10),S=tl[E][R];o(S,x)},{marginTop:a=0,marginRight:l=0,marginBottom:c=0,marginLeft:p=0}=i,{borderTopWidth:m=0,borderRightWidth:u=0,borderBottomWidth:f=0,borderLeftWidth:h=0}=i,{paddingTop:g=0,paddingRight:y=0,paddingBottom:d=0,paddingLeft:b=0}=i;return O("div",{className:"LayoutConfigurator",style:{width:r,height:e,...n},children:O(no,{feature:"margin",style:{top:a,right:l,bottom:c,left:p},onChange:s,children:O(no,{feature:"border",style:{top:m,right:u,bottom:f,left:h},onChange:s,children:O(no,{feature:"padding",style:{top:g,right:y,bottom:d,left:b},onChange:s,children:O("div",{className:"layout-content"})})})})})};function Rg(e=io,t=io){let{margin:o,marginTop:n,marginRight:r,marginBottom:i,marginLeft:s,padding:a,paddingTop:l,paddingRight:c,paddingBottom:p,paddingLeft:m,...u}=e;if(typeof o=="number")u.marginTop=u.marginRight=u.marginBottom=u.marginLeft=o;else if(typeof o=="string"){let f=gr.exec(o);if(f===null)console.error(`Invalid css value for margin '${o}'`);else{let[,h,g,y,d]=f,b=h&&g&&y;b&&d?(u.marginTop=parseInt(h,10),u.marginRight=parseInt(g,10),u.marginBottom=parseInt(y,10),u.marginLeft=parseInt(d,10)):b?(u.marginTop=parseInt(h,10),u.marginRight=u.marginLeft=parseInt(g,10),u.marginBottom=parseInt(y,10)):h&&g?(u.marginTop=u.marginBottom=parseInt(h,10),u.marginRight=u.marginLeft=parseInt(g,10)):u.marginTop=u.marginRight=u.marginBottom=u.marginLeft=parseInt(h,10)}}if(typeof n=="number"&&(u.marginTop=n),typeof r=="number"&&(u.marginRight=r),typeof i=="number"&&(u.marginBottom=i),typeof s=="number"&&(u.marginLeft=s),typeof a=="number")u.paddingTop=u.paddingRight=u.paddingBottom=u.paddingLeft=a;else if(typeof a=="string"){let f=gr.exec(a);if(f===null)console.error(`Invalid css value for padding '${a}'`);else{let[,h,g,y,d]=f,b=h&&g&&y;b&&d?(u.paddingTop=parseInt(h,10),u.paddingRight=parseInt(g,10),u.paddingBottom=parseInt(y,10),u.paddingLeft=parseInt(d,10)):b?(u.paddingTop=parseInt(h,10),u.paddingRight=u.paddingLeft=parseInt(g,10),u.paddingBottom=parseInt(y,10)):h&&g?(u.paddingTop=u.paddingBottom=parseInt(h,10),u.paddingRight=u.paddingLeft=parseInt(g,10)):u.paddingTop=u.paddingRight=u.paddingBottom=u.paddinggLeft=parseInt(h,10)}}return typeof l=="number"&&(u.paddingTop=l),typeof c=="number"&&(u.paddingRight=c),typeof p=="number"&&(u.paddingBottom=p),typeof m=="number"&&(u.paddingLeft=m),yr(u,t)}function yr(e=io){let t={...e},o,{border:n,borderWidth:r,borderTopWidth:i,borderRightWidth:s,borderBottomWidth:a,borderLeftWidth:l,borderColor:c,margin:p,marginTop:m,marginRight:u,marginBottom:f,marginLeft:h,padding:g,paddingTop:y,paddingRight:d,paddingBottom:b,paddingLeft:E,...R}=t,D={},x={};if(typeof p=="number"&&(t.marginTop=t.marginRight=t.marginBottom=t.marginLeft=p,D={marginTop:p,marginRight:p,marginBottom:p,marginLeft:p}),typeof g=="number"&&(t.paddingTop=t.paddingRight=t.paddingBottom=t.paddingLeft=g,x={paddingTop:g,paddingRight:g,paddingBottom:g,paddingLeft:g}),n||r||i||s||a||l){typeof n=="string"&&(o=nl.exec(n))&&([,r,c]=o,r=parseInt(r,10)),r&&(i=i===void 0?r:i,s=s===void 0?r:s,a=a===void 0?r:a,l=l===void 0?r:l),c=c||"black";let S=`
|
|
17
|
+
`,document.body.insertBefore(t,e)}}var De=class{constructor(){this.currentPath=null;this.tabMode=null;di()}prepare(t,o="full-view"){document.body.classList.add("drawing"),this.currentPath=null,this.tabMode=o;let n=this.getPoints(0,0,0,0),r=Io(n),i=document.getElementById("vuu-drop-outline");i==null||i.setAttribute("d",r),this.currentPath=r}clear(){Te=null,We(),document.body.classList.remove("drawing"),Lt.hidePopup()}get hoverDropTarget(){return Te}getPoints(t,o,n,r,i=0,s=0,a=0){let l=this.tabMode==="tab-only";if(s===0)return[[t,o+a],[t,o+a],[t,o],[t+s,o],[t+s,o],[t+n,o],[t+n,o+r],[t,o+r]];if(l){let c=i;return[[c,o],[c,o],[c+s,o],[c+s,o],[c+s,o+a],[c+s,o+a],[c,o+a],[c,o+a]]}else return i===0?[[t,o+a],[t,o+a],[t,o],[t+s,o],[t+s,o+a],[t+n,o+a],[t+n,o+r],[t,o+r]]:[[t,o+a],[t+i,o+a],[t+i,o],[t+i,o],[t+i,o+a],[t+n,o+a],[t+n,o+r],[t,o+r]]}draw(t,o){let r=vt;if(Te!==null)this.drawTarget(Te);else if(vt=t.nextDropTarget!=null,t.pos.tab?fi(t):J&&We(),this.drawTarget(t,o),vt){let[i,s,a]=zo(t);{let l=hi(ko,{dropTarget:t,onHover:ci,orientation:a});Lt.showPopup({left:i,top:s,component:l})}}else Lt.hidePopup()}drawTarget(t,o){let r=t.getTargetDropOutline(6,o);if(r){let{l:i,t:s,r:a,b:l,tabLeft:c,tabWidth:p,tabHeight:m,guideLines:u}=r,f=a-i,h=l-s;if(this.currentPath){let E=document.getElementById("vuu-drop-outline");E==null||E.setAttribute("d",this.currentPath)}let g=this.getPoints(i,s,f,h,c,p,m),y=Io(g),d=document.getElementById("hw-drop-outline-animate");d==null||d.setAttribute("to",y),d==null||d.beginElement(),this.currentPath=y;let b=document.getElementById("hw-drop-guides");b==null||b.setAttribute("d",mi(u))}}},Bo="transition:margin-left .4s ease-out;margin-left: 63px",Oo="transition:margin-left .4s ease-out;margin-left: 0px";function fi(e){var a,l;let{AFTER:t,BEFORE:o}=Se,{clientRect:{Stack:n},pos:{tab:r}}=e,{id:i}=e.component.props,s=null;if(n&&r&&r.positionRelativeToTab!==t){let c=r.positionRelativeToTab===o?1:2,p=`:scope .hwTabstrip > .hwTabstrip-inner > .hwTab:nth-child(${r.index+c})`;s=(a=document.getElementById(i))==null?void 0:a.querySelector(p),s?(J===null||J!==s)&&(s.style.cssText=Bo,J&&(J.style.cssText=Oo),J=s):We()}else if((r==null?void 0:r.positionRelativeToTab)===o){if(J===null){let c=".vuuHeader-title";s=(l=document.getElementById(i))==null?void 0:l.querySelector(c),s.style.cssText=Bo,J=s}}else We()}function We(){J&&(J.style.cssText=Oo,J=null)}var ee,Pe,ie,$o,Fo,se,Ge,he=null,Ct,No,we,Vo,Mt,Ue=null,gi=3,Ze=new De,Ho=.4;function yi(e,t){return t?$(e,t):Q(e,o=>o.dropTarget)}var At={handleMousedown(e,t,o={}){ee=t,No=o,$o=e.clientX,Fo=e.clientY,Mt=o.dragThreshold===void 0?gi:o.dragThreshold,Mt===0?ee(e,0,0):(window.addEventListener("mousemove",Ye,!1),window.addEventListener("mouseup",Xe,!1),Ue=window.setTimeout(()=>{console.log("mousedownTimer fires"),window.removeEventListener("mousemove",Ye,!1),window.removeEventListener("mouseup",Xe,!1),ee==null||ee(e,0,0)},500)),e.preventDefault()},initDrag(e,t,{top:o,left:n,right:r,bottom:i},s,a,l,c){return{drag:Pe,drop:ie}=a,bi(e,t,{top:o,left:n,right:r,bottom:i},s,l,c)}};function Ye(e){let n=e.clientX-$o,r=e.clientY-Fo;Math.max(Math.abs(n),Math.abs(r))>Mt&&(window.removeEventListener("mousemove",Ye,!1),window.removeEventListener("mouseup",Xe,!1),ee==null||ee(e,n,r),ee=null)}function Xe(){Ue&&(window.clearTimeout(Ue),Ue=null),window.removeEventListener("mousemove",Ye,!1),window.removeEventListener("mouseup",Xe,!1)}function bi(e,t,o,n,r,i){se=yi(e,t);let{"data-path":s,path:a=s}=D(se);i&&(Ct=i.map(u=>Q(e,f=>f.id===u)).map(u=>u.props.path)),we=fe.measure(se,i),console.log({_measurements:we});let l=we[a];Ge=new _e(l,n.x,n.y,o,r);let c=Math.round(Ge.x.mousePct*100),p=Math.round(Ge.y.mousePct*100);return window.addEventListener("mousemove",_o,!1),window.addEventListener("mouseup",Wo,!1),Vo=!1,Ze.prepare(o,"tab-only"),No.DoNotTransform?"transform:none":`transform:scale(${Ho},${Ho});transform-origin:${c}% ${p}%;`}function _o(e){let t=e.clientX,o=e.clientY,n=Ge,r=he,i,s,a;n.update("x",t)&&(s=n.x.pos),n.update("y",o)&&(a=n.y.pos),s===void 0&&a===void 0||Pe==null||Pe(s,a),!(Vo||se===void 0)&&(n.inBounds()?i=Pt(t,o,se,we,n.hasIntrinsicSize(),Ct):i=Pt(n.dropX(),n.dropY(),se,we),r&&(i==null||i.box!==r.box)&&(he=null),i&&(Ze.draw(i,n),he=i))}function Wo(){xi()}function xi(){if(he){let e=Ze.hoverDropTarget||re.getActiveDropTarget(he);ie==null||ie(e),he=null}else ie==null||ie({component:se,pos:{position:N.Absolute}});Pe=null,ie=null,se=void 0,Ze.clear(),Ct=void 0,window.removeEventListener("mousemove",_o,!1),window.removeEventListener("mouseup",Wo,!1)}import Ri from"classnames";import{forwardRef as Ei}from"react";import{jsx as Si}from"react/jsx-runtime";var Go=Ei(function({children:t,className:o,dropTarget:n,resizeable:r,...i},s){let a=Ri("DraggableLayout",o);return Si("div",{className:a,ref:s,...i,children:t})}),Uo="DraggableLayout";Go.displayName=Uo;k(Uo,Go,"container");import{useForkRef as Ui}from"@salt-ds/core";import Zi from"classnames";import{forwardRef as Yi}from"react";import{getUniqueId as $i}from"@vuu-ui/vuu-utils";import Ae,{useCallback as Qe,useMemo as nn,useRef as et,useState as Fi}from"react";import Ti from"classnames";import{jsx as Di}from"react/jsx-runtime";var Zo="vuuPlaceholder",Je=({className:e,closeable:t,flexFill:o,resizeable:n,shim:r,...i})=>Di("div",{className:Ti(Zo,e,{[`${Zo}-shim`]:r}),...i,"data-placeholder":!0,"data-resizeable":!0});Je.displayName="Placeholder";k("Placeholder",Je);import Pi from"classnames";import wi,{useCallback as Le,useRef as je,useState as Li}from"react";import{jsx as Yo}from"react/jsx-runtime";var Xo=wi.memo(function({column:t,index:o,onDrag:n,onDragEnd:r,onDragStart:i,style:s}){let a=je(),l=je(null),c=je(0),[p,m]=Li(!1),u=Le(({key:x,shiftKey:S})=>{let L=S?10:1;t&&x==="ArrowDown"?n(o,L):t&&x==="ArrowUp"||!t&&x==="ArrowLeft"?n(o,-L):!t&&x==="ArrowRight"&&n(o,L)},[t,o,n]),f=Le(x=>{let{key:S}=x;(t&&(S==="ArrowUp"||S==="ArrowDown")||!t&&(S==="ArrowLeft"||S==="ArrowRIght"))&&(i(o),u(x),h.current=u)},[t,u,o,i]),h=je(f),g=x=>h.current(x),y=Le(x=>{a.current=!0;let S=x[t?"clientY":"clientX"],L=S-c.current;S&&S!==c.current&&n(o,L),c.current=S},[t,o,n]),d=Le(()=>{var x;window.removeEventListener("mousemove",y,!1),window.removeEventListener("mouseup",d,!1),r(),m(!1),(x=l.current)==null||x.focus()},[y,r,m]),b=Le(x=>{c.current=t?x.clientY:x.clientX,i(o),window.addEventListener("mousemove",y,!1),window.addEventListener("mouseup",d,!1),x.preventDefault(),m(!0)},[t,y,d,o,i,m]),E=()=>{var x;a.current?a.current=!1:(x=l.current)==null||x.focus()},R=()=>{h.current=f},T=Pi("Splitter","focusable",{active:p,column:t});return Yo("div",{className:T,"data-splitter":!0,ref:l,role:"separator",style:s,onBlur:R,onClick:E,onKeyDown:g,onMouseDown:b,tabIndex:0,children:Yo("div",{className:"grab-zone"})})});import{uuid as Jo}from"@vuu-ui/vuu-utils";import jo from"react";var vi={"data-placeholder":!0,"data-resizeable":!0},Ke={},ae="auto",zt={flexBasis:0,flexGrow:1,flexShrink:1,height:ae,width:ae},Ko={height:"width",width:"height"},qo=(e="row")=>e==="row"?["width","height","column"]:["height","width","row"],Mi=e=>typeof e=="string"&&e.endsWith("%"),U=e=>{let{style:{width:t=ae,height:o=ae}=Ke}=e.props,n=typeof o=="number",r=typeof t=="number";return n&&r?{height:o,width:t}:n?{height:o}:r?{width:t}:void 0};function kt(e,t,o){let n=Ko[t],{style:{[n]:r=ae,...i}=Ke}=e.props;return o&&o[t]?{...i,...zt,flexBasis:o[t],flexGrow:0,flexShrink:0}:{...i,...zt,[n]:r}}function Qo(e){let{style:{flex:t,flexGrow:o,flexShrink:n,flexBasis:r}=Ke}=e.props;return typeof t=="number"||r===0&&o===1&&n===1?!0:typeof r!="number"}function It(e,t,o){let n=Ko[t],{style:{[t]:r=ae,[n]:i=ae,...s}=Ke}=e.props;return r!==ae?Mi(r)?{flexBasis:0,flexGrow:1,flexShrink:1,[t]:void 0,[n]:i}:{flexBasis:r,flexGrow:0,flexShrink:0,[t]:r,[n]:i}:o&&o[t]?{...s,...zt,flexBasis:o[t],flexGrow:0,flexShrink:0}:{...s,[n]:i}}function ve(e,t,o,n,r){let i=[],s=0,a;if(n&&r){let p,[m,u,f,h]=r;[p,a]=t==="column"?[u-n.top,n.bottom-h]:[m-n.left,n.right-f],p&&i.push(K(`${o}.${s++}`,p,{flexGrow:0,flexShrink:0}))}else a=!0;let{version:l=0,style:c}=D(e);return i.push(B(e,`${o}.${s++}`,{version:l+1,style:{...c,flexBasis:"auto",flexGrow:0,flexShrink:0}})),a&&i.push(K(`${o}.${s++}`,0,void 0,{[`data-${t}-placeholder`]:!0})),Bt(t,{resizeable:!1,style:{flexBasis:"auto"}},i,o)}var Ci=(e,t)=>{if(!t)return e===0?1:0};function Bt(e,t,o,n){let r=Jo(),{flexFill:i,style:s,resizeable:a=!0}=t,{flexBasis:l=i?void 0:"auto"}=s,c=Ci(l,i);return jo.createElement(te.Flexbox,{id:r,key:r,path:n,flexFill:i,style:{...s,flexDirection:e,flexBasis:l,flexGrow:c,flexShrink:c},resizeable:a},o)}var Ai={flexGrow:1,flexShrink:1};function K(e,t,o,n){let r=Jo();return jo.createElement("div",{...vi,...n,"data-path":e,id:r,key:r,style:{...Ai,...o,flexBasis:t}})}var zi={},Me=1,Ce=2,ki=e=>typeof e.intrinsicSize=="number",Ii=(e,t)=>{let o={};return e.forEach(n=>{o[n]=P(t,n)}),o},qe=(e,t,o)=>e.map((n,r)=>{var l;let i=P(n,"resizeable"),{[t]:s}=(l=U(n))!=null?l:zi,a=Qo(n);return o?{index:r,flexOpen:a,intrinsicSize:s,resizeable:i,...Ii(o,n)}:{index:r,flexOpen:a,intrinsicSize:s,resizeable:i}}),en=e=>{let t=e.length,o=e.every(ki),n=Array(t).fill(0);if(o&&(n[0]=Ce,n[t-1]=Ce),t<2)return n;for(let r=0,i=0;r<t-1;r++)e[r].resizeable&&!i&&(i=Me),n[r]+=i;for(let r=t-1;r>0&&(n[r]&Me&&(n[r]-=Me),!e[r].resizeable);r--);return n},tn=(e,t)=>{let o=Oi(e,t),n=Hi(e,t),r=o!==-1&&n!==-1?[o,n]:void 0,i=Bi(e,r);return[r,i]};function Bi(e,t){if(t){let o=[];for(let n=0;n<e.length;n++)e[n].flexOpen&&!t.includes(n)&&o.push(n);return o}}function Oi(e,t){let o=t,n=!1;for(;o>=1&&!n;)o=o-1,n=on(e,o);return o}function Hi(e,t){let o=t,n=!1,r=e.length;for(;o<r-1&&!n;)o=o+1,n=on(e,o);return o===r?-1:o}function on(e,t){let{placeholder:o,splitter:n,resizeable:r,intrinsicSize:i}=e[t];return!!(!n&&!i&&(o||r))}var Ni=e=>!e.splitter&&!e.placeholder,sn=({children:e,onSplitterMoved:t,style:o})=>{let n=et(null),r=et(),i=et(),s=et([]),[,a]=Fi({}),l=y=>{i.current=y,a({})},c=(o==null?void 0:o.flexDirection)==="column",p=c?"height":"width",m=nn(()=>Array.isArray(e)?e:Ae.isValidElement(e)?[e]:[],[e]),u=Qe(y=>{let{current:d}=r;if(d){let[b,E]=tn(d,y);b&&(b.forEach(R=>{var x;let T=(x=n.current)==null?void 0:x.childNodes[R];if(T){let{size:S,minSize:L}=Gi(T,p);d[R].currentSize=S,d[R].minSize=L}}),E&&E.forEach(R=>{var x;let T=(x=n.current)==null?void 0:x.childNodes[R];if(T){let{[p]:S}=T.getBoundingClientRect();d[R].flexBasis=S}}))}},[p]),f=Qe((y,d)=>{i.current&&r.current&&l(_i(i.current,r.current,d,p))},[p]),h=Qe(()=>{let y=r.current;y&&(t==null||t(y.filter(Ni))),y==null||y.forEach(d=>{d.currentSize=void 0,d.flexBasis=void 0,d.flexOpen=!1})},[t]),g=Qe(y=>Ae.createElement(Xo,{column:c,index:y,key:`splitter-${y}`,onDrag:f,onDragEnd:h,onDragStart:u}),[f,h,u,c]);return nn(()=>{let[y,d]=Vi(m,p,g,s.current);r.current=d,i.current=y},[m,g,p]),{content:i.current||[],rootRef:n}};function Vi(e,t,o,n){let r=qe(e,t),i=en(r),s=[],a=[];for(let l=0;l<e.length;l++){let c=e[l];if(l===0&&i[l]&Ce&&(s.push(rn(l)),a.push({placeholder:!0,shim:!0})),c.key==null){let p=n[l]||(n[l]=$i());s.push(Ae.cloneElement(c,{key:p}))}else s.push(c);a.push(r[l]),l>0&&i[l]&Ce?(s.push(rn(l)),a.push({placeholder:!0})):i[l]&Me&&(s.push(o(s.length)),a.push({splitter:!0}))}return[s,a]}function _i(e,t,o,n){return Wi(t,o)?e.map((i,s)=>{let a=t[s],{currentSize:l,flexOpen:c,flexBasis:p}=a,m=l!==void 0;if(m||c){let{flexBasis:u}=i.props.style||{},f=m?a.currentSize:p;return f!==u?Ae.cloneElement(i,{style:{...i.props.style,flexBasis:f,[n]:"auto"}}):i}else return i}):e}function Wi(e,t){let o=[];e.forEach((p,m)=>{p.currentSize!==void 0&&o.push(m)});let n=t<0?o[0]:o[1],{currentSize:r=0,minSize:i=0}=e[n];if(r===i)return!1;if(Math.abs(t)>r-i){let p=t<0?-1:1;t=Math.max(0,r-i)*p}let s=e[o[0]],{currentSize:a=0}=s;s.currentSize=a+t;let l=e[o[1]],{currentSize:c=0}=l;return l.currentSize=c-t,!0}function rn(e){return Ae.createElement(Je,{shim:e===0,key:`placeholder-${e}`})}function Gi(e,t){let{[t]:o}=e.getBoundingClientRect(),r=getComputedStyle(e).getPropertyValue(`min-${t}`),i=r.endsWith("px")?parseInt(r,10):0;return{size:o,minSize:i}}import{jsx as Xi}from"react/jsx-runtime";var Ot="hwFlexbox",an=Yi(function(t,o){let{breakPoints:n,children:r,column:i,className:s,flexFill:a,gap:l,fullPage:c,id:p,onSplitterMoved:m,resizeable:u,row:f,spacing:h,splitterSize:g,style:y,...d}=t,{content:b,rootRef:E}=sn({children:r,onSplitterMoved:m,style:y}),R=Zi(Ot,s,{[`${Ot}-column`]:i,[`${Ot}-row`]:f,"flex-fill":a,"full-page":c});return Xi("div",{...d,className:R,"data-resizeable":u||void 0,id:p,ref:Ui(E,o),style:{...y,gap:l,"--spacing":h},children:b})});an.displayName="Flexbox";var Ht=an;import{useCallback as Bs}from"react";var ge={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"};import{useCallback as Zt,useContext as $n,useEffect as As,useRef as On,useState as zs}from"react";import Gt from"react";import{uuid as hn}from"@vuu-ui/vuu-utils";import Ie from"react";import{uuid as un}from"@vuu-ui/vuu-utils";import ze,{cloneElement as Ji}from"react";import{useCallback as ye}from"react";var V=new Map,Z=new Map,ln=e=>V.get(e),cn=e=>V.has(e),pn=(e,t)=>V.set(e,t),be=()=>{let e=ye((s,a)=>{let l=Z.get(s);if(l)return a!==void 0&&l[a]!==void 0?l[a]:a!==void 0?void 0:l},[]),t=ye((s,a,l)=>{if(a===void 0)Z.set(s,l);else if(Z.has(s)){let c=Z.get(s);Z.set(s,{...c,[a]:l})}else Z.set(s,{[a]:l})},[]),o=ye((s,a)=>{if(Z.has(s)){if(a===void 0)Z.delete(s);else if(Z.get(s)[a]){let{[a]:c,...p}=Z.get(s);Object.keys(p).length>0?Z.set(s,p):Z.delete(s)}}},[]),n=ye((s,a)=>{let l=V.get(s);if(l)return a!==void 0?l[a]:l},[]),r=ye((s,a,l)=>{if(a===void 0)V.set(s,l);else if(V.has(s)){let c=V.get(s);V.set(s,{...c,[a]:l})}else V.set(s,{[a]:l})},[]),i=ye((s,a)=>{if(V.has(s)){if(a===void 0)V.delete(s);else if(V.get(s)[a]){let{[a]:c,...p}=V.get(s);Object.keys(p).length>0?V.set(s,p):V.delete(s)}}},[]);return{loadSessionState:e,loadState:n,saveSessionState:t,saveState:r,purgeState:i,purgeSessionState:o}};var mn=e=>e.flexDirection==="column"?["height","width"]:["width","height"],ji={},ke=(e,t="0")=>{let[o,n]=Nt(w(e),e.props,t);return ze.cloneElement(e,o,n)},Ft=(e,t)=>{let o=w(e),[n,r]=Nt(o,e.props,"0",void 0,t);return Ji(e,n,r)};function Ki(e,t,o="0",n=null,r){var g,y;let{active:i=0,"data-path":s,path:a=s,id:l,style:c}=D(r),p=w(r)===e&&o===a,m=p?l:(g=t.id)!=null?g:un(),u=e==="Stack"?(y=t.active)!=null?y:i:void 0,f=m,h=p?c:Qi(e,t,n);return fo(e)?{id:m,key:f,path:o,style:h,type:e,active:u}:{id:m,key:f,style:h,"data-path":o}}function Nt(e,t,o,n=null,r){var c,p;let i=Ki(e,t,o,n,r);if(t.layout&&!r)return[i,[tt(t.layout,`${o}.0`)]];let s=(p=r==null?void 0:r.children)!=null?p:(c=r==null?void 0:r.props)==null?void 0:c.children,l=t.dropTarget&&s?s:qi(e,t.children,o,s);return[i,l]}function qi(e,t,o="0",n){let r=Array.isArray(t)?t:ze.isValidElement(t)?[t]:[];return F(e)?r.map((i,s)=>{let a=w(i),l=w(n==null?void 0:n[s]);if(!l||a===l){let[c,p]=Nt(a,i.props,`${o}.${s}`,e,n==null?void 0:n[s]);return ze.cloneElement(i,c,p)}return n==null?void 0:n[s]}):t}var Qi=(e,t,o)=>{let{style:n=ji}=t;if(e==="Flexbox"&&(n={flexDirection:t.column?"column":"row",...n,display:"flex"}),n.flex){let{flex:r,...i}=n;n={...i,...Rt(typeof r=="number"?r:0)}}else o==="Stack"?n={...n,...Rt(1)}:o==="Flexbox"&&(n.width||n.height)&&n.flexBasis===void 0&&(n={...n,flexBasis:"auto",flexGrow:0,flexShrink:0});return n};function tt({id:e=un(),type:t,children:o,props:n,state:r},i){let s=t.match(/^[a-z]/)?t:te[t];if(s===void 0)throw Error(`layoutUtils unable to create component from JSON, unknown type ${t}`);return r&&pn(e,r),ze.createElement(s,{id:e,...n,key:e,path:i},o?o.map((a,l)=>tt(a,`${i}.${l}`)):void 0)}function dn(e){return fn(e)}function fn(e){let t=w(e),{id:o,children:n,type:r,...i}=D(e),s=cn(o)?ln(o):void 0;return{id:o,type:t,props:es(i),state:s,children:ze.Children.map(n,fn)}}function es(e){if(e){let{path:t,...o}=e,n={};for(let[r,i]of Object.entries(o))n[r]=$t(i);return n}}function $t(e){if(typeof e=="string"||typeof e=="number"||typeof e=="boolean")return e;if(Array.isArray(e))return e.map($t);if(typeof e=="object"&&e!==null){let t={};for(let[o,n]of Object.entries(e))t[o]=$t(n);return t}}function gn(e,t){var s;let o=e.props.children,n=o.length,{index:r=-1,positionRelativeToTab:i="after"}=t.tab||{};return r===-1||r>=n?[o[n-1],"after"]:[(s=o[r])!=null?s:null,i]}function ot(e,t,o){let{active:n,children:r=[],path:i}=D(e),s=P(t,"path"),{idx:a,finalStep:l}=X(i,s,!0),[c,p]=l?ts(e,r,o):[n,r==null?void 0:r.map((u,f)=>f===a?ot(u,t,o):u)],m=w(e)==="Stack"?Array.isArray(c)?c[0]:c:n;return Ie.cloneElement(e,{active:m},p)}function ts(e,t,o){let n=P(e,"path"),r=t==null?void 0:t.length,{id:i=hn()}=D(o);return r?[r,t.concat(B(o,`${n}.${r}`,{id:i,key:i}))]:[0,[B(o,`${n}.0`,{id:i})]]}function nt(e,t,o,n,r,i,s){let{active:a,children:l,path:c}=D(e),p=P(t,"path"),{idx:m,finalStep:u}=X(c,p),[f,h]=u?os(e,l,m,o,n,r,i,s):[a,l.map((y,d)=>d===m?nt(y,t,o,n,r,i,s):y)],g=w(e)==="Stack"?f:a;return Ie.cloneElement(e,{active:g},h)}function os(e,t,o,n,r,i,s,a){let l=U(n);return l!=null&&l.width&&(l!=null&&l.height)?rs(e,t,o,n,r,s,a):yn(e,t,o,n,r,(i==null?void 0:i.width)||(i==null?void 0:i.height),s)}var ns=(e,t,{top:o,right:n,bottom:r,left:i},[s,a,l,c])=>{if(e==="column"&&t==="before")return a-o;if(e==="column")return r-c;if(e==="row"&&t==="before")return s-i;if(e==="row")return n-l};function rs(e,t,o,n,r,i,s){let{style:{flexDirection:a}}=D(e),[l,c,p]=qo(a),{[c]:m,[l]:u}=U(n),f=P(t[o],"path"),h=ns(a,r,i,s),[g,y]=m<i[c]?[ve(n,p,f,i,s),u]:[n,void 0],d=h?K(f,h,{flexGrow:0,flexShrink:0}):void 0;return m>i[c]&&(t=t.map(b=>{if(P(b,"placeholder"))return b;{let{[c]:E}=U(b);return E&&E<m?ve(b,p,P(b,"path")):b}})),yn(e,t,o,g,r,y,i,d)}function yn(e,t,o,n,r,i,s,a){let l=P(e,"path"),c=0,p=!t||t.length===0?[n]:t.reduce((m,u,f)=>{if(o===f){let[h,g]=is(e,u,n,s);r==="before"?a?m.push(a,g,h):m.push(g,h):a?m.push(h,g,a):m.push(h,g),c=m.indexOf(g)}else m.push(u);return m},[]).map((m,u)=>u<c?m:B(m,`${l}.${u}`));return[c,p]}function is(e,t,o,n){let r=hn(),{version:i=0}=D(o);if(i+=1,w(e)==="Flexbox"){let[s]=mn(e.props.style),a=6,l={[s]:(n[s]-a)/2},c=It(t,s,l),p=It(o,s,l);return[Ie.cloneElement(t,{style:c}),Ie.cloneElement(o,{id:r,version:i,style:p})]}else{let{style:{left:s,top:a,flex:l,...c}={left:void 0,top:void 0,flex:void 0}}=D(o);return[t,Ie.cloneElement(o,{id:r,version:i,style:c})]}}var _={ADD:"add",DRAG_START:"drag-start",DRAG_DROP:"drag-drop",LAYOUT_RESIZE:"layout-resize",MAXIMIZE:"maximize",MINIMIZE:"minimize",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"};import ue from"react";import rt from"react";function bn(e,{target:t,replacement:o}){return Vt(e,t,o)}function Vt(e,t,o){let n=P(t,"path"),r=P(t,"resizeable"),{style:i}=D(t),s=ke(rt.cloneElement(o,{resizeable:r,style:{...i,...o.props.style}}),n);return G(e,t,s)}function G(e,t,o,n){if(e===t)return o;let{idx:r,finalStep:i}=X(P(e,"path"),P(t,"path")),s=e.props.children.slice();return i?n?n===ge.MINIMIZE?s[r]=ss(e,s[r]):n===ge.RESTORE&&(s[r]=as(s[r])):s[r]=o:s[r]=G(s[r],t,o,n),rt.cloneElement(e,void 0,s)}function ss(e,t){let{style:o}=D(e),{style:n}=D(t),{width:r,height:i,flexBasis:s,flexShrink:a,flexGrow:l,...c}=n,p={width:r,height:i,flexBasis:s,flexShrink:a,flexGrow:l},m={...c,flexBasis:0,flexGrow:0,flexShrink:0},u=o.flexDirection==="row"?"vertical":o.flexDirection==="column"?"horizontal":!1;return u?rt.cloneElement(t,{collapsed:u,restoreStyle:p,style:m}):t}function as(e){let{style:t,restoreStyle:o}=D(e),{flexBasis:n,flexShrink:r,flexGrow:i,...s}=t,a={...s,...o};return rt.cloneElement(e,{collapsed:!1,style:a,restoreStyle:void 0})}function _t(e,{path:t}){let o=$(e,t),n=q(e,t);if(n===null)return e;let{children:r}=D(n);if(r.length>1&&Rn(r,t)){let{style:{flexBasis:i,display:s,flexDirection:a,...l}}=D(n),c=P(n,"path"),p=G(e,n,K(c,i,l));for(;(n=q(p,c))&&P(n,"path")!=="0";){let{children:m}=D(n);if(Rn(m)){c=P(n,"path");let{style:{flexBasis:u,display:f,flexDirection:h,...g}}=D(n);p=G(e,n,K(c,u,g))}else if(us(m))p=Tn(e,n);else break}return p}return En(e,o)}function En(e,t){let o=D(e),{children:n,path:r,preserve:i}=o,{active:s}=o,{idx:a,finalStep:l}=X(r,P(t,"path")),c=w(e),p=n.slice();if(l){if(p.splice(a,1),s!==void 0&&s>=a&&(s=Math.max(0,s-1)),p.length===1&&!i&&r!=="0"&&c.match(/Flexbox|Stack/))return ls(e,p[0]);!p.some(cs)&&p.some(Sn)&&(p=ps(p))}else p[a]=En(p[a],t);return p=p.map((m,u)=>B(m,`${r}.${u}`)),ue.cloneElement(e,{active:s},p)}function ls(e,t){let o=w(e),{path:n,style:{flexBasis:r,flexGrow:i,flexShrink:s,width:a,height:l}}=D(e),c=B(t,n);if(n==="0")c=ue.cloneElement(c,{style:{...t.props.style,width:a,height:l}});else if(o==="Flexbox"){let p=e.props.style.flexDirection==="column"?"height":"width",{style:{[p]:m,...u}}=c.props;c=ue.cloneElement(c,{flexFill:void 0,style:{...u,flexGrow:i,flexShrink:s,flexBasis:r,width:a,height:l}})}return c}var cs=e=>e.props.style.flexGrow>0,Sn=e=>{let{width:t,height:o,flexGrow:n}=e.props.style;return n===0&&typeof t!="number"&&typeof o!="number"},ps=e=>e.map(t=>Sn(t)?ue.cloneElement(t,{style:{...t.props.style,flexGrow:1}}):t),us=e=>{if(e&&e.length>0){let t=P(e[0],"placeholder"),o=!1;for(let n=1;n<e.length;n++){if(o=P(e[n],"placeholder"),t&&o)return!0;t=o}}},Tn=(e,t)=>{let{children:o,path:n}=D(e),{idx:r,finalStep:i}=X(n,P(t,"path")),s=o.slice();return i?s[r]=ms(t):s[r]=Tn(s[r],t),s=s.map((a,l)=>B(a,`${n}.${l}`)),ue.cloneElement(e,void 0,s)},ms=e=>{let{children:t}=D(e),o=[],n=[];for(let i=0;i<t.length;i++)P(t[i],"placeholder")?n.push(t[i]):(n.length===1?o.push(n.pop()):n.length>0&&(o.push(xn(n)),n.length=0),o.push(t[i]));n.length===1?o.push(n.pop()):n.length>0&&o.push(xn(n));let r=P(e,"path");return ue.cloneElement(e,void 0,o.map((i,s)=>B(i,`${r}.${s}`)))},xn=([e,...t])=>{let o=P(e,"style"),{flexBasis:n,flexGrow:r,flexShrink:i}=o;for(let{props:{style:s}}of t)n+=s.flexBasis,r=Math.max(r,s.flexGrow),i=Math.max(i,s.flexShrink);return ue.cloneElement(e,{style:{...o,flexBasis:n,flexGrow:r,flexShrink:i}})},Rn=(e,t)=>e.every(o=>P(o,"placeholder")||t&&P(o,"path")===t);import Wt from"react";function Dn(e,{path:t,size:o}){let n=$(e,t,!0),{style:r}=D(n),i={...r,width:o},s=Wt.cloneElement(n,{style:i});return G(e,n,s)}function Pn(e,{path:t,sizes:o}){let n=$(e,t,!0),{children:r,style:i}=D(n),s=i.flexDirection==="column"?"height":"width",a=ds(r,o,s),l=Wt.cloneElement(n,void 0,a);return G(e,n,l)}function ds(e,t,o){return e.map((n,r)=>{let{style:{[o]:i,flexBasis:s}}=D(n),a=t[r],{currentSize:l,flexBasis:c}=a,m=l!==void 0?a.currentSize:c;return m===void 0||i===m||s===m?n:Wt.cloneElement(n,{style:fs(n.props.style,o,m)})})}function fs(e,t,o){let n=typeof e[t]=="number",{flexShrink:r=1,flexGrow:i=1}=e;return{...e,[t]:n?o:"auto",flexBasis:n?"auto":o,flexShrink:r,flexGrow:i}}import{uuid as hs}from"@vuu-ui/vuu-utils";import it from"react";var wn=e=>{let[t]=w(e);return t===t.toLowerCase()};function Be(e,t,o,n,r,i){let{children:s,path:a}=D(e),l=P(t,"path"),{idx:c,finalStep:p}=X(a,l),m=p?gs(e,s,t,o,n,r,i):s.map((u,f)=>f===c?Be(u,t,o,n,r,i):u);return it.cloneElement(e,void 0,m)}function gs(e,t,o,n,r,i,s){let a=U(n);if(a!=null&&a.width&&(a!=null&&a.height)){if(i===void 0||s===void 0)throw Error("wrap-layout-element, updateChildren clientRect and dropRect must both be available");return bs(t,o,n,r,i,s)}return ys(e,t,o,n,r)}function ys(e,t,o,n,r){var x;let{version:i=0}=D(n),s=P(o,"path"),{type:a,flexDirection:l,showTabs:c}=vn(r),[p,m,u]=xs(a,o,n,l,r),f=Ln(r),h=f?1:0,g={resizeable:!0,style:u,version:i+1},d={[wn(o)?"data-resizeable":"resizeable"]:!0,style:m},b=a==="Stack"?{showTabs:c}:void 0,E=a==="Flexbox"?{splitterSize:(x=w(e)==="Flexbox"&&e.props.splitterSize)!=null?x:void 0}:void 0,R=hs(),T=it.createElement(te[a],{active:h,id:R,key:R,path:P(o,"path"),flexFill:P(o,"flexFill"),...E,...b,style:p,resizeable:P(o,"resizeable")},f?[B(o,`${s}.0`,d),ke(it.cloneElement(n,g),`${s}.1`)]:[ke(it.cloneElement(n,g),`${s}.0`),B(o,`${s}.1`,d)]);return t.map(S=>S===o?T:S)}function bs(e,t,o,n,r,i){let{flexDirection:s}=vn(n),a=s==="column"?"row":"column",l=Ln(n),[c,p,m,u]=i,[f,h]=s==="column"?[p-r.top,r.bottom-u]:[c-r.left,r.right-m],g=P(t,"path"),y=0,d=wn(t)?"data-resizeable":"resizeable",b=[];f&&b.push(l?B(t,`${g}.${y++}`,{[d]:!0,style:{flexBasis:f,flexGrow:1,flexShrink:1}}):K(`${g}.${y++}`,f,{flexGrow:0,flexShrink:0})),b.push(ve(o,a,`${g}.${y++}`,r,i)),h&&b.push(l?K(`${g}.${y++}`,0):B(t,`${g}.${y++}`,{[d]:!0,style:{flexBasis:0,flexGrow:1,flexShrink:1}}));let E=Bt(s,t.props,b,g);return e.map(R=>R===t?E:R)}function xs(e,t,o,n,r){let i={...t.props.style,flexDirection:n},s=e==="Flexbox"&&n==="column"?"height":"width",a=kt(o,s,r),l=kt(t,s);return[i,l,a]}var Ln=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 vn(e){return e.position.Header?{type:"Stack",flexDirection:"column",showTabs:!0}:{type:"Flexbox",flexDirection:e.position.EastOrWest?"row":"column"}}var kn=(e,t)=>{switch(t.type){case _.ADD:return Ds(e,t);case _.DRAG_DROP:return Ts(e,t);case _.MAXIMIZE:return Ss(e,t);case _.REMOVE:return _t(e,t);case _.REPLACE:return bn(e,t);case _.SET_PROP:return Mn(e,t);case _.SET_PROPS:return Es(e,t);case _.SET_TITLE:return Mn(e,{type:"set-prop",path:t.path,propName:"title",propValue:t.title});case _.SPLITTER_RESIZE:return Pn(e,t);case _.LAYOUT_RESIZE:return Dn(e,t);case _.SWITCH_TAB:return Rs(e,t);default:return e}},Rs=(e,{path:t,nextIdx:o})=>{let n=$(e,t,!0),r=Gt.cloneElement(n,{active:o});return G(e,n,r)},Mn=(e,{path:t,propName:o,propValue:n})=>{let r=$(e,t,!0),i=Gt.cloneElement(r,{[o]:n});return G(e,r,i)},Es=(e,{path:t,props:o})=>{let n=$(e,t,!0),r=Gt.cloneElement(n,o);return G(e,n,r)},Ss=(e,{path:t,type:o})=>{if(t){let n=$(e,t,!0);return G(e,n,n,o)}else return e},Ts=(e,t)=>{var h,g;let{draggedReactElement:o,dragInstructions:n,dropTarget:r}=t,i=r.component,{pos:s}=r,a=((h=s==null?void 0:s.position)==null?void 0:h.Header)&&w(i)==="Stack",{id:l,version:c}=D(o),p=U(o),m;if(a){let[y,d]=gn(i,s);y===void 0?m=ot(e,i,o):m=nt(e,y,o,d)}else!p&&((g=s==null?void 0:s.position)!=null&&g.Centre)?m=Vt(e,i,o):m=Ps(e,r,o);if(n.DoNotRemove)return m;let u=Q(m,y=>y.id===l&&y.version===c),f=P(u,"path");return _t(m,{path:f,type:"remove"})},Ds=(e,{path:t,component:o})=>ot(e,$(e,t),o),Ps=(e,t,o)=>{let{component:n,pos:r,clientRect:i,dropRect:s}=t,a=P(n,"path");if(a==="0.0")return Be(e,n,o,r);let l=q(e,a);if(Cn(r,l)){let c=r.position.SouthOrEast?"after":"before";return nt(e,n,o,c,r,i,s)}if(!Cn(r,l))return Be(e,n,o,r,i,s);if(F(w(l)))return Be(e,n,o,r);throw Error(`no support right now for position = ${r.position}`)},Cn=(e,t)=>e.position.Centre?zn(t)||An(t):e.position.NorthOrSouth?An(t):e.position.EastOrWest?zn(t):!1,An=e=>w(e)==="Flexbox"&&e.props.style.flexDirection==="column",zn=e=>w(e)==="Flexbox"&&e.props.style.flexDirection!=="column";import{createContext as ws}from"react";var Ls=e=>console.log(`dispatch ${e.type}, have you forgotten to provide a LayoutProvider ?`),Oe=ws({dispatchLayoutProvider:Ls,version:-1});import{useCallback as st,useRef as Ut}from"react";var vs={},In=[0,0],Ms=(e,t,o)=>{let n=document.createElement("div");n.className="vuuSimpleDraggableWrapper",n.classList.add("vuuSimpleDraggableWrapper","salt-theme","salt-density-medium"),n.dataset.dragging="true";let r=o!=null?o:document.createElement("div");r.id=t,n.appendChild(r),document.body.appendChild(n);let i=`top:${e.top}px;left:${e.left}px;width:${e.width}px;height:${e.height}px;`;return[n,i,e.left,e.top]},Cs=e=>{let{offsetParent:t}=e;if(t===null)return In;{let{left:o,top:n}=t.getBoundingClientRect();return[o,n]}},Bn=(e,t)=>{let o=Ut(),n=Ut(),r=Ut(),i=st((c,p)=>{if(n.current&&r.current){let{dragOffsets:[m,u],targetPosition:f}=n.current,h=typeof c=="number"?c-m:f.left,g=typeof p=="number"?p-u:f.top;(h!==f.left||g!==f.top)&&(n.current.targetPosition.left=h,n.current.targetPosition.top=g,r.current.style.top=g+"px",r.current.style.left=h+"px")}},[]),s=st(c=>{if(n.current){let{dragInstructions:p,payload:m,originalCSS:u}=n.current;t({type:"drag-drop",draggedReactElement:m,dragInstructions:p,dropTarget:c}),console.log("[useLayoutDragDrop]",{dragInstructions:p}),r.current&&(p.RemoveDraggableOnDragEnd?document.body.removeChild(r.current):(r.current.style.cssText=u,delete r.current.dataset.dragging)),o.current=void 0,n.current=void 0,r.current=void 0}},[t]),a=st(c=>{if(o.current){let{payload:p,dragContainerPath:m,dragElement:u,dragRect:f,instructions:h=vs,path:g}=o.current,{current:y}=e,d={x:c.clientX,y:c.clientY},b=p!=null?p:$(y,g,!0),{id:E}=b.props,R=U(b),T="",x="",S="",L=-1,C=-1,H=In,v=document.getElementById(E);if(v===null)[v,x,L,C]=Ms(f,E,u);else{H=Cs(v);let[I,M]=H,{width:A,height:z,left:j,top:W}=v.getBoundingClientRect();L=j-I,C=W-M,x=`width:${A}px;height:${z}px;left:${L}px;top:${C}px;z-index: 100;background-color:#ccc;opacity: 0.6;`,v.dataset.dragging="true",T=v.style.cssText}S=At.initDrag(e.current,m,f,d,{drag:i,drop:s},R),v.style.cssText=x+S,r.current=v,n.current={payload:b,originalCSS:T,dragRect:f,dragOffsets:H,dragInstructions:h,targetPosition:{left:L,top:C}}}},[i,s,e]);return st(c=>{let{evt:p,...m}=c;console.log("prepare to drag",{options:m}),o.current={...m,dragContainerPath:""},At.handleMousedown(p,a,m.instructions)},[a])};import{jsx as Fn}from"react/jsx-runtime";var Hn=e=>e.dropTarget,ks=e=>["drag-drop","remove","set-title","splitter-resize","switch-tab"].includes(e.type),Vm=()=>{let e=Is();return Fn("div",{children:`Context: ${e} `})},_m=e=>{let{children:t,layout:o,onLayoutChange:n}=e,r=On(void 0),i=On(t),[,s]=zs(null),a=Zt(m=>{if(n){let u=Q(m,Hn)||r.current,h=w(u)==="DraggableLayout"?D(u).children[0]:u,g=dn(h);n(g,"drag-root")}},[n]),l=Zt((m,u=!1)=>{let f=kn(r.current,m);f!==r.current&&(r.current=f,s({}),!u&&ks(m)&&a(f))},[a]),c=Zt(m=>{switch(m.type){case"drag-start":{p(m);break}case"save":{a(r.current);break}default:{l(m);break}}},[l,a]),p=Bn(r,c);return As(()=>{if(o){let m=Q(r.current,Hn),u=Ro(m),f=tt(o,`${m.props.path}.0`),h=u?{type:_.REPLACE,target:u,replacement:f}:{type:_.ADD,path:m.props.path,component:f};l(h,!0)}},[l,o]),r.current===void 0?r.current=Ft(t):t!==i.current&&(r.current=Ft(t,r.current),i.current=t),Fn(Oe.Provider,{value:{dispatchLayoutProvider:c,version:0},children:r.current})},Y=()=>{let{dispatchLayoutProvider:e}=$n(Oe);return e},Is=()=>{console.log({LayoutProviderContext:Oe});let{version:e}=$n(Oe);return e};import{jsx as Os}from"react/jsx-runtime";var Nn=function(t){let{path:o}=t,n=Y(),r=Bs(i=>{n({type:ge.SPLITTER_RESIZE,path:o,sizes:i})},[n,o]);return Os(Ht,{...t,onSplitterMoved:r})};Nn.displayName="Flexbox";k("Flexbox",Nn,"container");import{useForkRef as oa}from"@salt-ds/core";import na from"classnames";import{forwardRef as ra}from"react";import{useCallback as Zn,useEffect as _s,useRef as Jt,useState as Ws}from"react";import{useCallback as Hs,useLayoutEffect as Vn,useRef as $s}from"react";var nd=["height","width"],rd=["height"],id=["width"],me=new WeakMap,Wn=(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}},_n=new ResizeObserver(e=>{for(let t of e){let{target:o,contentRect:n}=t,r=me.get(o);if(r){let{onResize:i,measurements:s}=r,a=!1;for(let[l,c]of Object.entries(s)){let p=Wn(o,n,l);p!==c&&(a=!0,s[l]=p)}a&&i&&i(s)}}});function Gn(e,t,o,n=!1){let r=$s(t),i=Hs(s=>{let a=s.getBoundingClientRect();return r.current.reduce((l,c)=>(l[c]=Wn(s,a,c),l),{})},[]);Vn(()=>{let s=e.current,a=!1;async function l(){me.set(s,{measurements:{}}),a=!1;let{fonts:c}=document;if(c&&await c.ready,!a){let p=me.get(s);if(p){let m=i(s);p.measurements=m,_n.observe(s),n&&o(m)}}}if(s){if(me.has(s))throw Error("useResizeObserver attemping to observe same element twice");l()}return()=>{s&&me.has(s)&&(_n.unobserve(s),me.delete(s),a=!0)}},[e,i]),Vn(()=>{let s=e.current,a=me.get(s);if(a){if(r.current!==t){r.current=t;let l=i(s);a.measurements=l}a.onResize=o}},[t,i,e,o])}function Fs(e,t){let o=document.body.querySelector(`.${e}`),n={get:function(r,i){let s=r.getPropertyValue(`--${e}-breakpoint-${i}`);return s?parseInt(s):void 0}};return o?new Proxy(getComputedStyle(o),n):t!=null?t:{}}var Ns=([,e],[,t])=>t-e,Xt=e=>Object.entries(e).sort(Ns).map(([t,o],n,r)=>[t,o,n<r.length-1?r[n+1][1]:9999]),Yt=null,Vs=(e="salt")=>{let{xs:t,sm:o,md:n,lg:r,xl:i}=Fs(e);return Xt({xs:t,sm:o,md:n,lg:r,xl:i})},Un=e=>(Yt===null&&(Yt=Vs(e)),Yt);var Gs=[],Yn=({breakPoints:e,smallerThan:t},o)=>{let[n,r]=Ws(t?!1:"lg"),i=Jt(document.body),s=Jt(e?Xt(e):Un()),a=Jt("lg"),l=Zn(p=>{if(s.current){for(let[m,u]of s.current)if(p>=u)return m}},[s]),c=Zn(p=>{if(t){let m=s.current.find(([u])=>u===t);if(m){let[,,u]=m;return p<u}}else return l(p);return p},[t,l]);return Gn(o||i,s.current?["width"]:Gs,({width:p})=>{let m=c(p);m!==a.current&&(a.current=m,r(m))},!0),_s(()=>{let p=o||i;if(p.current){let m=a.current;if(s.current){let{clientWidth:u}=p.current,f=c(u);a.current=f,f!==m&&r(f)}}},[r,c,o]),n};var Xn="data-collapsible",Us={[Xn]:!0,"data-pad-start":!0,"data-pad-end":!0},Zs=e=>{var t;return(t=Us[e])!=null?t:!1},Ys=e=>e===Xn,Xs={dynamic:"dynamic",instant:"instant",true:"instant"},Js=e=>{var t;return(t=Xs[e])!=null?t:"none"},fd=e=>Object.keys(e).reduce((t,o)=>{let[n,r]=t;if(Zs(o)){let i=Ys(o)?Js(e[o]):e[o];n[o]=i,r[o]=void 0}return t},[{},{}]);import{getUniqueId as js}from"@vuu-ui/vuu-utils";import{cloneElement as Ks,isValidElement as qs,useCallback as Qs,useMemo as Jn,useRef as jt}from"react";var ea=["xs","sm","md","lg","xl"],ta=12,jn=({children:e,cols:t,style:o})=>{let n=jt(null),r=jt(null),i=jt(),s=t!=null?t:ta,l=(o==null?void 0:o.flexDirection)==="column"?"height":"width",c=Jn(()=>Array.isArray(e)?e:qs(e)?[e]:[],[e]),p=Qs((m,u)=>{let f=qe(m,u,ea),h=[],g=[];for(let y=0;y<m.length;y++){let d=m[y],{style:{flex:b,...E}}=d.props;h.push(Ks(d,{key:js(),style:{...E,"--parent-col-count":s}})),g.push(f[y])}return[h,g]},[s]);return Jn(()=>{let[m,u]=p(c,l);r.current=u,i.current=m},[p,c,l]),{cols:s,content:i.current,rootRef:n}};import{jsx as ia}from"react/jsx-runtime";var at="hwFluidGrid",Kt=ra(function(t,o){let{breakPoints:n,children:r,column:i,cols:s=12,className:a,flexFill:l,gap:c=3,fullPage:p,id:m,onSplitterMoved:u,resizeable:f,row:h,showGrid:g,spacing:y,splitterSize:d,style:b,...E}=t,{cols:R,content:T,rootRef:x}=jn({children:r,cols:s,style:b}),S=Yn({breakPoints:n},x),L=na(at,a,{[`${at}-column`]:i,[`${at}-row`]:h,[`${at}-show-grid`]:g,"flex-fill":l,"full-page":p}),C={...b,"--spacing":y,"--grid-col-count":R,"--grid-gap":c};return ia("div",{...E,className:L,"data-breakpoint":S,"data-cols":R,"data-resizeable":f||void 0,id:m,ref:oa(x,o),style:C,children:T})});Kt.displayName="FluidGrid";import{jsx as sa}from"react/jsx-runtime";var Kn=function(t){return sa(Kt,{...t})};Kn.displayName="FluidGrid";k("FluidGrid",Kn,"container");import Sa from"classnames";import lr,{useRef as Ta,useState as cr}from"react";import{useCallback as He,useState as aa}from"react";var lt=(e,t,o,n)=>{var y;let{loadSessionState:r,purgeSessionState:i,purgeState:s,saveSessionState:a}=be(),[l,c]=aa((y=r(e,"contributions"))!=null?y:[]),p=Y(),m=He((d,b)=>{let E=l.concat([{location:d,content:b}]);a(e,"contributions",E),c(E)},[l,e,a]),u=He(()=>{i(e,"contributions"),c([])},[e,i]),f=He(()=>{let d=r(e,"data-source");d&&d.unsubscribe(),i(e),s(e),p({type:"remove",path:o})},[p,e,r,i,s,o]),h=He(async(d,b,E)=>{var T;d.stopPropagation();let R=(T=t.current)==null?void 0:T.getBoundingClientRect();return new Promise((x,S)=>{p({type:"drag-start",evt:d,path:b===void 0?o:`${o}.${b}`,dragRect:R,preDragActivity:E,dropTargets:n,resolveDragStart:x,rejectDragStart:S})})},[t,p,o,n]);return[He(async(d,b)=>{var R;let{type:E}=d;switch(E){case"maximize":case"minimize":case"restore":return p({type:E,path:(R=d.path)!=null?R:o});case"remove":return f();case"mousedown":return h(b,d.index,d.preDragActivity);case"add-toolbar-contribution":return m(d.location,d.content);case"remove-toolbar-contribution":return u();default:return}},[p,o,f,h,m,u]),l]};import{useForkRef as da,useIdMemo as fa}from"@salt-ds/core";import ha from"classnames";import Qt,{forwardRef as ga,useCallback as ya,useMemo as ba,useRef as ir,useState as xa}from"react";import{useCallback as de,useMemo as qn}from"react";var Qn=({id:e,rootRef:t,path:o,dropTargets:n,title:r})=>{let i=Y(),{loadState:s,loadSessionState:a,purgeState:l,saveState:c,saveSessionState:p}=be(),[m,u]=lt(e,t,o,n),f=qn(()=>{var x;return(x=s("view-title"))!=null?x:r},[s,r]),h=de(x=>{o&&i({type:"set-title",path:o,title:x})},[i,o]),g=qn(()=>s(e),[e,s]),y=de(x=>s(e,x),[e,s]),d=de(x=>{l(e,x),i({type:"save"})},[e,i,l]),b=de((x,S)=>{c(e,S,x),i({type:"save"})},[e,i,c]),E=de(x=>a(e,x),[e,a]),R=de((x,S)=>p(e,S,x),[e,p]),T=de(({type:x,...S})=>{let{[x]:L}=S;b(L,x)},[b]);return{contributions:u,dispatchViewAction:m,load:y,loadSession:E,onConfigChange:T,onEditTitle:h,purge:d,restoredState:g,save:b,saveSession:R,title:f}};import{useResizeObserver as la,WidthHeight as ca}from"@heswell/salt-lab";import{useCallback as er,useRef as tr}from"react";var pa=[],or=({mainRef:e,resize:t="responsive",rootRef:o})=>{let n=t==="defer",r=tr({}),i=tr(),s=er(()=>{e.current&&(e.current.style.height=r.current.height+"px",e.current.style.width=r.current.width+"px"),i.current=void 0},[e]),a=er(({height:l,width:c})=>{r.current.height=l,r.current.width=c,i.current!==null&&clearTimeout(i.current),i.current=window.setTimeout(s,40)},[s]);la(o,n?ca:pa,a,n)};import ua,{useContext as nr}from"react";var ma={dispatch:null},ct=ua.createContext(ma),rr=()=>{var t;let e=nr(ct);return(t=e==null?void 0:e.dispatch)!=null?t:null},df=()=>nr(ct);import{jsx as qt,jsxs as Ea}from"react/jsx-runtime";var $e="vuuView",Ra=(e,t)=>e&&t?{...e,...t}:e||t,sr=ga(function(t,o){let{Header:n=ar,children:r,className:i,collapsed:s,closeable:a,"data-resizeable":l,dropTargets:c,expanded:p,flexFill:m,id:u,header:f,orientation:h="horizontal",path:g,resize:y="responsive",resizeable:d=l,tearOut:b,style:E={},title:R,...T}=t,x=fa(u),S=ir(null),L=ir(null),[C,H]=xa(),{contributions:v,dispatchViewAction:I,load:M,loadSession:A,onConfigChange:z,onEditTitle:j,purge:W,restoredState:Re,save:lo,saveSession:co,title:ht}=Qn({id:x,rootRef:S,path:g,dropTargets:c,title:R});or({mainRef:L,resize:y,rootRef:S});let po=ya(Lr=>{H(Lr)},[]),Dr=()=>Qt.isValidElement(r)&&(Re||C)?Qt.cloneElement(r,Ra(Re,C)):r,Pr=ba(()=>({dispatch:I,id:x,path:g,title:ht,load:M,loadSession:A,onConfigChange:z,purge:W,save:lo,saveSession:co,setComponentProps:po}),[I,x,M,A,z,g,W,lo,co,po,ht]),wr=typeof f=="object"?f:{};return qt("div",{...T,className:ha($e,i,{[`${$e}-collapsed`]:s,[`${$e}-expanded`]:p,[`${$e}-resize-defer`]:y==="defer"}),"data-resizeable":d,id:x,ref:da(o,S),style:E,tabIndex:-1,children:Ea(ct.Provider,{value:Pr,children:[f?qt(n,{...wr,collapsed:s,contributions:v,expanded:p,closeable:a,onEditTitle:j,orientation:h,tearOut:b,title:ht}):null,qt("div",{className:`${$e}-main`,ref:L,children:Dr()})]})})});sr.displayName="View";var le=Qt.memo(sr);le.displayName="View";k("View",le,"view");import{EditableLabel as Da,Toolbar as Pa,ToolbarButton as wa,ToolbarField as La,Tooltray as pr}from"@heswell/salt-lab";import{CloseIcon as va}from"@salt-ds/icons";import{jsx as xe,jsxs as Ma}from"react/jsx-runtime";var ar=({className:e,contributions:t,collapsed:o,closeable:n,onEditTitle:r,orientation:i="horizontal",style:s,title:a="Untitled"})=>{let l=Ta(null),[c,p]=cr(a),[m,u]=cr(!1),f=rr(),h=v=>f==null?void 0:f({type:"remove"},v),g="vuuHeader",y=()=>{var v;(v=l.current)==null||v.focus()},d=v=>{v.stopPropagation()},E=Sa(g,e,`${g}-${o||i}`),R=()=>{u(!0)},T=v=>{v.key==="Enter"&&u(!0)},x=(v="",I="",M=!0,A=!1)=>{var z;u(!1),A?p(v):I!==v&&(p(I),r==null||r(I)),M===!1&&((z=l.current)==null||z.focus())},S=v=>{f==null||f({type:"mousedown"},v)},L=[],C=[],H=[];return t==null||t.forEach((v,I)=>{switch(v.location){case"pre-title":L.push(lr.cloneElement(v.content,{key:I}));break;default:C.push(lr.cloneElement(v.content,{key:I}))}}),a&&L.push(xe(La,{className:"vuuHeader-title",children:xe(Da,{editing:m,value:c,onChange:p,onMouseDownCapture:y,onEnterEditMode:R,onExitEditMode:x,onKeyDown:T,ref:l,tabIndex:0},"title")},"title")),n&&H.push(Ma(wa,{onClick:h,onMouseDown:d,children:[xe(va,{})," Close"]},"close")),C.length>0&&L.push(xe(pr,{"data-align-end":!0,children:C},"contributions")),H.length>0&&L.push(xe(pr,{"data-align-end":!0,children:H},"actions")),xe(Pa,{className:E,orientation:i,style:s,onMouseDown:S,children:L})};import{uuid as Ca}from"@vuu-ui/vuu-utils";import{List as Aa,ListItem as za}from"@heswell/salt-lab";import ur from"classnames";import{cloneElement as ka,memo as Ia}from"react";import{jsx as eo}from"react/jsx-runtime";var Ba=e=>{let t=e.cloneNode(!0);return t.id="",delete t.dataset.idx,t},mr=Ia(({className:e,children:t,idx:o,resizeable:n,header:r,closeable:i,...s})=>eo(za,{className:ur("vuuPaletteItem",e),"data-draggable":!0,...s}));mr.displayName="PaletteItem";var Oa=({children:e,className:t,orientation:o="horizontal",ViewProps:n,...r})=>{let i=Y(),s="vuuPalette";function a(l){var S;let p=l.target.closest(".vuuPaletteItem"),m=parseInt((S=p.dataset.idx)!=null?S:"-1");m!==-1&&console.log({children:e,idx:m,listItemElement:p});let{props:{caption:u,children:f,template:h,...g}}=e[m],{height:y,left:d,top:b,width:E}=p.getBoundingClientRect(),R=Ca(),x=h?f:eo(le,{...n,...{id:R,key:R},...g,title:g.label,children:f});i({dragRect:{left:d,top:b,right:d+E,bottom:b+150,width:E,height:y},dragElement:Ba(p),evt:l.nativeEvent,instructions:{DoNotRemove:!0,DoNotTransform:!0,RemoveDraggableOnDragEnd:!0,dragThreshold:10},path:"*",payload:x,type:"drag-start"})}return eo(Aa,{...r,borderless:!0,className:ur(s,t,`${s}-${o}`),maxHeight:800,selected:null,children:e.map((l,c)=>l.type===mr?ka(l,{key:c,onMouseDown:a}):l)})};k("Palette",Oa,"view");import{uuid as Ha}from"@vuu-ui/vuu-utils";import{List as $a,ListItem as Fa}from"@heswell/salt-lab";import Na from"classnames";import{jsx as to}from"react/jsx-runtime";var Va="vuuPalette",Lh=e=>{let{children:t,ViewProps:o,label:n,onMouseDown:r,template:i,...s}=e,a=Y();return to(Fa,{onMouseDown:c=>{let{left:p,top:m,width:u}=c.currentTarget.getBoundingClientRect(),f=Ha(),g=i?t:to(le,{...{id:f,key:f},...o,title:e.label,children:t});a({type:"drag-start",evt:c.nativeEvent,path:"*",payload:g,instructions:{DoNotRemove:!0,DoNotTransform:!0,RemoveDraggableOnDragEnd:!0,dragThreshold:10},dragRect:{left:p,top:m,right:p+u,bottom:m+150,width:u,height:100}})},...s,children:n})},_a=({className:e,...t})=>to($a,{...t,className:Na(Va,e),height:"100%",selectionStrategy:"none"});k("PaletteSalt",_a,"view");import{Tab as Wa,Tabstrip as Ga,Toolbar as Ua,ToolbarField as Za}from"@heswell/salt-lab";import{useIdMemo as Ya}from"@salt-ds/core";import Xa from"classnames";import ut,{forwardRef as Ja,useCallback as ja}from"react";import{jsx as pt,jsxs as el}from"react/jsx-runtime";var dr="Tabs",Ka=()=>{},qa=(e,t)=>{var o,n;return(n=(o=e.props)==null?void 0:o.title)!=null?n:`Tab ${t+1}`},Qa=e=>{let t=[];return ut.Children.forEach(e,o=>{ut.isValidElement(o)?t.push(o):console.warn("Stack has unexpected child element type")}),t},oo=Ja(function({active:t=0,children:o,className:n,enableAddTab:r,enableCloseTabs:i,getTabIcon:s=Ka,getTabLabel:a=qa,id:l,keyBoardActivation:c="manual",onMouseDown:p,onTabAdd:m,onTabClose:u,onTabEdit:f,onTabSelectionChanged:h,showTabs:g,style:y,TabstripProps:d},b){var I;let E=Ya(l),R=M=>{h==null||h(M)},T=M=>{u==null||u(M)},x=()=>{m==null||m(ut.Children.count(o))},S=M=>{var W;let z=M.target.closest('[role^="tab"]');if((z==null?void 0:z.getAttribute("role"))==="tab"){let Re=parseInt((W=z.dataset.idx)!=null?W:"-1");if(Re===-1)throw Error("Stack: mousedown on tab with unknown index");p==null||p(M,Re)}},L=ja((M,A,z,j)=>{f==null||f(j,A)},[f]),C=()=>{var M;return ut.isValidElement(o)?o:Array.isArray(o)&&(M=o[t])!=null?M:null},H=()=>Qa(o).map((M,A)=>{let z=`${E}-${A}`,{closeable:j,id:W}=M.props;return pt(Wa,{ariaControls:`${z}-tab`,"data-icon":s(M,A),draggable:!0,id:z,label:a(M,A),closeable:j&&(d==null?void 0:d.enableCloseTab)!==!1,editable:(d==null?void 0:d.enableRenameTab)!==!1},W!=null?W:A)}),v=C();return el("div",{className:Xa(dr,n,{[`${dr}-horizontal`]:(d==null?void 0:d.orientation)==="vertical"}),style:y,id:E,ref:b,children:[g?pt(Ua,{className:"vuuTabHeader vuuHeader",orientation:d==null?void 0:d.orientation,children:pt(Za,{disableFocusRing:!0,"data-collapsible":"dynamic","data-priority":"3",style:{alignSelf:"flex-end"},children:pt(Ga,{...d,activeTabIndex:(I=d==null?void 0:d.activeTabIndex)!=null?I:v===null?-1:t,enableRenameTab:(d==null?void 0:d.enableRenameTab)!==!1,enableAddTab:r,enableCloseTab:i,keyBoardActivation:c,onActiveChange:R,onAddTab:x,onCloseTab:T,onExitEditMode:L,onMouseDown:S,children:H()})})}):null,v]})});oo.displayName="Stack";import{useIdMemo as tl}from"@salt-ds/core";import ol,{useRef as nl}from"react";import{jsx as no}from"react/jsx-runtime";var rl=e=>no(le,{resizeable:!0,title:`Tab ${e}`,style:{flexGrow:1,flexShrink:0,flexBasis:0},header:!0,closeable:!0,children:no(xt,{style:{flex:1}})}),fr=e=>{let t=nl(null),o=Y(),{loadState:n}=be(),{createNewChild:r=rl,id:i,onTabSelectionChanged:s,path:a,...l}=e,{children:c}=e,p=tl(i),[m]=lt(p,t,a);return no(oo,{...l,id:p,getTabLabel:(b,E)=>{let{id:R,title:T}=b.props;return n(R,"view-title")||T||`Tab ${E+1}`},onMouseDown:async(b,E)=>{let R;await m({type:"mousedown",index:E,preDragActivity:async()=>new Promise(S=>{console.log("preDragActivity: Ok, gonna release the drag"),R=S})},b)&&(R==null||R(void 0))},onTabAdd:(b,E=ol.Children.count(c))=>{if(a){console.log("[StackLayout] handleTabAdd");let R=r(E);console.log({component:R}),o({type:"add",path:a,component:R})}},onTabClose:b=>{if(Array.isArray(c)){let{props:{"data-path":E,path:R=E}}=c[b];o({type:"remove",path:R})}},onTabEdit:(b,E)=>{o({type:"set-title",path:`${a}.${b}`,title:E})},onTabSelectionChanged:b=>{console.log(`StackLayout handleTabSelection nextTab = ${b}`),a&&(o({type:"switch-tab",path:a,nextIdx:b}),s==null||s(b))},ref:t})};fr.displayName="Stack";k("Stack",fr,"container");import hr,{useState as gr}from"react";import{jsx as ro,jsxs as yr}from"react/jsx-runtime";var dg=({children:e})=>{let[o,n]=gr(e),[r,i]=gr(e),s=l=>{let c=So(o,l);i(c)},a=(l,c)=>{console.log(`change ${l} -> ${c}`);let p=hr.cloneElement(r,{style:{...r.props.style,[l]:c}});i(p),n(hr.cloneElement(o,{},p))};return yr("div",{"data-design-mode":`${!1}`,children:[o,ro("br",{}),yr("div",{style:{display:"flex"},children:[ro(br,{height:300,managedStyle:r.props.style,width:300,onChange:a,style:void 0}),ro(xr,{layout:o,onSelect:s,style:{width:300,height:300,backgroundColor:"#ccc"}})]})]})};import{FormField as mt,Input as dt}from"@heswell/salt-lab";import{jsx as O,jsxs as so}from"react/jsx-runtime";var ao={},il={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"}},io=({feature:e,children:t,style:o,onChange:n})=>so("div",{className:`LayoutBox layout-${e} layout-outer`,children:[so("div",{className:"layout-top",children:[O("span",{className:"layout-title",children:e}),O(mt,{className:"layout-input",style:{width:30},children:O(dt,{value:o.top,onChange:(r,i)=>n(e,"top",i)})})]}),so("div",{className:"layout-inner",children:[O("div",{className:"layout-left",children:O(mt,{className:"layout-input",style:{width:30},children:O(dt,{value:o.left,onChange:(r,i)=>n(e,"left",i)})})}),t,O("div",{className:"layout-right",children:O(mt,{className:"layout-input",style:{width:30},children:O(dt,{value:o.right,onChange:(r,i)=>n(e,"right",i)})})})]}),O("div",{className:"layout-bottom",children:O(mt,{className:"layout-input",style:{width:30},children:O(dt,{value:o.bottom,onChange:(r,i)=>n(e,"bottom",i)})})})]}),Sg={margin:!0,marginTop:!0,marginRight:!0,marginBottom:!0,marginLeft:!0},Tg={padding:!0,paddingTop:!0,paddingRight:!0,paddingBottom:!0,paddingLeft:!0},Dg={border:!0,borderColor:!0,borderWidth:!0,borderTopWidth:!0,borderRightWidth:!0,borderBottomWidth:!0,borderLeftWidth:!0},ft="(\\d+)(?:px)?",sl=`^(?:${ft}(?:\\s${ft}(?:\\s${ft}(?:\\s${ft})?)?)?)$`,Rr=new RegExp(sl),al=/^(?:(\d+)(?:px)\ssolid\s([a-zA-Z,0-9().]+))$/,br=({height:e,managedStyle:t,onChange:o,style:n,width:r})=>{let i=Er(t),s=(E,R,T)=>{let x=parseInt(T||"0",10),S=il[E][R];o(S,x)},{marginTop:a=0,marginRight:l=0,marginBottom:c=0,marginLeft:p=0}=i,{borderTopWidth:m=0,borderRightWidth:u=0,borderBottomWidth:f=0,borderLeftWidth:h=0}=i,{paddingTop:g=0,paddingRight:y=0,paddingBottom:d=0,paddingLeft:b=0}=i;return O("div",{className:"LayoutConfigurator",style:{width:r,height:e,...n},children:O(io,{feature:"margin",style:{top:a,right:l,bottom:c,left:p},onChange:s,children:O(io,{feature:"border",style:{top:m,right:u,bottom:f,left:h},onChange:s,children:O(io,{feature:"padding",style:{top:g,right:y,bottom:d,left:b},onChange:s,children:O("div",{className:"layout-content"})})})})})};function Pg(e=ao,t=ao){let{margin:o,marginTop:n,marginRight:r,marginBottom:i,marginLeft:s,padding:a,paddingTop:l,paddingRight:c,paddingBottom:p,paddingLeft:m,...u}=e;if(typeof o=="number")u.marginTop=u.marginRight=u.marginBottom=u.marginLeft=o;else if(typeof o=="string"){let f=Rr.exec(o);if(f===null)console.error(`Invalid css value for margin '${o}'`);else{let[,h,g,y,d]=f,b=h&&g&&y;b&&d?(u.marginTop=parseInt(h,10),u.marginRight=parseInt(g,10),u.marginBottom=parseInt(y,10),u.marginLeft=parseInt(d,10)):b?(u.marginTop=parseInt(h,10),u.marginRight=u.marginLeft=parseInt(g,10),u.marginBottom=parseInt(y,10)):h&&g?(u.marginTop=u.marginBottom=parseInt(h,10),u.marginRight=u.marginLeft=parseInt(g,10)):u.marginTop=u.marginRight=u.marginBottom=u.marginLeft=parseInt(h,10)}}if(typeof n=="number"&&(u.marginTop=n),typeof r=="number"&&(u.marginRight=r),typeof i=="number"&&(u.marginBottom=i),typeof s=="number"&&(u.marginLeft=s),typeof a=="number")u.paddingTop=u.paddingRight=u.paddingBottom=u.paddingLeft=a;else if(typeof a=="string"){let f=Rr.exec(a);if(f===null)console.error(`Invalid css value for padding '${a}'`);else{let[,h,g,y,d]=f,b=h&&g&&y;b&&d?(u.paddingTop=parseInt(h,10),u.paddingRight=parseInt(g,10),u.paddingBottom=parseInt(y,10),u.paddingLeft=parseInt(d,10)):b?(u.paddingTop=parseInt(h,10),u.paddingRight=u.paddingLeft=parseInt(g,10),u.paddingBottom=parseInt(y,10)):h&&g?(u.paddingTop=u.paddingBottom=parseInt(h,10),u.paddingRight=u.paddingLeft=parseInt(g,10)):u.paddingTop=u.paddingRight=u.paddingBottom=u.paddinggLeft=parseInt(h,10)}}return typeof l=="number"&&(u.paddingTop=l),typeof c=="number"&&(u.paddingRight=c),typeof p=="number"&&(u.paddingBottom=p),typeof m=="number"&&(u.paddingLeft=m),Er(u,t)}function Er(e=ao){let t={...e},o,{border:n,borderWidth:r,borderTopWidth:i,borderRightWidth:s,borderBottomWidth:a,borderLeftWidth:l,borderColor:c,margin:p,marginTop:m,marginRight:u,marginBottom:f,marginLeft:h,padding:g,paddingTop:y,paddingRight:d,paddingBottom:b,paddingLeft:E,...R}=t,T={},x={};if(typeof p=="number"&&(t.marginTop=t.marginRight=t.marginBottom=t.marginLeft=p,T={marginTop:p,marginRight:p,marginBottom:p,marginLeft:p}),typeof g=="number"&&(t.paddingTop=t.paddingRight=t.paddingBottom=t.paddingLeft=g,x={paddingTop:g,paddingRight:g,paddingBottom:g,paddingLeft:g}),n||r||i||s||a||l){typeof n=="string"&&(o=al.exec(n))&&([,r,c]=o,r=parseInt(r,10)),r&&(i=i===void 0?r:i,s=s===void 0?r:s,a=a===void 0?r:a,l=l===void 0?r:l),c=c||"black";let S=`
|
|
18
18
|
${c} ${l||0}px ${i||0}px 0 0 inset,
|
|
19
|
-
${c} ${-s||0}px ${-a||0}px 0 0 inset`;return{...R,...
|
|
19
|
+
${c} ${-s||0}px ${-a||0}px 0 0 inset`;return{...R,...T,...x,borderTopWidth:i,borderRightWidth:s,borderBottomWidth:a,borderLeftWidth:l,borderColor:c,borderStyle:"solid",boxShadow:S}}else return t}import ll from"react";import cl from"classnames";import{Tree as pl}from"@heswell/salt-lab";import{jsx as Sr}from"react/jsx-runtime";var ul="hwLayoutTreeViewer",Tr=(e,t="0")=>({label:w(e),path:t,childNodes:ll.Children.map(e.props.children,(o,n)=>Tr(o,t?`${t}.${n}`:`${n}`))}),xr=({layout:e,onSelect:t,style:o})=>{let n=[Tr(e)],r=(i,[{path:s}])=>{t(s)};return Sr("div",{className:cl(ul),style:o,children:Sr(pl,{source:n,groupSelection:"single",onSelectionChange:r})})};export{ge as Action,Dg as BORDER_STYLES,xt as Component,te as ComponentRegistry,dg as ConfigWrapper,Or as DockLayout,At as Draggable,Go as DraggableLayout,gt as Drawer,ko as DropMenu,re as DropTarget,Ht as Flexbox,Nn as FlexboxLayout,Kt as FluidGrid,Kn as FluidGridLayout,ar as Header,rd as HeightOnly,br as LayoutConfigurator,_m as LayoutProvider,Oe as LayoutProviderContext,Vm as LayoutProviderVersion,xr as LayoutTreeViewer,Sg as MARGIN_STYLES,Tg as PADDING_STYLES,Oa as Palette,mr as PaletteItem,Lh as PaletteListItem,_a as PaletteSalt,Je as Placeholder,oo as Stack,fr as StackLayout,le as View,ct as ViewContext,nd as WidthHeight,id as WidthOnly,Pg as XXXnormalizeStyles,zo as computeMenuPosition,Wr as containerOf,Rt as expandFlex,fd as extractResponsiveProps,Q as findTarget,$ as followPath,So as followPathToComponent,q as followPathToParent,Gr as getChild,Ro as getChildProp,ln as getPersistentState,P as getProp,D as getProps,cn as hasPersistentState,Pt as identifyDropTarget,F as isContainer,fo as isLayoutComponent,ml as isRegistered,Zs as isResponsiveAttribute,xc as isTabstrip,Zl as isTypeOf,vr as isView,Ql as nextLeaf,X as nextStep,ec as previousLeaf,k as registerComponent,B as resetPath,pn as setPersistentState,oc as setRef,w as typeOf,Yn as useBreakpoints,Y as useLayoutProviderDispatch,Is as useLayoutProviderVersion,be as usePersistentState,Gn as useResizeObserver,lt as useViewActionDispatcher,df as useViewContext,rr as useViewDispatch};
|
|
20
20
|
//# sourceMappingURL=index.js.map
|