@vuu-ui/vuu-shell 0.8.7 → 0.8.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cjs/index.js +4 -3
- package/cjs/index.js.map +4 -4
- package/esm/index.js +4 -3
- package/esm/index.js.map +4 -4
- package/index.css +1 -1
- package/index.css.map +3 -3
- package/package.json +6 -6
- package/types/vuu-shell/src/shell-layouts/context-panel/ContextPanel.d.ts +3 -2
- package/types/vuu-popups/src/dialog/Dialog.d.ts +0 -7
- package/types/vuu-popups/src/dialog/index.d.ts +0 -1
- package/types/vuu-popups/src/index.d.ts +0 -5
- package/types/vuu-popups/src/menu/ContextMenu.d.ts +0 -15
- package/types/vuu-popups/src/menu/MenuList.d.ts +0 -43
- package/types/vuu-popups/src/menu/context-menu-provider.d.ts +0 -10
- package/types/vuu-popups/src/menu/index.d.ts +0 -4
- package/types/vuu-popups/src/menu/key-code.d.ts +0 -12
- package/types/vuu-popups/src/menu/list-dom-utils.d.ts +0 -4
- package/types/vuu-popups/src/menu/use-cascade.d.ts +0 -25
- package/types/vuu-popups/src/menu/use-items-with-ids-next.d.ts +0 -13
- package/types/vuu-popups/src/menu/use-keyboard-navigation.d.ts +0 -26
- package/types/vuu-popups/src/menu/useContextMenu.d.ts +0 -13
- package/types/vuu-popups/src/menu/utils.d.ts +0 -2
- package/types/vuu-popups/src/popup/index.d.ts +0 -1
- package/types/vuu-popups/src/popup/popup-service.d.ts +0 -55
- package/types/vuu-popups/src/popup-menu/PopupMenu.d.ts +0 -14
- package/types/vuu-popups/src/popup-menu/index.d.ts +0 -1
- package/types/vuu-popups/src/portal/Portal.d.ts +0 -8
- package/types/vuu-popups/src/portal/index.d.ts +0 -3
- package/types/vuu-popups/src/portal/portal-utils.d.ts +0 -1
- package/types/vuu-popups/src/portal/render-portal.d.ts +0 -10
package/cjs/index.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
"use strict";var pa=Object.create;var Gt=Object.defineProperty;var fa=Object.getOwnPropertyDescriptor;var ga=Object.getOwnPropertyNames;var ha=Object.getPrototypeOf,ba=Object.prototype.hasOwnProperty;var ya=(e,t)=>{for(var o in t)Gt(e,o,{get:t[o],enumerable:!0})},tn=(e,t,o,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of ga(t))!ba.call(e,r)&&r!==o&&Gt(e,r,{get:()=>t[r],enumerable:!(n=fa(t,r))||n.enumerable});return e};var V=(e,t,o)=>(o=e!=null?pa(ha(e)):{},tn(t||!e||!e.__esModule?Gt(o,"default",{value:e,enumerable:!0}):o,e)),va=e=>tn(Gt({},"__esModule",{value:!0}),e);var vl={};ya(vl,{ConnectionStatusIcon:()=>Ta,ContextPanel:()=>Yo,DEFAULT_DENSITY:()=>Ls,DEFAULT_THEME:()=>Ds,DEFAULT_THEME_MODE:()=>ws,DensitySwitch:()=>Ca,Feature:()=>So,LeftNav:()=>nl,LoginPanel:()=>rl,SaveLayoutPanel:()=>Da,SessionEditingForm:()=>ll,Shell:()=>fl,ShellContextProvider:()=>bl,ThemeContext:()=>go,ThemeProvider:()=>ho,ThemeSwitch:()=>Jo,getAuthDetailsFromCookies:()=>sl,getAuthModeFromCookies:()=>Hs,logout:()=>qo,redirectToLogin:()=>Ps,useShellContext:()=>yl,useShellLayout:()=>jo,useThemeAttributes:()=>Ee});module.exports=va(vl);var mt=V(require("react")),on=V(require("classnames"));var qe=require("react/jsx-runtime"),Ta=({connectionStatus:e,className:t,element:o="span",...n})=>{let[r,a]=(0,mt.useState)("vuuConnectingStatus");(0,mt.useEffect)(()=>{switch(e){case"connected":case"reconnected":a("vuuActiveStatus");break;case"connecting":a("vuuConnectingStatus");break;case"disconnected":a("vuuDisconnectedStatus");break;default:break}},[e]);let l=mt.default.createElement(o,{...n,className:(0,on.default)("vuuStatus vuuIcon",r,t)});return(0,qe.jsx)(qe.Fragment,{children:(0,qe.jsxs)("div",{className:"vuuStatus-container salt-theme",children:[l,(0,qe.jsxs)("div",{className:"vuuStatus-text",children:["Status: ",e.toUpperCase()]})]})})};var nn=require("@salt-ds/lab"),rn=require("react"),sn=V(require("classnames")),an=require("react/jsx-runtime"),xa="vuuDensitySwitch",Ma=["high","medium","low","touch"],Ea="high",Ca=({className:e,defaultDensity:t=Ea,onChange:o})=>{let n=(0,rn.useCallback)((a,l)=>{o(l)},[o]),r=(0,sn.default)(xa,e);return(0,an.jsx)(nn.Dropdown,{className:r,source:Ma,defaultSelected:t,onSelectionChange:n})};var Oe=V(require("react")),mn=require("@vuu-ui/vuu-layout");var ln=V(require("react")),Ge=require("react/jsx-runtime"),Zt=class extends ln.default.Component{constructor(t){super(t),this.state={errorMessage:null}}static getDerivedStateFromError(t){return{errorMessage:t.message}}componentDidCatch(t,o){console.log(t,o)}render(){return this.state.errorMessage?(0,Ge.jsxs)(Ge.Fragment,{children:[(0,Ge.jsx)("h1",{children:"Something went wrong."}),(0,Ge.jsx)("p",{children:this.state.errorMessage})]}):this.props.children}};var un=require("react/jsx-runtime"),cn=()=>(0,un.jsx)("div",{className:"hwLoader",children:"loading"});var dn=async e=>{let t=new CSSStyleSheet;return fetch(e).then(o=>o.text()).then(o=>t.replace(o))};var Pt=require("react/jsx-runtime"),Jt=new Map,Sa=e=>((0,Oe.useEffect)(()=>()=>{Jt.delete(e)},[e]),Jt.has(e)||Jt.set(e,Oe.default.lazy(()=>import(e))),Jt.get(e));function La({url:e,css:t,params:o,...n}){console.log("Feature render",{css:t,url:e,props:n}),(0,Oe.useEffect)(()=>(console.log("%cFeature mount","color: green;"),()=>{console.log("%cFeature unmount","color:red;")}),[]),t&&dn(t).then(a=>{document.adoptedStyleSheets=[...document.adoptedStyleSheets,a]});let r=Sa(e);return(0,Pt.jsx)(Zt,{children:(0,Pt.jsx)(Oe.Suspense,{fallback:(0,Pt.jsx)(cn,{}),children:(0,Pt.jsx)(r,{...n,...o})})})}var So=Oe.default.memo(La);So.displayName="Feature";(0,mn.registerComponent)("Feature",So,"view");var pn=require("react/jsx-runtime"),Da=()=>(0,pn.jsx)("div",{className:"vuuSaveLayoutPanel",children:"save layout"});var fn=require("react"),j=require("react/jsx-runtime"),Lo=(0,fn.memo)(()=>(0,j.jsxs)("svg",{width:"44",height:"45",viewBox:"0 0 44 45",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[(0,j.jsxs)("g",{clipPath:"url(#clip0_217_6990)",children:[(0,j.jsx)("path",{d:"M39.8642 15.5509L35.9196 7.58974L34.3369 6.85464L24.6235 22.0825L39.1628 30.618L42.3152 25.6347L39.8642 15.5509Z",fill:"url(#paint0_linear_217_6990)"}),(0,j.jsx)("path",{d:"M42.6246 24.8716C41.9199 25.9157 40.9625 26.824 39.767 27.4905C38.424 28.2396 36.9563 28.597 35.5081 28.597C32.7541 28.597 30.0715 27.3094 28.4466 24.9855L15.772 3.90967L15.7655 3.9206C13.3615 0.137431 8.25372 -1.13143 4.24754 1.10507C0.178173 3.37435 -1.20852 8.39359 1.14854 12.3125L18.3445 40.9095C19.1108 42.1846 20.1816 43.1834 21.4144 43.8764C21.4241 43.8826 21.4338 43.8889 21.4435 43.8951C21.4484 43.8982 21.4549 43.9013 21.4597 43.9045C22.0332 44.2228 22.6423 44.471 23.2725 44.6536C23.3194 44.6677 23.368 44.6817 23.415 44.6942C23.6418 44.7551 23.8702 44.8097 24.1019 44.8534C24.1456 44.8612 24.1894 44.8659 24.2331 44.8737C24.4194 44.9049 24.6073 44.9314 24.7952 44.9501C24.8698 44.9579 24.9443 44.9658 25.0188 44.9704C25.2342 44.9876 25.4497 44.9985 25.6668 45.0001C25.6781 45.0001 25.6895 45.0001 25.6992 45.0001C25.7024 45.0001 25.704 45.0001 25.7073 45.0001C25.7105 45.0001 25.7121 45.0001 25.7154 45.0001C25.9503 45.0001 26.1868 44.9876 26.4217 44.9689C26.4751 44.9642 26.5286 44.9595 26.5837 44.9533C26.8137 44.9299 27.0438 44.9002 27.2738 44.8596C27.277 44.8596 27.2803 44.8596 27.2835 44.8596C27.5362 44.8144 27.7889 44.7551 28.0384 44.6864C28.0546 44.6817 28.0692 44.677 28.0854 44.6723C28.4483 44.5709 28.8063 44.4445 29.1594 44.2931C29.1659 44.29 29.174 44.2868 29.1805 44.2837C29.4494 44.1682 29.7151 44.0418 29.9759 43.8967C30.24 43.75 30.491 43.5908 30.7308 43.4206C30.9398 43.2739 31.1407 43.1179 31.3367 42.9524C31.5748 42.7495 31.8 42.5373 32.009 42.3141C32.1661 42.1471 32.3168 41.9723 32.4609 41.7913C32.5079 41.732 32.5517 41.6711 32.5954 41.6118C32.6942 41.4807 32.7882 41.3465 32.8789 41.2091C32.9259 41.1373 32.9728 41.0671 33.0182 40.9953C33.036 40.9672 33.0555 40.9407 33.0717 40.9126L42.7153 24.8763H42.6214L42.6246 24.8716Z",fill:"url(#paint1_linear_217_6990)"}),(0,j.jsx)("path",{d:"M42.8402 16.4218L42.1112 15.2232L38.9636 9.58433L37.504 7.19644C37.2286 6.56123 36.579 6.11331 35.8176 6.11331C34.8083 6.11331 33.9919 6.90147 33.9919 7.87223C33.9919 8.20154 34.0907 8.50432 34.2543 8.76808L34.2349 8.78056L39.9048 18.0808C40.5884 19.2186 40.7715 20.5437 40.4199 21.8141C40.0684 23.0845 39.226 24.1458 38.045 24.806C37.2675 25.2398 36.3846 25.4693 35.4936 25.4693C33.6727 25.4693 31.9766 24.5281 31.0662 23.0143L22.9161 9.63271H22.9323L19.4899 3.90958L19.4834 3.92051C19.4235 3.8253 19.3538 3.73947 19.2907 3.64738L19.1935 3.48663C19.1935 3.48663 19.1854 3.49131 19.1821 3.49443C17.5654 1.27666 14.9799 0.0390178 12.3118 0.00936427V0H7.91199V0.02185C10.9851 -0.184164 14.0582 1.23296 15.7656 3.92051L15.7721 3.90958L28.4451 24.987C30.0699 27.3093 32.7542 28.5985 35.5066 28.5985C36.9548 28.5985 38.4225 28.2426 39.7655 27.4919C40.961 26.8255 41.9168 25.9156 42.6231 24.8731H42.717L42.6846 24.9261C43.1366 24.2347 43.4833 23.4731 43.7068 22.6615C44.2916 20.5452 43.9871 18.3352 42.8369 16.4234L42.8402 16.4218Z",fill:"#F37880"}),(0,j.jsxs)("g",{opacity:"0.86",children:[(0,j.jsx)("path",{d:"M34.2332 8.78212L39.9031 18.0824C40.5868 19.2202 40.7698 20.5452 40.4183 21.8156C40.2044 22.5897 39.8059 23.2858 39.2616 23.8617C39.9744 23.2343 40.4879 22.4243 40.7423 21.5035C41.0938 20.2331 40.9107 18.908 40.2271 17.7703L34.5572 8.46998L34.5767 8.4575C34.413 8.19374 34.3142 7.89096 34.3142 7.56165C34.3142 7.15586 34.4584 6.78285 34.6982 6.48476C34.2672 6.80626 33.9902 7.30881 33.9902 7.87379C33.9902 8.2031 34.0891 8.50588 34.2527 8.76964L34.2332 8.78212Z",fill:"white"}),(0,j.jsx)("path",{d:"M42.6917 24.9169L42.6863 24.9256C42.6863 24.9256 42.6899 24.9187 42.6935 24.9152C42.6935 24.9152 42.6935 24.9152 42.6935 24.9169H42.6917Z",fill:"white"}),(0,j.jsx)("path",{d:"M40.0911 27.1798C38.7481 27.9289 37.2804 28.2863 35.8322 28.2863C33.0782 28.2863 30.3955 26.9988 28.7707 24.6749L16.0961 3.59744L16.0896 3.60837C14.9281 1.78077 13.1364 0.543128 11.1422 0H7.91199V0.02185C10.9851 -0.184164 14.0582 1.23296 15.7656 3.92051L15.7721 3.90958L28.4451 24.987C30.0699 27.3093 32.7542 28.5985 35.5066 28.5985C36.9548 28.5985 38.4225 28.2426 39.7655 27.4919C40.4815 27.0924 41.1084 26.6055 41.6511 26.0561C41.1862 26.479 40.6662 26.8583 40.0894 27.1798H40.0911Z",fill:"white"})]})]}),(0,j.jsxs)("defs",{children:[(0,j.jsxs)("linearGradient",{id:"paint0_linear_217_6990",x1:"24.6235",y1:"18.7363",x2:"42.3152",y2:"18.7363",gradientUnits:"userSpaceOnUse",children:[(0,j.jsx)("stop",{stopColor:"#4906A5"}),(0,j.jsx)("stop",{offset:"1",stopColor:"#D3423A"})]}),(0,j.jsxs)("linearGradient",{id:"paint1_linear_217_6990",x1:"-2.35794e-05",y1:"22.5009",x2:"42.7186",y2:"22.5009",gradientUnits:"userSpaceOnUse",children:[(0,j.jsx)("stop",{stopColor:"#7C06A5"}),(0,j.jsx)("stop",{offset:"1",stopColor:"#D3423A"})]}),(0,j.jsx)("clipPath",{id:"clip0_217_6990",children:(0,j.jsx)("rect",{width:"44",height:"45",fill:"white"})})]})]}));Lo.displayName="VuuLogo";var ot=require("@vuu-ui/vuu-layout");var pt=require("react"),Ha=require("react/jsx-runtime"),wa={isDragSource:!1,isDropTarget:!1,register:()=>{}},Ia=()=>console.log("have you forgotten to provide a DragDrop Provider ?"),Na=(0,pt.createContext)({registerDragDropParty:Ia});var gn=e=>{var r,a;let{dragSources:t,dropTargets:o,registerDragDropParty:n}=(0,pt.useContext)(Na);if(e){let l=(r=t==null?void 0:t.has(e))!=null?r:!1,u=(a=o==null?void 0:o.has(e))!=null?a:!1;return{isDragSource:l,isDropTarget:u,register:n}}else return wa};var ne=require("react");var be=require("react");var Pa=["left","right"],Ra=["top","bottom"],Xt=":not(.wrapped)",hn=':not([aria-hidden="true"])',bn=e=>{let t=e.cloneNode(!0);return t.removeAttribute("id"),t.dataset.index="-1",t},ka=(e,t="width",o=!1)=>{let n=t==="width"?"left":"top",{[t]:r,[n]:a}=e.getBoundingClientRect(),{padEnd:l=!1,padStart:u=!1}=e.dataset,c=getComputedStyle(e),[s,d]=t==="width"?Pa:Ra,m=u&&!o?0:parseInt(c.getPropertyValue(`margin-${s}`),10),i=l&&!o?0:parseInt(c.getPropertyValue(`margin-${d}`),10),g=r;if(parseInt(c.getPropertyValue("flex-shrink"),10)>0){let p=parseInt(c.getPropertyValue("flex-basis"),10);!isNaN(p)&&p>0&&(g=p)}return[a,m+g+i]},Oa={horizontal:{CLIENT_POS:"clientX",CLIENT_SIZE:"clientWidth",CONTRA:"top",CONTRA_CLIENT_POS:"clientY",CONTRA_END:"bottom",CONTRA_POS:"y",DIMENSION:"width",END:"right",POS:"x",SCROLL_POS:"scrollLeft",SCROLL_SIZE:"scrollWidth",START:"left"},vertical:{CLIENT_POS:"clientY",CLIENT_SIZE:"clientHeight",CONTRA:"left",CONTRA_CLIENT_POS:"clientX",CONTRA_END:"right",CONTRA_POS:"x",DIMENSION:"height",END:"bottom",POS:"y",SCROLL_POS:"scrollTop",SCROLL_SIZE:"scrollHeight",START:"top"}},me=e=>Oa[e],yn=(e,t)=>{let o=e.find(n=>n.id===t);if(o)return o},vn=(e,t)=>{e.splice(t,1);for(let o=t;o<e.length;o++)e[o].currentIndex-=1},ft=(e,t,o,n,r)=>{var m;let a=[],{DIMENSION:l}=me(t),u=Array.from(o?e.querySelectorAll(o):e.children),c=u.length,s=typeof(n==null?void 0:n.from)=="number"?n.atEnd?Math.max(0,n.from-1):n.from:0,d=typeof(n==null?void 0:n.to)=="number"?Math.min(n.to+2,c-1):c-1;for(let i=s;i<=d;i++){let g=u[i],[f,p]=ka(g,l),h=i===c-1,C=g.id,S=parseInt((m=g.dataset.index)!=null?m:"-1");a.push({currentIndex:i,dataIndex:isNaN(S)?-1:S,id:C,index:i,isDraggedItem:r===C,isLast:h,isOverflowIndicator:g.dataset.index==="overflow",element:g,start:f,end:f+p,size:p,mid:f+p/2})}return a},Rt=e=>e.findIndex(t=>t.isDraggedItem),Do=(e,t)=>{let o=Rt(e),n=t==="fwd"?o+1:o-1;if(n<0||n>=e.length)throw Error("switchDropTargetPosition index out of range");let r=e.at(o),a=e.at(n),l=a.size-r.size;if(t==="fwd"){let u=a.start+l,c=a.end,s={...r,start:u,mid:Math.floor(u+(c-u)/2),end:c},d=r.start,m=r.end+l,i={...a,start:d,mid:Math.floor(d+(m-d)/2),end:m};e.splice(o,2,i,s)}else{let u=a.start,c=a.end-l,s={...r,start:u,mid:Math.floor(u+(c-u)/2),end:c},d=r.start-l,m=r.end,i={...a,start:d,mid:Math.floor(d+(m-d)/2),end:m};e.splice(n,2,s,i)}},gt=(e,t,o)=>{let n=e.length,r=Rt(e),a=e[r];if(o==="fwd"){let l=Math.round(t+a.size);for(let u=n-1;u>=0;u--){let c=e[u];if(l>c.mid)return u<r?a:c}}else{let l=Math.round(t);for(let u=0;u<n;u++){let c=e[u];if(l<c.mid)return u>r?a:c}}throw Error("no dropTraget identified")};function Tn(e,t){let{height:o,left:n,top:r,width:a}=e,{height:l,width:u}=t;return{height:Math.min(o,l),left:n,top:r,width:Math.min(a,u)}}var dr=require("@salt-ds/core");function xn(e){var t,o,n="";if(typeof e=="string"||typeof e=="number")n+=e;else if(typeof e=="object")if(Array.isArray(e))for(t=0;t<e.length;t++)e[t]&&(o=xn(e[t]))&&(n&&(n+=" "),n+=o);else for(t in e)e[t]&&(n&&(n+=" "),n+=t);return n}function Yt(){for(var e,t,o=0,n="";o<arguments.length;)(e=arguments[o++])&&(t=xn(e))&&(n&&(n+=" "),n+=t);return n}var ro=require("react");var Fa=require("@salt-ds/lab"),Dn=require("@salt-ds/core"),Ka=V(require("classnames")),wo=require("react");var kt=require("react"),Sn=V(require("react-dom"));var Mn=V(require("react-dom")),En=V(require("classnames")),Aa=1,$a=({className:e,dataMode:t,x:o=0,y:n=0,win:r=window})=>{let a=r.document.createElement("div");return a.className=(0,En.default)(`vuuPopup ${Aa++}`,e),a.style.cssText=`left:${o}px; top:${n}px;`,t&&(a.dataset.mode=t),r.document.body.appendChild(a),a},Cn=e=>$a(e),jt=(e,t,o,n,r)=>{t.style.cssText=`left:${o}px; top:${n}px;position: absolute;`,Mn.render(e,t,r)};var Ln=V(require("classnames")),Ot=function({children:t,x:o=0,y:n=0,onRender:r}){let[a,l,u]=Ee(),c=(0,kt.useMemo)(()=>Cn({className:(0,Ln.default)(a,l),dataMode:u}),[u,l,a]);return(0,kt.useLayoutEffect)(()=>{jt(t,c,o,n,r)},[t,r,c,o,n]),(0,kt.useLayoutEffect)(()=>()=>{var s;c&&(Sn.unmountComponentAtNode(c),c.classList.contains("vuuPopup")&&((s=c.parentElement)==null||s.removeChild(c)))},[c]),null};var wn=require("react/jsx-runtime");var Je=require("react");var Se=V(require("react")),Ho=V(require("classnames")),Fn=require("@vuu-ui/vuu-layout");var ue=require("react");var In=e=>e.closest("[data-root='true']")!==null,Nn=(e,t)=>{var o;return e.ariaHasPopup==="true"&&((o=e.dataset)==null?void 0:o.idx)===`${t}`||e.querySelector(`:scope > [data-idx='${t}'][aria-haspopup='true']`)!==null};function Ba(e,...t){let o=new Set(e);for(let n of t)for(let r of n)o.add(r);return o}var Va="Enter";var Ua="Delete",za=new Set([Va,Ua]),_a=new Set(["Tab"]),Wa=new Set(["ArrowRight","ArrowLeft"]),Hn=new Set(["Home","End","ArrowDown","ArrowUp"]),Pn=new Set(["Home","End","ArrowRight","ArrowLeft"]),qa=new Set(["F1","F2","F3","F4","F5","F6","F7","F8","F9","F10","F11","F12"]),vc=Ba(za,Pn,Hn,Wa,qa,_a);var Rn=({key:e},t="vertical")=>(t==="vertical"?Hn:Pn).has(e);var kn=({autoHighlightFirstItem:e=!1,count:t,highlightedIndex:o,onActivate:n,onHighlight:r,onCloseMenu:a,onOpenMenu:l})=>{let u=(0,ue.useRef)((o!=null?o:e)?0:-1),[,c]=(0,ue.useState)(null),s=o!==void 0,d=(0,ue.useCallback)(T=>{u.current=T,r==null||r(T),c({})},[r]),m=(0,ue.useCallback)(T=>{T!==u.current&&(s||d(T))},[s,d]),i=(0,ue.useRef)(!0),g=(0,ue.useRef)(!1),f=T=>g.current=T,p=s?o:u.current,h=(0,ue.useCallback)(T=>{let b=Ga(t,T.key,u.current);b!==u.current&&m(b)},[t,m]),C=(0,ue.useCallback)(T=>{if(Rn(T))T.preventDefault(),T.stopPropagation(),i.current=!0,h(T);else if((T.key==="ArrowRight"||T.key==="Enter")&&Nn(T.target,p)){let w=T.target.querySelector(`:scope > [data-idx='${p}']`);w&&(l==null||l(w))}else T.key==="ArrowLeft"&&!In(T.target)?a(p):T.key==="Enter"?n&&n(p):T.key==="Tab"&&a(-1)},[p,h,n,a,l]),S=(0,ue.useMemo)(()=>({onFocus:()=>{p===-1&&d(0)},onKeyDown:C,onMouseDownCapture:()=>{i.current=!1,f(!0)},onMouseMove:()=>{i.current&&(i.current=!1)},onMouseLeave:()=>{i.current=!0,f(!1),m(-1)}}),[C,p,d,m]);return{focusVisible:i.current?p:-1,controlledHighlighting:s,highlightedIndex:p,setHighlightedIndex:m,listProps:S,setIgnoreFocus:f}};function Ga(e,t,o){return t==="ArrowUp"?o>0?o-1:o:o===null?0:o===e-1?o:o+1}var Ze=V(require("react"));var Io=e=>e.type===Qt||!!e.props["data-group"],Za=e=>{if(Array.isArray(e)&&No(e[0]))return e[0]},Ja=(e,t,o,n=!1)=>{let{props:{children:r}}=e;return{childWithId:Ze.default.cloneElement(e,{hasSeparator:n,id:`${t}`,key:t,children:o?Za(r):r}),grandChildren:o?r:void 0}},On=(e,t)=>{let o=(0,Ze.useCallback)(()=>{let a=(l,u=t,c={},s={})=>{let d=c[u]=[],m=0,i=!1;return Ze.default.Children.forEach(l,g=>{if(!No(g))if(g.type===An)i=!0;else{let f=Io(g),p=`${u}-${m}`,{props:{action:h,options:C}}=g,{childWithId:S,grandChildren:T}=Ja(g,p,f,i);d.push(S),T?a(T,p,c,s):s[p]={action:h,options:C},m+=1,i=!1}}),[c,s]};return a(e)},[t,e]),[n,r]=(0,Ze.useMemo)(()=>o(),[o]);return[n,r]};var Ce=require("react/jsx-runtime"),$n="vuuMenuList",An=()=>(0,Ce.jsx)("li",{className:"vuuMenuItem-divider"}),Qt=()=>null,eo=({children:e,idx:t,...o})=>(0,Ce.jsx)("div",{...o,children:e}),Kn=({children:e})=>(0,Ce.jsx)(Ce.Fragment,{children:e});Kn.displayName="MenuItemLabel";eo.Label=Kn;var Xa=e=>Se.default.isValidElement(e)&&typeof e.type!="string"&&"displayName"in e.type?e.type.displayName:void 0,No=e=>Xa(e)==="MenuItemLabel",Ya=e=>e.props["data-icon"],Bn=({activatedByKeyboard:e,childMenuShowing:t,children:o,className:n,highlightedIdx:r,id:a,isRoot:l,listItemProps:u,onHighlightMenuItem:c,onActivate:s,onCloseMenu:d,onOpenMenu:m,...i})=>{let g=(0,Fn.useId)(a),f=(0,Se.useRef)(null),p=(0,Se.useMemo)(()=>new Map,[]),h=x=>{var v;let E=(v=f.current)==null?void 0:v.querySelector(`:scope > [data-idx='${x}']`);E!=null&&E.id&&(s==null||s(E.id))},{focusVisible:C,highlightedIndex:S,listProps:T}=kn({count:Se.default.Children.count(o),highlightedIndex:r,onActivate:h,onHighlight:c,onOpenMenu:m,onCloseMenu:d}),b=t==null?C:-1;(0,Se.useLayoutEffect)(()=>{var x;t===void 0&&e&&((x=f.current)==null||x.focus())},[e,t]);let w=()=>S===void 0||S===-1?void 0:p.get(S);function M(){let x={...u,role:"menuitem"},E=(k,y,L)=>y?[(0,Ce.jsx)("span",{className:"vuuIconContainer","data-icon":L},"icon")].concat(k):k;function v(k,y,L,I){var Y;let{children:P,className:N,"data-icon":R,id:H,hasSeparator:$,label:O,...K}=y.props,z=Io(y),G=z&&t===H,_=G?`${g}-${H}`:void 0;k.push((0,Ce.jsx)(eo,{...K,...x,...ja(H,L,(Y=y.key)!=null?Y:H,S,b,N,$),"aria-controls":_,"aria-haspopup":z||void 0,"aria-expanded":G||void 0,children:E(z&&O!=null?O:P,I,R)}))}let D=[];if(o.length>0){let k=o.some(Ya);o.forEach((y,L)=>{v(D,y,L,k)})}return D}return(0,Ce.jsx)("div",{...i,...T,"aria-activedescendant":w(),className:(0,Ho.default)($n,n,{[`${$n}-childMenuShowing`]:t!==void 0}),"data-root":l||void 0,id:g,ref:f,role:"menu",children:M()})},ja=(e,t,o,n,r,a,l)=>({id:`menuitem-${e}`,key:o!=null?o:t,"data-idx":t,"data-highlighted":t===n||void 0,className:(0,Ho.default)("vuuMenuItem",a,{"vuuMenuItem-separator":l,focusVisible:r===t})});Bn.displayName="MenuList";var Vn=Bn;var X=require("react");var Po=e=>e==null?void 0:e.closest("[data-idx],[aria-posinset]");var zn=(e,t,o)=>e.map((n,r)=>r===e.length-1?{...n,[o]:n[o]-t}:n),Qa=(e,t)=>zn(e,t,"left"),ei=(e,t)=>zn(e,t,"top"),ti=(e,t)=>{let[o,n]=t.slice(-2),r=document.getElementById(`${e}-${n.id}`);if(r===null)throw Error(`useCascade.flipSides element with id ${n.id} not found`);let{width:a}=r.getBoundingClientRect();return t.map(l=>l===n?{...l,left:o.left-(a-2)}:l)},oi=(e,t)=>{let[{left:o,top:n}]=t.slice(-1),{offsetWidth:r,offsetTop:a}=e;return{left:o+r,top:a+n}},_n=(e,t)=>{let o=e.lastIndexOf("-");return o>-1?e.slice(9,o):t},ni=e=>e.slice(9),Un=({ariaExpanded:e,ariaHasPopup:t,id:o},n)=>{if(o.startsWith("menuitem"))return{hostMenuId:_n(o,n),targetMenuId:ni(o),menuItemId:o,isGroup:t==="true",isOpen:e==="true"};throw Error(`getMenuItemDetails #${o} is not a menuitem`)},Wn=({id:e,onActivate:t,onMouseEnterItem:o,position:{x:n,y:r}})=>{let[,a]=(0,X.useState)({}),l=(0,X.useRef)([{id:e,left:n,top:r}]),u=(0,X.useCallback)(M=>l.current.findIndex(x=>x.id===M)!==-1,[]),c=(0,X.useCallback)(M=>{let x=i.current[M];if(x===void 0)throw Error(`getOpenMenuState no entry for menu ${M}`);return x},[]),s=(0,X.useCallback)(M=>{l.current=M,a({})},[]),d=(0,X.useRef)(),m=(0,X.useRef)(),i=(0,X.useRef)({[e]:"no-popup"}),g=(0,X.useCallback)((M=e,x,E=null)=>{if(M===e&&E===null)s([{id:e,left:n,top:r}]);else{i.current[M]="popup-open";let v=document.getElementById(E);if(v!==null){let{left:D,top:k}=oi(v,l.current);s(l.current.concat({id:x,left:D,top:k}))}else throw Error(`openMenu no menuItem ${E}`)}},[e,n,r,s]),f=(0,X.useCallback)(M=>{if(M===e)s([]);else{let x=l.current.slice(),E=x.pop();i.current[E.id]="no-popup";let v=x.at(-1);v&&(i.current[v.id]="no-popup"),s(x)}},[e,s]),p=(0,X.useCallback)(M=>{let x=l.current.slice(),E=M.slice(9),{id:v}=x.at(-1);for(;x.length>1&&!E.startsWith(v);){let D=_n(v,e);x.pop(),i.current[v]="no-popup",i.current[D]="no-popup",{id:v}=x[x.length-1]}x.length<l.current.length&&s(x)},[e,s]),h=(0,X.useCallback)(()=>{d.current&&(clearTimeout(d.current),d.current=void 0)},[]),C=(0,X.useCallback)((M,x,E)=>{h(),d.current=window.setTimeout(()=>{console.log(`scheduleOpen<timeout> opening menu ${x} from menu ${M} via menuitem ${E}`),p(E),i.current[M]="popup-open",i.current[x]="no-popup",g(M,x,E)},400)},[h,p,g]),S=(0,X.useCallback)((M,x,E)=>{console.log(`scheduleClose openMenuId ${x} from parent menu ${M} itemId ${E}`),i.current[x]="pending-close",m.current=window.setTimeout(()=>{p(E)},400)},[p]),T=(0,X.useCallback)(()=>{let{current:M}=l,[x]=M.slice(-1),E=document.getElementById(x.id);if(console.log(`handle render ${JSON.stringify(x)} tabindex ${E==null?void 0:E.tabIndex}`),E){let{right:v,bottom:D}=E.getBoundingClientRect(),{clientHeight:k,clientWidth:y}=document.body;if(v>y){let L=M.length>1?ti(e,M):Qa(M,v-y);s(L)}else if(D>k){let L=ei(M,D-k);s(L)}typeof E.tabIndex=="number"&&(console.log(`focus el ${E.id}`),E.focus())}else console.log(`no element found with if ${x.id}`)},[e,s]),b=(0,X.useCallback)(M=>{let{hostMenuId:x,targetMenuId:E,menuItemId:v,isGroup:D,isOpen:k}=Un(M,e),{current:{[x]:y}}=i;if(console.log(`trigger child menu ${v}`),y==="no-popup"&&D)i.current[x]="popup-pending",C(x,E,v);else if(y==="popup-pending"&&!D)i.current[x]="no-popup",clearTimeout(d.current),d.current=void 0;else if(y==="popup-pending"&&D)clearTimeout(d.current),C(x,E,v);else if(y==="popup-open")if(u(E)){let L=c(E);switch(console.log({menuStatus:L}),p(v),L){case"pending-close":clearTimeout(m.current),m.current=void 0,i.current[E]="no-popup",h();break;default:}}else{let[L,I]=l.current.slice(-2);L.id===x&&i.current[I.id]!=="pending-close"?(S(x,I.id,v),D&&!k&&C(x,E,v)):L.id===x&&D&&v!==I.id&&i.current[I.id]==="pending-close"||D?C(x,E,v):i.current[I.id]!=="pending-close"&&p(v)}y==="pending-close"&&(h(),clearTimeout(m.current),m.current=void 0,i.current[x]="popup-open")},[h,p,c,u,e,S,C]),w=(0,X.useMemo)(()=>({onMouseEnter:M=>{let x=Po(M.target);b(x),o(M,x.id)},onClick:M=>{let x=Po(M.target),{isGroup:E,menuItemId:v}=Un(x,e);E?b(x):t(v)}}),[t,o,e,b]);return{closeMenu:f,handleRender:T,listItemProps:w,openMenu:b,openMenus:l.current}};var qn=require("@vuu-ui/vuu-layout"),At=require("react/jsx-runtime"),Gn=require("react"),ri=()=>{},Ro=({activatedByKeyboard:e,children:t,className:o,id:n,onClose:r=()=>{},position:a={x:0,y:0},style:l,...u})=>{let c=(0,Je.useRef)(r);c.current=r;let s=(0,qn.useId)(n),d=(0,Je.useRef)(ri),[m,i]=On(t,s),g=(0,Je.useRef)(e),f=(0,Je.useCallback)(()=>{g.current=!1},[]);console.log({actions:i,menus:m});let p=(0,Je.useCallback)(v=>{let D=v.slice(9),{action:k,options:y}=i[D];d.current(s),r({type:"menu-action",menuId:k,options:y})},[i,s,r]),{closeMenu:h,listItemProps:C,openMenu:S,openMenus:T,handleRender:b}=Wn({id:`${s}`,onActivate:p,onMouseEnterItem:f,position:a});d.current=h;let w=()=>{console.log("handleCloseMenu"),g.current=!0,h()},M=()=>{},x=T.length-1,E=v=>{if(!(v>=x)){let{id:D}=T[v+1];return D}};return(0,At.jsx)(At.Fragment,{children:T.map(({id:v,left:D,top:k},y,L)=>{let I=E(y);return(0,At.jsx)(Ot,{x:D,y:k,onRender:b,children:(0,Gn.createElement)(Vn,{...u,activatedByKeyboard:g.current,childMenuShowing:I,className:o,id:v,isRoot:y===0,key:y,listItemProps:C,onActivate:p,onHighlightMenuItem:M,onCloseMenu:w,onOpenMenu:S,style:l,tabIndex:y===L.length-1?0:void 0},m[v])},y)})})};Ro.displayName="ContextMenu";var to=require("react"),si=require("react/jsx-runtime"),Zn=(0,to.createContext)(null);var or=require("@vuu-ui/vuu-utils"),nr=V(require("classnames")),Ae=require("react");var Jn=V(require("classnames")),ht=V(require("react")),oo=V(require("react-dom"));var ko=!1,pe=[],Xn=e=>(e==null?void 0:e.type)==="menu-action",Yn=e=>(e==null?void 0:e.type)==="click-away";function jn(e){if(e.key==="Esc"){if(pe.length)er();else if(ko){let t=document.body.querySelector(".vuuDialog");t&&oo.default.unmountComponentAtNode(t)}}}function Qn(e){if(pe.length){console.log("Popup.outsideClickHandler ... ");let t=document.body.querySelectorAll(".vuuPopup");for(let o=0;o<t.length;o++)if(t[o].contains(e.target)){console.log(" ... its ok, he's one of us");return}console.log(" ... close all"),er({mouseEvt:e,type:"click-away"})}}function er(e){if(pe.length===1)J.hidePopup(e,"anon","all");else if(pe.length){let t=document.body.querySelectorAll(".vuuPopup");for(let o=0;o<t.length;o++)oo.default.unmountComponentAtNode(t[o]);tr("*")}}function ai(e){pe.indexOf(e)===-1&&(pe.push(e),ko===!1&&(window.addEventListener("keydown",jn,!0),window.addEventListener("click",Qn,!0)))}function tr(e){if(pe.length){if(e==="*")pe.length=0;else{let t=pe.indexOf(e);t!==-1&&pe.splice(t,1)}pe.length===0&&ko===!1&&(window.removeEventListener("keydown",jn,!0),window.removeEventListener("click",Qn,!0))}}var ii=({children:e,position:t,style:o})=>{let n=(0,Jn.default)("hwPopup","hwPopupContainer",t);return(0,ht.createElement)("div",{className:n,style:o},e)},li=1,J=class{static showPopup({group:t="all",name:o="anon",left:n=0,position:r="",right:a="auto",top:l=0,width:u="auto",component:c}){if(!c)throw Error("PopupService showPopup, no component supplied");typeof c.props.onClose=="function"?J.onClose=c.props.onClose:J.onClose=void 0,ai(o),document.addEventListener("keydown",J.escapeKeyListener,!0);let s=document.body.querySelector(".vuuPopup."+t);s===null&&(s=document.createElement("div"),s.className="vuuPopup "+t,document.body.appendChild(s));let d={width:u};jt((0,ht.createElement)(ii,{key:li++,position:r,style:d},c),s,n,l,()=>{J.keepWithinThePage(s,a)})}static escapeKeyListener(t){t.key==="Escape"&&(console.log("%cESC listener","color:green;font-weight:bold;"),J.hidePopup())}static hidePopup(t,o="anon",n="all"){var r;if(console.log("PopupService.hidePopup",{reason:t}),pe.indexOf(o)!==-1){tr(o);let a=document.body.querySelector(`.vuuPopup.${n}`);a&&oo.default.unmountComponentAtNode(a)}document.removeEventListener("keydown",J.escapeKeyListener,!0),console.log(`PopupService will call onClose if found ${typeof(J==null?void 0:J.onClose)}`),(r=J==null?void 0:J.onClose)==null||r.call(J,t)}static keepWithinThePage(t,o="auto"){let n=t.querySelector(".vuuPopupContainer > *");if(n){let{top:r,left:a,width:l,height:u,right:c}=n.getBoundingClientRect(),s=window.innerWidth,m=window.innerHeight-(r+u);m<0&&(n.style.top=Math.round(r)+m+"px");let i=s-(a+l);if(i<0&&(n.style.left=Math.round(a)+i+"px"),typeof o=="number"&&o!==c){let g=o-c;n.style.left=a+g+"px"}}}};var no=require("react/jsx-runtime"),rr=(e,t)=>{let o=(0,Ae.useContext)(Zn),[n,r,a]=Ee(),l=(0,Ae.useCallback)((s,d,m)=>{let i=[];for(let g of s)i=i.concat(g(d,m));return i},[]),u=(0,Ae.useCallback)((s,d,{ContextMenuProps:m,contextMenu:i,...g})=>{if(s.stopPropagation(),s.preventDefault(),i)return ui(s,i);let f=[];if(e&&f.push(e),o&&Array.isArray(o==null?void 0:o.menuBuilders)&&o.menuBuilders.length>0&&f.push(...o.menuBuilders),f.length>0){let p=l(f,d,g),h=C=>(t==null?void 0:t(C))===!0?!0:o==null?void 0:o.menuActionHandler(C);p.length&&h&&(console.log(`showContextMenu ${d}`,{options:g}),di(s,p,h,{...m,className:(0,nr.default)(m==null?void 0:m.className,n,r),"data-mode":a}))}else console.warn("useContextMenu, no menuBuilders configured. These should be supplied via the ContextMenuProvider(s)")},[l,o,a,r,t,e,n]),c=(0,Ae.useCallback)(()=>{console.log("hide comnytext menu")},[]);return[u,c]},ci={},ui=(e,t)=>{let o={x:e.clientX,y:e.clientY};J.showPopup({focus:!0,left:0,top:0,component:(0,Ae.cloneElement)(t,{position:o})})},di=(e,t,o,{position:n,...r}=ci)=>{let a=s=>{let d=(m,i)=>(0,or.isGroupMenuItemDescriptor)(m)?(0,no.jsx)(Qt,{label:m.label,children:m.children.map(d)},i):(0,no.jsx)(eo,{action:m.action,"data-icon":m.icon,options:m.options,children:m.label},i);return s.map(d)},l=s=>{var d;Xn(s)&&(o(s),J.hidePopup()),(d=r==null?void 0:r.onClose)==null||d.call(r,s)},u=n!=null?n:{x:e.clientX,y:e.clientY},c=(0,no.jsx)(Ro,{...r,onClose:l,position:u,children:a(t)});J.showPopup({left:0,top:0,component:c,focus:!0})};var $e=require("react");var ar=V(require("classnames")),ir=require("@salt-ds/core"),lr=require("@vuu-ui/vuu-layout");var ur=require("react/jsx-runtime"),sr="vuuPopupMenu",mi=e=>{if(e){let{bottom:t,left:o}=e.getBoundingClientRect();return{x:o,y:t+6}}},cr=({className:e,icon:t="more-vert",id:o,menuActionHandler:n,menuBuilder:r,menuLocation:a="header",menuOptions:l,onMenuClose:u,tabIndex:c=0,...s})=>{let d=(0,$e.useRef)(null),m=(0,$e.useRef)(!1),[i,g]=(0,$e.useState)(!1),f=(0,lr.useId)(o),[p]=rr(r,n),h=(0,$e.useCallback)(S=>{console.log("PopupMenu popup closed",{reason:S}),g(!1),Yn(S)?S.mouseEvt.target===d.current&&(m.current=!0):requestAnimationFrame(()=>{var T;u==null||u(),c!==-1&&((T=d.current)==null||T.focus())})},[u,c]),C=(0,$e.useCallback)(S=>{m.current?m.current=!1:(g(!0),p(S,a,{ContextMenuProps:{id:`${f}-menu`,onClose:h,position:mi(d.current)},...l}))},[h,f,a,l,p]);return(0,ur.jsx)(ir.Button,{...s,"aria-controls":`${f}-menu-root`,"aria-expanded":i,"aria-haspopup":"menu",className:(0,ar.default)(sr,e,{[`${sr}-open`]:i}),"data-icon":t,id:f,onClick:C,ref:d,tabIndex:c,variant:"secondary"})};var Oo=require("react/jsx-runtime"),pi=e=>e.split(" ").map(t=>`vuuDraggable-${t}`),so=(0,ro.forwardRef)(function({wrapperClassName:t,element:o,onTransitionEnd:n,style:r,scale:a=1},l){let u=(0,ro.useCallback)(s=>{s&&(s.innerHTML="",s.appendChild(o),a!==1&&(s.style.transform=`scale(${a},${a})`))},[o,a]),c=(0,dr.useForkRef)(l,u);return(0,Oo.jsx)(Ot,{children:(0,Oo.jsx)("div",{className:Yt("vuuDraggable",...pi(t)),ref:c,onTransitionEnd:n,style:r})})}),Ao=e=>{let t=document.createElement("div");return t.className="vuuDraggable-spacer",e&&t.addEventListener("transitionend",()=>{e.current=!1}),t},mr=()=>{let e=document.createElement("div");return e.className="vuuDraggable-dropIndicatorPosition",e},pr=e=>{let t=document.createElement("div");return t.className="vuuDraggable-dropIndicator",e&&t.addEventListener("transitionend",()=>{e.current=!1}),t};var fr=()=>{let e=(0,be.useRef)(0),t=(0,be.useRef)(!1),o=(0,be.useMemo)(()=>[Ao(t),Ao()],[]),n=(0,be.useCallback)(()=>o.forEach(c=>c.remove()),[o]),r=(0,be.useCallback)((c,s="width")=>{let[d,m]=o;e.current=requestAnimationFrame(()=>{t.current=!0,d.style.cssText=`${s}: 0px`,m.style.cssText=`${s}: ${c}px`,o[0]=m,o[1]=d})},[o]),a=(0,be.useCallback)(()=>{e.current&&(cancelAnimationFrame(e.current),e.current=0)},[]),l=(0,be.useCallback)((c,s,d,m=!1,i="static",g="horizontal")=>{if(s){let f=g==="horizontal"?"width":"height",[p,h]=o;if(a(),m)t.current?(n(),p.style.cssText=`${f}: ${d}px`,h.style.cssText=`${f}: 0px`,i==="fwd"?(s.element.before(p),s.element.after(h)):(s.element.after(p),s.element.before(h))):i==="fwd"?s.element.after(h):s.element.before(h),r(d,f);else if(i==="static")p.style.cssText=`${f}: ${d}px`,s.element.before(p);else throw Error("useDragDisplacers currently only supports noTransition for static displacement");i!=="static"&&Do(c,i)}},[r,a,n,o]),u=(0,be.useCallback)((c,s,d,m=!1,i="static",g="horizontal")=>{let f=g==="horizontal"?"width":"height",[p,h]=o;a(),m?(t.current?(n(),p.style.cssText=`${f}: ${d}px`,h.style.cssText=`${f}: 0px`,s.element.before(p),s.element.after(h)):i==="fwd"?s.element.after(h):s.element.before(h),r(d,f)):(p.style.cssText=`${f}: ${d}px`,s.element.after(p)),i!=="static"&&Do(c,i)},[r,a,n,o]);return{displaceItem:l,displaceLastItem:u,clearSpacers:n}};var gr=({draggableRef:e,onDrop:t,orientation:o="horizontal",containerRef:n,itemQuery:r="*",selected:a,viewportRange:l})=>{let u=(0,ne.useRef)(),c=(0,ne.useRef)(!1),s=(0,ne.useRef)(-1),d=(0,ne.useRef)([]),m=(0,ne.useRef)(!1),[i,g]=(0,ne.useState)(!1),{clearSpacers:f,displaceItem:p,displaceLastItem:h}=fr(),C=(0,ne.useRef)(),S=`:is(${r}${Xt}${hn},.vuuOverflowContainer-OverflowIndicator)`,T=y=>d.current.findIndex(L=>L.id===y.id),b=(0,ne.useRef)();b.current=l;let w=(0,ne.useCallback)(()=>{f()},[f]),M=(0,ne.useCallback)((y,L,I)=>{let{current:P}=n,{current:N}=C;if(P&&N){d.current=ft(P,o,S,b.current);let{size:R}=N,$=s.current+R/2,{current:O}=d,K=gt(O,$,"fwd");if(K){let G=T(K),_=O[G];I&&y==="fwd"?h(O,O[O.length-1],R,!1,"static",o):p(O,_,R,!0,"static",o)}}},[n,p,h,S,o]),x=(0,ne.useCallback)(y=>{let I=y.target.closest(r);I.ariaSelected&&Array.isArray(a)&&a.length>1&&console.log("its a selected element, and we have a multi select");let{current:P}=n;if(P&&I){let{SCROLL_SIZE:N,CLIENT_SIZE:R}=me(o),{id:H}=I,{[N]:$,[R]:O}=P;c.current=$>O;let K=d.current=ft(P,o,S,l,H);console.log({dropTargets:K});let z=Rt(K),G=K[z];G&&P&&(C.current=G,(G.isLast?h:p)(K,G,G.size,!1,"static",o))}},[n,p,h,S,r,o,a,l]),[E,v]=(0,ne.useMemo)(()=>{let y=!1;return[P=>{if(!y){y=!0;let N=P.element.querySelector(".vuuPopupMenu");if(N){let R=new MouseEvent("click",{view:window,bubbles:!0,cancelable:!0});N.dispatchEvent(R)}}},P=>{if(y){y=!1;let N=P.element.querySelector(".vuuPopupMenu");if(N){let R=new MouseEvent("click",{view:window,bubbles:!0,cancelable:!0});N.dispatchEvent(R)}}}]},[]),D=(0,ne.useCallback)((y,L)=>{let{current:I}=C;if(I&&e.current&&n.current){s.current=y;let{current:P}=d,N=gt(P,y,L);if(N&&!N.isDraggedItem)if(N.isOverflowIndicator)g(m.current=!0),E(N);else{let{size:R}=I;(T(N)===P.length-1?h:p)(P,N,R,!0,L,o);let O=P.at(-1);v(O),g(m.current=!1)}u.current=L}},[n,p,h,e,v,o,E]),k=(0,ne.useCallback)(()=>{var P;f();let{current:y}=d,L=Rt(y),I=y[L];if(I&&(u.current=void 0,m.current?t(I.index,-1):t(I.index,L)),g(!1),n.current){let N=(P=n.current)==null?void 0:P.scrollTop;L<y.length&&(n.current.scrollTop=N)}},[f,n,t]);return{beginDrag:x,drag:D,drop:k,handleScrollStart:w,handleScrollStop:M,revealOverflowedItems:i}};var Q=require("react");var $t=require("react");var hr=()=>{let e=(0,$t.useMemo)(()=>mr(),[]),t=(0,$t.useCallback)(()=>e.remove(),[e]);return{positionDropIndicator:(0,$t.useCallback)((n,r="end")=>(r==="end"?n.element.after(e):n.element.before(e),e),[e]),clearSpacer:t}};var yr=require("react/jsx-runtime"),fi=':not([data-overflowed="true"])',gi=':not([aria-hidden="true"])',br=({draggableRef:e,onDrop:t,orientation:o="horizontal",containerRef:n,itemQuery:r="*",selected:a,viewportRange:l})=>{let u=(0,Q.useRef)(),c=(0,Q.useRef)(null),s=(0,Q.useRef)(null),d=(0,Q.useRef)(""),m=(0,Q.useRef)(!1),i=(0,Q.useRef)(-1),g=(0,Q.useRef)([]),f=(0,Q.useRef)(!1),[p,h]=(0,Q.useState)(!1),[C,S]=(0,Q.useState)(),{clearSpacer:T,positionDropIndicator:b}=hr(),w=(0,Q.useRef)(),M=`:is(${r}${fi}${gi},[data-overflow-indicator])`,x=P=>g.current.findIndex(N=>N.id===P.id),E=(P,N,R)=>{P.start+=N,P.mid+=N,P.end+=N,typeof R=="number"&&(P.currentIndex+=R)},v=(0,Q.useRef)();v.current=l;let D=(0,Q.useCallback)(()=>{T()},[T]),k=(0,Q.useCallback)((P,N,R)=>{let{current:H}=n,{current:$}=w;if(H&&$){g.current=ft(H,o,M,v.current);let{size:O}=$,z=i.current+O/2,{current:G}=g,_=gt(G,z,"fwd");_&&b(R&&P==="fwd"?G[G.length-1]:_,"start")}},[n,b,M,o]),y=(0,Q.useCallback)(P=>{let R=P.target.closest(r);R.ariaSelected&&Array.isArray(a)&&a.length>1&&console.log("its a selected element, and we have a multi select");let{current:H}=n;if(H&&R){let{SCROLL_SIZE:$,CLIENT_SIZE:O}=me(o),{id:K}=R,{[$]:z,[O]:G}=H;m.current=z>G;let _=g.current=ft(H,o,M,l),Y=yn(_,K);if(Y&&H){let A=x(Y);vn(_,A),w.current=Y;let{current:F}=v;if(F!=null&&F.atEnd)for(let Z=0;Z<_.length;Z++)E(_[Z],Y.size);for(let Z=A;Z<_.length;Z++)E(_[Z],-Y.size,-1);let[W,le]=Y.isLast?[_[_.length-1],"end"]:[_[A],"start"];s.current=W,d.current=le;let ke=b(W,le),{top:B,left:q,width:ee}=ke.getBoundingClientRect(),te={top:Y.isLast?F!=null&&F.atEnd&&!F.atStart?B+Y.size-2:B-2:B-Y.size-2,left:q,width:ee,height:2};S((0,yr.jsx)(so,{wrapperClassName:"dropIndicatorContainer",style:te,ref:c,element:pr()}))}}},[r,a,n,o,M,l,b]),L=(0,Q.useCallback)((P,N)=>{let{current:R}=s,{current:H}=w;if(H&&e.current&&n.current){let $=o==="horizontal"?"left":"top";i.current=P;let{current:O}=g,K=gt(O,P,N);if(K&&K.index!==(R==null?void 0:R.index)){if(K.isOverflowIndicator)h(f.current=!0);else if(c.current){if(x(K)===O.length-1){let G=O[O.length-1],Y=b(G,"start").getBoundingClientRect();c.current.style[$]=`${Y.top}px`}else{let _=b(K,"start").getBoundingClientRect();c.current.style[$]=`${_.top}px`}h(f.current=!1)}s.current=K,u.current=N}}},[e,n,o,b]),I=(0,Q.useCallback)(()=>{T();let{current:P}=w,{current:N}=s,{current:R}=d,{current:H}=v;if(P&&H&&N){let{index:$}=P,O=R==="start",{index:K,currentIndex:z}=N;s.current=null,u.current=void 0,f.current?t($,-1):$<K?t($,O?z:z+1):t($,O?K:K+1),S(void 0)}h(!1)},[T,t]);return{beginDrag:y,drag:L,drop:I,dropIndicator:C,handleScrollStart:D,handleScrollStop:k,revealOverflowedItems:p}};var U=require("react");var Fe=require("react");var vr=({containerRef:e,onScrollingStopped:t,orientation:o="vertical"})=>{let n=(0,Fe.useRef)(null),r=(0,Fe.useRef)(!1),a=(0,Fe.useRef)(0),l=(0,Fe.useRef)("fwd"),u=(0,Fe.useCallback)((s=!1)=>{console.log("[useAutoScroll] stopScrolling"),n.current!==null&&(clearTimeout(n.current),n.current=null),r.current=!1,t==null||t(l.current,a.current,s)},[t]),c=(0,Fe.useCallback)((s,d,m=30)=>{let{current:i}=e;if(i){let{SCROLL_POS:g,SCROLL_SIZE:f,CLIENT_SIZE:p}=me(o),{[g]:h,[f]:C,[p]:S}=i,T=s==="fwd"?C-S-h:h,b=Math.min(T,m);s==="fwd"?(l.current="fwd",i[g]=a.current=h+b):(l.current="bwd",i[g]=a.current=h-b),b===T?u(!0):(r.current=!0,n.current=window.setTimeout(()=>{c(s,d,m)},100))}},[e,o,u]);return{isScrolling:r,startScrolling:c,stopScrolling:u}};var Mr=require("react/jsx-runtime"),hi={beginDrag:()=>{},drag:()=>{},draggableRef:{current:null},drop:()=>{},isDragging:!1,isScrolling:!1,handleScrollStart:()=>{},handleScrollStop:()=>{},revealOverflowedItems:!1},Tr={start:0,end:1e3,contraStart:0,contraEnd:1e3},bi=()=>hi,yi=3,vi=(e,t)=>e.closest(t),Ti=e=>e.dataset.index==="overflow"&&e.parentElement!==null&&e.parentElement.classList.contains("overflowed"),xi=(e,t)=>{let o=`:is(${t}${Xt},.vuuOverflowContainer-OverflowIndicator)`,r=Array.from(e.querySelectorAll(o)).pop();return[r,Ti(r)]},xr=({allowDragDrop:e,containerRef:t,draggableClassName:o,itemQuery:n="*",onDragStart:r,onDrop:a,onDropSettle:l,orientation:u,...c})=>{let s=(0,U.useRef)({start:0,end:0,contraStart:0,contraEnd:0}),[d,m]=(0,U.useState)({draggable:void 0,draggedItemIndex:-1,isDragging:!1}),i=(0,U.useRef)(null),g=(0,U.useRef)(),f=(0,U.useRef)(null),p=(0,U.useRef)(!1),h=(0,U.useRef)({x:0,y:0}),C=(0,U.useRef)({x:0,y:0}),S=(0,U.useRef)({x:0,y:0}),T=(0,U.useRef)(null),b=(0,U.useRef)(-1),w=(0,U.useRef)(-1),M=(0,U.useRef)(),{isDragSource:x,isDropTarget:E,register:v}=gn(c.id);c.id&&(x||E)&&v(c.id);let D=(0,U.useCallback)(()=>{var ee;let{current:B}=w,q=(ee=t.current)==null?void 0:ee.querySelector(`${n}[data-index="${B}"]`);q&&q.classList.remove("vuuDropTarget-settling"),w.current=-1,l==null||l(B),m(te=>({...te,draggable:void 0}))},[t,n,l]),k=(0,U.useCallback)(B=>{if(t.current){let{POS:q,SCROLL_POS:ee,SCROLL_SIZE:te,CLIENT_SIZE:Z}=me(u),{[ee]:he,[te]:It,[Z]:_e}=t.current,lt=It-_e,ct=he<lt,Nt=s.current.end,ut=he>0&&B-h.current[q]<=s.current.start,dt=ct&&B-h.current[q]>=Nt;return ut?"bwd":dt?"fwd":""}},[t,u]),y=e===!0||e==="natural-movement"?gr:e==="drop-indicator"?br:bi,L=(0,U.useCallback)((B,q,ee)=>{var te;(te=M.current)==null||te.call(M,B,q,ee)},[]),{isScrolling:I,startScrolling:P,stopScrolling:N}=vr({containerRef:t,onScrollingStopped:L,orientation:u}),R=(0,U.useCallback)((B,q)=>{b.current=q,a==null||a(B,q),w.current=q},[a]),{beginDrag:H,drag:$,drop:O,handleScrollStart:K,handleScrollStop:z,...G}=y({...c,containerRef:t,draggableRef:i,isDragSource:x,isDropTarget:E,itemQuery:n,onDrop:R,orientation:u});M.current=z;let _=(0,U.useCallback)(B=>{let{CLIENT_POS:q,CONTRA_CLIENT_POS:ee,CONTRA_POS:te,POS:Z}=me(u),{clientX:he,clientY:It}=B,{[q]:_e,[ee]:lt}=B,ct=C.current[Z],Nt=C.current[te],ut=Math.abs(ct-_e);if((x?Math.abs(Nt-lt):0)-ut>5&&(s.current=Tr),C.current.x=he,C.current.y=It,s.current===Tr&&i.current){let Ht=C.current.x-h.current.x,We=C.current.y-h.current.y;i.current.style.top=`${We}px`,i.current.style.left=`${Ht}px`}else if(ut>0&&i.current){let Ht=ct<_e?"fwd":"bwd",We=k(_e),Eo=C.current[Z]-h.current[Z];if(We&&p.current&&!I.current?(K(),P(We,1)):!We&&I.current&&N(),!I.current){let Wt=Math.round(Math.max(s.current.start,Math.min(s.current.end,Eo))),Me=u==="horizontal"?"left":"top";i.current.style[Me]=`${Wt}px`,$(Wt,Ht)}}},[$,i,k,K,x,I,u,P,N]),Y=(0,U.useCallback)(()=>{document.removeEventListener("mousemove",_,!1),document.removeEventListener("mouseup",Y,!1),T.current=i.current,O(),m(B=>({...B,draggedItemIndex:-1,isDragging:!1})),g.current=void 0},[_,i,O]),A=(0,U.useCallback)(B=>{let{clientX:q,clientY:ee,target:te}=B,Z=vi(te,n),{current:he}=t;if(he&&Z){let{CONTRA:It,CONTRA_END:_e,DIMENSION:lt,END:ct,SCROLL_SIZE:Nt,CLIENT_SIZE:ut,START:dt}=me(u);g.current=Z;let{[Nt]:Ht,[ut]:We}=he;p.current=Ht>We;let[Eo,Wt]=xi(he,n),Me=he.getBoundingClientRect(),qt=Z.getBoundingClientRect(),Co=qt[lt],{[dt]:ua,[ct]:da}=Eo.getBoundingClientRect();h.current.x=q-qt.left,h.current.y=ee-qt.top,s.current.start=Me[dt],s.current.end=Wt?Math.max(ua,Me.right-Co):p.current?Me[dt]+Me[lt]-Co:da-Co,s.current.contraStart=Me[It],s.current.contraEnd=Me[_e],H(B);let{dataset:{index:ma="-1"}}=Z;m({isDragging:!0,draggable:(0,Mr.jsx)(so,{element:bn(Z),onTransitionEnd:D,ref:i,style:Tn(qt,Me),wrapperClassName:o}),draggedItemIndex:parseInt(ma)}),r==null||r(),document.addEventListener("mousemove",_,!1),document.addEventListener("mouseup",Y,!1)}},[H,t,_,Y,o,i,n,r,u,D]),F=(0,U.useCallback)(B=>{let{CLIENT_POS:q,POS:ee}=me(u),{[q]:te}=B;Math.abs(te-S.current[ee])>yi&&t.current&&(f.current&&(window.clearTimeout(f.current),f.current=null),document.removeEventListener("mousemove",F),document.removeEventListener("mouseup",W,!1),A(B))},[t,H,u]),W=(0,U.useCallback)(()=>{f.current&&(window.clearTimeout(f.current),f.current=null),document.removeEventListener("mousemove",F,!1),document.removeEventListener("mouseup",W,!1)},[F]),le=(0,U.useCallback)(B=>{console.log("useDragDropNext onMouseDown");let{current:q}=t;if(q&&!B.defaultPrevented){let{clientX:ee,clientY:te}=B;C.current.x=S.current.x=ee,C.current.y=S.current.y=te,document.addEventListener("mousemove",F,!1),document.addEventListener("mouseup",W,!1),B.persist(),f.current=window.setTimeout(()=>{document.removeEventListener("mousemove",F,!1),document.removeEventListener("mouseup",W,!1),A(B.nativeEvent)},500)}},[t,A,F,W]),{current:ke}=T;return(0,U.useLayoutEffect)(()=>{if(ke&&t.current){let B=b.current,q=t.current.querySelector(`${n}[data-index="${B}"]`);q?(q.classList.add("vuuDropTarget-settling"),requestAnimationFrame(()=>{let{top:ee,left:te}=q.getBoundingClientRect(),{top:Z,left:he}=ke.getBoundingClientRect();he!==te||Z!==ee?(ke.classList.add("vuuDraggable-settling"),ke.style.top=`${ee}px`,ke.style.left=`${te}px`):D()})):console.log(`dont have the dropped item (at ${B})`),T.current=null}},[t,n,ke,D]),{...G,...d,isScrolling:I,onMouseDown:e?le:void 0}};var ye=require("react"),Ft=require("@salt-ds/core");var Fo=require("react/jsx-runtime"),$o="vuuEditableLabel",Er=(0,ye.forwardRef)(function({className:t,defaultEditing:o,defaultValue:n,editing:r,onChange:a,onEnterEditMode:l,onExitEditMode:u,value:c,...s},d){let m=(0,ye.useRef)(null),i=(0,ye.useRef)(!1),[g,f]=(0,Ft.useControlled)({controlled:c,default:n!=null?n:"",name:"EditableLabel",state:"value"}),[p,h]=(0,Ft.useControlled)({controlled:r,default:o!=null?o:!1,name:"EditableLabel",state:"editing"}),C=(0,ye.useCallback)(D=>{h(i.current=D)},[]),S=(0,ye.useRef)(g);(0,ye.useLayoutEffect)(()=>{p&&m.current!==null&&(m.current.select(),m.current.focus())},[p,m]);let T=(0,ye.useCallback)(()=>{C(!0),l&&l()},[l,C]),b=({cancelEdit:D=!1,allowDeactivation:k=!1}={})=>{C(!1);let y=S.current;y!==g&&(D?f(y):S.current=g),u&&u(y,g,k,D)},w=D=>{let{value:k}=D.target;f(k),a&&a(k)},M=()=>{T()},x=()=>{i.current&&b({allowDeactivation:!0})},E=D=>{p&&D.key==="Enter"?(D.stopPropagation(),b()):D.key==="ArrowRight"||D.key==="ArrowLeft"?D.stopPropagation():D.key==="Escape"&&b({cancelEdit:!0})},v=Yt($o,t,{[`${$o}-editing`]:p});return(0,Fo.jsx)("div",{...s,className:v,onDoubleClick:M,"data-text":g,ref:d,children:p?(0,Fo.jsx)(Ft.Input,{inputProps:{className:`${$o}-input`},value:g,onBlur:x,onChange:w,onKeyDown:E,inputRef:m,style:{padding:0},textAlign:"left",variant:"secondary"}):g})});var yt=require("@vuu-ui/vuu-layout"),Fr=require("@salt-ds/core"),Kr=V(require("classnames")),vt=V(require("react"));var ae=require("react");var Cr=e=>typeof e=="object"&&e!==null&&"tabIndex"in e&&typeof e.tabIndex=="number",Sr=e=>({label:"Close",location:"tab",action:"close-tab",options:e}),Lr=e=>({label:"Rename",location:"tab",action:"rename-tab",options:e});var Mi=e=>{if(e){let t=parseInt(e.dataset.index||"");if(!isNaN(t))return t}return-1},Dr=(e,t)=>{if(e){let o=e.querySelector(`[data-index]:has(${t})`);return Mi(o)}return-1},Ko=e=>Dr(e,'[aria-selected="true"]'),wr=e=>Dr(e,".vuuEditableLabel-editing");var bt=require("@vuu-ui/vuu-utils"),Le=require("react"),Ir=(e,t,o="horizontal")=>{let n=(0,Le.useRef)(!1),r=(0,Le.useCallback)(()=>{n.current=!0},[]),a=(0,Le.useCallback)(()=>{n.current=!1},[]),l=(0,Le.useCallback)(()=>{var c,s;(c=e.current)==null||c.style.setProperty("--tab-thumb-transition","none"),(s=e.current)==null||s.removeEventListener("transitionend",l)},[e]),u=(0,Le.useRef)(-1);return(0,Le.useMemo)(()=>{var d,m;let c=0,s=0;if(u.current!==-1){let i=(d=e.current)==null?void 0:d.querySelector(".vuuTab-selected"),g=(m=e.current)==null?void 0:m.querySelector(`[data-index="${t}"] .vuuTab`),{positionProp:f,sizeProp:p}=bt.MEASURES[o];if(i&&g&&!n.current){let{[f]:h,[p]:C}=i.getBoundingClientRect(),{[f]:S}=g.getBoundingClientRect();if((0,bt.isValidNumber)(h)&&(0,bt.isValidNumber)(S)&&(0,bt.isValidNumber)(C)){console.log({orientation:o,positionProp:f,oldPosition:h,newPosition:S}),c=h-S,s=C;let b=Math.abs(c/(o==="horizontal"?1100:700));requestAnimationFrame(()=>{var w,M,x,E;(w=e.current)==null||w.style.setProperty("--tab-thumb-offset","0px"),(M=e.current)==null||M.style.setProperty("--tab-thumb-size","100%"),(x=e.current)==null||x.style.setProperty("--tab-thumb-transition",`all ${b}s ease`),(E=e.current)==null||E.addEventListener("transitionend",l)})}}}return u.current=t,n.current?{containerStyle:{"--tab-thumb-offset":"0px","--tab-thumb-size":"100%"},resumeAnimation:a,suspendAnimation:r}:{containerStyle:{"--tab-thumb-offset":`${c}px`,"--tab-thumb-size":s?`${s}px`:void 0},resumeAnimation:a,suspendAnimation:r}},[t,e,o,l,a,r])};var Hr=require("@salt-ds/core"),Pr=require("@vuu-ui/vuu-utils"),re=require("react"),ie=require("@vuu-ui/vuu-utils");var Rr={horizontal:{[ie.Home]:"start",[ie.End]:"end",[ie.ArrowLeft]:"bwd",[ie.ArrowRight]:"fwd"},vertical:{[ie.Home]:"start",[ie.End]:"end",[ie.ArrowUp]:"bwd",[ie.ArrowDown]:"fwd"}},Ei=(e,t="horizontal")=>Rr[t][e]!==void 0,Ci=e=>e===ie.ArrowDown;function Nr(e,t,o){return t==="start"?0:t==="end"?e-1:t==="bwd"?o>0?o-1:o:o===null?0:o===e-1?o:o+1}var Si=e=>e!==null&&!e.classList.contains("wrapped"),ao=(e,t)=>e?e.querySelector(`[data-index="${t}"]`):null,kr=({containerRef:e,defaultHighlightedIdx:t=-1,highlightedIdx:o,keyBoardActivation:n,orientation:r,selectedIndex:a=0})=>{let l=n==="manual",u=(0,re.useRef)(!1),c=(0,re.useRef)(-1),[s,d]=(0,re.useState)(!1),[,m]=(0,re.useState)({}),[i,g]=(0,Hr.useControlled)({controlled:o,default:t,name:"UseKeyboardNavigation"}),f=(0,re.useCallback)(y=>{g(c.current=y)},[g]),p=(0,re.useRef)(!1),h=(0,re.useCallback)((y,L=!1,I,P=70)=>{f(y),I===!0&&!p.current&&(p.current=!0);let N=()=>{let R=ao(e.current,y);if(R){let H=(0,Pr.getFocusableElement)(R);H==null||H.focus()}};L?N():setTimeout(N,P)},[e,f]),C=y=>{if(c.current===-1&&y.target.tabIndex!==-1){let L=wr(e.current);L!==-1?requestAnimationFrame(()=>{f(L)}):setTimeout(()=>{c.current===-1&&a!==null&&f(a)},200)}},S=(0,re.useCallback)(()=>{var y,L;return(L=(y=e.current)==null?void 0:y.querySelectorAll("[data-index]").length)!=null?L:0},[e]),T=(0,re.useCallback)((y="fwd",L)=>{let I=S(),N=Nr(I,y,typeof L=="number"?L:I),R=y==="start"?"fwd":y==="end"?"bwd":y;for(;(R==="fwd"&&N<I||R==="bwd"&&N>0)&&!Si(ao(e.current,N));){let H=Nr(I,R,N);if(H===N)break;N=H}return N},[e,S]),b=(0,re.useCallback)((y,L=!1)=>{let I=Rr[r][y.key],P=T(I,i);P!==i?l&&h(P,!0):L&&m({})},[i,l,T,h,r]),w=(0,re.useCallback)(()=>{let y=ao(e.current,i);return y?y.querySelector(".vuuPopupMenu")!=null:!1},[e,i]),M=(0,re.useCallback)(()=>{let y=ao(e.current,i),L=y==null?void 0:y.querySelector(".vuuPopupMenu");if(L){let I=new MouseEvent("click",{view:window,bubbles:!0,cancelable:!0});L.dispatchEvent(I)}return!1},[e,i]),x=(0,re.useCallback)(y=>{S()>0&&Ei(y.key,r)?(y.preventDefault(),p.current?b(y):(p.current=!0,b(y,!0))):Ci(y.key)&&w()&&M()},[M,S,w,b,r]),E=(y,L)=>{f(L)},v=(0,re.useCallback)(()=>{s||(d(!0),u.current?u.current=!1:p.current=!0)},[s]),D=(0,re.useCallback)(()=>{s||(u.current=!0),p.current=!1},[s]);return{containerProps:{onBlur:y=>{let L=y.target.closest(".vuuTabstrip"),I=y.relatedTarget;L&&!(L!=null&&L.contains(I))&&(f(-1),d(!1))},onMouseDownCapture:D,onFocus:v,onMouseLeave:()=>{p.current=!0,f(-1),u.current=!1}},focusVisible:p.current?i:-1,focusIsWithinComponent:s,highlightedIdx:i,focusTab:h,onClick:E,onFocus:C,onKeyDown:x,setHighlightedIdx:f}};var Or=require("@salt-ds/core"),Kt=require("react"),Li=["Enter"," "],Di=e=>e&&e.matches('[class*="vuuTab "]'),Ar=({defaultSelected:e,highlightedIdx:t,onSelectionChange:o,selected:n})=>{let[r,a,l]=(0,Or.useControlled)({controlled:n,default:e!=null?e:0,name:"Tabstrip",state:"value"}),u=(0,Kt.useCallback)(m=>Li.includes(m.key),[]),c=(0,Kt.useCallback)(m=>{a(m),o==null||o(m)},[o,a]),s=(0,Kt.useCallback)(m=>{let i=m.target;u(m)&&t!==r&&Di(i)&&(m.stopPropagation(),m.preventDefault(),c(t))},[u,t,r,c]),d=(0,Kt.useCallback)((m,i)=>{i!==r&&c(i)},[c,r]);return{activateTab:c,isControlled:l,onClick:d,onKeyDown:s,selected:r}};var wi=new Set(["Enter"," "]),Ii=e=>wi.has(e),Ni=(e,t)=>e?e.querySelector(`[data-index="${t}"]`):null,$r=({activeTabIndex:e,allowDragDrop:t,animateSelectionThumb:o,containerRef:n,onActiveChange:r,onAddTab:a,onCloseTab:l,onExitEditMode:u,onMoveTab:c,orientation:s,keyBoardActivation:d})=>{let m=(0,ae.useRef)(e),{focusTab:i,highlightedIdx:g,onClick:f,onKeyDown:p,setHighlightedIdx:h,...C}=kr({containerRef:n,keyBoardActivation:d,orientation:s,selectedIndex:m.current}),{activateTab:S,onClick:T,onKeyDown:b,selected:w}=Ar({highlightedIdx:g,onSelectionChange:r,selected:e});m.current=w;let{containerStyle:M,resumeAnimation:x,suspendAnimation:E}=Ir(n,o?w:-1,s),v=(0,ae.useCallback)((A,F)=>{let{current:W}=m;console.log(`useTabstrip handleDrop ${A} - ${F} ${W}`),c==null||c(A,F);let le=-1;F!==-1&&(W===A?le=F:A>W&&F<=W?le=W+1:A<W&&F>=W&&(le=W-1),le!==-1&&(E(),S(le),requestAnimationFrame(x)),i(F,!1,!1,350))},[i,c,x,S,E]),{onMouseDown:D,...k}=xr({allowDragDrop:t,containerRef:n,draggableClassName:`tabstrip-${s}`,onDrop:v,orientation:"horizontal",itemQuery:".vuuOverflowContainer-item"}),y=(0,ae.useCallback)((A,F,W,le)=>{console.log(`handleExitEditMode ${A} ${F} ${W} ${le}`),u==null||u(A,F,W,le),W||i(le,!1,!0)},[i,u]),L=(0,ae.useCallback)((A,F)=>{f(A,F),T(A,F)},[f,T]),I=(0,ae.useCallback)((A=g)=>{let F=Ni(n.current,A);if(F)return F.querySelector(".vuuEditableLabel")},[n,g]),P=(0,ae.useCallback)((A=g)=>{let F=I(A);return F?F.classList.contains("vuuEditableLabel-editing"):!1},[I,g]),N=(0,ae.useCallback)((A=g)=>{let F=I(A);if(F){let W=new MouseEvent("dblclick",{view:window,bubbles:!0,cancelable:!0});F.dispatchEvent(W)}},[I,g]),R=(0,ae.useCallback)(A=>{p(A),A.defaultPrevented||b(A),!A.defaultPrevented&&Ii(A.key)&&N()},[N,p,b]),H=(0,ae.useCallback)(A=>{let F=Ko(n.current),W=F>A?F-1:F===A?0:F;return E(),l==null||l(A,W),setTimeout(()=>{x()},200),!0},[n,l,x,E]),$=(0,ae.useCallback)(A=>(N(A),!0),[N]),O=(0,ae.useCallback)(A=>{if(Cr(A.options))switch(A.menuId){case"close-tab":return H(A.options.tabIndex);case"rename-tab":return $(A.options.tabIndex);default:console.log(`tab menu action ${A.menuId}`)}return!1},[H,$]),K=(0,ae.useCallback)(()=>{P()?h(g):i(g)},[g,i,h,P]),z=(0,ae.useCallback)(A=>{let F=parseInt(A.index);isNaN(F)||S(F)},[S]),G={onFocus:C.onFocus,onKeyDown:R},_=(0,ae.useCallback)(()=>{a==null||a(),requestAnimationFrame(()=>{let A=Ko(n.current);A!==-1&&i(A)})},[n,i,a]),Y={onClick:L,onKeyDown:R,onExitEditMode:y,onMenuAction:O,onMenuClose:K,onMouseDown:D};return{activeTabIndex:w,containerStyle:M,focusVisible:C.focusVisible,containerProps:{...C.containerProps,onSwitchWrappedItemIntoView:z},navigationProps:G,onClickAddTab:_,tabProps:Y,...k}};var Tt=require("react/jsx-runtime"),Vr=require("react"),Bo="vuuTabstrip",Br=({activeTabIndex:e,allowAddTab:t,allowCloseTab:o,allowDragDrop:n=!1,allowRenameTab:r=!1,animateSelectionThumb:a=!1,children:l,className:u,id:c,keyBoardActivation:s="manual",location:d,onActiveChange:m,onAddTab:i,onCloseTab:g,onExitEditMode:f,onMoveTab:p,orientation:h="horizontal",showTabMenuButton:C,style:S,...T})=>{let b=(0,vt.useRef)(null),{activeTabIndex:w,focusVisible:M,containerStyle:x,draggedItemIndex:E,onClickAddTab:v,tabProps:D,...k}=$r({activeTabIndex:e,allowDragDrop:n,animateSelectionThumb:a,containerRef:b,keyBoardActivation:s,onActiveChange:m,onAddTab:i,onCloseTab:g,onExitEditMode:f,onMoveTab:p,orientation:h}),y=(0,yt.useId)(c),L=(0,Kr.default)(Bo,`${Bo}-${h}`,u),I=S||x?{...S,...x}:void 0,P=(0,vt.useMemo)(()=>(0,yt.asReactElements)(l).map((N,R)=>{let{id:H=`${y}-tab-${R}`,closeable:$=o,editable:O=r,showMenuButton:K=C}=N.props,z=R===w;return vt.default.cloneElement(N,{...D,...k.navigationProps,closeable:$,"data-overflow-priority":z?"1":void 0,dragging:E===R,editable:O,focusVisible:M===R,id:H,index:R,key:R,location:d,selected:z,showMenuButton:K,tabIndex:z?0:-1})}).concat(t?(0,Vr.createElement)(Fr.Button,{...k.navigationProps,"aria-label":"Create Tab",className:`${Bo}-addTabButton`,"data-icon":"add","data-overflow-priority":"1",key:"addButton",onClick:v,variant:"secondary",tabIndex:-1}):[]),[w,t,o,r,l,M,y,d,v,C,D,E,k.navigationProps]);return(0,Tt.jsxs)(Tt.Fragment,{children:[(0,Tt.jsx)(yt.OverflowContainer,{...T,...k.containerProps,className:L,height:28,id:y,orientation:h,overflowIcon:"more-horiz",ref:b,style:I,children:P}),k.draggable]})};var Gr=require("@salt-ds/core"),Zr=V(require("classnames")),je=require("react");var Ur=require("react"),zr=V(require("classnames"));var Wr=require("react/jsx-runtime"),Hi="vuuTabMenu",_r=({allowClose:e,allowRename:t,location:o,onMenuAction:n,onMenuClose:r,index:a})=>{let[l,u]=(0,Ur.useMemo)(()=>[(c,s)=>{let d=[];return t&&d.push(Lr(s)),e&&d.push(Sr(s)),d},{tabIndex:a}],[e,t,a]);return(0,Wr.jsx)(cr,{className:Hi,menuBuilder:l,menuActionHandler:n,menuLocation:(0,zr.default)("tab",o),menuOptions:u,onMenuClose:r,tabIndex:-1})};var Ye=require("react/jsx-runtime"),Xe="vuuTab",qr=()=>{},Bt=(0,je.forwardRef)(function({ariaControls:t,children:o,className:n,closeable:r=!1,dragging:a,editable:l=!1,editing:u,focusVisible:c,index:s=-1,label:d,location:m,onClick:i,onClose:g,onEnterEditMode:f=qr,onExitEditMode:p=qr,onFocus:h,onKeyUp:C,onMenuAction:S,onMenuClose:T,orientation:b,selected:w,showMenuButton:M=r||l,tabIndex:x,...E},v){if(M&&typeof S!="function")throw Error("Tab onMenuAction must be provided if showMenuButton is set");let D=(0,je.useRef)(null),k=(0,je.useRef)(null),y=(0,Gr.useForkRef)(v,D),L=(0,je.useCallback)(H=>{u||(H.preventDefault(),i==null||i(H,s))},[u,s,i]),I=(H="",$="",O=!0)=>p(H,$,O,s),P=H=>{switch(H.key){case"Backspace":case"Delete":r&&(H.stopPropagation(),g&&g(s));break;default:C&&C(H,s)}},N=()=>l?(0,Ye.jsx)(Er,{editing:u,defaultValue:d,onEnterEditMode:f,onExitEditMode:I,ref:k},d):d,R=H=>{if(k.current){let O=k.current.querySelector(".vuuEditableLabel-input");O==null||O.focus()}h==null||h(H)};return(0,Ye.jsxs)("div",{...E,"aria-controls":t,"aria-selected":w,className:(0,Zr.default)(Xe,{[`${Xe}-closeable`]:r,"vuuDraggable-dragAway":a,[`${Xe}-editing`]:u,[`${Xe}-selected`]:w||void 0,[`${Xe}-vertical`]:b==="vertical",vuuFocusVisible:c}),onClick:L,onFocus:R,onKeyUp:P,ref:y,role:"tab",tabIndex:x,children:[(0,Ye.jsx)("div",{className:`${Xe}-main`,children:(0,Ye.jsx)("span",{className:`${Xe}-text`,"data-text":l?void 0:d,children:o!=null?o:N()})}),M?(0,Ye.jsx)(_r,{allowClose:r,allowRename:l,location:m,onMenuAction:S,onMenuClose:T,index:s}):null]})});var po=require("@salt-ds/core"),mo=V(require("classnames")),fo=require("react");function Pi(e){var t;if(e){let o=e.dataset.idx;if(o)return parseInt(o,10);if(o=(t=e.ariaPosInSet)!=null?t:"-1")return parseInt(o,10)-1}}var Vo=e=>e.closest("[data-idx],[aria-posinset]");var Jr=e=>Pi(Vo(e));var xt=require("react"),Ri=new Set(["/","-","."]),ki=e=>Ri.has(e),Xr=(e,t)=>t.startsWith(e)&&ki(t[e.length]),Yr=(e,t="root",{collapsibleHeaders:o=void 0,defaultExpanded:n=!1,revealSelected:r=!1}={})=>{let a=(i,g,f)=>{if(i.childNodes)return i.childNodes.length;if(i.header){let p=f+1,h=0;for(;p<g.length&&!g[p].header;)h++,p++;return h}else return 0},l=(0,xt.useCallback)(i=>Array.isArray(r)?r.some(g=>Xr(i,g)):n,[n,r]),u=(0,xt.useCallback)((i,g,f=1,p="",h=[],C=[])=>{let S=0;return i.forEach((T,b,w)=>{var I;let M=T.header&&o,x=T.childNodes&&o===!1,E=!T.childNodes||T.childNodes.length===0,v=x||E&&!M,D=p?`${p}.${b}`:`${b}`,k=(I=T.id)!=null?I:`${t}-${D}`,y=v?void 0:l(k),L={...T,childNodes:void 0,id:k,count:!x&&y===void 0?0:a(T,w,b),expanded:y,index:g.index,level:f};if(h.push(L),C.push(i[b]),S+=1,g.index+=1,T.childNodes){let[P,N]=u(T.childNodes,g,f+1,D,[],C);L.childNodes=N,(y===!0||x)&&(S+=P)}}),[S,h,C]},[o,t,l]),[c,s,d]=(0,xt.useMemo)(()=>u(e,{index:0}),[u,e]),m=(0,xt.useCallback)((i,g=s)=>{let f=g.find(p=>{var h;return p.id===i||((h=p==null?void 0:p.childNodes)==null?void 0:h.length)&&Xr(p.id,i)});if((f==null?void 0:f.id)===i)return d[f.index];if(f)return m(i,f.childNodes)},[d,s]);return[c,s,m]};var Ke=require("react"),es=require("@salt-ds/core"),jr="single",Oi="checkbox",Ai="multi",$i="extended",Fi=["Enter"," "],Qr={},Ki=e=>e.expanded!==void 0,ts=e=>e&&e!=="none",os=({defaultSelected:e,highlightedIdx:t,treeNodes:o,onChange:n,selected:r,selection:a=jr,selectionKeys:l=Fi})=>{let u=a===jr,c=a===Ai||a.startsWith(Oi),s=a===$i,d=(0,Ke.useRef)(-1),m=(0,Ke.useCallback)(b=>l.includes(b.key),[l]),[i,g]=(0,es.useControlled)({controlled:r,default:e!=null?e:[],name:"selected"}),f=(0,Ke.useCallback)((b,w,M,x,E=!1)=>{let{current:v}=d,D=i==null?void 0:i.includes(M),y=u||s&&!E&&(!x||v===-1),L=c||s&&E&&!x,I=[];if(y&&D)I=[];else if(y)I=[M];else if(L&&D)I=i.filter(P=>P!==M);else if(L)I=i.concat(M);else if(s){let[P,N]=w>v?[v,w]:[w,v];I=i.slice();for(let R=P;R<=N;R++){let{id:H}=o[R];i.includes(H)||I.push(H)}}g(I),n&&n(b,I)},[s,o,c,n,i,g,u]),p=(0,Ke.useCallback)(b=>{if(~t&&m(b)){b.preventDefault();let w=o[t];f(b,t,w.id,!1,b.ctrlKey||b.metaKey),s&&(d.current=t)}},[s,t,o,m,f]),h=(0,Ke.useCallback)((b,w)=>{if(s&&b.shiftKey){let M=o[w];f(b,w,M.id,!0)}},[s,o,f]),C=a==="none"?Qr:{onKeyDown:p,onKeyboardNavigation:h},S=(0,Ke.useCallback)(b=>{if(t!==-1){let w=o[t];Ki(w)||(b.preventDefault(),b.stopPropagation(),f(b,t,w.id,b.shiftKey,b.ctrlKey||b.metaKey),s&&(d.current=t))}},[s,t,o,f]);return{listHandlers:C,listItemHandlers:a==="none"?Qr:{onClick:S},selected:i,setSelected:g}};var ce=require("react");var et=require("react");var Qe=new Map,rs=(e,t,o)=>{switch(o){case"height":return t.height;case"clientHeight":return e.clientHeight;case"clientWidth":return e.clientWidth;case"contentHeight":return t.contentHeight;case"contentWidth":return t.contentWidth;case"scrollHeight":return Math.ceil(e.scrollHeight);case"scrollWidth":return Math.ceil(e.scrollWidth);case"width":return t.width;default:return 0}};var ns=new ResizeObserver(e=>{for(let t of e){let{target:o,borderBoxSize:n,contentBoxSize:r}=t,a=Qe.get(o);if(a){let[{blockSize:l,inlineSize:u}]=n,[{blockSize:c,inlineSize:s}]=r,{onResize:d,measurements:m}=a,i=!1;for(let[g,f]of Object.entries(m)){let p=rs(o,{height:l,width:u,contentHeight:c,contentWidth:s},g);p!==f&&(i=!0,m[g]=p)}i&&d&&d(m)}}});function ss(e,t,o,n=!1){let r=(0,et.useRef)(t),a=(0,et.useCallback)(l=>{let{width:u,height:c}=l.getBoundingClientRect(),{clientWidth:s,clientHeight:d}=l;return r.current.reduce((m,i)=>(m[i]=rs(l,{width:u,height:c,contentHeight:d,contentWidth:s},i),m),{})},[]);(0,et.useEffect)(()=>{let l=e.current;async function u(){Qe.set(l,{measurements:{}}),await document.fonts.ready;let c=Qe.get(l);if(c){let s=a(l);c.measurements=s,ns.observe(l),n&&o(s)}else console.log("%cuseResizeObserver an target expected to be under observation wa snot found. This warrants investigation","font-weight:bold; color:red;")}if(l){if(Qe.has(l))throw Error("useResizeObserver attemping to observe same element twice");u()}return()=>{l&&Qe.has(l)&&(ns.unobserve(l),Qe.delete(l))}},[a,e]),(0,et.useEffect)(()=>{let l=e.current,u=Qe.get(l);if(u){if(r.current!==t){r.current=t;let c=a(l);u.measurements=c}u.onResize=o}},[t,a,e,o])}var Bi=["height","scrollHeight"],as=(e,t,o=!1)=>{let n=(0,ce.useRef)(0),r=(0,ce.useRef)(!1),a=(0,ce.useRef)(0),l=(0,ce.useRef)(0),u=(0,ce.useCallback)(d=>{let m=d.ariaExpanded?d.firstChild:d,i=o?30:0,g=m.offsetTop,f=m.offsetHeight,p=n.current+i,h=p+a.current-i;(g+f>h||g<p)&&(n.current=g+f>h?n.current+(g+f)-h:g-i,r.current=!0,e.current&&(e.current.scrollTop=n.current),setTimeout(()=>{r.current=!1}))},[e,o]),c=(0,ce.useCallback)(d=>{n.current=d.target.scrollTop},[]);(0,ce.useEffect)(()=>{let{current:d}=e;return d&&d.addEventListener("scroll",c),()=>{d&&d.removeEventListener("scroll",c)}},[e,c]),(0,ce.useLayoutEffect)(()=>{if(t!==-1&&l.current>a.current&&e.current){let d=e.current.querySelector(`
|
|
1
|
+
"use strict";var Na=Object.create;var Oo=Object.defineProperty;var Ra=Object.getOwnPropertyDescriptor;var Pa=Object.getOwnPropertyNames;var ka=Object.getPrototypeOf,Aa=Object.prototype.hasOwnProperty;var Oa=(e,t)=>{for(var o in t)Oo(e,o,{get:t[o],enumerable:!0})},Sr=(e,t,o,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of Pa(t))!Aa.call(e,r)&&r!==o&&Oo(e,r,{get:()=>t[r],enumerable:!(n=Ra(t,r))||n.enumerable});return e};var X=(e,t,o)=>(o=e!=null?Na(ka(e)):{},Sr(t||!e||!e.__esModule?Oo(o,"default",{value:e,enumerable:!0}):o,e)),Fa=e=>Sr(Oo({},"__esModule",{value:!0}),e);var Md={};Oa(Md,{ConnectionStatusIcon:()=>Ka,ContextPanel:()=>br,DEFAULT_DENSITY:()=>zl,DEFAULT_THEME:()=>_l,DEFAULT_THEME_MODE:()=>Gl,DensitySwitch:()=>Ua,Feature:()=>Nn,LeftNav:()=>ud,LoginPanel:()=>dd,SaveLayoutPanel:()=>Ga,SessionEditingForm:()=>gd,Shell:()=>vd,ShellContextProvider:()=>Ed,ThemeContext:()=>vn,ThemeProvider:()=>Tn,ThemeSwitch:()=>gr,getAuthDetailsFromCookies:()=>md,getAuthModeFromCookies:()=>Zl,logout:()=>mr,redirectToLogin:()=>Jl,useShellContext:()=>Cd,useShellLayout:()=>yr,useThemeAttributes:()=>je});module.exports=Fa(Md);var Ut=X(require("react")),Er=X(require("classnames"));var vt=require("react/jsx-runtime"),Ka=({connectionStatus:e,className:t,element:o="span",...n})=>{let[r,s]=(0,Ut.useState)("vuuConnectingStatus");(0,Ut.useEffect)(()=>{switch(e){case"connected":case"reconnected":s("vuuActiveStatus");break;case"connecting":s("vuuConnectingStatus");break;case"disconnected":s("vuuDisconnectedStatus");break;default:break}},[e]);let a=Ut.default.createElement(o,{...n,className:(0,Er.default)("vuuStatus vuuIcon",r,t)});return(0,vt.jsx)(vt.Fragment,{children:(0,vt.jsxs)("div",{className:"vuuStatus-container salt-theme",children:[a,(0,vt.jsxs)("div",{className:"vuuStatus-text",children:["Status: ",e.toUpperCase()]})]})})};var Cr=require("@salt-ds/lab"),Mr=require("react"),wr=X(require("classnames")),Lr=require("react/jsx-runtime"),$a="vuuDensitySwitch",Ba=["high","medium","low","touch"],Va="high",Ua=({className:e,defaultDensity:t=Va,onChange:o})=>{let n=(0,Mr.useCallback)((s,a)=>{o(a)},[o]),r=(0,wr.default)($a,e);return(0,Lr.jsx)(Cr.Dropdown,{className:r,source:Ba,defaultSelected:t,onSelectionChange:n})};var ct=X(require("react")),Pr=require("@vuu-ui/vuu-layout");var Dr=X(require("react")),Tt=require("react/jsx-runtime"),Fo=class extends Dr.default.Component{constructor(t){super(t),this.state={errorMessage:null}}static getDerivedStateFromError(t){return{errorMessage:t.message}}componentDidCatch(t,o){console.log(t,o)}render(){return this.state.errorMessage?(0,Tt.jsxs)(Tt.Fragment,{children:[(0,Tt.jsx)("h1",{children:"Something went wrong."}),(0,Tt.jsx)("p",{children:this.state.errorMessage})]}):this.props.children}};var Nr=require("react/jsx-runtime"),Hr=()=>(0,Nr.jsx)("div",{className:"hwLoader",children:"loading"});var Rr=async e=>{let t=new CSSStyleSheet;return fetch(e).then(o=>o.text()).then(o=>t.replace(o))};var fo=require("react/jsx-runtime"),Ko=new Map,za=e=>((0,ct.useEffect)(()=>()=>{Ko.delete(e)},[e]),Ko.has(e)||Ko.set(e,ct.default.lazy(()=>import(e))),Ko.get(e));function _a({url:e,css:t,params:o,...n}){console.log("Feature render",{css:t,url:e,props:n}),(0,ct.useEffect)(()=>(console.log("%cFeature mount","color: green;"),()=>{console.log("%cFeature unmount","color:red;")}),[]),t&&Rr(t).then(s=>{document.adoptedStyleSheets=[...document.adoptedStyleSheets,s]});let r=za(e);return(0,fo.jsx)(Fo,{children:(0,fo.jsx)(ct.Suspense,{fallback:(0,fo.jsx)(Hr,{}),children:(0,fo.jsx)(r,{...n,...o})})})}var Nn=ct.default.memo(_a);Nn.displayName="Feature";(0,Pr.registerComponent)("Feature",Nn,"view");var kr=require("react/jsx-runtime"),Ga=()=>(0,kr.jsx)("div",{className:"vuuSaveLayoutPanel",children:"save layout"});var Ar=require("react"),ae=require("react/jsx-runtime"),Rn=(0,Ar.memo)(()=>(0,ae.jsxs)("svg",{width:"44",height:"45",viewBox:"0 0 44 45",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[(0,ae.jsxs)("g",{clipPath:"url(#clip0_217_6990)",children:[(0,ae.jsx)("path",{d:"M39.8642 15.5509L35.9196 7.58974L34.3369 6.85464L24.6235 22.0825L39.1628 30.618L42.3152 25.6347L39.8642 15.5509Z",fill:"url(#paint0_linear_217_6990)"}),(0,ae.jsx)("path",{d:"M42.6246 24.8716C41.9199 25.9157 40.9625 26.824 39.767 27.4905C38.424 28.2396 36.9563 28.597 35.5081 28.597C32.7541 28.597 30.0715 27.3094 28.4466 24.9855L15.772 3.90967L15.7655 3.9206C13.3615 0.137431 8.25372 -1.13143 4.24754 1.10507C0.178173 3.37435 -1.20852 8.39359 1.14854 12.3125L18.3445 40.9095C19.1108 42.1846 20.1816 43.1834 21.4144 43.8764C21.4241 43.8826 21.4338 43.8889 21.4435 43.8951C21.4484 43.8982 21.4549 43.9013 21.4597 43.9045C22.0332 44.2228 22.6423 44.471 23.2725 44.6536C23.3194 44.6677 23.368 44.6817 23.415 44.6942C23.6418 44.7551 23.8702 44.8097 24.1019 44.8534C24.1456 44.8612 24.1894 44.8659 24.2331 44.8737C24.4194 44.9049 24.6073 44.9314 24.7952 44.9501C24.8698 44.9579 24.9443 44.9658 25.0188 44.9704C25.2342 44.9876 25.4497 44.9985 25.6668 45.0001C25.6781 45.0001 25.6895 45.0001 25.6992 45.0001C25.7024 45.0001 25.704 45.0001 25.7073 45.0001C25.7105 45.0001 25.7121 45.0001 25.7154 45.0001C25.9503 45.0001 26.1868 44.9876 26.4217 44.9689C26.4751 44.9642 26.5286 44.9595 26.5837 44.9533C26.8137 44.9299 27.0438 44.9002 27.2738 44.8596C27.277 44.8596 27.2803 44.8596 27.2835 44.8596C27.5362 44.8144 27.7889 44.7551 28.0384 44.6864C28.0546 44.6817 28.0692 44.677 28.0854 44.6723C28.4483 44.5709 28.8063 44.4445 29.1594 44.2931C29.1659 44.29 29.174 44.2868 29.1805 44.2837C29.4494 44.1682 29.7151 44.0418 29.9759 43.8967C30.24 43.75 30.491 43.5908 30.7308 43.4206C30.9398 43.2739 31.1407 43.1179 31.3367 42.9524C31.5748 42.7495 31.8 42.5373 32.009 42.3141C32.1661 42.1471 32.3168 41.9723 32.4609 41.7913C32.5079 41.732 32.5517 41.6711 32.5954 41.6118C32.6942 41.4807 32.7882 41.3465 32.8789 41.2091C32.9259 41.1373 32.9728 41.0671 33.0182 40.9953C33.036 40.9672 33.0555 40.9407 33.0717 40.9126L42.7153 24.8763H42.6214L42.6246 24.8716Z",fill:"url(#paint1_linear_217_6990)"}),(0,ae.jsx)("path",{d:"M42.8402 16.4218L42.1112 15.2232L38.9636 9.58433L37.504 7.19644C37.2286 6.56123 36.579 6.11331 35.8176 6.11331C34.8083 6.11331 33.9919 6.90147 33.9919 7.87223C33.9919 8.20154 34.0907 8.50432 34.2543 8.76808L34.2349 8.78056L39.9048 18.0808C40.5884 19.2186 40.7715 20.5437 40.4199 21.8141C40.0684 23.0845 39.226 24.1458 38.045 24.806C37.2675 25.2398 36.3846 25.4693 35.4936 25.4693C33.6727 25.4693 31.9766 24.5281 31.0662 23.0143L22.9161 9.63271H22.9323L19.4899 3.90958L19.4834 3.92051C19.4235 3.8253 19.3538 3.73947 19.2907 3.64738L19.1935 3.48663C19.1935 3.48663 19.1854 3.49131 19.1821 3.49443C17.5654 1.27666 14.9799 0.0390178 12.3118 0.00936427V0H7.91199V0.02185C10.9851 -0.184164 14.0582 1.23296 15.7656 3.92051L15.7721 3.90958L28.4451 24.987C30.0699 27.3093 32.7542 28.5985 35.5066 28.5985C36.9548 28.5985 38.4225 28.2426 39.7655 27.4919C40.961 26.8255 41.9168 25.9156 42.6231 24.8731H42.717L42.6846 24.9261C43.1366 24.2347 43.4833 23.4731 43.7068 22.6615C44.2916 20.5452 43.9871 18.3352 42.8369 16.4234L42.8402 16.4218Z",fill:"#F37880"}),(0,ae.jsxs)("g",{opacity:"0.86",children:[(0,ae.jsx)("path",{d:"M34.2332 8.78212L39.9031 18.0824C40.5868 19.2202 40.7698 20.5452 40.4183 21.8156C40.2044 22.5897 39.8059 23.2858 39.2616 23.8617C39.9744 23.2343 40.4879 22.4243 40.7423 21.5035C41.0938 20.2331 40.9107 18.908 40.2271 17.7703L34.5572 8.46998L34.5767 8.4575C34.413 8.19374 34.3142 7.89096 34.3142 7.56165C34.3142 7.15586 34.4584 6.78285 34.6982 6.48476C34.2672 6.80626 33.9902 7.30881 33.9902 7.87379C33.9902 8.2031 34.0891 8.50588 34.2527 8.76964L34.2332 8.78212Z",fill:"white"}),(0,ae.jsx)("path",{d:"M42.6917 24.9169L42.6863 24.9256C42.6863 24.9256 42.6899 24.9187 42.6935 24.9152C42.6935 24.9152 42.6935 24.9152 42.6935 24.9169H42.6917Z",fill:"white"}),(0,ae.jsx)("path",{d:"M40.0911 27.1798C38.7481 27.9289 37.2804 28.2863 35.8322 28.2863C33.0782 28.2863 30.3955 26.9988 28.7707 24.6749L16.0961 3.59744L16.0896 3.60837C14.9281 1.78077 13.1364 0.543128 11.1422 0H7.91199V0.02185C10.9851 -0.184164 14.0582 1.23296 15.7656 3.92051L15.7721 3.90958L28.4451 24.987C30.0699 27.3093 32.7542 28.5985 35.5066 28.5985C36.9548 28.5985 38.4225 28.2426 39.7655 27.4919C40.4815 27.0924 41.1084 26.6055 41.6511 26.0561C41.1862 26.479 40.6662 26.8583 40.0894 27.1798H40.0911Z",fill:"white"})]})]}),(0,ae.jsxs)("defs",{children:[(0,ae.jsxs)("linearGradient",{id:"paint0_linear_217_6990",x1:"24.6235",y1:"18.7363",x2:"42.3152",y2:"18.7363",gradientUnits:"userSpaceOnUse",children:[(0,ae.jsx)("stop",{stopColor:"#4906A5"}),(0,ae.jsx)("stop",{offset:"1",stopColor:"#D3423A"})]}),(0,ae.jsxs)("linearGradient",{id:"paint1_linear_217_6990",x1:"-2.35794e-05",y1:"22.5009",x2:"42.7186",y2:"22.5009",gradientUnits:"userSpaceOnUse",children:[(0,ae.jsx)("stop",{stopColor:"#7C06A5"}),(0,ae.jsx)("stop",{offset:"1",stopColor:"#D3423A"})]}),(0,ae.jsx)("clipPath",{id:"clip0_217_6990",children:(0,ae.jsx)("rect",{width:"44",height:"45",fill:"white"})})]})]}));Rn.displayName="VuuLogo";var Ft=require("@vuu-ui/vuu-layout");var zt=require("react"),Ja=require("react/jsx-runtime"),Wa={isDragSource:!1,isDropTarget:!1,register:()=>{}},qa=()=>console.log("have you forgotten to provide a DragDrop Provider ?"),Za=(0,zt.createContext)({registerDragDropParty:qa});var Or=e=>{var r,s;let{dragSources:t,dropTargets:o,registerDragDropParty:n}=(0,zt.useContext)(Za);if(e){let a=(r=t==null?void 0:t.has(e))!=null?r:!1,l=(s=o==null?void 0:o.has(e))!=null?s:!1;return{isDragSource:a,isDropTarget:l,register:n}}else return Wa};var pe=require("react");var $e=require("react");var Xa=["left","right"],Ya=["top","bottom"],$o=":not(.wrapped)",Fr=':not([aria-hidden="true"])',Kr=e=>{let t=e.cloneNode(!0);return t.removeAttribute("id"),t.dataset.index="-1",t},ja=(e,t="width",o=!1)=>{let n=t==="width"?"left":"top",{[t]:r,[n]:s}=e.getBoundingClientRect(),{padEnd:a=!1,padStart:l=!1}=e.dataset,c=getComputedStyle(e),[i,d]=t==="width"?Xa:Ya,m=l&&!o?0:parseInt(c.getPropertyValue(`margin-${i}`),10),u=a&&!o?0:parseInt(c.getPropertyValue(`margin-${d}`),10),h=r;if(parseInt(c.getPropertyValue("flex-shrink"),10)>0){let f=parseInt(c.getPropertyValue("flex-basis"),10);!isNaN(f)&&f>0&&(h=f)}return[s,m+h+u]},Qa={horizontal:{CLIENT_POS:"clientX",CLIENT_SIZE:"clientWidth",CONTRA:"top",CONTRA_CLIENT_POS:"clientY",CONTRA_END:"bottom",CONTRA_POS:"y",DIMENSION:"width",END:"right",POS:"x",SCROLL_POS:"scrollLeft",SCROLL_SIZE:"scrollWidth",START:"left"},vertical:{CLIENT_POS:"clientY",CLIENT_SIZE:"clientHeight",CONTRA:"left",CONTRA_CLIENT_POS:"clientX",CONTRA_END:"right",CONTRA_POS:"x",DIMENSION:"height",END:"bottom",POS:"y",SCROLL_POS:"scrollTop",SCROLL_SIZE:"scrollHeight",START:"top"}},ke=e=>Qa[e],$r=(e,t)=>{let o=e.find(n=>n.id===t);if(o)return o},Br=(e,t)=>{e.splice(t,1);for(let o=t;o<e.length;o++)e[o].currentIndex-=1},_t=(e,t,o,n,r)=>{var m;let s=[],{DIMENSION:a}=ke(t),l=Array.from(o?e.querySelectorAll(o):e.children),c=l.length,i=typeof(n==null?void 0:n.from)=="number"?n.atEnd?Math.max(0,n.from-1):n.from:0,d=typeof(n==null?void 0:n.to)=="number"?Math.min(n.to+2,c-1):c-1;for(let u=i;u<=d;u++){let h=l[u],[p,f]=ja(h,a),b=u===c-1,E=h.id,C=parseInt((m=h.dataset.index)!=null?m:"-1");s.push({currentIndex:u,dataIndex:isNaN(C)?-1:C,id:E,index:u,isDraggedItem:r===E,isLast:b,isOverflowIndicator:h.dataset.index==="overflow",element:h,start:p,end:p+f,size:f,mid:p+f/2})}return s},Gt=(e,t=!1)=>{let o=e.findIndex(r=>r.isDraggedItem),{index:n}=e[o];if(t){let r=e.filter(a=>!a.isDraggedItem).reduce((a,l)=>Math.min(a,l.index),Number.MAX_SAFE_INTEGER);if(r>0&&!(n===0&&r===1))return r+o}return o},Pn=(e,t)=>{let o=Gt(e),n=t==="fwd"?o+1:o-1;if(n<0||n>=e.length)throw Error("switchDropTargetPosition index out of range");let r=e.at(o),s=e.at(n),a=s.size-r.size;if(t==="fwd"){let l=s.start+a,c=s.end,i={...r,start:l,mid:Math.floor(l+(c-l)/2),end:c},d=r.start,m=r.end+a,u={...s,start:d,mid:Math.floor(d+(m-d)/2),end:m};e.splice(o,2,u,i)}else{let l=s.start,c=s.end-a,i={...r,start:l,mid:Math.floor(l+(c-l)/2),end:c},d=r.start-a,m=r.end,u={...s,start:d,mid:Math.floor(d+(m-d)/2),end:m};e.splice(n,2,i,u)}},Wt=(e,t,o)=>{let n=e.length,r=Gt(e),s=e[r];if(o==="fwd"){let a=Math.round(t+s.size);for(let l=n-1;l>=0;l--){let c=e[l];if(a>c.mid)return l<r?s:c}}else{let a=Math.round(t);for(let l=0;l<n;l++){let c=e[l];if(a<c.mid)return l>r?s:c}}throw Error("no dropTraget identified")};function Vr(e,t){let{height:o,left:n,top:r,width:s}=e,{height:a,width:l}=t;return{height:Math.min(o,a),left:n,top:r,width:Math.min(s,l)}}var Ns=require("@salt-ds/core"),Rs=X(require("classnames")),Wo=require("react");var oc=require("@salt-ds/lab"),qr=require("@salt-ds/core"),nc=X(require("classnames")),kn=require("react");var go=require("react"),Gr=X(require("react-dom"));var Ur=X(require("react-dom")),zr=X(require("classnames")),ec=1,tc=({className:e,dataMode:t,x:o=0,y:n=0,win:r=window})=>{let s=r.document.createElement("div");return s.className=(0,zr.default)(`vuuPopup ${ec++}`,e),s.style.cssText=`left:${o}px; top:${n}px;`,t&&(s.dataset.mode=t),r.document.body.appendChild(s),s},_r=e=>tc(e),Bo=(e,t,o,n,r)=>{t.style.cssText=`left:${o}px; top:${n}px;position: absolute;`,Ur.render(e,t,r)};var Wr=X(require("classnames")),ho=function({children:t,x:o=0,y:n=0,onRender:r}){let[s,a,l]=je(),c=(0,go.useMemo)(()=>_r({className:(0,Wr.default)(s,a),dataMode:l}),[l,a,s]);return(0,go.useLayoutEffect)(()=>{Bo(t,c,o,n,r)},[t,r,c,o,n]),(0,go.useLayoutEffect)(()=>()=>{var i;c&&(Gr.unmountComponentAtNode(c),c.classList.contains("vuuPopup")&&((i=c.parentElement)==null||i.removeChild(c)))},[c]),null};var Zr=require("react/jsx-runtime");var Et=require("react");var et=X(require("react")),Fn=X(require("classnames")),rs=require("@vuu-ui/vuu-layout");var De=require("react");var Jr=e=>e.closest("[data-root='true']")!==null,Xr=(e,t)=>{var o;return e.ariaHasPopup==="true"&&((o=e.dataset)==null?void 0:o.idx)===`${t}`||e.querySelector(`:scope > [data-idx='${t}'][aria-haspopup='true']`)!==null};function rc(e,...t){let o=new Set(e);for(let n of t)for(let r of n)o.add(r);return o}var sc="Enter";var ic="Delete",lc=new Set([sc,ic]),ac=new Set(["Tab"]),cc=new Set(["ArrowRight","ArrowLeft"]),Yr=new Set(["Home","End","ArrowDown","ArrowUp"]),jr=new Set(["Home","End","ArrowRight","ArrowLeft"]),uc=new Set(["F1","F2","F3","F4","F5","F6","F7","F8","F9","F10","F11","F12"]),Mm=rc(lc,jr,Yr,cc,uc,ac);var Qr=({key:e},t="vertical")=>(t==="vertical"?Yr:jr).has(e);var es=({autoHighlightFirstItem:e=!1,count:t,highlightedIndex:o,onActivate:n,onHighlight:r,onCloseMenu:s,onOpenMenu:a})=>{let l=(0,De.useRef)((o!=null?o:e)?0:-1),[,c]=(0,De.useState)(null),i=o!==void 0,d=(0,De.useCallback)(v=>{l.current=v,r==null||r(v),c({})},[r]),m=(0,De.useCallback)(v=>{v!==l.current&&(i||d(v))},[i,d]),u=(0,De.useRef)(!0),h=(0,De.useRef)(!1),p=v=>h.current=v,f=i?o:l.current,b=(0,De.useCallback)(v=>{let I=dc(t,v.key,l.current);I!==l.current&&m(I)},[t,m]),E=(0,De.useCallback)(v=>{if(Qr(v))v.preventDefault(),v.stopPropagation(),u.current=!0,b(v);else if((v.key==="ArrowRight"||v.key==="Enter")&&Xr(v.target,f)){let L=v.target.querySelector(`:scope > [data-idx='${f}']`);L&&(a==null||a(L))}else v.key==="ArrowLeft"&&!Jr(v.target)?s(f):v.key==="Enter"?n&&n(f):v.key==="Tab"&&s(-1)},[f,b,n,s,a]),C=(0,De.useMemo)(()=>({onFocus:()=>{f===-1&&d(0)},onKeyDown:E,onMouseDownCapture:()=>{u.current=!1,p(!0)},onMouseMove:()=>{u.current&&(u.current=!1)},onMouseLeave:()=>{u.current=!0,p(!1),m(-1)}}),[E,f,d,m]);return{focusVisible:u.current?f:-1,controlledHighlighting:i,highlightedIndex:f,setHighlightedIndex:m,listProps:C,setIgnoreFocus:p}};function dc(e,t,o){return t==="ArrowUp"?o>0?o-1:o:o===null?0:o===e-1?o:o+1}var St=X(require("react"));var An=e=>e.type===Vo||!!e.props["data-group"],mc=e=>{if(Array.isArray(e)&&On(e[0]))return e[0]},pc=(e,t,o,n=!1)=>{let{props:{children:r}}=e;return{childWithId:St.default.cloneElement(e,{hasSeparator:n,id:`${t}`,key:t,children:o?mc(r):r}),grandChildren:o?r:void 0}},ts=(e,t)=>{let o=(0,St.useCallback)(()=>{let s=(a,l=t,c={},i={})=>{let d=c[l]=[],m=0,u=!1;return St.default.Children.forEach(a,h=>{if(!On(h))if(h.type===os)u=!0;else{let p=An(h),f=`${l}-${m}`,{props:{action:b,options:E}}=h,{childWithId:C,grandChildren:v}=pc(h,f,p,u);d.push(C),v?s(v,f,c,i):i[f]={action:b,options:E},m+=1,u=!1}}),[c,i]};return s(e)},[t,e]),[n,r]=(0,St.useMemo)(()=>o(),[o]);return[n,r]};var Qe=require("react/jsx-runtime"),ns="vuuMenuList",os=()=>(0,Qe.jsx)("li",{className:"vuuMenuItem-divider"}),Vo=()=>null,Uo=({children:e,idx:t,...o})=>(0,Qe.jsx)("div",{...o,children:e}),ss=({children:e})=>(0,Qe.jsx)(Qe.Fragment,{children:e});ss.displayName="MenuItemLabel";Uo.Label=ss;var fc=e=>et.default.isValidElement(e)&&typeof e.type!="string"&&"displayName"in e.type?e.type.displayName:void 0,On=e=>fc(e)==="MenuItemLabel",gc=e=>e.props["data-icon"],is=({activatedByKeyboard:e,childMenuShowing:t,children:o,className:n,highlightedIdx:r,id:s,isRoot:a,listItemProps:l,onHighlightMenuItem:c,onActivate:i,onCloseMenu:d,onOpenMenu:m,...u})=>{let h=(0,rs.useId)(s),p=(0,et.useRef)(null),f=(0,et.useMemo)(()=>new Map,[]),b=S=>{var y;let x=(y=p.current)==null?void 0:y.querySelector(`:scope > [data-idx='${S}']`);x!=null&&x.id&&(i==null||i(x.id))},{focusVisible:E,highlightedIndex:C,listProps:v}=es({count:et.default.Children.count(o),highlightedIndex:r,onActivate:b,onHighlight:c,onOpenMenu:m,onCloseMenu:d}),I=t==null?E:-1;(0,et.useLayoutEffect)(()=>{var S;t===void 0&&e&&((S=p.current)==null||S.focus())},[e,t]);let L=()=>C===void 0||C===-1?void 0:f.get(C);function M(){let S={...l,role:"menuitem"},x=(O,g,w)=>g?[(0,Qe.jsx)("span",{className:"vuuIconContainer","data-icon":w},"icon")].concat(O):O;function y(O,g,w,N){var G;let{children:k,className:R,"data-icon":T,id:H,hasSeparator:A,label:P,...F}=g.props,B=An(g),_=B&&t===H,V=_?`${h}-${H}`:void 0;O.push((0,Qe.jsx)(Uo,{...F,...S,...hc(H,w,(G=g.key)!=null?G:H,C,I,R,A),"aria-controls":V,"aria-haspopup":B||void 0,"aria-expanded":_||void 0,children:x(B&&P!=null?P:k,N,T)}))}let D=[];if(o.length>0){let O=o.some(gc);o.forEach((g,w)=>{y(D,g,w,O)})}return D}return(0,Qe.jsx)("div",{...u,...v,"aria-activedescendant":L(),className:(0,Fn.default)(ns,n,{[`${ns}-childMenuShowing`]:t!==void 0}),"data-root":a||void 0,id:h,ref:p,role:"menu",children:M()})},hc=(e,t,o,n,r,s,a)=>({id:`menuitem-${e}`,key:o!=null?o:t,"data-idx":t,"data-highlighted":t===n||void 0,className:(0,Fn.default)("vuuMenuItem",s,{"vuuMenuItem-separator":a,focusVisible:r===t})});is.displayName="MenuList";var ls=is;var ie=require("react");var Kn=e=>e==null?void 0:e.closest("[data-idx],[aria-posinset]");var cs=(e,t,o)=>e.map((n,r)=>r===e.length-1?{...n,[o]:n[o]-t}:n),bc=(e,t)=>cs(e,t,"left"),yc=(e,t)=>cs(e,t,"top"),Ic=(e,t)=>{let[o,n]=t.slice(-2),r=document.getElementById(`${e}-${n.id}`);if(r===null)throw Error(`useCascade.flipSides element with id ${n.id} not found`);let{width:s}=r.getBoundingClientRect();return t.map(a=>a===n?{...a,left:o.left-(s-2)}:a)},xc=(e,t)=>{let[{left:o,top:n}]=t.slice(-1),{offsetWidth:r,offsetTop:s}=e;return{left:o+r,top:s+n}},us=(e,t)=>{let o=e.lastIndexOf("-");return o>-1?e.slice(9,o):t},vc=e=>e.slice(9),as=({ariaExpanded:e,ariaHasPopup:t,id:o},n)=>{if(o.startsWith("menuitem"))return{hostMenuId:us(o,n),targetMenuId:vc(o),menuItemId:o,isGroup:t==="true",isOpen:e==="true"};throw Error(`getMenuItemDetails #${o} is not a menuitem`)},ds=({id:e,onActivate:t,onMouseEnterItem:o,position:{x:n,y:r}})=>{let[,s]=(0,ie.useState)({}),a=(0,ie.useRef)([{id:e,left:n,top:r}]),l=(0,ie.useCallback)(M=>a.current.findIndex(S=>S.id===M)!==-1,[]),c=(0,ie.useCallback)(M=>{let S=u.current[M];if(S===void 0)throw Error(`getOpenMenuState no entry for menu ${M}`);return S},[]),i=(0,ie.useCallback)(M=>{a.current=M,s({})},[]),d=(0,ie.useRef)(),m=(0,ie.useRef)(),u=(0,ie.useRef)({[e]:"no-popup"}),h=(0,ie.useCallback)((M=e,S,x=null)=>{if(M===e&&x===null)i([{id:e,left:n,top:r}]);else{u.current[M]="popup-open";let y=document.getElementById(x);if(y!==null){let{left:D,top:O}=xc(y,a.current);i(a.current.concat({id:S,left:D,top:O}))}else throw Error(`openMenu no menuItem ${x}`)}},[e,n,r,i]),p=(0,ie.useCallback)(M=>{if(M===e)i([]);else{let S=a.current.slice(),x=S.pop();u.current[x.id]="no-popup";let y=S.at(-1);y&&(u.current[y.id]="no-popup"),i(S)}},[e,i]),f=(0,ie.useCallback)(M=>{let S=a.current.slice(),x=M.slice(9),{id:y}=S.at(-1);for(;S.length>1&&!x.startsWith(y);){let D=us(y,e);S.pop(),u.current[y]="no-popup",u.current[D]="no-popup",{id:y}=S[S.length-1]}S.length<a.current.length&&i(S)},[e,i]),b=(0,ie.useCallback)(()=>{d.current&&(clearTimeout(d.current),d.current=void 0)},[]),E=(0,ie.useCallback)((M,S,x)=>{b(),d.current=window.setTimeout(()=>{console.log(`scheduleOpen<timeout> opening menu ${S} from menu ${M} via menuitem ${x}`),f(x),u.current[M]="popup-open",u.current[S]="no-popup",h(M,S,x)},400)},[b,f,h]),C=(0,ie.useCallback)((M,S,x)=>{console.log(`scheduleClose openMenuId ${S} from parent menu ${M} itemId ${x}`),u.current[S]="pending-close",m.current=window.setTimeout(()=>{f(x)},400)},[f]),v=(0,ie.useCallback)(()=>{let{current:M}=a,[S]=M.slice(-1),x=document.getElementById(S.id);if(console.log(`handle render ${JSON.stringify(S)} tabindex ${x==null?void 0:x.tabIndex}`),x){let{right:y,bottom:D}=x.getBoundingClientRect(),{clientHeight:O,clientWidth:g}=document.body;if(y>g){let w=M.length>1?Ic(e,M):bc(M,y-g);i(w)}else if(D>O){let w=yc(M,D-O);i(w)}typeof x.tabIndex=="number"&&(console.log(`focus el ${x.id}`),x.focus())}else console.log(`no element found with if ${S.id}`)},[e,i]),I=(0,ie.useCallback)(M=>{let{hostMenuId:S,targetMenuId:x,menuItemId:y,isGroup:D,isOpen:O}=as(M,e),{current:{[S]:g}}=u;if(console.log(`trigger child menu ${y}`),g==="no-popup"&&D)u.current[S]="popup-pending",E(S,x,y);else if(g==="popup-pending"&&!D)u.current[S]="no-popup",clearTimeout(d.current),d.current=void 0;else if(g==="popup-pending"&&D)clearTimeout(d.current),E(S,x,y);else if(g==="popup-open")if(l(x)){let w=c(x);switch(console.log({menuStatus:w}),f(y),w){case"pending-close":clearTimeout(m.current),m.current=void 0,u.current[x]="no-popup",b();break;default:}}else{let[w,N]=a.current.slice(-2);w.id===S&&u.current[N.id]!=="pending-close"?(C(S,N.id,y),D&&!O&&E(S,x,y)):w.id===S&&D&&y!==N.id&&u.current[N.id]==="pending-close"||D?E(S,x,y):u.current[N.id]!=="pending-close"&&f(y)}g==="pending-close"&&(b(),clearTimeout(m.current),m.current=void 0,u.current[S]="popup-open")},[b,f,c,l,e,C,E]),L=(0,ie.useMemo)(()=>({onMouseEnter:M=>{let S=Kn(M.target);I(S),o(M,S.id)},onClick:M=>{let S=Kn(M.target),{isGroup:x,menuItemId:y}=as(S,e);x?I(S):t(y)}}),[t,o,e,I]);return{closeMenu:p,handleRender:v,listItemProps:L,openMenu:I,openMenus:a.current}};var ms=require("@vuu-ui/vuu-layout"),bo=require("react/jsx-runtime"),ps=require("react"),Tc=()=>{},$n=({activatedByKeyboard:e,children:t,className:o,id:n,onClose:r=()=>{},position:s={x:0,y:0},style:a,...l})=>{let c=(0,Et.useRef)(r);c.current=r;let i=(0,ms.useId)(n),d=(0,Et.useRef)(Tc),[m,u]=ts(t,i),h=(0,Et.useRef)(e),p=(0,Et.useCallback)(()=>{h.current=!1},[]);console.log({actions:u,menus:m});let f=(0,Et.useCallback)(y=>{let D=y.slice(9),{action:O,options:g}=u[D];d.current(i),r({type:"menu-action",menuId:O,options:g})},[u,i,r]),{closeMenu:b,listItemProps:E,openMenu:C,openMenus:v,handleRender:I}=ds({id:`${i}`,onActivate:f,onMouseEnterItem:p,position:s});d.current=b;let L=()=>{console.log("handleCloseMenu"),h.current=!0,b()},M=()=>{},S=v.length-1,x=y=>{if(!(y>=S)){let{id:D}=v[y+1];return D}};return(0,bo.jsx)(bo.Fragment,{children:v.map(({id:y,left:D,top:O},g,w)=>{let N=x(g);return(0,bo.jsx)(ho,{x:D,y:O,onRender:I,children:(0,ps.createElement)(ls,{...l,activatedByKeyboard:h.current,childMenuShowing:N,className:o,id:y,isRoot:g===0,key:g,listItemProps:E,onActivate:f,onHighlightMenuItem:M,onCloseMenu:L,onOpenMenu:C,style:a,tabIndex:g===w.length-1?0:void 0},m[y])},g)})})};$n.displayName="ContextMenu";var zo=require("react"),Sc=require("react/jsx-runtime"),fs=(0,zo.createContext)(null);var Ts=require("@vuu-ui/vuu-utils"),Ss=X(require("classnames")),ut=require("react");var gs=X(require("classnames")),qt=X(require("react")),_o=X(require("react-dom"));var Bn=!1,Ae=[],hs=e=>(e==null?void 0:e.type)==="menu-action",bs=e=>(e==null?void 0:e.type)==="click-away";function ys(e){if(e.key==="Esc"){if(Ae.length)xs();else if(Bn){let t=document.body.querySelector(".vuuDialog");t&&_o.default.unmountComponentAtNode(t)}}}function Is(e){if(Ae.length){console.log("Popup.outsideClickHandler ... ");let t=document.body.querySelectorAll(".vuuPopup");for(let o=0;o<t.length;o++)if(t[o].contains(e.target)){console.log(" ... its ok, he's one of us");return}console.log(" ... close all"),xs({mouseEvt:e,type:"click-away"})}}function xs(e){if(Ae.length===1)se.hidePopup(e,"anon","all");else if(Ae.length){let t=document.body.querySelectorAll(".vuuPopup");for(let o=0;o<t.length;o++)_o.default.unmountComponentAtNode(t[o]);vs("*")}}function Ec(e){Ae.indexOf(e)===-1&&(Ae.push(e),Bn===!1&&(window.addEventListener("keydown",ys,!0),window.addEventListener("click",Is,!0)))}function vs(e){if(Ae.length){if(e==="*")Ae.length=0;else{let t=Ae.indexOf(e);t!==-1&&Ae.splice(t,1)}Ae.length===0&&Bn===!1&&(window.removeEventListener("keydown",ys,!0),window.removeEventListener("click",Is,!0))}}var Cc=({children:e,position:t,style:o})=>{let n=(0,gs.default)("hwPopup","hwPopupContainer",t);return(0,qt.createElement)("div",{className:n,style:o},e)},Mc=1,se=class{static showPopup({group:t="all",name:o="anon",left:n=0,position:r="",right:s="auto",top:a=0,width:l="auto",component:c}){if(!c)throw Error("PopupService showPopup, no component supplied");typeof c.props.onClose=="function"?se.onClose=c.props.onClose:se.onClose=void 0,Ec(o),document.addEventListener("keydown",se.escapeKeyListener,!0);let i=document.body.querySelector(".vuuPopup."+t);i===null&&(i=document.createElement("div"),i.className="vuuPopup "+t,document.body.appendChild(i));let d={width:l};Bo((0,qt.createElement)(Cc,{key:Mc++,position:r,style:d},c),i,n,a,()=>{se.keepWithinThePage(i,s)})}static escapeKeyListener(t){t.key==="Escape"&&(console.log("%cESC listener","color:green;font-weight:bold;"),se.hidePopup())}static hidePopup(t,o="anon",n="all"){var r;if(console.log("PopupService.hidePopup",{reason:t}),Ae.indexOf(o)!==-1){vs(o);let s=document.body.querySelector(`.vuuPopup.${n}`);s&&_o.default.unmountComponentAtNode(s)}document.removeEventListener("keydown",se.escapeKeyListener,!0),console.log(`PopupService will call onClose if found ${typeof(se==null?void 0:se.onClose)}`),(r=se==null?void 0:se.onClose)==null||r.call(se,t)}static keepWithinThePage(t,o="auto"){let n=t.querySelector(".vuuPopupContainer > *");if(n){let{top:r,left:s,width:a,height:l,right:c}=n.getBoundingClientRect(),i=window.innerWidth,m=window.innerHeight-(r+l);m<0&&(n.style.top=Math.round(r)+m+"px");let u=i-(s+a);if(u<0&&(n.style.left=Math.round(s)+u+"px"),typeof o=="number"&&o!==c){let h=o-c;n.style.left=s+h+"px"}}}};var Go=require("react/jsx-runtime"),Es=(e,t)=>{let o=(0,ut.useContext)(fs),[n,r,s]=je(),a=(0,ut.useCallback)((i,d,m)=>{let u=[];for(let h of i)u=u.concat(h(d,m));return u},[]),l=(0,ut.useCallback)((i,d,{ContextMenuProps:m,contextMenu:u,...h})=>{if(i.stopPropagation(),i.preventDefault(),u)return Lc(i,u);let p=[];if(e&&p.push(e),o&&Array.isArray(o==null?void 0:o.menuBuilders)&&o.menuBuilders.length>0&&p.push(...o.menuBuilders),p.length>0){let f=a(p,d,h),b=E=>(t==null?void 0:t(E))===!0?!0:o==null?void 0:o.menuActionHandler(E);f.length&&b&&(console.log(`showContextMenu ${d}`,{options:h}),Dc(i,f,b,{...m,className:(0,Ss.default)(m==null?void 0:m.className,n,r),"data-mode":s}))}else console.warn("useContextMenu, no menuBuilders configured. These should be supplied via the ContextMenuProvider(s)")},[a,o,s,r,t,e,n]),c=(0,ut.useCallback)(()=>{console.log("hide comnytext menu")},[]);return[l,c]},wc={},Lc=(e,t)=>{let o={x:e.clientX,y:e.clientY};se.showPopup({focus:!0,left:0,top:0,component:(0,ut.cloneElement)(t,{position:o})})},Dc=(e,t,o,{position:n,...r}=wc)=>{let s=i=>{let d=(m,u)=>(0,Ts.isGroupMenuItemDescriptor)(m)?(0,Go.jsx)(Vo,{label:m.label,children:m.children.map(d)},u):(0,Go.jsx)(Uo,{action:m.action,"data-icon":m.icon,options:m.options,children:m.label},u);return i.map(d)},a=i=>{var d;hs(i)&&(o(i),se.hidePopup()),(d=r==null?void 0:r.onClose)==null||d.call(r,i)},l=n!=null?n:{x:e.clientX,y:e.clientY},c=(0,Go.jsx)($n,{...r,onClose:a,position:l,children:s(t)});se.showPopup({left:0,top:0,component:c,focus:!0})};var dt=require("react");var Ms=X(require("classnames")),ws=require("@salt-ds/core"),Ls=require("@vuu-ui/vuu-layout");var Hs=require("react/jsx-runtime"),Cs="vuuPopupMenu",Hc=e=>{if(e){let{bottom:t,left:o}=e.getBoundingClientRect();return{x:o,y:t+6}}},Ds=({className:e,icon:t="more-vert",id:o,menuActionHandler:n,menuBuilder:r,menuLocation:s="header",menuOptions:a,onMenuClose:l,tabIndex:c=0,...i})=>{let d=(0,dt.useRef)(null),m=(0,dt.useRef)(!1),[u,h]=(0,dt.useState)(!1),p=(0,Ls.useId)(o),[f]=Es(r,n),b=(0,dt.useCallback)(C=>{console.log("PopupMenu popup closed",{reason:C}),h(!1),bs(C)?C.mouseEvt.target===d.current&&(m.current=!0):requestAnimationFrame(()=>{var v;l==null||l(),c!==-1&&((v=d.current)==null||v.focus())})},[l,c]),E=(0,dt.useCallback)(C=>{m.current?m.current=!1:(h(!0),f(C,s,{ContextMenuProps:{id:`${p}-menu`,onClose:b,position:Hc(d.current)},...a}))},[b,p,s,a,f]);return(0,Hs.jsx)(ws.Button,{...i,"aria-controls":`${p}-menu-root`,"aria-expanded":u,"aria-haspopup":"menu",className:(0,Ms.default)(Cs,e,{[`${Cs}-open`]:u}),"data-icon":t,id:p,onClick:E,ref:d,tabIndex:c,variant:"secondary"})};var Vn=require("react/jsx-runtime"),Nc=e=>e.split(" ").map(t=>`vuuDraggable-${t}`),qo=(0,Wo.forwardRef)(function({wrapperClassName:t,element:o,onTransitionEnd:n,style:r,scale:s=1},a){let l=(0,Wo.useCallback)(i=>{i&&(i.innerHTML="",i.appendChild(o),s!==1&&(i.style.transform=`scale(${s},${s})`))},[o,s]),c=(0,Ns.useForkRef)(a,l);return(0,Vn.jsx)(ho,{children:(0,Vn.jsx)("div",{className:(0,Rs.default)("vuuDraggable",...Nc(t)),ref:c,onTransitionEnd:n,style:r})})}),Un=e=>{let t=document.createElement("div");return t.className="vuuDraggable-spacer",e&&t.addEventListener("transitionend",()=>{e.current=!1}),t},Ps=()=>{let e=document.createElement("div");return e.className="vuuDraggable-dropIndicatorPosition",e},ks=e=>{let t=document.createElement("div");return t.className="vuuDraggable-dropIndicator",e&&t.addEventListener("transitionend",()=>{e.current=!1}),t};var As=()=>{let e=(0,$e.useRef)(0),t=(0,$e.useRef)(!1),o=(0,$e.useMemo)(()=>[Un(t),Un()],[]),n=(0,$e.useCallback)(()=>o.forEach(c=>c.remove()),[o]),r=(0,$e.useCallback)((c,i="width")=>{let[d,m]=o;e.current=requestAnimationFrame(()=>{t.current=!0,d.style.cssText=`${i}: 0px`,m.style.cssText=`${i}: ${c}px`,o[0]=m,o[1]=d})},[o]),s=(0,$e.useCallback)(()=>{e.current&&(cancelAnimationFrame(e.current),e.current=0)},[]),a=(0,$e.useCallback)((c,i,d,m=!1,u="static",h="horizontal")=>{if(i){let p=h==="horizontal"?"width":"height",[f,b]=o;if(s(),m)t.current?(n(),f.style.cssText=`${p}: ${d}px`,b.style.cssText=`${p}: 0px`,u==="fwd"?(i.element.before(f),i.element.after(b)):(i.element.after(f),i.element.before(b))):u==="fwd"?i.element.after(b):i.element.before(b),r(d,p);else if(u==="static")f.style.cssText=`${p}: ${d}px`,i.element.before(f);else throw Error("useDragDisplacers currently only supports noTransition for static displacement");u!=="static"&&Pn(c,u)}},[r,s,n,o]),l=(0,$e.useCallback)((c,i,d,m=!1,u="static",h="horizontal")=>{let p=h==="horizontal"?"width":"height",[f,b]=o;s(),m?(t.current?(n(),f.style.cssText=`${p}: ${d}px`,b.style.cssText=`${p}: 0px`,i.element.before(f),i.element.after(b)):u==="fwd"?i.element.after(b):i.element.before(b),r(d,p)):(f.style.cssText=`${p}: ${d}px`,i.element.after(f)),u!=="static"&&Pn(c,u)},[r,s,n,o]);return{displaceItem:a,displaceLastItem:l,clearSpacers:n}};var Os=({draggableRef:e,onDrop:t,orientation:o="horizontal",containerRef:n,itemQuery:r="*",selected:s,viewportRange:a})=>{let l=(0,pe.useRef)(),c=(0,pe.useRef)(!1),i=(0,pe.useRef)(-1),d=(0,pe.useRef)([]),m=(0,pe.useRef)(!1),[u,h]=(0,pe.useState)(!1),{clearSpacers:p,displaceItem:f,displaceLastItem:b}=As(),E=(0,pe.useRef)(),C=`:is(${r}${$o}${Fr},.vuuOverflowContainer-OverflowIndicator)`,v=g=>d.current.findIndex(w=>w.id===g.id),I=(0,pe.useRef)();I.current=a;let L=(0,pe.useCallback)(()=>{p()},[p]),M=(0,pe.useCallback)((g,w,N)=>{let{current:k}=n,{current:R}=E;if(k&&R){d.current=_t(k,o,C,I.current),g==="fwd"?d.current.push(R):d.current.unshift(R);let{size:T}=R,A=i.current+T/2,{current:P}=d,F=Wt(P,A,"fwd");if(F){let _=v(F),V=P[_];N&&g==="fwd"?b(P,P[P.length-1],T,!1,"static",o):f(P,V,T,!0,"static",o)}}},[n,f,b,C,o]),S=(0,pe.useCallback)(g=>{let N=g.target.closest(r);N.ariaSelected&&Array.isArray(s)&&s.length>1&&console.log("its a selected element, and we have a multi select");let{current:k}=n;if(k&&N){let{SCROLL_SIZE:R,CLIENT_SIZE:T}=ke(o),{id:H}=N,{[R]:A,[T]:P}=k;c.current=A>P;let F=d.current=_t(k,o,C,a,H),B=Gt(F),_=F[B];if(_&&k){E.current=_;let V=_.isLast?b:f;console.log({indexOfDraggedItem:B,draggedItem:_}),V(F,_,_.size,!1,"static",o)}}},[n,f,b,C,r,o,s,a]),[x,y]=(0,pe.useMemo)(()=>{let g=!1;return[k=>{if(!g){g=!0;let R=k.element.querySelector(".vuuPopupMenu");if(R){let T=new MouseEvent("click",{view:window,bubbles:!0,cancelable:!0});R.dispatchEvent(T)}}},k=>{if(g){g=!1;let R=k.element.querySelector(".vuuPopupMenu");if(R){let T=new MouseEvent("click",{view:window,bubbles:!0,cancelable:!0});R.dispatchEvent(T)}}}]},[]),D=(0,pe.useCallback)((g,w)=>{let{current:N}=E;if(N&&e.current&&n.current){i.current=g;let{current:k}=d,R=Wt(k,g,w);if(R&&!R.isDraggedItem)if(R.isOverflowIndicator)h(m.current=!0),x(R);else{let{size:T}=N;(v(R)===k.length-1?b:f)(k,R,T,!0,w,o);let P=k.at(-1);y(P),h(m.current=!1)}l.current=w}},[n,f,b,e,y,o,x]),O=(0,pe.useCallback)(()=>{var k;p();let{current:g}=d,w=Gt(g),N=g[w];if(N)if(l.current=void 0,m.current)t(N.index,-1);else{let R=Gt(g,!0);t(N.index,R)}if(h(!1),n.current){let R=(k=n.current)==null?void 0:k.scrollTop;w<g.length&&(n.current.scrollTop=R)}},[p,n,t]);return{beginDrag:S,drag:D,drop:O,handleScrollStart:L,handleScrollStop:M,revealOverflowedItems:u}};var ce=require("react");var yo=require("react");var Fs=()=>{let e=(0,yo.useMemo)(()=>Ps(),[]),t=(0,yo.useCallback)(()=>e.remove(),[e]);return{positionDropIndicator:(0,yo.useCallback)((n,r="end")=>(r==="end"?n.element.after(e):n.element.before(e),e),[e]),clearSpacer:t}};var $s=require("react/jsx-runtime"),Rc=':not([data-overflowed="true"])',Pc=':not([aria-hidden="true"])',Ks=({draggableRef:e,onDrop:t,orientation:o="horizontal",containerRef:n,itemQuery:r="*",selected:s,viewportRange:a})=>{let l=(0,ce.useRef)(),c=(0,ce.useRef)(null),i=(0,ce.useRef)(null),d=(0,ce.useRef)(""),m=(0,ce.useRef)(!1),u=(0,ce.useRef)(-1),h=(0,ce.useRef)([]),p=(0,ce.useRef)(!1),[f,b]=(0,ce.useState)(!1),[E,C]=(0,ce.useState)(),{clearSpacer:v,positionDropIndicator:I}=Fs(),L=(0,ce.useRef)(),M=`:is(${r}${Rc}${Pc},[data-overflow-indicator])`,S=k=>h.current.findIndex(R=>R.id===k.id),x=(k,R,T)=>{k.start+=R,k.mid+=R,k.end+=R,typeof T=="number"&&(k.currentIndex+=T)},y=(0,ce.useRef)();y.current=a;let D=(0,ce.useCallback)(()=>{v()},[v]),O=(0,ce.useCallback)((k,R,T)=>{let{current:H}=n,{current:A}=L;if(H&&A){h.current=_t(H,o,M,y.current);let{size:P}=A,B=u.current+P/2,{current:_}=h,V=Wt(_,B,"fwd");V&&I(T&&k==="fwd"?_[_.length-1]:V,"start")}},[n,I,M,o]),g=(0,ce.useCallback)(k=>{let T=k.target.closest(r);T.ariaSelected&&Array.isArray(s)&&s.length>1&&console.log("its a selected element, and we have a multi select");let{current:H}=n;if(H&&T){let{SCROLL_SIZE:A,CLIENT_SIZE:P}=ke(o),{id:F}=T,{[A]:B,[P]:_}=H;m.current=B>_;let V=h.current=_t(H,o,M,a),G=$r(V,F);if(G&&H){let K=S(G);Br(V,K),L.current=G;let{current:$}=y;if($!=null&&$.atEnd)for(let J=0;J<V.length;J++)x(V[J],G.size);for(let J=K;J<V.length;J++)x(V[J],-G.size,-1);let[Z,Y]=G.isLast?[V[V.length-1],"end"]:[V[K],"start"];i.current=Z,d.current=Y;let de=I(Z,Y),{top:W,left:q,width:j}=de.getBoundingClientRect(),ee={top:G.isLast?$!=null&&$.atEnd&&!$.atStart?W+G.size-2:W-2:W-G.size-2,left:q,width:j,height:2};C((0,$s.jsx)(qo,{wrapperClassName:"dropIndicatorContainer",style:ee,ref:c,element:ks()}))}}},[r,s,n,o,M,a,I]),w=(0,ce.useCallback)((k,R)=>{let{current:T}=i,{current:H}=L;if(H&&e.current&&n.current){let A=o==="horizontal"?"left":"top";u.current=k;let{current:P}=h,F=Wt(P,k,R);if(F&&F.index!==(T==null?void 0:T.index)){if(F.isOverflowIndicator)b(p.current=!0);else if(c.current){if(S(F)===P.length-1){let _=P[P.length-1],G=I(_,"start").getBoundingClientRect();c.current.style[A]=`${G.top}px`}else{let V=I(F,"start").getBoundingClientRect();c.current.style[A]=`${V.top}px`}b(p.current=!1)}i.current=F,l.current=R}}},[e,n,o,I]),N=(0,ce.useCallback)(()=>{v();let{current:k}=L,{current:R}=i,{current:T}=d,{current:H}=y;if(k&&H&&R){let{index:A}=k,P=T==="start",{index:F,currentIndex:B}=R;i.current=null,l.current=void 0,p.current?t(A,-1):A<F?t(A,P?B:B+1):t(A,P?F:F+1),C(void 0)}b(!1)},[v,t]);return{beginDrag:g,drag:w,drop:N,dropIndicator:E,handleScrollStart:D,handleScrollStop:O,revealOverflowedItems:f}};var oe=require("react");var mt=require("react");var Bs=({containerRef:e,onScrollingStopped:t,orientation:o="vertical"})=>{let n=(0,mt.useRef)(null),r=(0,mt.useRef)(!1),s=(0,mt.useRef)(0),a=(0,mt.useRef)("fwd"),l=(0,mt.useCallback)((i=!1)=>{console.log("[useAutoScroll] stopScrolling"),n.current!==null&&(clearTimeout(n.current),n.current=null),r.current=!1,t==null||t(a.current,s.current,i)},[t]),c=(0,mt.useCallback)((i,d,m=30)=>{let{current:u}=e;if(u){let{SCROLL_POS:h,SCROLL_SIZE:p,CLIENT_SIZE:f}=ke(o),{[h]:b,[p]:E,[f]:C}=u,v=i==="fwd"?E-C-b:b,I=Math.min(v,m);i==="fwd"?(a.current="fwd",u[h]=s.current=b+I):(a.current="bwd",u[h]=s.current=b-I),I===v?l(!0):(r.current=!0,n.current=window.setTimeout(()=>{c(i,d,m)},100))}},[e,o,l]);return{isScrolling:r,startScrolling:c,stopScrolling:l}};var Us=require("react/jsx-runtime"),kc={beginDrag:()=>{},drag:()=>{},draggableRef:{current:null},drop:()=>{},isDragging:!1,isScrolling:!1,handleScrollStart:()=>{},handleScrollStop:()=>{},revealOverflowedItems:!1},Vs={start:0,end:1e3,contraStart:0,contraEnd:1e3},Ac=()=>kc,Oc=3,Fc=(e,t)=>e.closest(t),Kc=e=>e.dataset.index==="overflow"&&e.parentElement!==null&&e.parentElement.classList.contains("overflowed"),$c=(e,t)=>{let o=`:is(${t}${$o},.vuuOverflowContainer-OverflowIndicator)`,r=Array.from(e.querySelectorAll(o)).pop();return[r,Kc(r)]},Zo=({allowDragDrop:e,containerRef:t,draggableClassName:o,itemQuery:n="*",onDragStart:r,onDrop:s,onDropSettle:a,orientation:l,...c})=>{let i=(0,oe.useRef)({start:0,end:0,contraStart:0,contraEnd:0}),[d,m]=(0,oe.useState)({draggable:void 0,draggedItemIndex:-1,isDragging:!1}),u=(0,oe.useRef)(null),h=(0,oe.useRef)(),p=(0,oe.useRef)(null),f=(0,oe.useRef)(!1),b=(0,oe.useRef)({x:0,y:0}),E=(0,oe.useRef)({x:0,y:0}),C=(0,oe.useRef)({x:0,y:0}),v=(0,oe.useRef)(null),I=(0,oe.useRef)(-1),L=(0,oe.useRef)(-1),M=(0,oe.useRef)(),{isDragSource:S,isDropTarget:x,register:y}=Or(c.id);c.id&&(S||x)&&y(c.id);let D=(0,oe.useCallback)(()=>{var j;let{current:W}=L,q=(j=t.current)==null?void 0:j.querySelector(`${n}[data-index="${W}"]`);q&&q.classList.remove("vuuDropTarget-settling"),L.current=-1,a==null||a(W),m(ee=>({...ee,draggable:void 0}))},[t,n,a]),O=(0,oe.useCallback)(W=>{if(t.current){let{POS:q,SCROLL_POS:j,SCROLL_SIZE:ee,CLIENT_SIZE:J}=ke(l),{[j]:te,[ee]:Ie,[J]:xe}=t.current,Me=Ie-xe,we=te<Me,Ne=i.current.end,Re=te>0&&W-b.current[q]<=i.current.start,Pe=we&&W-b.current[q]>=Ne;return Re?"bwd":Pe?"fwd":""}},[t,l]),g=e===!0||e==="natural-movement"?Os:e==="drop-indicator"?Ks:Ac,w=(0,oe.useCallback)((W,q,j)=>{var ee;(ee=M.current)==null||ee.call(M,W,q,j)},[]),{isScrolling:N,startScrolling:k,stopScrolling:R}=Bs({containerRef:t,onScrollingStopped:w,orientation:l}),T=(0,oe.useCallback)((W,q)=>{I.current=q,s==null||s(W,q),L.current=q},[s]),{beginDrag:H,drag:A,drop:P,handleScrollStart:F,handleScrollStop:B,..._}=g({...c,containerRef:t,draggableRef:u,isDragSource:S,isDropTarget:x,itemQuery:n,onDrop:T,orientation:l});M.current=B;let V=(0,oe.useCallback)(W=>{let{CLIENT_POS:q,CONTRA_CLIENT_POS:j,CONTRA_POS:ee,POS:J}=ke(l),{clientX:te,clientY:Ie}=W,{[q]:xe,[j]:Me}=W,we=E.current[J],Ne=E.current[ee],Re=Math.abs(we-xe);if((S?Math.abs(Ne-Me):0)-Re>5&&(i.current=Vs),E.current.x=te,E.current.y=Ie,i.current===Vs&&u.current){let U=E.current.x-b.current.x,z=E.current.y-b.current.y;u.current.style.top=`${z}px`,u.current.style.left=`${U}px`}else if(Re>0&&u.current){let U=we<xe?"fwd":"bwd",z=O(xe),Q=E.current[J]-b.current[J];if(z&&f.current&&!N.current?(F(),k(z,1)):!z&&N.current&&R(),!N.current){let re=Math.round(Math.max(i.current.start,Math.min(i.current.end,Q))),he=l==="horizontal"?"left":"top";u.current.style[he]=`${re}px`,A(re,U)}}},[A,u,O,F,S,N,l,k,R]),G=(0,oe.useCallback)(()=>{document.removeEventListener("mousemove",V,!1),document.removeEventListener("mouseup",G,!1),v.current=u.current,P(),m(W=>({...W,draggedItemIndex:-1,isDragging:!1})),h.current=void 0},[V,u,P]),K=(0,oe.useCallback)(W=>{let{clientX:q,clientY:j,target:ee}=W,J=Fc(ee,n),{current:te}=t;if(te&&J){let{CONTRA:Ie,CONTRA_END:xe,DIMENSION:Me,END:we,SCROLL_SIZE:Ne,CLIENT_SIZE:Re,START:Pe}=ke(l);h.current=J;let{[Ne]:U,[Re]:z}=te;f.current=U>z;let[Q,re]=$c(te,n),he=te.getBoundingClientRect(),Ue=J.getBoundingClientRect(),ze=Ue[Me],{[Pe]:at,[we]:It}=Q.getBoundingClientRect();b.current.x=q-Ue.left,b.current.y=j-Ue.top,i.current.start=he[Pe],i.current.end=re?Math.max(at,he.right-ze):f.current?he[Pe]+he[Me]-ze:It-ze,i.current.contraStart=he[Ie],i.current.contraEnd=he[xe],H(W);let{dataset:{index:Xe="-1"}}=J;m({isDragging:!0,draggable:(0,Us.jsx)(qo,{element:Kr(J),onTransitionEnd:D,ref:u,style:Vr(Ue,he),wrapperClassName:o}),draggedItemIndex:parseInt(Xe)}),r==null||r(),document.addEventListener("mousemove",V,!1),document.addEventListener("mouseup",G,!1)}},[H,t,V,G,o,u,n,r,l,D]),$=(0,oe.useCallback)(W=>{let{CLIENT_POS:q,POS:j}=ke(l),{[q]:ee}=W;Math.abs(ee-C.current[j])>Oc&&t.current&&(p.current&&(window.clearTimeout(p.current),p.current=null),document.removeEventListener("mousemove",$),document.removeEventListener("mouseup",Z,!1),K(W))},[t,H,l]),Z=(0,oe.useCallback)(()=>{p.current&&(window.clearTimeout(p.current),p.current=null),document.removeEventListener("mousemove",$,!1),document.removeEventListener("mouseup",Z,!1)},[$]),Y=(0,oe.useCallback)(W=>{let{current:q}=t;if(q&&!W.defaultPrevented){let{clientX:j,clientY:ee}=W;E.current.x=C.current.x=j,E.current.y=C.current.y=ee,document.addEventListener("mousemove",$,!1),document.addEventListener("mouseup",Z,!1),W.persist(),p.current=window.setTimeout(()=>{document.removeEventListener("mousemove",$,!1),document.removeEventListener("mouseup",Z,!1),K(W.nativeEvent)},500)}},[t,K,$,Z]),{current:de}=v;return(0,oe.useLayoutEffect)(()=>{if(de&&t.current){let W=I.current,q=t.current.querySelector(`${n}[data-index="${W}"]`);q?(q.classList.add("vuuDropTarget-settling"),requestAnimationFrame(()=>{let{top:j,left:ee}=q.getBoundingClientRect(),{top:J,left:te}=de.getBoundingClientRect();te!==ee||J!==j?(de.classList.add("vuuDraggable-settling"),de.style.top=`${j}px`,de.style.left=`${ee}px`):D()})):console.log(`dont have the dropped item (at ${W})`),v.current=null}},[t,n,de,D]),{..._,...d,isScrolling:N,onMouseDown:e?Y:void 0}};var zs=X(require("classnames")),Be=require("react"),Io=require("@salt-ds/core");var _n=require("react/jsx-runtime"),zn="vuuEditableLabel",_s=(0,Be.forwardRef)(function({className:t,defaultEditing:o,defaultValue:n,editing:r,onChange:s,onEnterEditMode:a,onExitEditMode:l,value:c,...i},d){let m=(0,Be.useRef)(null),u=(0,Be.useRef)(!1),[h,p]=(0,Io.useControlled)({controlled:c,default:n!=null?n:"",name:"EditableLabel",state:"value"}),[f,b]=(0,Io.useControlled)({controlled:r,default:o!=null?o:!1,name:"EditableLabel",state:"editing"}),E=(0,Be.useCallback)(D=>{b(u.current=D)},[]),C=(0,Be.useRef)(h);(0,Be.useLayoutEffect)(()=>{f&&m.current!==null&&(m.current.select(),m.current.focus())},[f,m]);let v=(0,Be.useCallback)(()=>{E(!0),a&&a()},[a,E]),I=({cancelEdit:D=!1,allowDeactivation:O=!1}={})=>{E(!1);let g=C.current;g!==h&&(D?p(g):C.current=h),l&&l(g,h,O,D)},L=D=>{let{value:O}=D.target;p(O),s&&s(O)},M=()=>{v()},S=()=>{u.current&&I({allowDeactivation:!0})},x=D=>{f&&D.key==="Enter"?(D.stopPropagation(),I()):D.key==="ArrowRight"||D.key==="ArrowLeft"?D.stopPropagation():D.key==="Escape"&&I({cancelEdit:!0})},y=(0,zs.default)(zn,t,{[`${zn}-editing`]:f});return(0,_n.jsx)("div",{...i,className:y,onDoubleClick:M,"data-text":h,ref:d,children:f?(0,_n.jsx)(Io.Input,{inputProps:{className:`${zn}-input`},value:h,onBlur:S,onChange:L,onKeyDown:x,inputRef:m,style:{padding:0},textAlign:"left",variant:"secondary"}):h})});var Gs=require("@salt-ds/core");var Bc=/[.*+?^${}()|[\]\\]/g;function Jo(e){return e.replace(Bc,"\\$&")}var Zt=require("react/jsx-runtime"),Vc=(0,Gs.makePrefixer)("saltHighlighter"),Ws=e=>{let{matchPattern:t,text:o=""}=e,n=typeof t=="string"?new RegExp(`(${Jo(t)})`,"gi"):t;return n===void 0?(0,Zt.jsx)(Zt.Fragment,{children:o}):(0,Zt.jsx)("span",{children:o.split(n).map((r,s)=>r.match(n)?(0,Zt.jsx)("strong",{className:Vc("highlight"),children:r},`${s}-${r}`):r)})};var Gn=require("react"),Wn=X(require("classnames"));var Zs=X(require("classnames"));var Xs=require("react/jsx-runtime"),qs="vuuCheckboxIcon",Js=({checked:e=!1,...t})=>(0,Xs.jsx)("span",{...t,className:(0,Zs.default)(qs,{[`${qs}-checked`]:e})});var Ct=require("react/jsx-runtime"),xo="vuuListItem",Xo=(0,Gn.forwardRef)(function(t,o){return(0,Ct.jsx)("div",{"aria-hidden":!0,className:(0,Wn.default)(xo,`${xo}-proxy`),ref:o})}),Yo=(0,Gn.forwardRef)(function({children:t,className:o,disabled:n,tabIndex:r,item:s,itemHeight:a,itemTextHighlightPattern:l,label:c,selectable:i,selected:d,showCheckbox:m,style:u,...h},p){let f=(0,Wn.default)(xo,o,{vuuDisabled:n,[`${xo}-checkbox`]:m}),b=a!==void 0?{...u,height:a}:u;return(0,Ct.jsxs)("div",{className:f,...h,"aria-disabled":n||void 0,"aria-selected":d||void 0,ref:p,style:b,children:[m&&(0,Ct.jsx)(Js,{"aria-hidden":!0,checked:d}),t&&typeof t!="string"?t:l==null?(0,Ct.jsx)("span",{className:`${xo}-textWrapper`,children:c||t}):(0,Ct.jsx)(Ws,{matchPattern:l,text:c||t})]})});var Fi=require("@vuu-ui/vuu-layout"),Ki=require("@salt-ds/core"),un=X(require("classnames")),We=require("react");var vo=require("react"),zc=require("react/jsx-runtime"),Uc=(0,vo.createContext)(void 0);function Ys(){let e=(0,vo.useContext)(Uc);if(e)return e}var _c=e=>Object.prototype.toString.call(e)==="[object Object]";function Jt(e){return typeof e=="string"?e:_c(e)?Object.prototype.hasOwnProperty.call(e,"label")?String(e.label):(console.warn(["itemToString: you've likely forgotten to set the label prop on the item object.","You can also provide your own `itemToString` implementation."].join(`
|
|
2
|
+
`)),""):String(e)}function Gc(e,...t){let o=new Set(e);for(let n of t)for(let r of n)o.add(r);return o}var To="ArrowUp",So="ArrowDown",js="ArrowLeft",Qs="ArrowRight",qn="Enter";var jo="Home",Eo="End",Zn="PageUp",Qo="PageDown",ei=" ";var Wc=new Set(["Enter","Delete"," "]),qc=new Set(["Tab"]),Zc=new Set(["ArrowRight","ArrowLeft"]),ti=new Set([jo,Eo,Zn,Qo,So,To]),Jc=new Set(["F1","F2","F3","F4","F5","F6","F7","F8","F9","F10","F11","F12"]),Xc=Gc(Wc,ti,Zc,Jc,qc),en=e=>Xc.has(e.key)?!1:e.key.length===1&&!e.ctrlKey&&!e.metaKey&&!e.altKey,oi=({key:e})=>ti.has(e);var Jn=require("react");var Yc={},jc=e=>Array.isArray(e.childNodes),Qc=e=>!0,eu=e=>e.closest("[data-toggle],[aria-expanded]").dataset.toggle==="true",ni=({collapsibleHeaders:e,collectionHook:t,highlightedIdx:o,onToggle:n})=>{let r=(0,Jn.useCallback)(l=>{if(l.key===Qs||l.key===qn){let c=t.data[o];c&&c.expanded===!1&&c.value&&(l.preventDefault(),t.expandGroupItem(c),n==null||n(c.value))}if(l.key===js||l.key===qn){let c=t.data[o];c&&c.expanded&&c.value&&(l.preventDefault(),t.collapseGroupItem(c),n==null||n(c.value))}},[t.collapseGroupItem,t.data,t.expandGroupItem,o]),a={onClick:(0,Jn.useCallback)(l=>{console.log(`useCollapsibleGroups idx=${o}`);let c=t.data[o];console.log(l.target,l.currentTarget),c&&jc(c)&&(!Qc(c)||eu(l.target))&&(l.stopPropagation(),l.preventDefault(),c.expanded===!1&&c.value?(t.expandGroupItem(c),n==null||n(c.value)):c.expanded===!0&&c.value&&(t.collapseGroupItem(c),n==null||n(c.value)))},[t.collapseGroupItem,t.data,t.expandGroupItem,o]),onKeyDown:r};return e?a:Yc};function tu(e){if(e){let t=e.dataset.idx;if(t)return parseInt(t,10);if(t=e.ariaPosInSet)return parseInt(t,10)-1}return-1}var ou=e=>e.closest("[data-idx],[aria-posinset]");var ri=e=>tu(ou(e));var si=e=>e==="none",Xt=e=>Array.isArray(e)?e.length>0:e!=null,ii=e=>Array.isArray(e)?e[0]:e;var ne=require("react");var Yt=require("react");var li=e=>null;var ai=e=>null;var Xn=(e,t)=>e!==null&&Object.prototype.hasOwnProperty.call(e,t),Yn=e=>Xn(e,"header"),ci=e=>Xn(e,"childNodes"),Co=(e,t)=>e&&Object.prototype.hasOwnProperty.call(e.props,t),ui=e=>{if((0,Yt.isValidElement)(e)){if(Co(e,"disabled"))return e.props.disabled===!0}else if(Xn(e,"disabled"))return e.disabled===!0;return!1},di=e=>(0,Yt.isValidElement)(e)&&Co(e,"focusable")?e.props.focusable:!0,mi=(e,t,o)=>{if(e.childNodes)return e.childNodes.length;if(e.header){let n=o+1,r=0;for(;n<t.length&&!t[n].header;)r++,n++;return r}else return 0},nu=e=>{if(typeof e.props.children=="string")return e.props.children;if(e.props.title)return e.props.title;if(e.props.label)return e.props.label},pi=e=>e.type===ai||Co(e,"data-header"),fi=e=>e.type===li||Co(e,"data-group"),ru=e=>Co(e,"selectable")?e.props.selectable===!0:!fi(e)&&!pi(e),su=e=>{if(fi(e)){let{props:{children:t}}=e;if(typeof t!="string")return Qn(t)}},iu=(e,t)=>{let o=[];return Yt.Children.forEach(e,n=>{(0,Yt.isValidElement)(n)&&o.push(t(n))}),o},jn=(e,t)=>{if(Array.isArray(e))return e.length===0&&(t!=null&&t.noChildrenLabel)?[{label:t.noChildrenLabel,value:null}]:e.map((o,n)=>{var r,s;return{childNodes:jn(o.childNodes,t),description:o.description,expanded:o.expanded,value:o,label:(s=(r=t==null?void 0:t.itemToString)==null?void 0:r.call(t,o))!=null?s:Jt(o)}});if(e)throw Error("list-child-items expects source to be an array")},Qn=e=>{if(e)return iu(e,t=>{let{"data-id":o,disabled:n,id:r=o,"data-expanded":s,expanded:a=s}=t.props;return{childNodes:su(t),disabled:n,expanded:a,header:pi(t),id:r,label:nu(t),selectable:ru(t),value:t}})},lu=new Set(["/","-","."]),au=e=>lu.has(e),gi=(e,t)=>t.startsWith(e)&&au(t[e.length]),cu=new Set([".","/"]);function uu(e,t){return t.startsWith(e)?cu.has(t.charAt(e.length)):!1}function tn(e,t,o){let n;return e.map(s=>s.id===t?{...s,...o}:uu(s.id,t)&&s.childNodes?(n=tn(s.childNodes,t,o),{...s,childNodes:n}):s)}var du=e=>e&&e.replace(/^\s+/g,""),er=e=>new RegExp(`(${Jo(du(e))})`,"gi"),hi=(e="",t=er)=>(o="")=>!!o.length&&!!e.length&&o.match(t(e))!==null;function on(e,t){return Array.isArray(e)?e.includes(t):e===t}var mu={},nn=({children:e,id:t,label:o="",options:n=mu,source:r})=>{var R;let{getItemId:s}=n,[,a]=(0,ne.useState)(null),l=Ys(),c=(0,ne.useRef)([]),i=(0,ne.useRef)([]),d=(0,ne.useMemo)(()=>[],[]),m=(0,ne.useRef)((R=n.filterPattern)!=null?R:""),{getFilterRegex:u=er,noChildrenLabel:h,itemToString:p=Jt}=n,f=(0,ne.useCallback)(T=>n.defaultExpanded||!1,[n.defaultExpanded]),b=(0,ne.useCallback)((T,H,A=1,P="",F=[],B=[],_=[])=>(T.forEach((V,G,K)=>{var J,te;let $=V.header&&n.collapsibleHeaders,Z=V.childNodes&&n.collapsibleHeaders===!1,Y=!V.childNodes||V.childNodes.length===0,de=Z||Y&&!$,W=P?`${P}.${G}`:`item-${G}`,q=(J=V.id)!=null?J:s?s(G):`${t}-${W}`,j=de?void 0:(te=V.expanded)!=null?te:f(q),ee={...V,childNodes:void 0,count:!Z&&j===void 0?0:mi(V,K,G),description:V.description,disabled:ui(V.value),focusable:di(V.value)?void 0:!1,id:q,index:H.value,expanded:j,level:A};if(F.push(ee),B.push(ee),_.push(T[G].value),H.value+=1,V.childNodes){let[Ie]=b(V.childNodes,H,A+1,W,[],B,_);ee.childNodes=Ie}}),[F,_,B]),[n.collapsibleHeaders,s,t,f]),E=(0,ne.useCallback)(()=>m.current?hi(m.current,u):null,[u]),C=(0,ne.useCallback)((T,H=E(),A=[],P={value:0})=>{let F=!1;for(let B of T)F&&!Yn(B)||(B.value!==null&&(H===null||H(p(B.value)))&&(A[P.value]=B,P.value+=1),F=!1,Yn(B)&&B.expanded===!1?F=!0:ci(B)&&B.expanded!==!1&&B.childNodes&&C(B.childNodes,H,A,P));return A},[E,p]),v=(0,ne.useMemo)(()=>l?d:jn(r,{itemToString:p,noChildrenLabel:h})||Qn(e)||[],[l,d,r,p,h,e]),[I,L,M]=(0,ne.useMemo)(()=>l?[d,d,d]:b(v,{value:0}),[d,b,l,v]);i.current=M,(0,ne.useMemo)(()=>l?d:c.current=C(I),[d,C,I,l]);let S=(0,ne.useRef)(I),x=(0,ne.useCallback)((T="")=>{typeof T=="string"&&(m.current=T,c.current=C(I),a({}))},[I,C]),y=(0,ne.useCallback)((T,H=I)=>{let A=H.find(P=>{var F;return P.id===T||((F=P==null?void 0:P.childNodes)==null?void 0:F.length)&&gi(P.id,T)});if((A==null?void 0:A.id)===T)return L==null?void 0:L[A.index];if(A)return y(T,A.childNodes);throw Error(`useCollectionData itemById, id ${T} not found `)},[L,I]),D=(0,ne.useCallback)(T=>{let H=i.current.find(A=>(0,ne.isValidElement)(A.value)?A.label===T:A.value===T);if(H)return H;throw Error("useCollectionData toCollectionItem, item not found ")},[]),O=(0,ne.useCallback)(T=>{if(T===null)return null;if(Array.isArray(T)){let H=[];for(let A of T){let P=D(A);H.push(P)}return H}else if(T!==void 0)return D(T)},[D]),g=(0,ne.useCallback)(T=>{let H=A=>{let P=i.current.find(F=>(0,ne.isValidElement)(F.value)?F.label===A:F.value!==null&&p(F.value)===A);if(P)return P};if(T===null)return null;if(Array.isArray(T)){let A=[];for(let P of T){let F=H(P);F&&A.push(F)}return A}else if(T!==void 0)return H(T)},[p]),w=(0,ne.useCallback)(T=>{for(let H of S.current)if(T===H.value)return H.id;throw Error("useCollectionData itemToId, item not found")},[]),N=(0,ne.useCallback)(T=>{S.current=tn(S.current,T.id,{expanded:!1}),c.current=C(S.current),a({})},[C]),k=(0,ne.useCallback)(T=>{S.current=tn(S.current,T.id,{expanded:!0}),c.current=C(S.current),a({})},[C]);return l||{collapseGroupItem:N,data:c.current,expandGroupItem:k,setFilterPattern:x,itemById:y,itemToId:w,toCollectionItem:D,itemToCollectionItem:O,stringToCollectionItem:g}};var rn=require("react"),pu={scrollToIndex:e=>{},scrollToItem:e=>{},scrollTo:e=>{}},sn=({collectionHook:e,forwardedRef:t,scrollableRef:o,scrollIntoView:n})=>{let r=(0,rn.useMemo)(()=>({scrollToIndex:s=>{let a=e.data[s];a&&(n==null||n(a))},scrollToItem:s=>{let a=e.toCollectionItem(s);a&&(n==null||n(a))},scrollTo:s=>{o!=null&&o.current&&(o.current.scrollTop=s)}}),[e.data,e.toCollectionItem,n]);(0,rn.useImperativeHandle)(t,()=>o.current?r:pu,[r])};var Ii=require("@salt-ds/core"),ve=require("react");var or=-2;function bi(e,t,o){return t===To||t===Eo?o>0?o-1:o:o===null?0:o===e-1?o:o+1}var tr=(e,t)=>{let o=ii(t);return o?e.indexOf(o):-1},fu=(e,t,o,n)=>e===Eo?n:e===jo?-1:t!==-1?t:o,xi=e=>{let t=document.getElementById(e.id);if(t)return t.getBoundingClientRect();throw Error(`useKeyboardNavigation.getItemRect no element found for item #${e==null?void 0:e.id}`)},gu=(e,t,o,n)=>{let{top:r}=t.getBoundingClientRect(),{scrollTop:s,clientHeight:a,scrollHeight:l}=e,c=o.length-1,i=Math.min(s+a,l-a);if(i!==s&&n<c){e.scrollTo(0,i);let d=n,m;do d+=1,m=xi(o[d]);while(m.top<r&&d<c);return d}},hu=async(e,t,o,n)=>{let{top:r}=t.getBoundingClientRect(),{scrollTop:s,clientHeight:a}=e,l=Math.max(s-a,0);if(l!==s&&n>0)return e.scrollTo(0,l),new Promise(c=>{requestAnimationFrame(()=>{let i=n,d;do i-=1,d=xi(o[i]);while(d.top>r&&i>0);c(i)})})},bu=e=>!e.header&&!e.childNodes,yi=e=>bu(e)||e.expanded!==void 0,vi=({containerRef:e,defaultHighlightedIndex:t=-1,disableHighlightOnFocus:o,highlightedIndex:n,indexPositions:r,onHighlight:s,onKeyboardNavigation:a,restoreLastFocus:l,selected:c})=>{let i=(0,ve.useRef)(-1),[,d]=(0,ve.useState)({}),[m,u,h]=(0,Ii.useControlled)({controlled:n,default:t,name:"UseKeyboardNavigation"}),p=(0,ve.useCallback)((x,y=!1)=>{s==null||s(x),u(x),y&&(i.current=x)},[s,u]),f=(0,ve.useCallback)(async(x,y)=>{let{id:D}=r[y],O;if(D){let g=document.getElementById(D),{current:w}=e;g&&w&&(O=x.key===Qo?gu(w,g,r,y):await hu(w,g,r,y))}return O!=null?O:y},[e,r]),b=(0,ve.useCallback)((x=So,y=x===So?-1:r.length)=>{if(r.length===0)return-1;{let D=tr(r,c),O=fu(x,y,D,r.length),g=bi(r.length,x,O);if(g===0&&x===To&&!yi(r[0]))return y;for(;((x===So||x===jo)&&g<r.length||(x===To||x===Eo)&&g>0)&&!yi(r[g]);)g=bi(r.length,x,g);return g}},[r,c]),E=(0,ve.useRef)(!1),C=(0,ve.useRef)(!1),v=x=>C.current=x,I=(0,ve.useCallback)(x=>{if(C.current)C.current=!1;else if(E.current=!0,r.length===0)p(or);else if(m!==-1)d({});else if(l)if(i.current!==-1)p(i.current);else{let y=tr(r,c);p(y!==-1?y:0)}else if(Xt(c)){let y=tr(r,c);p(y)}else o!==!0&&p(b())},[o,m,r,b,l,c,p]),L=(0,ve.useCallback)(async x=>{let y=x.key===Qo||x.key===Zn?await f(x,m):b(x.key,m);y!==m&&p(y,!0),a==null||a(x,y)},[m,b,f,a,p]),M=(0,ve.useCallback)(x=>{r.length>0&&oi(x)?(x.preventDefault(),x.stopPropagation(),E.current=!0,L(x)):en(x)&&(E.current=!0)},[r,L]),S=(0,ve.useMemo)(()=>({onBlur:x=>{let y=x.target.closest(".saltList"),D=x.relatedTarget;y&&!(y!=null&&y.contains(D))&&(E.current=!1,u(-1),l||(i.current=-1))},onFocus:I,onKeyDown:M,onMouseDownCapture:()=>{E.current=!1,v(!0)},onMouseMove:()=>{E.current&&(E.current=!1)},onMouseLeave:()=>{E.current=!1,v(!1),p(-1)}}),[I,M,l,u,p]);return{focusVisible:E.current?m:-1,controlledHighlighting:h,highlightedIndex:m,setHighlightedIndex:p,keyboardNavigation:E,listProps:S,setIgnoreFocus:v}};var Si=require("@salt-ds/core"),Ee=require("react");var yu={},Iu=["Enter"," "],nr=e=>e&&e.disabled!==!0&&e.selectable!==!1,Ti=(e,t)=>{var o,n;return((o=e.index)!=null?o:0)-((n=t.index)!=null?n:0)};var Ei=({defaultSelected:e,disableSelection:t=!1,highlightedIdx:o,indexPositions:n,onSelect:r,onSelectionChange:s,selected:a,selectionStrategy:l,selectionKeys:c=Iu,tabToSelect:i})=>{let d=l==="deselectable",m=l==="multiple",u=l==="extended",h=(0,Ee.useRef)(-1),p=(0,Ee.useCallback)(g=>c.includes(g.key),[c]),f=(0,Ee.useCallback)(()=>m||u?[]:null,[m,u]),[b,E]=(0,Si.useControlled)({controlled:a,default:e!=null?e:f(),name:"UseSelection",state:"selected"}),C=(0,Ee.useCallback)(g=>Array.isArray(b)?b.includes(g):b===g,[b]),v=(0,Ee.useCallback)(g=>g,[]),I=(0,Ee.useCallback)(g=>C(g)?null:g,[C]),L=(0,Ee.useCallback)(g=>{let w=C(g)?b.filter(N=>N!==g):b.concat(g);return w.sort(Ti),w},[C,b]),M=(0,Ee.useCallback)((g,w)=>{let N=w?b:[],[k]=b.slice(-1),R=k?n.indexOf(k):0,T=Math.min(g,R),H=Math.max(g,R),A=n.slice(T,H+1),P=[...new Set([...N,...A])];return P.sort(Ti),P},[n,b]),S=(0,Ee.useCallback)((g,w,N,k,R)=>{let T;m?T=L(N):u?R&&!k?T=L(N):k?T=M(w,R):T=[N]:d?T=I(N):T=v(N),T!==b&&E(T),r==null||r(g,N),T!==b&&s&&s(g,T)},[m,u,d,b,r,L,M,I,v,E,s]),x=(0,Ee.useCallback)(g=>{let w=n[o];nr(w)&&(p(g)||i&&g.key==="Tab")&&(g.key!=="Tab"&&g.preventDefault(),S(g,o,w,!1,g.ctrlKey||g.metaKey),u&&(h.current=o))},[n,o,p,i,S,u]),y=(0,Ee.useCallback)((g,w)=>{if(u&&g.shiftKey){let N=n[w];nr(N)&&S(g,w,N,!0)}},[u,n,S]),D=(0,Ee.useCallback)(g=>{let w=n[o];!t&&nr(w)&&(g.preventDefault(),g.stopPropagation(),S(g,o,w,g.shiftKey,g.ctrlKey||g.metaKey),u&&(h.current=o))},[t,u,o,n,S]);return{listHandlers:si(l)?yu:{onClick:D,onKeyDown:x,onKeyboardNavigation:y},selected:b,setSelected:E}};var Mt=require("react");var Ci=({disableTypeToSelect:e,highlightedIdx:t,highlightItemAtIndex:o,typeToNavigate:n,items:r,applyIncrementalSearch:s=!0})=>{let a=(0,Mt.useRef)(null),l=(0,Mt.useRef)(""),c=(0,Mt.useRef)(-1),i=(0,Mt.useCallback)(m=>{if(m||!s){let u=new RegExp(`^${l.current}`,"i"),h=r.findIndex(({label:p},f)=>f>c.current&&u.test(p));h===-1&&(h=r.findIndex(({label:p},f)=>f<=c.current&&u.test(p))),h!==-1&&o(h)}else l.current="",a.current=null,c.current=-1},[s,o,r]),d=(0,Mt.useCallback)(m=>{let u=c.current!==-1;(en(m)||u&&m.key===ei)&&n&&(m.preventDefault(),m.stopPropagation(),(c.current===-1||m.key===l.current)&&(c.current=t),a.current!==null&&(clearTimeout(a.current),a.current=null),m.key!==l.current&&(l.current+=m.key),s&&i(!0),a.current=window.setTimeout(()=>{i()},100))},[n,s,t,i]);return{onKeyDown:e?void 0:d}};var _e=require("react");var Lt=require("react");var wi=["height"],wt=new Map,Li=(e,t,o)=>{switch(o){case"height":return t.height;case"clientHeight":return e.clientHeight;case"clientWidth":return e.clientWidth;case"contentHeight":return t.contentHeight;case"contentWidth":return t.contentWidth;case"scrollHeight":return Math.ceil(e.scrollHeight);case"scrollWidth":return Math.ceil(e.scrollWidth);case"width":return t.width;default:return 0}};var Mi=new ResizeObserver(e=>{for(let t of e){let{target:o,borderBoxSize:n,contentBoxSize:r}=t,s=wt.get(o);if(s){let[{blockSize:a,inlineSize:l}]=n,[{blockSize:c,inlineSize:i}]=r,{onResize:d,measurements:m}=s,u=!1;for(let[h,p]of Object.entries(m)){let f=Li(o,{height:a,width:l,contentHeight:c,contentWidth:i},h);f!==p&&(u=!0,m[h]=f)}u&&d&&d(m)}}});function Dt(e,t,o,n=!1){let r=(0,Lt.useRef)(t),s=(0,Lt.useCallback)(a=>{let{width:l,height:c}=a.getBoundingClientRect(),{clientWidth:i,clientHeight:d}=a;return r.current.reduce((m,u)=>(m[u]=Li(a,{width:l,height:c,contentHeight:d,contentWidth:i},u),m),{})},[]);(0,Lt.useEffect)(()=>{let a=e.current;async function l(){wt.set(a,{measurements:{}}),await document.fonts.ready;let c=wt.get(a);if(c){let i=s(a);c.measurements=i,Mi.observe(a),n&&o(i)}else console.log("%cuseResizeObserver an target expected to be under observation wa snot found. This warrants investigation","font-weight:bold; color:red;")}if(a){if(wt.has(a))throw Error("useResizeObserver attemping to observe same element twice");l()}return()=>{a&&wt.has(a)&&(Mi.unobserve(a),wt.delete(a))}},[s,e]),(0,Lt.useEffect)(()=>{let a=e.current,l=wt.get(a);if(l){if(r.current!==t){r.current=t;let c=s(a);l.measurements=c}l.onResize=o}},[t,s,e,o])}var Ri=require("@salt-ds/core"),Di=["height"],xu=["height","scrollHeight"],vu=[],Hi={containerOnly:[xu,vu],withContent:[Di,Di]},Tu=e=>e?Hi.containerOnly:Hi.withContent,Ni={current:null},Su=(e,t)=>{let{transform:o="none"}=getComputedStyle(e);if(o.startsWith("matrix")){let n=o.lastIndexOf(",");return parseInt(o.slice(n+1))}else{let n=e.offsetParent;if(n===t||t===null)return e.offsetTop;{let r=e.offsetTop;for(;n!==null&&n!==t;)r+=n.offsetTop,n=n.offsetParent;return r}}},Pi=({containerRef:e,contentRef:t=Ni,highlightedIdx:o=-1,indexPositions:n,stickyHeaders:r=!1})=>{let s=(0,_e.useRef)(!1),a=(0,_e.useRef)({height:0,contentHeight:0}),l=(0,_e.useCallback)(f=>{s.current=!0,e.current&&(e.current.scrollTop=f),setTimeout(()=>{s.current=!1})},[]),c=(0,_e.useCallback)(()=>l(0),[l]),i=(0,_e.useCallback)(()=>{l(a.current.contentHeight-a.current.height)},[l]),d=(0,_e.useCallback)(f=>{let b=t.current||e.current;if(f.id){let E=document.getElementById(f.id);if(E&&e.current){let{height:C}=a.current,v=E.ariaExpanded&&E.firstChild?E.firstChild:E,I=r?36:0,L=Su(v,b),M=v.offsetHeight,{scrollTop:S}=e.current,x=S+I,y=x+C-I;if(L+M>y||L<x){let D=L+M>y?S+(L+M)-y:L-I;l(D)}}}},[e,t,l,r]);(0,Ri.useIsomorphicLayoutEffect)(()=>{let{height:f,contentHeight:b}=a.current,E=n[o];if(b>f&&E){let[C]=n,[v]=n.slice(-1);E===C?c():E===v?i():d(n[o])}},[o,n,d,i,c]);let m=(0,_e.useCallback)(({height:f,scrollHeight:b})=>{typeof f=="number"&&(a.current.height=f),typeof b=="number"&&(a.current.contentHeight=b)},[]),u=(0,_e.useCallback)(({height:f})=>{typeof f=="number"&&(a.current.contentHeight=f)},[]),[h,p]=Tu(t===Ni);return Dt(e,h,m,!0),Dt(t,p,u,!0),{isScrolling:s,scrollIntoView:d}};var ue=require("react");var ln=({allowDragDrop:e=!1,collapsibleHeaders:t,collectionHook:o,containerRef:n,contentRef:r,defaultHighlightedIndex:s,defaultSelected:a,disabled:l,disableAriaActiveDescendant:c,disableHighlightOnFocus:i,disableTypeToSelect:d,highlightedIndex:m,id:u,label:h="",listHandlers:p,onHighlight:f,onKeyboardNavigation:b,onKeyDown:E,onMoveListItem:C,onSelect:v,onSelectionChange:I,restoreLastFocus:L,selected:M,selectionStrategy:S,selectionKeys:x,stickyHeaders:y,tabToSelect:D,viewportRange:O})=>{let g=(0,ue.useRef)(null),w=(0,ue.useRef)(M||a),N=(U,z)=>{var Q,re;(re=(Q=G.listHandlers).onKeyboardNavigation)==null||re.call(Q,U,z),b==null||b(U,z)},k=(0,ue.useCallback)((U,z)=>{v&&((0,ue.isValidElement)(z.value)?v(U,z.label):z.value!==null&&v(U,z.value))},[v]),R=(0,ue.useCallback)((U,z)=>{I&&I(U,Array.isArray(z)?z.map(Q=>(0,ue.isValidElement)(Q.value)?Q.label:Q.value):z&&((0,ue.isValidElement)(z.value)?z.label:z.value))},[I]),{highlightedIndex:T,listProps:{onKeyDown:H,onMouseMove:A,...P},setHighlightedIndex:F,...B}=vi({containerRef:n,defaultHighlightedIndex:s,disableHighlightOnFocus:i,highlightedIndex:m,indexPositions:o.data,label:h,onHighlight:f,onKeyboardNavigation:N,restoreLastFocus:L,selected:w.current}),_=ni({collapsibleHeaders:t,highlightedIdx:T,collectionHook:o}),V=(0,ue.useCallback)(()=>{F(-1)},[F]),G=Ei({defaultSelected:a,highlightedIdx:T,indexPositions:o.data,label:h,onSelect:k,onSelectionChange:R,selected:M,selectionStrategy:S,selectionKeys:x,tabToSelect:D}),K=(0,ue.useCallback)((U,z,Q)=>{let re=o.data.indexOf(U);return re===z?Q:re<Math.min(z,Q)||re>Math.max(z,Q)?re:z<re?re-1:re+1},[o.data]),$=(0,ue.useCallback)((U,z,Q)=>Array.isArray(U)?U.map(re=>K(re,z,Q)):K(U,z,Q),[K]),Z=(0,ue.useCallback)((U,z)=>{Xt(G.selected)&&(g.current=$(G.selected,U,z)),C==null||C(U,z),F(-1)},[G.selected,C,F,$]),Y=(0,ue.useCallback)(U=>{F(U)},[F]),{setSelected:de}=G;(0,ue.useEffect)(()=>{let{current:U}=g;if(Xt(U)){let z=Array.isArray(U)?U.map(Q=>o.data[Q]):o.data[U];de(z)}},[o.data,de]),(0,ue.useEffect)(()=>{Xt(w.current)&&de(Array.isArray(w.current)?[]:null)},[de,o.data]);let{onMouseDown:W,isDragging:q,isScrolling:j,...ee}=Zo({allowDragDrop:e,draggableClassName:"list-item",orientation:"vertical",containerRef:n,id:u,itemQuery:".vuuListItem",onDragStart:V,onDrop:Z,onDropSettle:Y,viewportRange:O}),{onKeyDown:J}=Ci({disableTypeToSelect:d,highlightedIdx:T,highlightItemAtIndex:F,typeToNavigate:!0,items:o.data}),te=(0,ue.useCallback)(U=>{var z,Q,re;U.defaultPrevented||J==null||J(U),H(U),U.defaultPrevented||(Q=(z=G.listHandlers).onKeyDown)==null||Q.call(z,U),U.defaultPrevented||(re=_==null?void 0:_.onKeyDown)==null||re.call(_,U),U.defaultPrevented||E==null||E(U)},[_,H,E,G.listHandlers,J]),{isScrolling:Ie,scrollIntoView:xe}=Pi({containerRef:n,contentRef:r,highlightedIdx:T,indexPositions:o.data,stickyHeaders:y}),Me=Ie.current||j.current,we=(0,ue.useCallback)(U=>{if(!Me&&!l&&!q){A();let z=ri(U.target);if(z!==-1&&z!==T){let Q=o.data[z];!Q||Q.disabled?F(-1):F(z)}}},[q,Me,l,F,A,T,o.data]),Ne=()=>{var U;return T===void 0||T===-1||c||(U=o.data[T])==null?void 0:U.id};w.current=G.selected;let Re={"aria-activedescendant":Ne(),onBlur:P.onBlur,onFocus:P.onFocus,onKeyDown:te,onMouseDown:W,onMouseDownCapture:P.onMouseDownCapture,onMouseLeave:P.onMouseLeave},Pe=p||{onClick:G.listHandlers.onClick,onMouseMove:we};return{focusVisible:B.focusVisible,controlledHighlighting:B.controlledHighlighting,highlightedIndex:T,keyboardNavigation:B.keyboardNavigation,listHandlers:Pe,listItemHeaderHandlers:_,listControlProps:Re,scrollIntoView:xe,selected:G.selected,setHighlightedIndex:F,setIgnoreFocus:B.setIgnoreFocus,setSelected:G.setSelected,...ee}};var ki=require("@salt-ds/core"),Ht=require("react");var Eu=(e,t,o=0)=>e===0?0:o===0?e*t:e-1*(t+o)+t,an=({borderless:e,displayedItemCount:t,getItemHeight:o,height:n,itemCount:r,itemGapSize:s,itemHeight:a,rootRef:l,rowHeightRef:c})=>{let[i,d]=(0,Ht.useState)(36),[m,u]=(0,Ht.useState)(),[h,p]=(0,Ht.useMemo)(()=>{let b=e?0:2,E=a!=null?a:i,C=Eu(r,E,s);if(n!==void 0&&typeof n=="number"||typeof n=="string")return[C,n];let v=Math.min(t,r)||t;return typeof o=="function"?b+=Array(v).fill(0).reduce((L,M,S)=>L+o(S)+s,0)-s:b+=v*Number(E)+(v-1)*s,[C,b,m]},[e,m,t,o,n,r,s,a,i]);(0,ki.useIsomorphicLayoutEffect)(()=>{if(l.current){let{clientHeight:b}=l.current;u(b)}},[l]);let f=(0,Ht.useCallback)(({height:b})=>{typeof b=="number"&&d(b)},[]);return Dt(c,wi,f,!0),{contentHeight:h,listClientHeight:m,listItemHeight:i,listHeight:p}};var Oi=require("@salt-ds/core"),Ge=require("react"),Ai=(e,t,o,n)=>{let r=Math.ceil(t/n),s=Math.floor(e/n),a=Math.ceil(s+r-1);return{atStart:s===0,atEnd:a===o-1,from:s,to:a}},cn=({containerSize:e,itemCount:t,itemGapSize:o=0,itemSize:n,onViewportScroll:r})=>{let s=(0,Ge.useRef)(0),a=(0,Ge.useRef)(0),l=(0,Ge.useRef)(0),c=(0,Ge.useMemo)(()=>Ai(l.current,e,t,n+o),[e,t,n,o]),[i,d]=(0,Ge.useState)(c);return(0,Oi.useIsomorphicLayoutEffect)(()=>{d(c)},[c]),{onVerticalScroll:(0,Ge.useCallback)(u=>{let h=u.target.scrollTop;if(h!==l.current){l.current=h;let p=n+o,f=Ai(h,e,t,p);(f.from!==s.current||f.to!==a.current)&&(s.current=f.from,a.current=f.to,r==null||r(f.from,f.to),d(f))}},[n,o,e,t,r]),viewportRange:i}};var Oe=require("react/jsx-runtime"),$i=require("react"),Cu="No data to display",Mo="vuuList",cb=(0,We.forwardRef)(function({ListItem:t=Yo,ListPlaceholder:o,allowDragDrop:n,borderless:r,children:s,className:a,collapsibleHeaders:l=!1,defaultHighlightedIndex:c,defaultSelected:i,disabled:d=!1,disableFocus:m=!1,disableTypeToSelect:u,displayedItemCount:h=10,emptyMessage:p,focusVisible:f,getItemHeight:b,getItemId:E,height:C,highlightedIndex:v,id:I,itemGapSize:L=0,itemHeight:M,itemTextHighlightPattern:S,itemToString:x=Jt,listHandlers:y,maxHeight:D,maxWidth:O,minHeight:g,minWidth:w,onMoveListItem:N,onSelect:k,onSelectionChange:R,onHighlight:T,restoreLastFocus:H,selected:A,selectionStrategy:P,checkable:F=P==="multiple",scrollingApiRef:B,selectionKeys:_,showEmptyMessage:V=!1,source:G,style:K,stickyHeaders:$,tabToSelect:Z,width:Y,...de},W){let q=(0,Fi.useId)(I),j=(0,We.useRef)(null),ee=(0,We.useRef)(null),J=(0,We.useRef)(null),te=nn({id:q,label:"List",source:G,children:s,options:{collapsibleHeaders:l,getItemId:E,itemToString:x}}),{listClientHeight:Ie,listHeight:xe,listItemHeight:Me}=an({borderless:r,displayedItemCount:h,getItemHeight:b,height:C,itemCount:te.data.length,itemGapSize:L,itemHeight:M,rootRef:j,rowHeightRef:J}),{onVerticalScroll:we,viewportRange:Ne}=cn({containerSize:Ie!=null?Ie:typeof xe=="number"?xe:0,itemCount:te.data.length,itemGapSize:L,itemSize:Me}),{draggable:Re,draggedItemIndex:Pe,dropIndicator:U,focusVisible:z,highlightedIndex:Q,listControlProps:re,listHandlers:he,listItemHeaderHandlers:Ue,scrollIntoView:ze,selected:at}=ln({allowDragDrop:n,collapsibleHeaders:l,collectionHook:te,containerRef:j,contentRef:ee,defaultHighlightedIndex:c,defaultSelected:te.itemToCollectionItem(i),disabled:d,disableTypeToSelect:u,highlightedIndex:v,id:q,label:q,listHandlers:y,onMoveListItem:N,onSelect:k,onSelectionChange:R,onHighlight:T,restoreLastFocus:H,selected:te.itemToCollectionItem(A),selectionStrategy:P,selectionKeys:_,stickyHeaders:$,tabToSelect:Z,viewportRange:Ne});sn({collectionHook:te,forwardedRef:B,scrollableRef:j,scrollIntoView:ze});let It=f!=null?f:z,Xe=function(le,Se,Le,be){let xt=(0,$i.createElement)(t,{...Ue,className:(0,un.default)(`${Mo}Header`,{focusVisible:l&&It===le.value}),"aria-expanded":be,"data-idx":l?le.value:void 0,"data-index":l?le.value:void 0,"data-highlighted":le.value===Q||void 0,"data-sticky":$,"data-selectable":!1,id:Se,key:`header-${le.value}`,label:Le});return le.value+=1,xt},mo=b===void 0?()=>M:b;function Ca(Ye,le,Se){var Ao,Tr;let{disabled:Le,value:be,id:xt,label:Po}=le,ko=(0,We.isValidElement)(be),po={className:(0,un.default)((Ao=be==null?void 0:be.props)==null?void 0:Ao.className,{vuuHighlighted:Se.value===Q,vuuFocusVisible:It===Se.value,["vuuDraggable-dragAway"]:Pe===Se.value}),disabled:Le||d,id:xt,item:ko?void 0:(Tr=le==null?void 0:le.value)!=null?Tr:void 0,itemHeight:mo(Se.value),itemTextHighlightPattern:S,key:xt,"data-idx":Se.value,"data-index":Se.value,label:Po,role:"option",selected:on(at,le),showCheckbox:F};Ye.push(ko?(0,We.cloneElement)(be,po):(0,Oe.jsx)(t,{...po})),Se.value+=1}let Ma=function(le,Se,Le){let{count:be=0,id:xt,expanded:Po,label:ko=""}=Se[Le.value],po=Xe(Le,xt,ko,Po),Ao=Po!==!1?[po].concat(vr(Se,Le,Le.value+be)||[]):po;le.push((0,Oe.jsx)("div",{role:"group",children:Ao},xt))},vr=(Ye,le={value:0},Se=Ye.length)=>{let Le=[];for(;le.value<Se;){let be=Ye[le.value];be.header?Le.push(Xe(le,be.id,be.label,be.expanded===!1)):be.childNodes?Ma(Le,Ye,le):Ca(Le,be,le)}return Le};function wa(){return p||V?(0,Oe.jsx)("span",{className:`${Mo}-empty-message`,children:p!=null?p:Cu}):null}let La=()=>{if(te.data.length){let Ye=te.data;return vr(Ye)}else wa()},Da="auto",Ha={"--list-item-gap":L?`${L}px`:void 0,minWidth:w,minHeight:g,width:Y!=null?Y:"100%",height:C!=null?C:"100%",maxWidth:O!=null?O:Y,maxHeight:D!=null?D:xe};return(0,Oe.jsxs)("div",{"aria-multiselectable":P==="multiple"||P==="extended"||P==="extended-multi-range"||void 0,...de,...he,...re,className:(0,un.default)(Mo,a,{[`${Mo}-collapsible`]:l,vuuFocusVisible:Q===or}),id:`${q}`,ref:(0,Ki.useForkRef)(j,W),role:"listbox",onScroll:we,style:{...K,...Ha},tabIndex:d||m?void 0:0,children:[(0,Oe.jsx)(Xo,{ref:J}),te.data.length===0&&o!==void 0?(0,Oe.jsx)(Oe.Fragment,{children:(0,Oe.jsx)(o,{})}):(0,Oe.jsxs)("div",{className:`${Mo}-scrollingContentContainer`,ref:ee,style:{height:Da},children:[La(),U,Re]})]})});var jt=require("@salt-ds/core");function Bi(e){var t,o,n="";if(typeof e=="string"||typeof e=="number")n+=e;else if(typeof e=="object")if(Array.isArray(e))for(t=0;t<e.length;t++)e[t]&&(o=Bi(e[t]))&&(n&&(n+=" "),n+=o);else for(t in e)e[t]&&(n&&(n+=" "),n+=t);return n}function rr(){for(var e,t,o=0,n="";o<arguments.length;)(e=arguments[o++])&&(t=Bi(e))&&(n&&(n+=" "),n+=t);return n}var Rt=require("react");var Ui=require("react");var dn=class{constructor(t=0,o=0){this.keys=new Map,this.free=[],this.nextKeyValue=0,this.reset(t,o)}next(){return this.free.length?this.free.pop():this.nextKeyValue++}reset(t,o){this.keys.forEach((r,s)=>{(s<t||s>=o)&&(this.free.push(r),this.keys.delete(s))});let n=o-t;this.keys.size+this.free.length>n&&(this.free.length=n-this.keys.size);for(let r=t;r<o;r++)if(!this.keys.has(r)){let s=this.next();this.keys.set(r,s)}}keyFor(t){return this.keys.get(t)}};var Mu=([e],[t])=>e-t,Vi=5,zi=({data:e,listItemGapSize:t=0,listItemHeight:o,viewportRange:n})=>{let r=(0,Ui.useMemo)(()=>new dn(0,1),[]),s=o+t,a=Math.max(0,n.from-Vi),l=Math.min(e.length,n.to+Vi);return r.reset(a,l),e.slice(a,l).map((i,d)=>[r.keyFor(d+a),(d+a)*s,d+a+1,i]).sort(Mu)};var Nt=require("react/jsx-runtime"),wu="No data to display",mn=(0,jt.makePrefixer)("saltList"),Lu=(0,Rt.memo)(Yo),Lb=(0,Rt.forwardRef)(function({borderless:t,children:o,className:n,collapsibleHeaders:r=!1,defaultHighlightedIndex:s,defaultSelected:a,disabled:l=!1,disableFocus:c=!1,disableTypeToSelect:i,displayedItemCount:d=10,emptyMessage:m,getItemHeight:u,getItemId:h,height:p,highlightedIndex:f,id:b,itemGapSize:E=0,itemHeight:C,itemTextHighlightPattern:v,itemToString:I,maxHeight:L,maxWidth:M,minHeight:S,minWidth:x,onSelect:y,onSelectionChange:D,onViewportScroll:O,onHighlight:g,restoreLastFocus:w,selected:N,selectionStrategy:k,scrollingApiRef:R,selectionKeys:T,showEmptyMessage:H=!1,source:A,style:P,stickyHeaders:F,tabToSelect:B,width:_,...V},G){let K=(0,jt.useIdMemo)(b),$=(0,Rt.useRef)(null),Z=(0,Rt.useRef)(null),Y=nn({id:K,label:"List",source:A,children:o,options:{collapsibleHeaders:r,getItemId:h,itemToString:I}}),{contentHeight:de,listItemHeight:W,listHeight:q}=an({borderless:t,displayedItemCount:d,height:p,itemCount:Y.data.length,itemGapSize:E,itemHeight:C,rootRef:$,rowHeightRef:Z}),{focusVisible:j,highlightedIndex:ee,listControlProps:J,listHandlers:te,scrollIntoView:Ie,selected:xe}=ln({collapsibleHeaders:r,collectionHook:Y,containerRef:$,defaultHighlightedIndex:s,defaultSelected:Y.itemToCollectionItem(a),disabled:l,disableTypeToSelect:i,highlightedIndex:f,label:K,onSelect:y,onSelectionChange:D,onHighlight:g,restoreLastFocus:w,selected:Y.itemToCollectionItem(N),selectionStrategy:k,selectionKeys:T,stickyHeaders:F,tabToSelect:B}),{onVerticalScroll:Me,viewportRange:we}=cn({containerSize:typeof q=="number"?q:0,itemCount:Y.data.length,itemGapSize:E,itemSize:W});console.log({viewPortRange:we});let Ne=zi({data:Y.data,listItemGapSize:E,listItemHeight:W,viewportRange:we});sn({collectionHook:Y,forwardedRef:R,scrollableRef:$,scrollIntoView:Ie});function Re(re,he,Ue){let[ze,at,It,Xe]=he,mo=It-1;re.push((0,Nt.jsx)(Lu,{"aria-setsize":Y.data.length,"aria-posinset":It,className:rr(n,{saltHighlighted:mo===ee,saltFocusVisible:j===mo}),"data-idx":mo,item:Xe,label:Xe.label,"data-offset":at,role:"option",selected:on(xe,Xe),id:Xe.id,translate3d:at},ze)),Ue.value+=1}function Pe(re,he={value:0},Ue=re.length){let ze=[];for(;he.value<Ue;){let at=re[he.value];Re(ze,at,he)}return ze}function U(){return m||H?(0,Nt.jsx)("span",{className:mn("empty-message"),children:m!=null?m:wu}):null}let z=()=>{if(Ne.length)return Pe(Ne);U()},Q={"--list-item-gap":E?`${E}px`:void 0,minWidth:x,minHeight:S,width:_!=null?_:"100%",height:p!=null?p:"100%",maxWidth:M!=null?M:_,maxHeight:L!=null?L:q};return(0,Nt.jsx)("div",{...V,...te,...J,className:rr(mn(),n,mn("virtualized")),id:`${K}`,ref:(0,jt.useForkRef)($,G),role:"listbox",onScroll:Me,style:{...P,...Q},tabIndex:l||c?void 0:0,children:(0,Nt.jsxs)("div",{className:mn("scrollingContentContainer"),style:{height:de},children:[(0,Nt.jsx)(Xo,{ref:Z}),z()]})})});var eo=require("@vuu-ui/vuu-layout"),rl=require("@salt-ds/core"),sl=X(require("classnames")),to=X(require("react"));var ye=require("react");var _i=e=>typeof e=="object"&&e!==null&&"tabIndex"in e&&typeof e.tabIndex=="number",Gi=e=>({label:"Close",location:"tab",action:"close-tab",options:e}),Wi=e=>({label:"Rename",location:"tab",action:"rename-tab",options:e});var Du=e=>{if(e){let t=parseInt(e.dataset.index||"");if(!isNaN(t))return t}return-1},qi=(e,t)=>{if(e){let o=e.querySelector(`[data-index]:has(${t})`);return Du(o)}return-1},sr=e=>qi(e,'[aria-selected="true"]'),Zi=e=>qi(e,".vuuEditableLabel-editing");var Qt=require("@vuu-ui/vuu-utils"),tt=require("react"),Ji=(e,t,o="horizontal")=>{let n=(0,tt.useRef)(!1),r=(0,tt.useCallback)(()=>{n.current=!0},[]),s=(0,tt.useCallback)(()=>{n.current=!1},[]),a=(0,tt.useCallback)(()=>{var c,i;(c=e.current)==null||c.style.setProperty("--tab-thumb-transition","none"),(i=e.current)==null||i.removeEventListener("transitionend",a)},[e]),l=(0,tt.useRef)(-1);return(0,tt.useMemo)(()=>{var d,m;let c=0,i=0;if(l.current!==-1){let u=(d=e.current)==null?void 0:d.querySelector(".vuuTab-selected"),h=(m=e.current)==null?void 0:m.querySelector(`[data-index="${t}"] .vuuTab`),{positionProp:p,sizeProp:f}=Qt.MEASURES[o];if(u&&h&&!n.current){let{[p]:b,[f]:E}=u.getBoundingClientRect(),{[p]:C}=h.getBoundingClientRect();if((0,Qt.isValidNumber)(b)&&(0,Qt.isValidNumber)(C)&&(0,Qt.isValidNumber)(E)){console.log({orientation:o,positionProp:p,oldPosition:b,newPosition:C}),c=b-C,i=E;let I=Math.abs(c/(o==="horizontal"?1100:700));requestAnimationFrame(()=>{var L,M,S,x;(L=e.current)==null||L.style.setProperty("--tab-thumb-offset","0px"),(M=e.current)==null||M.style.setProperty("--tab-thumb-size","100%"),(S=e.current)==null||S.style.setProperty("--tab-thumb-transition",`all ${I}s ease`),(x=e.current)==null||x.addEventListener("transitionend",a)})}}}return l.current=t,n.current?{containerStyle:{"--tab-thumb-offset":"0px","--tab-thumb-size":"100%"},resumeAnimation:s,suspendAnimation:r}:{containerStyle:{"--tab-thumb-offset":`${c}px`,"--tab-thumb-size":i?`${i}px`:void 0},resumeAnimation:s,suspendAnimation:r}},[t,e,o,a,s,r])};var Yi=require("@salt-ds/core"),ji=require("@vuu-ui/vuu-utils"),fe=require("react"),Te=require("@vuu-ui/vuu-utils");var Qi={horizontal:{[Te.Home]:"start",[Te.End]:"end",[Te.ArrowLeft]:"bwd",[Te.ArrowRight]:"fwd"},vertical:{[Te.Home]:"start",[Te.End]:"end",[Te.ArrowUp]:"bwd",[Te.ArrowDown]:"fwd"}},Hu=(e,t="horizontal")=>Qi[t][e]!==void 0,Nu=e=>e===Te.ArrowDown;function Xi(e,t,o){return t==="start"?0:t==="end"?e-1:t==="bwd"?o>0?o-1:o:o===null?0:o===e-1?o:o+1}var Ru=e=>e!==null&&!e.classList.contains("wrapped"),pn=(e,t)=>e?e.querySelector(`[data-index="${t}"]`):null,el=({containerRef:e,defaultHighlightedIdx:t=-1,highlightedIdx:o,keyBoardActivation:n,orientation:r,selectedIndex:s=0})=>{let a=n==="manual",l=(0,fe.useRef)(!1),c=(0,fe.useRef)(-1),[i,d]=(0,fe.useState)(!1),[,m]=(0,fe.useState)({}),[u,h]=(0,Yi.useControlled)({controlled:o,default:t,name:"UseKeyboardNavigation"}),p=(0,fe.useCallback)(g=>{h(c.current=g)},[h]),f=(0,fe.useRef)(!1),b=(0,fe.useCallback)((g,w=!1,N,k=70)=>{p(g),N===!0&&!f.current&&(f.current=!0);let R=()=>{let T=pn(e.current,g);if(T){let H=(0,ji.getFocusableElement)(T);H==null||H.focus()}};w?R():setTimeout(R,k)},[e,p]),E=g=>{if(c.current===-1&&g.target.tabIndex!==-1){let w=Zi(e.current);w!==-1?requestAnimationFrame(()=>{p(w)}):setTimeout(()=>{c.current===-1&&s!==null&&p(s)},200)}},C=(0,fe.useCallback)(()=>{var g,w;return(w=(g=e.current)==null?void 0:g.querySelectorAll("[data-index]").length)!=null?w:0},[e]),v=(0,fe.useCallback)((g="fwd",w)=>{let N=C(),R=Xi(N,g,typeof w=="number"?w:N),T=g==="start"?"fwd":g==="end"?"bwd":g;for(;(T==="fwd"&&R<N||T==="bwd"&&R>0)&&!Ru(pn(e.current,R));){let H=Xi(N,T,R);if(H===R)break;R=H}return R},[e,C]),I=(0,fe.useCallback)((g,w=!1)=>{let N=Qi[r][g.key],k=v(N,u);k!==u?a&&b(k,!0):w&&m({})},[u,a,v,b,r]),L=(0,fe.useCallback)(()=>{let g=pn(e.current,u);return g?g.querySelector(".vuuPopupMenu")!=null:!1},[e,u]),M=(0,fe.useCallback)(()=>{let g=pn(e.current,u),w=g==null?void 0:g.querySelector(".vuuPopupMenu");if(w){let N=new MouseEvent("click",{view:window,bubbles:!0,cancelable:!0});w.dispatchEvent(N)}return!1},[e,u]),S=(0,fe.useCallback)(g=>{C()>0&&Hu(g.key,r)?(g.preventDefault(),f.current?I(g):(f.current=!0,I(g,!0))):Nu(g.key)&&L()&&M()},[M,C,L,I,r]),x=(g,w)=>{p(w)},y=(0,fe.useCallback)(()=>{i||(d(!0),l.current?l.current=!1:f.current=!0)},[i]),D=(0,fe.useCallback)(()=>{i||(l.current=!0),f.current=!1},[i]);return{containerProps:{onBlur:g=>{let w=g.target.closest(".vuuTabstrip"),N=g.relatedTarget;w&&!(w!=null&&w.contains(N))&&(p(-1),d(!1))},onMouseDownCapture:D,onFocus:y,onMouseLeave:()=>{f.current=!0,p(-1),l.current=!1}},focusVisible:f.current?u:-1,focusIsWithinComponent:i,highlightedIdx:u,focusTab:b,onClick:x,onFocus:E,onKeyDown:S,setHighlightedIdx:p}};var tl=require("@salt-ds/core"),wo=require("react"),Pu=["Enter"," "],ku=e=>e&&e.matches('[class*="vuuTab "]'),ol=({defaultSelected:e,highlightedIdx:t,onSelectionChange:o,selected:n})=>{let[r,s,a]=(0,tl.useControlled)({controlled:n,default:e!=null?e:0,name:"Tabstrip",state:"value"}),l=(0,wo.useCallback)(m=>Pu.includes(m.key),[]),c=(0,wo.useCallback)(m=>{s(m),o==null||o(m)},[o,s]),i=(0,wo.useCallback)(m=>{let u=m.target;l(m)&&t!==r&&ku(u)&&(m.stopPropagation(),m.preventDefault(),c(t))},[l,t,r,c]),d=(0,wo.useCallback)((m,u)=>{u!==r&&c(u)},[c,r]);return{activateTab:c,isControlled:a,onClick:d,onKeyDown:i,selected:r}};var Au=new Set(["Enter"," "]),Ou=e=>Au.has(e),Fu=(e,t)=>e?e.querySelector(`[data-index="${t}"]`):null,nl=({activeTabIndex:e,allowDragDrop:t,animateSelectionThumb:o,containerRef:n,onActiveChange:r,onAddTab:s,onCloseTab:a,onExitEditMode:l,onMoveTab:c,orientation:i,keyBoardActivation:d})=>{let m=(0,ye.useRef)(e),{focusTab:u,highlightedIdx:h,onClick:p,onKeyDown:f,setHighlightedIdx:b,...E}=el({containerRef:n,keyBoardActivation:d,orientation:i,selectedIndex:m.current}),{activateTab:C,onClick:v,onKeyDown:I,selected:L}=ol({highlightedIdx:h,onSelectionChange:r,selected:e});m.current=L;let{containerStyle:M,resumeAnimation:S,suspendAnimation:x}=Ji(n,o?L:-1,i),y=(0,ye.useCallback)((K,$)=>{let{current:Z}=m;console.log(`useTabstrip handleDrop ${K} - ${$} ${Z}`),c==null||c(K,$);let Y=-1;$!==-1&&(Z===K?Y=$:K>Z&&$<=Z?Y=Z+1:K<Z&&$>=Z&&(Y=Z-1),Y!==-1&&(x(),C(Y),requestAnimationFrame(S)),u($,!1,!1,350))},[u,c,S,C,x]),{onMouseDown:D,...O}=Zo({allowDragDrop:t,containerRef:n,draggableClassName:`tabstrip-${i}`,onDrop:y,orientation:"horizontal",itemQuery:".vuuOverflowContainer-item"}),g=(0,ye.useCallback)((K,$,Z,Y)=>{console.log(`handleExitEditMode ${K} ${$} ${Z} ${Y}`),l==null||l(K,$,Z,Y),Z||u(Y,!1,!0)},[u,l]),w=(0,ye.useCallback)((K,$)=>{p(K,$),v(K,$)},[p,v]),N=(0,ye.useCallback)((K=h)=>{let $=Fu(n.current,K);if($)return $.querySelector(".vuuEditableLabel")},[n,h]),k=(0,ye.useCallback)((K=h)=>{let $=N(K);return $?$.classList.contains("vuuEditableLabel-editing"):!1},[N,h]),R=(0,ye.useCallback)((K=h)=>{let $=N(K);if($){let Z=new MouseEvent("dblclick",{view:window,bubbles:!0,cancelable:!0});$.dispatchEvent(Z)}},[N,h]),T=(0,ye.useCallback)(K=>{f(K),K.defaultPrevented||I(K),!K.defaultPrevented&&Ou(K.key)&&R()},[R,f,I]),H=(0,ye.useCallback)(K=>{let $=sr(n.current),Z=$>K?$-1:$===K?0:$;return x(),a==null||a(K,Z),setTimeout(()=>{S()},200),!0},[n,a,S,x]),A=(0,ye.useCallback)(K=>(R(K),!0),[R]),P=(0,ye.useCallback)(K=>{if(_i(K.options))switch(K.menuId){case"close-tab":return H(K.options.tabIndex);case"rename-tab":return A(K.options.tabIndex);default:console.log(`tab menu action ${K.menuId}`)}return!1},[H,A]),F=(0,ye.useCallback)(()=>{k()?b(h):u(h)},[h,u,b,k]),B=(0,ye.useCallback)(K=>{let $=parseInt(K.index);isNaN($)||C($)},[C]),_={onFocus:E.onFocus,onKeyDown:T},V=(0,ye.useCallback)(()=>{s==null||s(),requestAnimationFrame(()=>{let K=sr(n.current);K!==-1&&u(K)})},[n,u,s]),G={onClick:w,onKeyDown:T,onExitEditMode:g,onMenuAction:P,onMenuClose:F,onMouseDown:D};return{activeTabIndex:L,containerStyle:M,focusVisible:E.focusVisible,containerProps:{...E.containerProps,onSwitchWrappedItemIntoView:B},navigationProps:_,onClickAddTab:V,tabProps:G,...O}};var oo=require("react/jsx-runtime"),ll=require("react"),ir="vuuTabstrip",il=({activeTabIndex:e,allowAddTab:t,allowCloseTab:o,allowDragDrop:n=!1,allowRenameTab:r=!1,animateSelectionThumb:s=!1,children:a,className:l,id:c,keyBoardActivation:i="manual",location:d,onActiveChange:m,onAddTab:u,onCloseTab:h,onExitEditMode:p,onMoveTab:f,orientation:b="horizontal",showTabMenuButton:E,style:C,...v})=>{let I=(0,to.useRef)(null),{activeTabIndex:L,focusVisible:M,containerStyle:S,draggedItemIndex:x,onClickAddTab:y,tabProps:D,...O}=nl({activeTabIndex:e,allowDragDrop:n,animateSelectionThumb:s,containerRef:I,keyBoardActivation:i,onActiveChange:m,onAddTab:u,onCloseTab:h,onExitEditMode:p,onMoveTab:f,orientation:b}),g=(0,eo.useId)(c),w=(0,sl.default)(ir,`${ir}-${b}`,l),N=C||S?{...C,...S}:void 0,k=(0,to.useMemo)(()=>(0,eo.asReactElements)(a).map((R,T)=>{let{id:H=`${g}-tab-${T}`,closeable:A=o,editable:P=r,showMenuButton:F=E}=R.props,B=T===L;return to.default.cloneElement(R,{...D,...O.navigationProps,closeable:A,"data-overflow-priority":B?"1":void 0,dragging:x===T,editable:P,focusVisible:M===T,id:H,index:T,key:T,location:d,selected:B,showMenuButton:F,tabIndex:B?0:-1})}).concat(t?(0,ll.createElement)(rl.Button,{...O.navigationProps,"aria-label":"Create Tab",className:`${ir}-addTabButton`,"data-icon":"add","data-overflow-priority":"1",key:"addButton",onClick:y,variant:"secondary",tabIndex:-1}):[]),[L,t,o,r,a,M,g,d,y,E,D,x,O.navigationProps]);return(0,oo.jsxs)(oo.Fragment,{children:[(0,oo.jsx)(eo.OverflowContainer,{...v,...O.containerProps,className:w,height:28,id:g,orientation:b,overflowIcon:"more-horiz",ref:I,style:N,children:k}),O.draggable]})};var pl=require("@salt-ds/core"),fl=X(require("classnames")),At=require("react");var al=require("react"),cl=X(require("classnames"));var dl=require("react/jsx-runtime"),Ku="vuuTabMenu",ul=({allowClose:e,allowRename:t,location:o,onMenuAction:n,onMenuClose:r,index:s})=>{let[a,l]=(0,al.useMemo)(()=>[(c,i)=>{let d=[];return t&&d.push(Wi(i)),e&&d.push(Gi(i)),d},{tabIndex:s}],[e,t,s]);return(0,dl.jsx)(Ds,{className:Ku,menuBuilder:a,menuActionHandler:n,menuLocation:(0,cl.default)("tab",o),menuOptions:l,onMenuClose:r,tabIndex:-1})};var kt=require("react/jsx-runtime"),Pt="vuuTab",ml=()=>{},Lo=(0,At.forwardRef)(function({ariaControls:t,children:o,className:n,closeable:r=!1,dragging:s,editable:a=!1,editing:l,focusVisible:c,index:i=-1,label:d,location:m,onClick:u,onClose:h,onEnterEditMode:p=ml,onExitEditMode:f=ml,onFocus:b,onKeyUp:E,onMenuAction:C,onMenuClose:v,orientation:I,selected:L,showMenuButton:M=r||a,tabIndex:S,...x},y){if(M&&typeof C!="function")throw Error("Tab onMenuAction must be provided if showMenuButton is set");let D=(0,At.useRef)(null),O=(0,At.useRef)(null),g=(0,pl.useForkRef)(y,D),w=(0,At.useCallback)(H=>{l||(H.preventDefault(),u==null||u(H,i))},[l,i,u]),N=(H="",A="",P=!0)=>f(H,A,P,i),k=H=>{switch(H.key){case"Backspace":case"Delete":r&&(H.stopPropagation(),h&&h(i));break;default:E&&E(H,i)}},R=()=>a?(0,kt.jsx)(_s,{editing:l,defaultValue:d,onEnterEditMode:p,onExitEditMode:N,ref:O},d):d,T=H=>{if(O.current){let P=O.current.querySelector(".vuuEditableLabel-input");P==null||P.focus()}b==null||b(H)};return(0,kt.jsxs)("div",{...x,"aria-controls":t,"aria-selected":L,className:(0,fl.default)(Pt,{[`${Pt}-closeable`]:r,"vuuDraggable-dragAway":s,[`${Pt}-editing`]:l,[`${Pt}-selected`]:L||void 0,[`${Pt}-vertical`]:I==="vertical",vuuFocusVisible:c}),onClick:w,onFocus:T,onKeyUp:k,ref:g,role:"tab",tabIndex:S,children:[(0,kt.jsx)("div",{className:`${Pt}-main`,children:(0,kt.jsx)("span",{className:`${Pt}-text`,"data-text":a?void 0:d,children:o!=null?o:R()})}),M?(0,kt.jsx)(ul,{allowClose:r,allowRename:a,location:m,onMenuAction:C,onMenuClose:v,index:i}):null]})});var In=require("@salt-ds/core"),yn=X(require("classnames")),xn=require("react");function $u(e){var t;if(e){let o=e.dataset.idx;if(o)return parseInt(o,10);if(o=(t=e.ariaPosInSet)!=null?t:"-1")return parseInt(o,10)-1}}var lr=e=>e.closest("[data-idx],[aria-posinset]");var gl=e=>$u(lr(e));var no=require("react"),Bu=new Set(["/","-","."]),Vu=e=>Bu.has(e),hl=(e,t)=>t.startsWith(e)&&Vu(t[e.length]),bl=(e,t="root",{collapsibleHeaders:o=void 0,defaultExpanded:n=!1,revealSelected:r=!1}={})=>{let s=(u,h,p)=>{if(u.childNodes)return u.childNodes.length;if(u.header){let f=p+1,b=0;for(;f<h.length&&!h[f].header;)b++,f++;return b}else return 0},a=(0,no.useCallback)(u=>Array.isArray(r)?r.some(h=>hl(u,h)):n,[n,r]),l=(0,no.useCallback)((u,h,p=1,f="",b=[],E=[])=>{let C=0;return u.forEach((v,I,L)=>{var N;let M=v.header&&o,S=v.childNodes&&o===!1,x=!v.childNodes||v.childNodes.length===0,y=S||x&&!M,D=f?`${f}.${I}`:`${I}`,O=(N=v.id)!=null?N:`${t}-${D}`,g=y?void 0:a(O),w={...v,childNodes:void 0,id:O,count:!S&&g===void 0?0:s(v,L,I),expanded:g,index:h.index,level:p};if(b.push(w),E.push(u[I]),C+=1,h.index+=1,v.childNodes){let[k,R]=l(v.childNodes,h,p+1,D,[],E);w.childNodes=R,(g===!0||S)&&(C+=k)}}),[C,b,E]},[o,t,a]),[c,i,d]=(0,no.useMemo)(()=>l(e,{index:0}),[l,e]),m=(0,no.useCallback)((u,h=i)=>{let p=h.find(f=>{var b;return f.id===u||((b=f==null?void 0:f.childNodes)==null?void 0:b.length)&&hl(f.id,u)});if((p==null?void 0:p.id)===u)return d[p.index];if(p)return m(u,p.childNodes)},[d,i]);return[c,i,m]};var pt=require("react"),xl=require("@salt-ds/core"),yl="single",Uu="checkbox",zu="multi",_u="extended",Gu=["Enter"," "],Il={},Wu=e=>e.expanded!==void 0,vl=e=>e&&e!=="none",Tl=({defaultSelected:e,highlightedIdx:t,treeNodes:o,onChange:n,selected:r,selection:s=yl,selectionKeys:a=Gu})=>{let l=s===yl,c=s===zu||s.startsWith(Uu),i=s===_u,d=(0,pt.useRef)(-1),m=(0,pt.useCallback)(I=>a.includes(I.key),[a]),[u,h]=(0,xl.useControlled)({controlled:r,default:e!=null?e:[],name:"selected"}),p=(0,pt.useCallback)((I,L,M,S,x=!1)=>{let{current:y}=d,D=u==null?void 0:u.includes(M),g=l||i&&!x&&(!S||y===-1),w=c||i&&x&&!S,N=[];if(g&&D)N=[];else if(g)N=[M];else if(w&&D)N=u.filter(k=>k!==M);else if(w)N=u.concat(M);else if(i){let[k,R]=L>y?[y,L]:[L,y];N=u.slice();for(let T=k;T<=R;T++){let{id:H}=o[T];u.includes(H)||N.push(H)}}h(N),n&&n(I,N)},[i,o,c,n,u,h,l]),f=(0,pt.useCallback)(I=>{if(~t&&m(I)){I.preventDefault();let L=o[t];p(I,t,L.id,!1,I.ctrlKey||I.metaKey),i&&(d.current=t)}},[i,t,o,m,p]),b=(0,pt.useCallback)((I,L)=>{if(i&&I.shiftKey){let M=o[L];p(I,L,M.id,!0)}},[i,o,p]),E=s==="none"?Il:{onKeyDown:f,onKeyboardNavigation:b},C=(0,pt.useCallback)(I=>{if(t!==-1){let L=o[t];Wu(L)||(I.preventDefault(),I.stopPropagation(),p(I,t,L.id,I.shiftKey,I.ctrlKey||I.metaKey),i&&(d.current=t))}},[i,t,o,p]);return{listHandlers:E,listItemHandlers:s==="none"?Il:{onClick:C},selected:u,setSelected:h}};var Ce=require("react");var qu=["height","scrollHeight"],Sl=(e,t,o=!1)=>{let n=(0,Ce.useRef)(0),r=(0,Ce.useRef)(!1),s=(0,Ce.useRef)(0),a=(0,Ce.useRef)(0),l=(0,Ce.useCallback)(d=>{let m=d.ariaExpanded?d.firstChild:d,u=o?30:0,h=m.offsetTop,p=m.offsetHeight,f=n.current+u,b=f+s.current-u;(h+p>b||h<f)&&(n.current=h+p>b?n.current+(h+p)-b:h-u,r.current=!0,e.current&&(e.current.scrollTop=n.current),setTimeout(()=>{r.current=!1}))},[e,o]),c=(0,Ce.useCallback)(d=>{n.current=d.target.scrollTop},[]);(0,Ce.useEffect)(()=>{let{current:d}=e;return d&&d.addEventListener("scroll",c),()=>{d&&d.removeEventListener("scroll",c)}},[e,c]),(0,Ce.useLayoutEffect)(()=>{if(t!==-1&&a.current>s.current&&e.current){let d=e.current.querySelector(`
|
|
2
3
|
[data-idx='${t}'],
|
|
3
4
|
[aria-posinset='${t+1}']
|
|
4
|
-
`);d===null?console.log("[useViewportTracking], is this virtualised ? we're going to have to know rowHeight"):
|
|
5
|
+
`);d===null?console.log("[useViewportTracking], is this virtualised ? we're going to have to know rowHeight"):l(d)}},[t,e,l]),(0,Ce.useEffect)(()=>{},[o]);let i=(0,Ce.useCallback)(({height:d,scrollHeight:m})=>{s.current=d,a.current=m},[]);return Dt(e,qu,i,!0),r};var Do=require("react");var Fe=require("react");var El=({id:e})=>{let t=e.lastIndexOf("-");if(t!==-1){let n=e.slice(t+1).split(".");return n.length===1?null:(n.pop(),`${e.slice(0,t)}-${n.join(".")}`)}else if((t=e.lastIndexOf("/"))!==-1)return e.slice(0,t)},Cl=e=>e.childNodes!==void 0;var ar=e=>e.header===!0,Zu=new Set([".","/"]),Ml=(e,t)=>t.startsWith(e.id)?Zu.has(t.charAt(e.id.length)):!1,Ot=(e,t)=>{for(let o of e){if(o.id===t)return o;if(Ml(o,t))return Ot(o.childNodes,t)}},fn=(e,t)=>{let o=typeof t=="string"?t:t.id;for(let n=0;n<e.length;n++)if(e[n].id===o)return n},gn=(e,t,o)=>{let n;return e.map(s=>s.id===t?{...s,...o}:Ml(s,t)?(n=gn(s.childNodes,t,o),{...s,childNodes:n}):s)};var Pl=require("@salt-ds/core");function Ju(e,...t){let o=new Set(e);for(let n of t)for(let r of n)o.add(r);return o}var cr="ArrowUp",wl="ArrowDown",ro="ArrowLeft";var Ll="ArrowRight",hn="Enter";var Xu="Delete",Yu=new Set([hn,Xu]),ju=new Set(["Tab"]),Qu=new Set(["ArrowRight","ArrowLeft"]),Dl=new Set(["Home","End","ArrowDown","ArrowUp"]),Hl=new Set(["Home","End","ArrowRight","ArrowLeft"]),ed=new Set(["F1","F2","F3","F4","F5","F6","F7","F8","F9","F10","F11","F12"]),jy=Ju(Yu,Hl,Dl,Qu,ed,ju);var Nl=({key:e},t="vertical")=>(t==="vertical"?Dl:Hl).has(e);function Rl(e,t,o){return t===cr||t===ro?o>0?o-1:o:o===null?0:o===e-1?o:o+1}var td=e=>!e.header&&!e.childNodes,od=e=>td(e)||e.expanded!==void 0,kl=({defaultHighlightedIdx:e=-1,highlightedIdx:t,treeNodes:o,onHighlight:n,onKeyboardNavigation:r,selected:s=[]})=>{let{bwd:a,fwd:l}=(0,Fe.useMemo)(()=>({bwd:cr,fwd:wl}),[]),[c,i,d]=(0,Pl.useControlled)({controlled:t,default:e,name:"highlightedIdx"}),m=(0,Fe.useCallback)(I=>{n==null||n(I),i(I)},[n,i]),u=(0,Fe.useCallback)((I=l,L=I===l?-1:o.length)=>{let M=Rl(o.length,I,L);for(;M!==-1&&(I===l&&M<o.length||I===a&&M>0)&&!od(o[M]);)M=Rl(o.length,I,M);return M},[a,l,o]),h=(0,Fe.useRef)(!0),p=(0,Fe.useRef)(!1),f=I=>p.current=I,b=(0,Fe.useCallback)(()=>{if(p.current)p.current=!1;else if(s.length>0){let I=Ot(o,s[0]);if(I){let L=fn(o,I);m(L)}}else m(u())},[o,u,s,m]),E=(0,Fe.useCallback)(I=>{let L=u(I.key,c);L!==c&&(m(L),r==null||r(I,L))},[c,u,r,m]),C=(0,Fe.useCallback)(I=>{o.length>0&&Nl(I,"vertical")&&(I.preventDefault(),I.stopPropagation(),h.current=!0,E(I))},[o,E]),v=(0,Fe.useMemo)(()=>({onBlur:()=>{m(-1)},onFocus:b,onKeyDown:C,onMouseDownCapture:()=>{h.current=!1,f(!0)},onMouseMove:()=>{h.current&&(h.current=!1)},onMouseLeave:()=>{h.current=!0,f(!1),m(-1)}}),[b,C,m]);return{focusVisible:h.current?c:-1,controlledHighlighting:d,highlightedIdx:c,hiliteItemAtIndex:m,keyBoardNavigation:h,listProps:v,setIgnoreFocus:f}};var so=require("react");var bn=(e,t=[],o={value:0})=>{let n=!1;for(let r of e)n&&!ar(r)||(t[o.value]=r,o.value+=1,n=!1,ar(r)&&r.expanded===!1?n=!0:Cl(r)&&ur(r)&&bn(r.childNodes,t,o));return t},Al=e=>{let t=(0,so.useRef)(e),o=(0,so.useRef)(e),n=(0,so.useRef)(bn(e)),[,r]=(0,so.useState)({});e!==t.current&&(t.current=e,o.current=e,n.current=bn(e));let s=a=>{o.current=a,n.current=bn(a),r({})};return{data:o.current,indexPositions:n.current,setData:s}};var ot=require("react");var nd={},rd=e=>e&&e.hasAttribute("aria-expanded"),Ol=({collapsibleHeaders:e,highlightedIdx:t,treeNodes:o,setVisibleData:n,source:r})=>{let s=(0,ot.useRef)(r),a=(0,ot.useRef)(s.current),l=(0,ot.useCallback)(p=>{n(a.current=p)},[n]),c=(0,ot.useCallback)((p,{id:f})=>gn(p,f,{expanded:!0}),[]),i=(0,ot.useCallback)((p,{id:f})=>gn(p,f,{expanded:!1}),[]),d=(0,ot.useCallback)(p=>{if(p.key===Ll||p.key===hn){let f=o[t];f&&f.expanded===!1&&(p.preventDefault(),l(c(a.current,f)))}if(p.key===ro||p.key===hn){let f=o[t];f&&f.expanded&&(p.preventDefault(),l(i(a.current,f)))}},[i,c,t,o,l]),m=e?{onKeyDown:d}:nd,h={onClick:(0,ot.useCallback)(p=>{let f=lr(p.target);if(rd(f)){p.stopPropagation(),p.preventDefault();let b=Ot(r,f.id);(b==null?void 0:b.expanded)===!1?l(c(r,b)):(b==null?void 0:b.expanded)===!0&&l(i(r,b))}},[i,c,l,r])};return{listHandlers:m,listItemHandlers:h}};var Fl=require("react");var Kl=({highlightedIdx:e,hiliteItemAtIndex:t,indexPositions:o,source:n})=>({listHandlers:{onKeyDown:(0,Fl.useCallback)(a=>{if(a.key===ro){let l=o[e],c=El(l);if(c){a.preventDefault();let i=Ot(n,c);if(i){let d=fn(o,i);d!==void 0&&t(d)}}}},[e,t,o,n])}});var sd=[],$l=({defaultSelected:e,sourceWithIds:t,onChange:o,onHighlight:n,selected:r,selection:s})=>{let a=(0,Do.useRef)(sd),l=Al(t),c=(v,I)=>{var L,M;(M=(L=u.listHandlers).onKeyboardNavigation)==null||M.call(L,v,I)},{highlightedIdx:i,...d}=kl({treeNodes:l.indexPositions,onHighlight:n,onKeyboardNavigation:c,selected:a.current}),m=Ol({collapsibleHeaders:!0,highlightedIdx:i,treeNodes:l.indexPositions,setVisibleData:l.setData,source:l.data}),u=Tl({defaultSelected:e,highlightedIdx:i,treeNodes:l.indexPositions,onChange:o,selected:r,selection:s}),h=Kl({source:l.data,highlightedIdx:i,hiliteItemAtIndex:d.hiliteItemAtIndex,indexPositions:l.indexPositions}),p=(0,Do.useCallback)(v=>{var I,L,M;(I=m.listItemHandlers)==null||I.onClick(v),v.defaultPrevented||(M=(L=u.listItemHandlers)==null?void 0:L.onClick)==null||M.call(L,v)},[m,u]),f=(0,Do.useCallback)(v=>{var I,L,M,S,x,y,D,O;(L=(I=d.listProps).onKeyDown)==null||L.call(I,v),v.defaultPrevented||(S=(M=u.listHandlers).onKeyDown)==null||S.call(M,v),v.defaultPrevented||(y=(x=m.listHandlers).onKeyDown)==null||y.call(x,v),v.defaultPrevented||(O=(D=h.listHandlers).onKeyDown)==null||O.call(D,v)},[m.listHandlers,d.listProps,u.listHandlers,h.listHandlers]),b=()=>{var v;return i===void 0||i===-1||(v=l.indexPositions[i])==null?void 0:v.id};a.current=u.selected;let E={"aria-activedescendant":b(),onBlur:d.listProps.onBlur,onFocus:d.listProps.onFocus,onKeyDown:f,onMouseDownCapture:d.listProps.onMouseDownCapture,onMouseLeave:d.listProps.onMouseLeave,onMouseMove:d.listProps.onMouseMove},C={onClick:p};return{focusVisible:d.focusVisible,highlightedIdx:i,hiliteItemAtIndex:d.hiliteItemAtIndex,listProps:E,listItemHandlers:C,selected:u.selected,visibleData:l.data}};var He=require("react/jsx-runtime"),Vl=require("react"),ft="vuuTree",ur=e=>e.expanded===!0,Bl=({children:e,idx:t,...o})=>(0,He.jsx)("li",{...o,children:e}),id=(0,xn.forwardRef)(function({allowDragDrop:t,className:o,defaultSelected:n,groupSelection:r="none",id:s,onHighlight:a,onSelectionChange:l,revealSelected:c,selected:i,selection:d="single",source:m,...u},h){var R;let p=(0,In.useIdMemo)(s),f=(0,xn.useRef)(null),[,b,E]=bl(m,p,{revealSelected:c?(R=i!=null?i:n)!=null?R:!1:void 0}),C=(T,H)=>{if(l){let A=H.map(P=>E(P)).filter(P=>P!==void 0);l(A)}},{focusVisible:v,highlightedIdx:I,hiliteItemAtIndex:L,listProps:M,listItemHandlers:S,selected:x,visibleData:y}=$l({defaultSelected:n,groupSelection:r,onChange:C,onHighlight:a,selected:i,selection:d,sourceWithIds:b});Sl(f,I);let O={...{onMouseEnter:T=>{let H=T.target,A=gl(H);L(A)}},...S,role:"treeitem"},g=vl(r);function w(T,H,A){T.push((0,He.jsxs)(Bl,{...O,...ld(H,A,I,x,v),children:[H.icon?(0,He.jsx)("span",{className:`${ft}Node-icon`,"data-icon":H.icon}):null,(0,He.jsx)("span",{children:H.label})]})),A.value+=1}function N(T,H,A,P,F){let{value:B}=A;A.value+=1,T.push((0,Vl.createElement)(Bl,{...S,"aria-expanded":H.expanded,"aria-level":H.level,"aria-selected":x.includes(P)||void 0,className:(0,yn.default)(`${ft}Node`,{focusVisible:v===B,[`${ft}Node-toggle`]:!g}),"data-idx":B,"data-highlighted":B===I||void 0,"data-selectable":!0,id:P,key:`header-${B}`},g?(0,He.jsxs)("div",{className:`${ft}Node-label`,children:[(0,He.jsx)("span",{className:`${ft}Node-toggle`}),F]}):(0,He.jsxs)("div",{className:`${ft}Node-label`,children:[H.icon?(0,He.jsx)("span",{className:`${ft}Node-icon`,"data-icon":H.icon}):null,(0,He.jsx)("span",{children:F})]}),(0,He.jsx)("ul",{role:"group",children:ur(H)?k(H.childNodes,A):""})))}function k(T,H={value:0}){if((T==null?void 0:T.length)>0){let A=[];for(let P of T)P.childNodes?N(A,P,H,P.id,P.label):w(A,P,H);return A}}return(0,He.jsx)("ul",{...u,...M,className:(0,yn.default)(ft,o),id:`Tree-${p}`,ref:(0,In.useForkRef)(f,h),role:"tree",tabIndex:0,children:k(y)})}),ld=(e,t,o,n,r,s)=>({id:e.id,key:e.id,"aria-level":e.level,"aria-selected":n.includes(e.id)||void 0,"data-idx":t.value,"data-highlighted":t.value===o||void 0,className:(0,yn.default)("vuuTreeNode",s,{focusVisible:r===t.value})});id.displayName="Tree";var Sn=X(require("classnames")),gt=require("react");var nt=require("react"),Ul=X(require("classnames")),Wl=require("react/jsx-runtime"),zl="medium",_l="salt-theme",Gl="light",vn=(0,nt.createContext)({density:"high",theme:"salt",themeMode:"light"}),ad=["salt","salt-density-high","light"],je=()=>{let e=(0,nt.useContext)(vn);return e?[`${e.theme}-theme`,`salt-density-${e.density}`,e.themeMode]:ad},cd=(e,t,o,n)=>{var r;return(0,nt.isValidElement)(e)?(0,nt.cloneElement)(e,{className:(0,Ul.default)((r=e.props)==null?void 0:r.className,`${t}-theme`,`${t}-density-${n}`),"data-mode":o}):(console.warn(`
|
|
5
6
|
ThemeProvider can only apply CSS classes for theming to a single nested child element of the ThemeProvider.
|
|
6
|
-
Wrap elements with a single container`),e)},ho=({applyThemeClasses:e=!1,children:t,theme:o,themeMode:n,density:r})=>{var i,g,f;let{density:a,themeMode:l,theme:u}=(0,we.useContext)(go),c=(i=r!=null?r:a)!=null?i:Ls,s=(g=n!=null?n:l)!=null?g:ws,d=(f=o!=null?o:u)!=null?f:Ds,m=e?ol(t,d,s,c):t;return(0,Is.jsx)(go.Provider,{value:{themeMode:s,density:c,theme:d},children:m})};ho.displayName="ThemeProvider";var se=require("react/jsx-runtime"),Ct="vuuLeftNav",nl=({"data-path":e,onResize:t,open:o=!0,sizeCollapsed:n=80,sizeContent:r=240,sizeExpanded:a=240,style:l,...u})=>{let c=(0,ot.useLayoutProviderDispatch)(),s=(0,Ve.useRef)(o),[d,m]=(0,Ve.useState)({activeTabIndex:0,navStatus:"menu-full"}),[i]=Ee(),g=(0,Ve.useCallback)((C,S)=>{switch(S){case 0:return C?[a,"menu-full"]:[n,"menu-icons"];default:return[n+r,"menu-content"]}},[n,r,a]),f=(0,Ve.useCallback)(C=>{let[S,T]=g(s.current,C);m({activeTabIndex:C,navStatus:T}),c({type:ot.Action.LAYOUT_RESIZE,path:e,size:S})},[c,g,e]),p=(0,Ve.useCallback)(()=>{s.current=!s.current,m(({activeTabIndex:C,navStatus:S})=>({activeTabIndex:C,navStatus:S==="menu-icons"?"menu-full":"menu-icons"})),c({type:ot.Action.LAYOUT_RESIZE,path:e,size:s.current?240:80})},[c,e]),h={...l,"--nav-menu-collapsed-width":`${n}px`,"--nav-menu-expanded-width":`${a}px`};return(0,se.jsxs)("div",{...u,className:(0,bo.default)(Ct,`${Ct}-${d.navStatus}`),style:h,children:[(0,se.jsxs)("div",{className:(0,bo.default)(`${Ct}-menu-primary`,i),"data-mode":"dark",children:[(0,se.jsx)("div",{className:"vuuLeftNav-logo",children:(0,se.jsx)(Lo,{})}),(0,se.jsx)("div",{className:`${Ct}-main`,children:(0,se.jsxs)(Br,{activeTabIndex:d.activeTabIndex,animateSelectionThumb:!1,className:`${Ct}-Tabstrip`,onActiveChange:f,orientation:"vertical",children:[(0,se.jsx)(Bt,{"data-icon":"demo",label:"DEMO"}),(0,se.jsx)(Bt,{"data-icon":"tables",label:"VUU TABLES"}),(0,se.jsx)(Bt,{"data-icon":"templates",label:"LAYOUT TEMPLATES"}),(0,se.jsx)(Bt,{"data-icon":"layouts",label:"MY LAYOUTS"})]})}),(0,se.jsx)("div",{className:"vuuLeftNav-buttonBar",children:(0,se.jsx)("button",{className:(0,bo.default)("vuuLeftNav-toggleButton",{"vuuLeftNav-toggleButton-open":s.current,"vuuLeftNav-toggleButton-closed":!s.current}),"data-icon":s.current?"chevron-left":"chevron-right",onClick:p})})]}),(0,se.jsxs)(ot.Stack,{active:d.activeTabIndex-1,className:`${Ct}-menu-secondary`,showTabs:!1,children:[(0,se.jsx)("div",{style:{background:"yellow",height:"100%"},children:"VUU Tables"}),(0,se.jsx)("div",{style:{background:"green",height:"100%"},children:"Layout Templates"}),(0,se.jsx)("div",{style:{background:"red",height:"100%"},children:"My Layouts"})]})]})};var Wo=require("react"),ve=require("@salt-ds/core");var Te=require("react/jsx-runtime"),Ns="vuuLoginPanel",rl=({requirePassword:e=!0,onSubmit:t})=>{let[o,n]=(0,Wo.useState)(""),[r,a]=(0,Wo.useState)(""),l=()=>{t(o,r)},u=d=>{n(d.target.value)},c=d=>{a(d.target.value)},s=o.trim()!==""&&(e===!1||r.trim()!=="");return(0,Te.jsxs)("div",{className:Ns,children:[(0,Te.jsxs)(ve.FormField,{style:{width:200},children:[(0,Te.jsx)(ve.FormFieldLabel,{children:"Username"}),(0,Te.jsx)(ve.Input,{value:o,id:"text-username",onChange:u})]}),e?(0,Te.jsxs)(ve.FormField,{style:{width:200},children:[(0,Te.jsx)(ve.FormFieldLabel,{children:"Password"}),(0,Te.jsx)(ve.Input,{inputProps:{type:"password"},value:r,id:"text-password",onChange:c})]}):null,(0,Te.jsx)(ve.Button,{className:`${Ns}-login`,disabled:!s,onClick:l,variant:"cta",children:"Login"})]})};var yo=require("@vuu-ui/vuu-utils"),Hs=()=>{let e=(0,yo.getCookieValue)("vuu-auth-mode");return e!=null?e:""},sl=()=>{let e=(0,yo.getCookieValue)("vuu-username"),t=(0,yo.getCookieValue)("vuu-auth-token");return[e,t]},al=()=>Hs()==="login"?"login.html":"demo.html",Ps=(e=al())=>{window.location.href=e},qo=e=>{document.cookie="vuu-username= ; expires = Thu, 01 Jan 1970 00:00:00 GMT",document.cookie="vuu-auth-token= ; expires = Thu, 01 Jan 1970 00:00:00 GMT",Ps(e)};var oe=require("react"),Go=V(require("classnames")),As=require("@salt-ds/core"),Zo=require("@salt-ds/core"),St=require("@vuu-ui/vuu-data"),nt=require("@vuu-ui/vuu-utils");var ge=require("react/jsx-runtime"),Ie="vuuSessionEditingForm",Rs=(e,t)=>{let o=e.find(n=>n.name===t);if(o)return o;throw Error(`SessionEditingForm, no field '${t}' found`)},ks=e=>{let{dataset:{field:t},value:o}=e.target;if(t===void 0)throw Error("SessionEditingForm, form field has no field name");return[t,o]},Ne={uninitialised:0,unchanged:1,changed:2,invalid:3};function Os(e,t,o=!1){switch(t){case"int":case"long":{let n=parseInt(e,10);if((0,nt.isValidNumber)(n))return n;if(o)throw Error("SessionEditingForm getTypedValue");return}case"double":{let n=parseFloat(e);return(0,nt.isValidNumber)(n)?n:void 0}case"boolean":return e==="true";default:return e}}var il=(e,t)=>{if(e)return e;if(t)return new St.RemoteDataSource({bufferSize:0,table:t.table,columns:t.columns.map(o=>o.name)});throw Error("SessionEditingForm: either a DataSource or a TableSchema must be provided")},ll=({className:e,config:{fields:t,key:o},dataSource:n,id:r,onClose:a,schema:l,...u})=>{let[c,s]=(0,oe.useState)(),[d,m]=(0,oe.useState)(""),i=(0,oe.useRef)(null),g=(0,oe.useRef)(),f=(0,oe.useRef)(Ne.uninitialised),p=(0,oe.useMemo)(()=>{let v=y=>{if(k){let L={};for(let I of p.columns)L[I]=y[k[I]];f.current===Ne.uninitialised&&(f.current=Ne.unchanged,g.current=L),s(L)}},D=il(n,l),k=(0,nt.buildColumnMap)(D.columns);return D.subscribe({range:{from:0,to:5}},y=>{y.type==="viewport-update"&&y.rows&&(f.current===Ne.uninitialised?v(y.rows[0]):console.log("what do we do with server updates"))}),D},[n,l]),h=(0,As.useIdMemo)(r),C=(0,oe.useCallback)(v=>{let[D,k]=ks(v),{type:y}=Rs(t,D),L=Os(k,y);s((I={})=>{let P={...I,[D]:L},N=(0,nt.shallowEquals)(P,g.current);return f.current=N?Ne.unchanged:L!==void 0?Ne.changed:Ne.invalid,P})},[t]),S=(0,oe.useCallback)(v=>{let[D,k]=ks(v),{type:y}=Rs(t,D),L=c==null?void 0:c[o],I=Os(k,y,!0);typeof L=="string"&&p.menuRpcCall({rowKey:L,field:D,value:I,type:"VP_EDIT_CELL_RPC"})},[p,t,o,c]),T=(0,oe.useCallback)(v=>{typeof v=="object"&&v!==null&&"type"in v&&v.type==="CLOSE_DIALOG_ACTION"&&a()},[a]),b=(0,oe.useCallback)(async()=>{let v=await p.menuRpcCall({type:"VP_EDIT_SUBMIT_FORM_RPC"});(0,St.isErrorResponse)(v)?m(v.error):(0,St.hasAction)(v)&&T(v.action)},[T,p]),w=(0,oe.useCallback)(v=>{v.key==="Enter"&&f.current===Ne.changed&&b()},[b]),M=(0,oe.useCallback)(()=>{a()},[a]),x=v=>{var k;let D=String((k=c==null?void 0:c[v.name])!=null?k:"");return v.readonly||v.name===o?(0,ge.jsx)("div",{className:`${Ie}-fieldValue vuuReadOnly`,children:D}):(0,ge.jsx)("input",{className:`${Ie}-fieldValue`,"data-field":v.name,onBlur:S,onChange:C,type:"text",value:D,id:`${h}-input-${v.name}`})};(0,oe.useEffect)(()=>{if(i.current){let v=i.current.querySelector("input");v&&setTimeout(()=>{v.focus(),v.select()},100)}},[]),(0,oe.useEffect)(()=>()=>{p&&p.unsubscribe()},[p]);let E=f.current===Ne.changed;return(0,ge.jsxs)("div",{...u,className:(0,Go.default)(Ie,e),children:[d?(0,ge.jsx)("div",{className:`${Ie}-errorBanner`,"data-icon":"error",title:d,children:"Error, edit(s) not saved"}):void 0,(0,ge.jsx)("div",{className:`${Ie}-content`,ref:i,onKeyDown:w,children:t.map(v=>{var D;return(0,ge.jsxs)("div",{className:`${Ie}-field`,children:[(0,ge.jsx)("label",{className:(0,Go.default)(`${Ie}-fieldLabel`,{[`${Ie}-required`]:v.required}),htmlFor:`${h}-input-${v.name}`,children:(D=v==null?void 0:v.label)!=null?D:v.description}),x(v)]},v.name)})}),(0,ge.jsxs)("div",{className:`${Ie}-buttonbar salt-theme salt-density-high`,children:[(0,ge.jsx)(Zo.Button,{type:"submit",variant:"cta",disabled:!E,onClick:b,children:"Submit"}),(0,ge.jsx)(Zo.Button,{variant:"secondary",onClick:M,children:"Cancel"})]})]})};var ia=require("@vuu-ui/vuu-data"),la=V(require("classnames")),Re=require("react");var Ue=require("react");var $s=(e,t,o="latest")=>new Promise((n,r)=>{console.log(`load local config at ${e} for user ${t.username}, id ${o}`);let a=localStorage.getItem(e);if(a){let l=JSON.parse(a);n(l)}else r()}),Fs=(e,t,o)=>new Promise((n,r)=>{try{localStorage.setItem(e,JSON.stringify(o)),n(void 0)}catch{r()}});var Ks=(e,t,o="latest")=>new Promise((n,r)=>{fetch(`${e}/${t.username}/${o}`,{}).then(a=>{a.ok?n(a.json()):r(void 0)}).catch(()=>{r(void 0)})}),Bs=(e,t,o)=>new Promise((n,r)=>{fetch(`${e}/${t.username}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(o)}).then(a=>{a.ok?n(void 0):r()})});var Vs=({saveLocation:e,saveUrl:t="api/vui",user:o,defaultLayout:n})=>{let[r,a]=(0,Ue.useState)(n),l=e==="remote",u=l?Ks:$s,c=l?Bs:Fs,s=(0,Ue.useCallback)(async(i="latest")=>{try{let g=await u(t,o,i);a(g)}catch{a(n)}},[n,u,t,o]);(0,Ue.useEffect)(()=>{s()},[s]);let d=(0,Ue.useCallback)(i=>{c(t,o,i)},[c,t,o]),m=(0,Ue.useCallback)(i=>s(i),[s]);return[r,d,m]};var To=require("@vuu-ui/vuu-layout");var Qs=require("react");var Gs=require("@salt-ds/core"),Zs=require("@salt-ds/lab"),Js=require("@salt-ds/icons");var zs=require("@vuu-ui/vuu-utils"),vo=require("@salt-ds/lab"),_s=require("@salt-ds/core"),Ws=require("@salt-ds/icons"),He=require("react");var Us=async e=>await fetch(`api/vui/${e.username}`,{}).then(o=>o.ok?o.json():null).catch(()=>{console.log("error getting history")});var ze=require("react/jsx-runtime"),cl=({lastUpdate:e},{lastUpdate:t})=>t===e?0:t<e?-1:1,ul=e=>(0,ze.jsx)(vo.ListItem,{...e}),qs=(0,He.forwardRef)(function({loginUrl:t,onNavigate:o,user:n,layoutId:r="latest"},a){let[l,u]=(0,He.useState)([]);(0,He.useEffect)(()=>{async function m(){let g=(await Us(n)).filter(f=>f.id!=="latest").sort(cl).map(({id:f,lastUpdate:p})=>({lastUpdate:p,id:f,label:`Saved at ${(0,zs.formatDate)(new Date(p),"kk:mm:ss")}`}));console.log({sortedHistory:g}),u(g)}m()},[n]);let c=(0,He.useCallback)((m,i)=>{i&&o(i.id)},[o]),s=(0,He.useCallback)(()=>{qo(t)},[t]),d=l.length===0?null:r==="latest"?l[0]:l.find(m=>m.id===r);return(0,ze.jsxs)("div",{className:"vuuUserPanel",ref:a,children:[(0,ze.jsx)(vo.List,{ListItem:ul,className:"vuuUserPanel-history",onSelect:c,selected:d,source:l}),(0,ze.jsx)("div",{className:"vuuUserPanel-buttonBar",children:(0,ze.jsxs)(_s.Button,{"aria-label":"logout",onClick:s,children:[(0,ze.jsx)(Ws.ExportIcon,{})," Logout"]})})]})});var Lt=require("react/jsx-runtime"),Xs=({layoutId:e,loginUrl:t,onNavigate:o,user:n})=>(0,Lt.jsxs)(Zs.DropdownBase,{className:"vuuUserProfile",placement:"bottom-end",children:[(0,Lt.jsx)(Gs.Button,{variant:"secondary",children:(0,Lt.jsx)(Js.UserSolidIcon,{})}),(0,Lt.jsx)(qs,{layoutId:e,loginUrl:t,onNavigate:a=>{o(a)},user:n})]});var Ys=V(require("classnames")),rt=require("@salt-ds/core"),js=require("react");var Ut=require("react/jsx-runtime"),dl="vuuThemeSwitch",Jo=({className:e,defaultMode:t,mode:o,onChange:n,...r})=>{let[a,l]=(0,rt.useControlled)({controlled:o,default:t!=null?t:"light",name:"ThemeSwitch",state:"mode"}),u=(0,js.useCallback)(s=>{let{value:d}=s.target;l(d),n(d)},[n,l]),c=(0,Ys.default)(dl,e);return(0,Ut.jsxs)(rt.ToggleButtonGroup,{className:c,...r,onChange:u,value:a,children:[(0,Ut.jsx)(rt.ToggleButton,{"aria-label":"alert","data-icon":"light",value:"dark"}),(0,Ut.jsx)(rt.ToggleButton,{"aria-label":"home","data-icon":"dark",value:"light"})]})};var ea=V(require("classnames"));var zt=require("react/jsx-runtime"),ml="vuuAppHeader",ta=({className:e,layoutId:t,loginUrl:o,onNavigate:n,onSwitchTheme:r,themeMode:a="light",user:l,...u})=>{let c=(0,ea.default)(ml,e),s=(0,Qs.useCallback)(d=>r==null?void 0:r(d),[r]);return(0,zt.jsxs)("header",{className:c,...u,children:[(0,zt.jsx)(Jo,{defaultMode:a,onChange:s}),(0,zt.jsx)(Xs,{layoutId:t,loginUrl:o,onNavigate:n,user:l})]})};var ca=require("@vuu-ui/vuu-utils");var oa=require("@salt-ds/core"),Xo=V(require("classnames")),na=require("react"),ra=require("@vuu-ui/vuu-layout");var st=require("react/jsx-runtime"),Pe="vuuContextPanel",Yo=({className:e,expanded:t=!1,overlay:o=!1,title:n})=>{let r=(0,ra.useLayoutProviderDispatch)(),a=(0,na.useCallback)(()=>{r({path:"#context-panel",propName:"expanded",propValue:!1,type:"set-prop"})},[r]),l=(0,Xo.default)(Pe,e,{[`${Pe}-expanded`]:t,[`${Pe}-inline`]:o!==!0,[`${Pe}-overlay`]:o});return(0,st.jsx)("div",{className:(0,Xo.default)(Pe,l),children:(0,st.jsx)("div",{className:`${Pe}-inner`,children:(0,st.jsxs)("div",{className:`${Pe}-header`,children:[(0,st.jsx)("h2",{className:`${Pe}-title`,children:n}),(0,st.jsx)(oa.Button,{className:`${Pe}-close`,"data-icon":"close",onClick:a,variant:"secondary"})]})})})};var _t=require("@vuu-ui/vuu-layout");var Dt=require("react/jsx-runtime"),sa=({appHeader:e,leftSidePanel:t})=>(0,Dt.jsxs)(_t.Flexbox,{className:"App",style:{flexDirection:"row",height:"100%",width:"100%"},children:[t,(0,Dt.jsxs)(_t.Flexbox,{className:"vuuShell-content",style:{flex:1,flexDirection:"column"},children:[e,(0,Dt.jsx)(_t.DraggableLayout,{dropTarget:!0,style:{flex:1}},"main-content")]}),(0,Dt.jsx)(Yo,{id:"context-panel",overlay:!0,title:"Column Settings"})]});var xe=require("@vuu-ui/vuu-layout"),it=require("react"),at=require("react/jsx-runtime"),aa=({appHeader:e,leftSidePanel:t})=>{let o=(0,it.useRef)(null),[n,r]=(0,it.useState)(!0),a=(0,it.useCallback)(u=>{var s;let c=u.target;(s=o.current)!=null&&s.contains(c)||r(!n)},[n]),l=(0,it.useCallback)(u=>{let c=[];return c.push((0,at.jsx)(xe.Drawer,{onClick:a,open:n,position:"left",inline:!0,peekaboo:!0,sizeOpen:200,toggleButton:"end",children:(0,at.jsx)(xe.View,{className:"vuuShell-palette",id:"vw-app-palette",ref:o,style:{height:"100%"},children:u},"app-palette")},"left-panel")),c},[a,n]);return(0,at.jsxs)(xe.Flexbox,{className:"App",style:{flexDirection:"column",height:"100%",width:"100%"},children:[e,(0,at.jsx)(xe.DockLayout,{style:{flex:1},children:l(t).concat((0,at.jsx)(xe.DraggableLayout,{dropTarget:!0,style:{width:"100%",height:"100%"}},"main-content"))})]})};var jo=({leftSidePanelLayout:e="inlay",...t})=>(e==="inlay"?aa:sa)(t);var wt=require("react/jsx-runtime"),{error:Qo}=(0,ca.logger)("Shell"),pl={type:"View",props:{style:{height:"calc(100% - 6px)"}},children:[{props:{className:"vuuShell-warningPlaceholder"},type:"Placeholder"}]},fl=({children:e,className:t,defaultLayout:o=pl,leftSidePanel:n,leftSidePanelLayout:r,loginUrl:a,saveLocation:l="remote",saveUrl:u,serverUrl:c,user:s,...d})=>{let m=(0,Re.useRef)(null),i=(0,Re.useRef)("latest"),[g,f,p]=Vs({defaultLayout:o,saveLocation:l,user:s}),h=(0,Re.useCallback)(E=>{try{f(E)}catch{Qo==null||Qo("Failed to save layout")}},[f]),C=(0,Re.useCallback)(E=>{m.current&&(m.current.dataset.mode=E)},[]),S=(0,Re.useCallback)(E=>{i.current=E,p(E)},[p]);(0,Re.useEffect)(()=>{c&&s.token&&(0,ia.connectToServer)({authToken:s.token,url:c,username:s.username})},[c,s.token,s.username]);let[T,b,w]=Ee(),M=(0,la.default)("vuuShell",t,T,b),x=jo({leftSidePanelLayout:r,appHeader:(0,wt.jsx)(ta,{layoutId:i.current,loginUrl:a,user:s,onNavigate:S,onSwitchTheme:C}),leftSidePanel:n});return(0,wt.jsxs)(ho,{children:[(0,wt.jsx)(To.LayoutProvider,{layout:g,onLayoutChange:h,children:(0,wt.jsx)(To.DraggableLayout,{className:M,"data-mode":w,ref:m,...d,children:x})}),e]})};var Mo=require("react"),xo=require("react/jsx-runtime"),gl={},en=(0,Mo.createContext)(gl),hl=({children:e,context:t,inheritedContext:o})=>{let n={...o,...t};return(0,xo.jsx)(en.Provider,{value:n,children:e})},bl=({children:e,value:t})=>(0,xo.jsx)(en.Consumer,{children:o=>(0,xo.jsx)(hl,{context:t,inheritedContext:o,children:e})}),yl=()=>(0,Mo.useContext)(en);
|
|
7
|
+
Wrap elements with a single container`),e)},Tn=({applyThemeClasses:e=!1,children:t,theme:o,themeMode:n,density:r})=>{var u,h,p;let{density:s,themeMode:a,theme:l}=(0,nt.useContext)(vn),c=(u=r!=null?r:s)!=null?u:zl,i=(h=n!=null?n:a)!=null?h:Gl,d=(p=o!=null?o:l)!=null?p:_l,m=e?cd(t,d,i,c):t;return(0,Wl.jsx)(vn.Provider,{value:{themeMode:i,density:c,theme:d},children:m})};Tn.displayName="ThemeProvider";var ge=require("react/jsx-runtime"),io="vuuLeftNav",ud=({"data-path":e,onResize:t,open:o=!0,sizeCollapsed:n=80,sizeContent:r=240,sizeExpanded:s=240,style:a,...l})=>{let c=(0,Ft.useLayoutProviderDispatch)(),i=(0,gt.useRef)(o),[d,m]=(0,gt.useState)({activeTabIndex:0,navStatus:"menu-full"}),[u]=je(),h=(0,gt.useCallback)((E,C)=>{switch(C){case 0:return E?[s,"menu-full"]:[n,"menu-icons"];default:return[n+r,"menu-content"]}},[n,r,s]),p=(0,gt.useCallback)(E=>{let[C,v]=h(i.current,E);m({activeTabIndex:E,navStatus:v}),c({type:Ft.Action.LAYOUT_RESIZE,path:e,size:C})},[c,h,e]),f=(0,gt.useCallback)(()=>{i.current=!i.current,m(({activeTabIndex:E,navStatus:C})=>({activeTabIndex:E,navStatus:C==="menu-icons"?"menu-full":"menu-icons"})),c({type:Ft.Action.LAYOUT_RESIZE,path:e,size:i.current?240:80})},[c,e]),b={...a,"--nav-menu-collapsed-width":`${n}px`,"--nav-menu-expanded-width":`${s}px`};return(0,ge.jsxs)("div",{...l,className:(0,Sn.default)(io,`${io}-${d.navStatus}`),style:b,children:[(0,ge.jsxs)("div",{className:(0,Sn.default)(`${io}-menu-primary`,u),"data-mode":"dark",children:[(0,ge.jsx)("div",{className:"vuuLeftNav-logo",children:(0,ge.jsx)(Rn,{})}),(0,ge.jsx)("div",{className:`${io}-main`,children:(0,ge.jsxs)(il,{activeTabIndex:d.activeTabIndex,animateSelectionThumb:!1,className:`${io}-Tabstrip`,onActiveChange:p,orientation:"vertical",children:[(0,ge.jsx)(Lo,{"data-icon":"demo",label:"DEMO"}),(0,ge.jsx)(Lo,{"data-icon":"tables",label:"VUU TABLES"}),(0,ge.jsx)(Lo,{"data-icon":"templates",label:"LAYOUT TEMPLATES"}),(0,ge.jsx)(Lo,{"data-icon":"layouts",label:"MY LAYOUTS"})]})}),(0,ge.jsx)("div",{className:"vuuLeftNav-buttonBar",children:(0,ge.jsx)("button",{className:(0,Sn.default)("vuuLeftNav-toggleButton",{"vuuLeftNav-toggleButton-open":i.current,"vuuLeftNav-toggleButton-closed":!i.current}),"data-icon":i.current?"chevron-left":"chevron-right",onClick:f})})]}),(0,ge.jsxs)(Ft.Stack,{active:d.activeTabIndex-1,className:`${io}-menu-secondary`,showTabs:!1,children:[(0,ge.jsx)("div",{style:{background:"yellow",height:"100%"},children:"VUU Tables"}),(0,ge.jsx)("div",{style:{background:"green",height:"100%"},children:"Layout Templates"}),(0,ge.jsx)("div",{style:{background:"red",height:"100%"},children:"My Layouts"})]})]})};var dr=require("react"),Ve=require("@salt-ds/core");var qe=require("react/jsx-runtime"),ql="vuuLoginPanel",dd=({requirePassword:e=!0,onSubmit:t})=>{let[o,n]=(0,dr.useState)(""),[r,s]=(0,dr.useState)(""),a=()=>{t(o,r)},l=d=>{n(d.target.value)},c=d=>{s(d.target.value)},i=o.trim()!==""&&(e===!1||r.trim()!=="");return(0,qe.jsxs)("div",{className:ql,children:[(0,qe.jsxs)(Ve.FormField,{style:{width:200},children:[(0,qe.jsx)(Ve.FormFieldLabel,{children:"Username"}),(0,qe.jsx)(Ve.Input,{value:o,id:"text-username",onChange:l})]}),e?(0,qe.jsxs)(Ve.FormField,{style:{width:200},children:[(0,qe.jsx)(Ve.FormFieldLabel,{children:"Password"}),(0,qe.jsx)(Ve.Input,{inputProps:{type:"password"},value:r,id:"text-password",onChange:c})]}):null,(0,qe.jsx)(Ve.Button,{className:`${ql}-login`,disabled:!i,onClick:a,variant:"cta",children:"Login"})]})};var En=require("@vuu-ui/vuu-utils"),Zl=()=>{let e=(0,En.getCookieValue)("vuu-auth-mode");return e!=null?e:""},md=()=>{let e=(0,En.getCookieValue)("vuu-username"),t=(0,En.getCookieValue)("vuu-auth-token");return[e,t]},pd=()=>Zl()==="login"?"login.html":"demo.html",Jl=(e=pd())=>{window.location.href=e},mr=e=>{document.cookie="vuu-username= ; expires = Thu, 01 Jan 1970 00:00:00 GMT",document.cookie="vuu-auth-token= ; expires = Thu, 01 Jan 1970 00:00:00 GMT",Jl(e)};var me=require("react"),pr=X(require("classnames")),Ql=require("@salt-ds/core"),fr=require("@salt-ds/core"),lo=require("@vuu-ui/vuu-data"),Kt=require("@vuu-ui/vuu-utils");var Ke=require("react/jsx-runtime"),rt="vuuSessionEditingForm",Xl=(e,t)=>{let o=e.find(n=>n.name===t);if(o)return o;throw Error(`SessionEditingForm, no field '${t}' found`)},Yl=e=>{let{dataset:{field:t},value:o}=e.target;if(t===void 0)throw Error("SessionEditingForm, form field has no field name");return[t,o]},st={uninitialised:0,unchanged:1,changed:2,invalid:3};function jl(e,t,o=!1){switch(t){case"int":case"long":{let n=parseInt(e,10);if((0,Kt.isValidNumber)(n))return n;if(o)throw Error("SessionEditingForm getTypedValue");return}case"double":{let n=parseFloat(e);return(0,Kt.isValidNumber)(n)?n:void 0}case"boolean":return e==="true";default:return e}}var fd=(e,t)=>{if(e)return e;if(t)return new lo.RemoteDataSource({bufferSize:0,table:t.table,columns:t.columns.map(o=>o.name)});throw Error("SessionEditingForm: either a DataSource or a TableSchema must be provided")},gd=({className:e,config:{fields:t,key:o},dataSource:n,id:r,onClose:s,schema:a,...l})=>{let[c,i]=(0,me.useState)(),[d,m]=(0,me.useState)(""),u=(0,me.useRef)(null),h=(0,me.useRef)(),p=(0,me.useRef)(st.uninitialised),f=(0,me.useMemo)(()=>{let y=g=>{if(O){let w={};for(let N of f.columns)w[N]=g[O[N]];p.current===st.uninitialised&&(p.current=st.unchanged,h.current=w),i(w)}},D=fd(n,a),O=(0,Kt.buildColumnMap)(D.columns);return D.subscribe({range:{from:0,to:5}},g=>{g.type==="viewport-update"&&g.rows&&(p.current===st.uninitialised?y(g.rows[0]):console.log("what do we do with server updates"))}),D},[n,a]),b=(0,Ql.useIdMemo)(r),E=(0,me.useCallback)(y=>{let[D,O]=Yl(y),{type:g}=Xl(t,D),w=jl(O,g);i((N={})=>{let k={...N,[D]:w},R=(0,Kt.shallowEquals)(k,h.current);return p.current=R?st.unchanged:w!==void 0?st.changed:st.invalid,k})},[t]),C=(0,me.useCallback)(y=>{let[D,O]=Yl(y),{type:g}=Xl(t,D),w=c==null?void 0:c[o],N=jl(O,g,!0);typeof w=="string"&&f.menuRpcCall({rowKey:w,field:D,value:N,type:"VP_EDIT_CELL_RPC"})},[f,t,o,c]),v=(0,me.useCallback)(y=>{typeof y=="object"&&y!==null&&"type"in y&&y.type==="CLOSE_DIALOG_ACTION"&&s()},[s]),I=(0,me.useCallback)(async()=>{let y=await f.menuRpcCall({type:"VP_EDIT_SUBMIT_FORM_RPC"});(0,lo.isErrorResponse)(y)?m(y.error):(0,lo.hasAction)(y)&&v(y.action)},[v,f]),L=(0,me.useCallback)(y=>{y.key==="Enter"&&p.current===st.changed&&I()},[I]),M=(0,me.useCallback)(()=>{s()},[s]),S=y=>{var O;let D=String((O=c==null?void 0:c[y.name])!=null?O:"");return y.readonly||y.name===o?(0,Ke.jsx)("div",{className:`${rt}-fieldValue vuuReadOnly`,children:D}):(0,Ke.jsx)("input",{className:`${rt}-fieldValue`,"data-field":y.name,onBlur:C,onChange:E,type:"text",value:D,id:`${b}-input-${y.name}`})};(0,me.useEffect)(()=>{if(u.current){let y=u.current.querySelector("input");y&&setTimeout(()=>{y.focus(),y.select()},100)}},[]),(0,me.useEffect)(()=>()=>{f&&f.unsubscribe()},[f]);let x=p.current===st.changed;return(0,Ke.jsxs)("div",{...l,className:(0,pr.default)(rt,e),children:[d?(0,Ke.jsx)("div",{className:`${rt}-errorBanner`,"data-icon":"error",title:d,children:"Error, edit(s) not saved"}):void 0,(0,Ke.jsx)("div",{className:`${rt}-content`,ref:u,onKeyDown:L,children:t.map(y=>{var D;return(0,Ke.jsxs)("div",{className:`${rt}-field`,children:[(0,Ke.jsx)("label",{className:(0,pr.default)(`${rt}-fieldLabel`,{[`${rt}-required`]:y.required}),htmlFor:`${b}-input-${y.name}`,children:(D=y==null?void 0:y.label)!=null?D:y.description}),S(y)]},y.name)})}),(0,Ke.jsxs)("div",{className:`${rt}-buttonbar salt-theme salt-density-high`,children:[(0,Ke.jsx)(fr.Button,{type:"submit",variant:"cta",disabled:!x,onClick:I,children:"Submit"}),(0,Ke.jsx)(fr.Button,{variant:"secondary",onClick:M,children:"Cancel"})]})]})};var Ta=require("@vuu-ui/vuu-data"),Sa=X(require("classnames")),lt=require("react");var ht=require("react");var ea=(e,t,o="latest")=>new Promise((n,r)=>{console.log(`load local config at ${e} for user ${t.username}, id ${o}`);let s=localStorage.getItem(e);if(s){let a=JSON.parse(s);n(a)}else r()}),ta=(e,t,o)=>new Promise((n,r)=>{try{localStorage.setItem(e,JSON.stringify(o)),n(void 0)}catch{r()}});var oa=(e,t,o="latest")=>new Promise((n,r)=>{fetch(`${e}/${t.username}/${o}`,{}).then(s=>{s.ok?n(s.json()):r(void 0)}).catch(()=>{r(void 0)})}),na=(e,t,o)=>new Promise((n,r)=>{fetch(`${e}/${t.username}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(o)}).then(s=>{s.ok?n(void 0):r()})});var ra=({saveLocation:e,saveUrl:t="api/vui",user:o,defaultLayout:n})=>{let[r,s]=(0,ht.useState)(n),a=e==="remote",l=a?oa:ea,c=a?na:ta,i=(0,ht.useCallback)(async(u="latest")=>{try{let h=await l(t,o,u);s(h)}catch{s(n)}},[n,l,t,o]);(0,ht.useEffect)(()=>{i()},[i]);let d=(0,ht.useCallback)(u=>{c(t,o,u)},[c,t,o]),m=(0,ht.useCallback)(u=>i(u),[i]);return[r,d,m]};var Ln=require("@vuu-ui/vuu-layout");var ha=require("react");var ua=require("@salt-ds/core"),da=require("@salt-ds/lab"),ma=require("@salt-ds/icons");var ia=require("@vuu-ui/vuu-utils"),Cn=require("@salt-ds/lab"),la=require("@salt-ds/core"),aa=require("@salt-ds/icons"),it=require("react");var sa=async e=>await fetch(`api/vui/${e.username}`,{}).then(o=>o.ok?o.json():null).catch(()=>{console.log("error getting history")});var bt=require("react/jsx-runtime"),hd=({lastUpdate:e},{lastUpdate:t})=>t===e?0:t<e?-1:1,bd=e=>(0,bt.jsx)(Cn.ListItem,{...e}),ca=(0,it.forwardRef)(function({loginUrl:t,onNavigate:o,user:n,layoutId:r="latest"},s){let[a,l]=(0,it.useState)([]);(0,it.useEffect)(()=>{async function m(){let h=(await sa(n)).filter(p=>p.id!=="latest").sort(hd).map(({id:p,lastUpdate:f})=>({lastUpdate:f,id:p,label:`Saved at ${(0,ia.formatDate)(new Date(f),"kk:mm:ss")}`}));console.log({sortedHistory:h}),l(h)}m()},[n]);let c=(0,it.useCallback)((m,u)=>{u&&o(u.id)},[o]),i=(0,it.useCallback)(()=>{mr(t)},[t]),d=a.length===0?null:r==="latest"?a[0]:a.find(m=>m.id===r);return(0,bt.jsxs)("div",{className:"vuuUserPanel",ref:s,children:[(0,bt.jsx)(Cn.List,{ListItem:bd,className:"vuuUserPanel-history",onSelect:c,selected:d,source:a}),(0,bt.jsx)("div",{className:"vuuUserPanel-buttonBar",children:(0,bt.jsxs)(la.Button,{"aria-label":"logout",onClick:i,children:[(0,bt.jsx)(aa.ExportIcon,{})," Logout"]})})]})});var ao=require("react/jsx-runtime"),pa=({layoutId:e,loginUrl:t,onNavigate:o,user:n})=>(0,ao.jsxs)(da.DropdownBase,{className:"vuuUserProfile",placement:"bottom-end",children:[(0,ao.jsx)(ua.Button,{variant:"secondary",children:(0,ao.jsx)(ma.UserSolidIcon,{})}),(0,ao.jsx)(ca,{layoutId:e,loginUrl:t,onNavigate:s=>{o(s)},user:n})]});var fa=X(require("classnames")),$t=require("@salt-ds/core"),ga=require("react");var Ho=require("react/jsx-runtime"),yd="vuuThemeSwitch",gr=({className:e,defaultMode:t,mode:o,onChange:n,...r})=>{let[s,a]=(0,$t.useControlled)({controlled:o,default:t!=null?t:"light",name:"ThemeSwitch",state:"mode"}),l=(0,ga.useCallback)(i=>{let{value:d}=i.target;a(d),n(d)},[n,a]),c=(0,fa.default)(yd,e);return(0,Ho.jsxs)($t.ToggleButtonGroup,{className:c,...r,onChange:l,value:s,children:[(0,Ho.jsx)($t.ToggleButton,{"aria-label":"alert","data-icon":"light",value:"dark"}),(0,Ho.jsx)($t.ToggleButton,{"aria-label":"home","data-icon":"dark",value:"light"})]})};var ba=X(require("classnames"));var No=require("react/jsx-runtime"),Id="vuuAppHeader",ya=({className:e,layoutId:t,loginUrl:o,onNavigate:n,onSwitchTheme:r,themeMode:s="light",user:a,...l})=>{let c=(0,ba.default)(Id,e),i=(0,ha.useCallback)(d=>r==null?void 0:r(d),[r]);return(0,No.jsxs)("header",{className:c,...l,children:[(0,No.jsx)(gr,{defaultMode:s,onChange:i}),(0,No.jsx)(pa,{layoutId:t,loginUrl:o,onNavigate:n,user:a})]})};var Ea=require("@vuu-ui/vuu-utils");var Ia=require("@salt-ds/core"),hr=X(require("classnames")),Mn=require("react"),wn=require("@vuu-ui/vuu-layout");var yt=require("react/jsx-runtime"),Ze="vuuContextPanel",br=({className:e,expanded:t=!1,content:o,overlay:n=!1,title:r})=>{let s=(0,wn.useLayoutProviderDispatch)(),a=(0,Mn.useCallback)(()=>{s({path:"#context-panel",propName:"expanded",propValue:!1,type:"set-prop"})},[s]),l=(0,hr.default)(Ze,e,{[`${Ze}-expanded`]:t,[`${Ze}-inline`]:n!==!0,[`${Ze}-overlay`]:n}),c=(0,Mn.useMemo)(()=>o?(0,wn.layoutFromJson)(o,"context-0"):null,[o]);return(0,yt.jsx)("div",{className:(0,hr.default)(Ze,l),children:(0,yt.jsxs)("div",{className:`${Ze}-inner`,children:[(0,yt.jsxs)("div",{className:`${Ze}-header`,children:[(0,yt.jsx)("h2",{className:`${Ze}-title`,children:r}),(0,yt.jsx)(Ia.Button,{className:`${Ze}-close`,"data-icon":"close",onClick:a,variant:"secondary"})]}),(0,yt.jsx)("div",{className:`${Ze}-content`,children:c})]})})};var Ro=require("@vuu-ui/vuu-layout");var co=require("react/jsx-runtime"),xa=({appHeader:e,leftSidePanel:t})=>(0,co.jsxs)(Ro.Flexbox,{className:"App",style:{flexDirection:"row",height:"100%",width:"100%"},children:[t,(0,co.jsxs)(Ro.Flexbox,{className:"vuuShell-content",style:{flex:1,flexDirection:"column"},children:[e,(0,co.jsx)(Ro.DraggableLayout,{dropTarget:!0,style:{flex:1}},"main-content")]}),(0,co.jsx)(br,{id:"context-panel",overlay:!0,title:"Column Settings"})]});var Je=require("@vuu-ui/vuu-layout"),Vt=require("react"),Bt=require("react/jsx-runtime"),va=({appHeader:e,leftSidePanel:t})=>{let o=(0,Vt.useRef)(null),[n,r]=(0,Vt.useState)(!0),s=(0,Vt.useCallback)(l=>{var i;let c=l.target;(i=o.current)!=null&&i.contains(c)||r(!n)},[n]),a=(0,Vt.useCallback)(l=>{let c=[];return c.push((0,Bt.jsx)(Je.Drawer,{onClick:s,open:n,position:"left",inline:!0,peekaboo:!0,sizeOpen:200,toggleButton:"end",children:(0,Bt.jsx)(Je.View,{className:"vuuShell-palette",id:"vw-app-palette",ref:o,style:{height:"100%"},children:l},"app-palette")},"left-panel")),c},[s,n]);return(0,Bt.jsxs)(Je.Flexbox,{className:"App",style:{flexDirection:"column",height:"100%",width:"100%"},children:[e,(0,Bt.jsx)(Je.DockLayout,{style:{flex:1},children:a(t).concat((0,Bt.jsx)(Je.DraggableLayout,{dropTarget:!0,style:{width:"100%",height:"100%"}},"main-content"))})]})};var yr=({leftSidePanelLayout:e="inlay",...t})=>(e==="inlay"?va:xa)(t);var uo=require("react/jsx-runtime"),{error:Ir}=(0,Ea.logger)("Shell"),xd={type:"View",props:{style:{height:"calc(100% - 6px)"}},children:[{props:{className:"vuuShell-warningPlaceholder"},type:"Placeholder"}]},vd=({children:e,className:t,defaultLayout:o=xd,leftSidePanel:n,leftSidePanelLayout:r,loginUrl:s,saveLocation:a="remote",saveUrl:l,serverUrl:c,user:i,...d})=>{let m=(0,lt.useRef)(null),u=(0,lt.useRef)("latest"),[h,p,f]=ra({defaultLayout:o,saveLocation:a,user:i}),b=(0,lt.useCallback)(x=>{try{p(x)}catch{Ir==null||Ir("Failed to save layout")}},[p]),E=(0,lt.useCallback)(x=>{m.current&&(m.current.dataset.mode=x)},[]),C=(0,lt.useCallback)(x=>{u.current=x,f(x)},[f]);(0,lt.useEffect)(()=>{c&&i.token&&(0,Ta.connectToServer)({authToken:i.token,url:c,username:i.username})},[c,i.token,i.username]);let[v,I,L]=je(),M=(0,Sa.default)("vuuShell",t,v,I),S=yr({leftSidePanelLayout:r,appHeader:(0,uo.jsx)(ya,{layoutId:u.current,loginUrl:s,user:i,onNavigate:C,onSwitchTheme:E}),leftSidePanel:n});return(0,uo.jsxs)(Tn,{children:[(0,uo.jsx)(Ln.LayoutProvider,{layout:h,onLayoutChange:b,children:(0,uo.jsx)(Ln.DraggableLayout,{className:M,"data-mode":L,ref:m,...d,children:S})}),e]})};var Hn=require("react"),Dn=require("react/jsx-runtime"),Td={},xr=(0,Hn.createContext)(Td),Sd=({children:e,context:t,inheritedContext:o})=>{let n={...o,...t};return(0,Dn.jsx)(xr.Provider,{value:n,children:e})},Ed=({children:e,value:t})=>(0,Dn.jsx)(xr.Consumer,{children:o=>(0,Dn.jsx)(Sd,{context:t,inheritedContext:o,children:e})}),Cd=()=>(0,Hn.useContext)(xr);
|
|
7
8
|
//# sourceMappingURL=index.js.map
|