@vuu-ui/vuu-ui-controls 0.8.16 → 0.8.17
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/esm/index.js +4 -4
- package/esm/index.js.map +2 -2
- package/package.json +8 -8
package/esm/index.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
var bo=(r,e,t)=>{if(!e.has(r))throw TypeError("Cannot "+t)};var Be=(r,e,t)=>(bo(r,e,"read from private field"),t?t.call(r):e.get(r)),xo=(r,e,t)=>{if(e.has(r))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(r):e.set(r,t)},jr=(r,e,t,n)=>(bo(r,e,"write to private field"),n?n.call(r,t):e.set(r,t),t);import{useId as Jc}from"@vuu-ui/vuu-layout";import{Input as Yc}from"@salt-ds/core";import{forwardRef as ed,useCallback as td,useRef as rd}from"react";import{cloneElement as Ka,createContext as za,useContext as Ua}from"react";import{jsx as Ga}from"react/jsx-runtime";var yo=za(void 0);function Qt({children:r,collectionHook:e,...t}){return Ga(yo.Provider,{value:e,children:Object.keys(t).length>0?Ka(r,t):r})}function So(){let r=Ua(yo);if(r)return r}var Wa=r=>Object.prototype.toString.call(r)==="[object Object]";function Ie(r){return typeof r=="string"?r:Wa(r)?Object.prototype.hasOwnProperty.call(r,"label")?String(r.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(r)}import{useCallback as Te,useMemo as Yt,useRef as er,useState as ll,isValidElement as Ro}from"react";import{isValidElement as Xr,Children as Qa}from"react";var vo=r=>null;var Io=r=>null;var Zr=(r,e)=>r!==null&&Object.prototype.hasOwnProperty.call(r,e),qr=r=>Zr(r,"header"),To=r=>Zr(r,"childNodes"),Dt=(r,e)=>r&&Object.prototype.hasOwnProperty.call(r.props,e),Co=r=>{if(Xr(r)){if(Dt(r,"disabled"))return r.props.disabled===!0}else if(Zr(r,"disabled"))return r.disabled===!0;return!1},wo=r=>Xr(r)&&Dt(r,"focusable")?r.props.focusable:!0,Eo=(r,e,t)=>{if(r.childNodes)return r.childNodes.length;if(r.header){let n=t+1,o=0;for(;n<e.length&&!e[n].header;)o++,n++;return o}else return 0},ja=r=>{if(typeof r.props.children=="string")return r.props.children;if(r.props.title)return r.props.title;if(r.props.label)return r.props.label},Do=r=>r.type===Io||Dt(r,"data-header"),Mo=r=>r.type===vo||Dt(r,"data-group"),Xa=r=>Dt(r,"selectable")?r.props.selectable===!0:!Mo(r)&&!Do(r),Za=r=>{if(Mo(r)){let{props:{children:e}}=r;if(typeof e!="string")return Yr(e)}},qa=(r,e)=>{let t=[];return Qa.forEach(r,n=>{Xr(n)&&t.push(e(n))}),t},Jr=(r,e)=>{if(Array.isArray(r))return r.length===0&&(e!=null&&e.noChildrenLabel)?[{label:e.noChildrenLabel,value:null}]:r.map((t,n)=>{var o,s;return{childNodes:Jr(t.childNodes,e),description:t.description,expanded:t.expanded,value:t,label:(s=(o=e==null?void 0:e.itemToString)==null?void 0:o.call(e,t))!=null?s:Ie(t)}});if(r)throw Error("list-child-items expects source to be an array")},Yr=r=>{if(r)return qa(r,e=>{let{"data-id":t,disabled:n,id:o=t,"data-expanded":s,expanded:i=s}=e.props;return{childNodes:Za(e),disabled:n,expanded:i,header:Do(e),id:o,label:ja(e),selectable:Xa(e),value:e}})},Ja=new Set(["/","-","."]),Ya=r=>Ja.has(r),en=(r,e)=>e.startsWith(r)&&Ya(e[r.length]),el=new Set([".","/"]);function tl(r,e){return e.startsWith(r)?el.has(e.charAt(r.length)):!1}function jt(r,e,t){let n;return r.map(s=>s.id===e?{...s,...t}:tl(s.id,e)&&s.childNodes?(n=jt(s.childNodes,e,t),{...s,childNodes:n}):s)}var rl=/[.*+?^${}()|[\]\\]/g;function Xt(r){return r.replace(rl,"\\$&")}var Zt=(r,e)=>Object.keys(r).reduce((n,o)=>{let s=r[o],i=e[o];return typeof s=="function"&&typeof i=="function"&&(n[o]=(...a)=>{s(...a),i(...a)}),n},{...e});var nl=r=>r&&r.replace(/^\s+/g,""),tn=r=>new RegExp(`(${Xt(nl(r))})`,"gi"),Po=(r="",e=tn)=>(t="")=>!!t.length&&!!r.length&&t.match(e(r))!==null;function qt(r,e){return Array.isArray(r)?r.includes(e.id):r===e.id}import{isValidElement as ol,useCallback as sl,useEffect as Lo,useRef as ko,useState as il}from"react";function Jt({controlled:r,default:e,name:t,state:n="value"}){let{current:o}=ko(r!==void 0),[s,i]=il(e),a=r!==void 0?r:s,{current:l}=ko(e);Lo(()=>{},[n,t,r]),Lo(()=>{},[JSON.stringify(e,al)]);let u=sl(d=>{o||i(d)},[o]);return[a,u,o]}function al(r,e){return ol(e)?null:e}var ul={},je=({children:r,id:e,options:t=ul,source:n})=>{var M,V;let{getItemId:o}=t,[,s]=ll(null),i=So(),a=er([]),l=er([]),u=Yt(()=>[],[]),d=er((M=t.filterPattern)!=null?M:""),p=(V=t.disableFilter)!=null?V:!1,{getFilterRegex:c=tn,noChildrenLabel:m,itemToString:f=Ie}=t,h=Te(()=>t.defaultExpanded||!1,[t.defaultExpanded]),g=Te((C,F,H=1,B="",z=[],G=[],$=[])=>(C.forEach((_,Y,X)=>{var ae,pe;let ce=_.header&&t.collapsibleHeaders,te=_.childNodes&&t.collapsibleHeaders===!1,le=!_.childNodes||_.childNodes.length===0,oe=te||le&&!ce,ue=B?`${B}.${Y}`:`item-${Y}`,he=(ae=_.id)!=null?ae:o?o(Y):`${e}-${ue}`,ge=oe?void 0:(pe=_.expanded)!=null?pe:h(),re={..._,childNodes:void 0,count:!te&&ge===void 0?0:Eo(_,X,Y),description:_.description,disabled:Co(_.value),focusable:wo(_.value)?void 0:!1,id:he,index:F.value,expanded:ge,level:H};if(z.push(re),G.push(re),$.push(C[Y].value),F.value+=1,_.childNodes){let[Ne]=g(_.childNodes,F,H+1,ue,[],G,$);re.childNodes=Ne}}),[z,$,G]),[t.collapsibleHeaders,o,e,h]),y=Te(()=>d.current&&!p?Po(d.current,c):null,[p,c]),E=Te((C,F=y(),H=[],B={value:0})=>{let z=!1;for(let G of C)z&&!qr(G)||(G.value!==null&&(F===null||F(f(G.value)))&&(H[B.value]=G,B.value+=1),z=!1,qr(G)&&G.expanded===!1?z=!0:To(G)&&G.expanded!==!1&&G.childNodes&&E(G.childNodes,F,H,B));return H},[y,f]),I=Yt(()=>i?u:Jr(n,{itemToString:f,noChildrenLabel:m})||Yr(r)||[],[i,u,n,f,m,r]),[b,v,S]=Yt(()=>i?[u,u,u]:g(I,{value:0}),[u,g,i,I]);l.current=S,Yt(()=>i?u:a.current=E(b),[u,E,b,i]);let T=er(b),A=Te((C="")=>{typeof C=="string"&&(d.current=C,a.current=E(b),s({}))},[b,E]),w=Te((C,F=b)=>{let H=F.find(B=>{var z;return B.id===C||((z=B==null?void 0:B.childNodes)==null?void 0:z.length)&&en(B.id,C)});if((H==null?void 0:H.id)===C)return v==null?void 0:v[H.index];if(H)return w(C,H.childNodes);throw Error(`useCollectionData itemById, id ${C} not found `)},[v,b]),D=Te((C,F=b)=>{let H=F.find(z=>{var G;return z.id===C||((G=z==null?void 0:z.childNodes)==null?void 0:G.length)&&en(z.id,C)}),B=H?a.current.indexOf(H):-1;if(B!==-1)return B;throw Error(`useCollectionData indexOfItemById, id ${C} not found `)},[b]),O=Te(C=>{let F=l.current.find(H=>Ro(H.value)?H.label===C:H.value===C);if(F)return F;throw Error("useCollectionData toCollectionItem, item not found ")},[]),x=Te(C=>{if(C===null)return null;if(Array.isArray(C)){let F=[];for(let H of C){let B=O(H);F.push(B)}return F}else if(C!==void 0)return O(C)},[O]),L=Te(C=>{if(C===void 0)return;let F=x(C);return Array.isArray(F)?F.map(H=>H.id):F?[F.id]:[]},[x]),N=Te(C=>{let F=H=>{let B=l.current.find(z=>Ro(z.value)?z.label===H:z.value!==null&&f(z.value)===H);if(B)return B};if(C===null)return null;if(Array.isArray(C)){let H=[];for(let B of C){let z=F(B);z&&H.push(z)}return H}else if(C!==void 0)return F(C)},[f]),k=Te(C=>{for(let F of T.current)if(C===F.value)return F.id;throw Error("useCollectionData itemToId, item not found")},[]),P=Te(C=>{T.current=jt(T.current,C.id,{expanded:!1}),a.current=E(T.current),s({})},[E]),R=Te(C=>{T.current=jt(T.current,C.id,{expanded:!0}),a.current=E(T.current),s({})},[E]);return i||{collapseGroupItem:P,data:a.current,expandGroupItem:R,setFilterPattern:A,indexOfItemById:D,itemById:w,itemToId:k,toCollectionItem:O,itemToCollectionItem:x,itemToCollectionItemId:L,stringToCollectionItem:N}};import{useCallback as cl,useEffect as dl,useLayoutEffect as pl,useRef as fl}from"react";var Dh=["height","width"],No=["width"],Oo=["height"],tt=new Map,Ao=(r,e,t)=>{switch(t){case"height":return e.height;case"clientHeight":return r.clientHeight;case"clientWidth":return r.clientWidth;case"contentHeight":return e.contentHeight;case"contentWidth":return e.contentWidth;case"scrollHeight":return Math.ceil(r.scrollHeight);case"scrollWidth":return Math.ceil(r.scrollWidth);case"width":return e.width;default:return 0}};var Ho=new ResizeObserver(r=>{for(let e of r){let{target:t,borderBoxSize:n,contentBoxSize:o}=e,s=tt.get(t);if(s){let[{blockSize:i,inlineSize:a}]=n,[{blockSize:l,inlineSize:u}]=o,{onResize:d,measurements:p}=s,c=!1;for(let[m,f]of Object.entries(p)){let h=Ao(t,{height:i,width:a,contentHeight:l,contentWidth:u},m);h!==f&&(c=!0,p[m]=h)}c&&d&&d(p)}}});function ze(r,e,t,n=!1){let o=fl(e),s=r.current,i=cl(a=>{let{width:l,height:u}=a.getBoundingClientRect(),{clientWidth:d,clientHeight:p}=a;return o.current.reduce((c,m)=>(c[m]=Ao(a,{width:l,height:u,contentHeight:p,contentWidth:d},m),c),{})},[]);pl(()=>{async function a(){tt.set(s,{measurements:{}}),await document.fonts.ready;let l=tt.get(s);if(l){let u=i(s);l.measurements=u,Ho.observe(s),n&&t(u)}else console.log("%cuseResizeObserver an target expected to be under observation wa snot found. This warrants investigation","font-weight:bold; color:red;")}return s&&(tt.has(s)&&console.log("useResizeObserver attemping to observe same element twice",{target:s}),a()),()=>{s&&tt.has(s)&&(Ho.unobserve(s),tt.delete(s))}},[i,s]),dl(()=>{let a=r.current,l=tt.get(a);if(l){if(o.current!==e){o.current=e;let u=i(a);l.measurements=u}l.onResize=t}},[e,i,r,t])}var Fo=r=>r===void 0||r==="default"||r==="deselectable",ut=r=>r==="multiple"||(r==null?void 0:r.startsWith("extended"))===!0,Vo=r=>r==="none",Ph=(r,e=!1)=>r==="multiple"||r==="multiple-special-key"&&e,Lh=r=>r!=="none"&&r!=="default",Ue=r=>r!==void 0&&r.length>0,Bo=r=>r[0];import{useCallback as ml,useRef as hl,useState as gl}from"react";var bl=r=>typeof r!="function",Ah=r=>{let[e,t]=gl(r),n=hl(e),o=ml(s=>{if(bl(s))n.current=s,t(s);else{let{current:i}=n;n.current=s(i),t(n.current)}},[]);return[n,o]};import Uo from"classnames";import{useForkRef as Cl}from"@salt-ds/core";import{Children as wl,cloneElement as Go,forwardRef as El,useRef as Dl}from"react";import{useControlled as Sl,useForkRef as vl}from"@salt-ds/core";import{useCallback as rt,useRef as Ko,useState as Il}from"react";import{useEffect as $o,useRef as xl}from"react";var yl=[],_o=({popperRef:r,rootRef:e,isOpen:t,onClose:n})=>{let o=xl(t);$o(()=>{o.current=t},[t]),$o(()=>{let[s,i]=t?[a=>{var u,d;let l=a.target;!((u=r.current)!=null&&u.contains(l))&&!((d=e.current)!=null&&d.contains(l))&&n("click-away")},a=>{a.key==="Escape"&&o.current&&(n("Escape"),a.stopPropagation())}]:yl;return s&&i&&(document.body.addEventListener("mousedown",s,!0),document.body.addEventListener("keydown",i,!0)),()=>{s&&i&&(document.body.removeEventListener("mousedown",s,!0),document.body.removeEventListener("keydown",i,!0))}},[t,n,r,e])};var Tl=[],zo=({defaultIsOpen:r,disabled:e,fullWidth:t,id:n,isOpen:o,onOpenChange:s,onKeyDown:i,openKeys:a=["Enter","ArrowDown"," "],openOnFocus:l,popupComponent:u,popupWidth:d,rootRef:p,width:c})=>{var P;let m=Ko(null),f=Ko(null),h=rt(R=>{f.current=R},[]),[g,y]=Sl({controlled:o,default:!!r,name:"useDropdown",state:"isOpen"}),[E,I]=Il({width:(P=d!=null?d:c)!=null?P:0}),b=rt(()=>{y(!0),s==null||s(!0)},[s,y]),v=rt(R=>{y(!1),s==null||s(!1,R)},[s,y]);_o({popperRef:f,rootRef:p,isOpen:g,onClose:v});let S=rt(()=>{e||l&&(y(!0),s==null||s(!0),m.current=window.setTimeout(()=>{m.current=null},1e3))},[e,s,l,y]),T=rt(R=>{if(["Enter"," "].indexOf(R.key)===-1){let M=!g;y(M),s==null||s(M)}},[g,y,s]),A=rt(R=>{R.key==="Escape"&&g?(R.key==="Escape"&&(R.stopPropagation(),R.preventDefault()),v(R.key)):a.includes(R.key)&&!g?(R.preventDefault(),b()):i==null||i(R)},[v,g,i,a,b]),w=rt(R=>{var M;g&&((M=f.current)!=null&&M.contains(R.relatedTarget)||v("blur"))},[v,g]),D=t!=null?t:!1;ze(p,D?No:Tl,I,D);let x=`${n}-dropdown`,L={"aria-expanded":g,"aria-owns":g?x:void 0,id:`${n}-control`,onClick:e||l?void 0:T,onFocus:S,role:"listbox",onBlur:w,onKeyDown:e?void 0:A,style:{width:D?void 0:c}},N={id:x,width:E.width},k=vl(h,u.ref);return{componentProps:N,popupComponentRef:k,isOpen:g,label:"Dropdown Button",triggerProps:L}};import{useId as Ml}from"@vuu-ui/vuu-layout";import{PopupComponent as Pl,Portal as Ll}from"@vuu-ui/vuu-popups";import{jsx as Wo,jsxs as kl}from"react/jsx-runtime";var tr="vuuDropdown",ct=El(function({PopupProps:e,"aria-labelledby":t,children:n,className:o,defaultIsOpen:s,disabled:i,fullWidth:a,id:l,isOpen:u,onKeyDown:d,onOpenChange:p,openKeys:c,openOnFocus:m,placement:f="below-full-width",popupWidth:h,width:g,...y},E){let I=Dl(null),b=Uo(tr,o,{[`${tr}-fullWidth`]:a,[`${tr}-disabled`]:i}),[v,S]=wl.toArray(n),T=Ml(l),{componentProps:A,isOpen:w,popupComponentRef:D,triggerProps:O}=zo({ariaLabelledBy:t,defaultIsOpen:s,disabled:i,fullWidth:a,id:T,isOpen:u,onOpenChange:p,onKeyDown:d,openKeys:c,openOnFocus:m,popupComponent:S,popupWidth:h,rootRef:I,width:g}),x=()=>{let{id:k,role:P,...R}=O,{id:M=k,role:V=P,...C}=v.props;return Go(v,Zt(C,{...R,id:M,role:V}))},L=()=>{let{id:k,width:P,...R}=A,{className:M,id:V=k,width:C,...F}=S.props;return Go(S,{...F,...R,className:Uo(M,`${tr}-popup-component`),id:V,ref:D,width:f.endsWith("full-width")?"auto":C!=null?C:P})},N=Cl(I,E);return kl("div",{...y,className:b,id:l,ref:N,children:[x(),w&&Wo(Ll,{children:Wo(Pl,{...e,anchorElement:I,placement:f,children:L()})})]})});import{Button as Rl}from"@salt-ds/core";import Hl from"classnames";import{forwardRef as Nl}from"react";import{jsx as rn,jsxs as Ol}from"react/jsx-runtime";var Mt="vuuDropdownButton",Qo=Nl(function({ariaHideOptionRole:e,className:t,disabled:n,icon:o="chevron-down",isOpen:s,label:i,labelId:a,fullWidth:l,posInSet:u,setSize:d,labelAriaAttributes:p,...c},m){return rn(Rl,{className:Hl(Mt,{[`${Mt}-fullWidth`]:l},t),disabled:n,variant:"secondary",...c,ref:m,children:Ol("div",{className:`${Mt}-content`,children:[rn("span",{"aria-hidden":e?"true":void 0,...p,className:`${Mt}-buttonLabel`,id:a,role:"option",children:i}),rn("span",{className:`${Mt}-buttonIcon`,"data-icon":o,"aria-hidden":"true"})]})})});import{useForkRef as $c}from"@salt-ds/core";import{cloneElement as _c,forwardRef as Kc,useCallback as zc,useRef as ri}from"react";import{useId as Uc}from"@vuu-ui/vuu-layout";function Al(r,...e){let t=new Set(r);for(let n of e)for(let o of n)t.add(o);return t}var Pt="ArrowUp",Lt="ArrowDown",jo="ArrowLeft",Xo="ArrowRight",nn="Enter",Mg="Escape",on="Home",rr="End",sn="PageUp",nr="PageDown",Zo=" ",Fl=new Set(["Enter","Delete"," "]),Vl=new Set(["Tab"]),Bl=new Set(["ArrowRight","ArrowLeft"]),qo=new Set([on,rr,sn,nr,Lt,Pt]),$l=new Set(["F1","F2","F3","F4","F5","F6","F7","F8","F9","F10","F11","F12"]),_l=Al(Fl,qo,Bl,$l,Vl),or=r=>_l.has(r.key)?!1:r.key.length===1&&!r.ctrlKey&&!r.metaKey&&!r.altKey,Jo=({key:r})=>qo.has(r);import{useCallback as Yo}from"react";var Kl={},zl=r=>Array.isArray(r.childNodes),Ul=r=>!0,Gl=r=>r.closest("[data-toggle],[aria-expanded]").dataset.toggle==="true",es=({collapsibleHeaders:r,collectionHook:e,highlightedIdx:t,onToggle:n})=>{let o=Yo(a=>{if(a.key===Xo||a.key===nn){let l=e.data[t];l&&l.expanded===!1&&l.value&&(a.preventDefault(),e.expandGroupItem(l),n==null||n(l.value))}if(a.key===jo||a.key===nn){let l=e.data[t];l&&l.expanded&&l.value&&(a.preventDefault(),e.collapseGroupItem(l),n==null||n(l.value))}},[e.collapseGroupItem,e.data,e.expandGroupItem,t]),i={onClick:Yo(a=>{console.log(`useCollapsibleGroups idx=${t}`);let l=e.data[t];console.log(a.target,a.currentTarget),l&&zl(l)&&(!Ul(l)||Gl(a.target))&&(a.stopPropagation(),a.preventDefault(),l.expanded===!1&&l.value?(e.expandGroupItem(l),n==null||n(l.value)):l.expanded===!0&&l.value&&(e.collapseGroupItem(l),n==null||n(l.value)))},[e.collapseGroupItem,e.data,e.expandGroupItem,t]),onKeyDown:o};return r?i:Kl};var Ng=(r,e)=>r.querySelector(`:scope > [data-idx="${e}"]`);function Wl(r){if(r){let e=r.dataset.index;if(e)return parseInt(e,10);if(e=r.ariaPosInSet)return parseInt(e,10)-1}return-1}var Ql=r=>r==null?void 0:r.id,ts=r=>r.closest("[data-index],[aria-posinset]"),Og=r=>Ql(ts(r)),rs=r=>Wl(ts(r));import{useImperativeHandle as jl,useMemo as Xl}from"react";var Zl={scrollToIndex:()=>{},scrollToItem:()=>{},scrollTo:()=>{}},sr=({collectionHook:r,forwardedRef:e,scrollableRef:t,scrollIntoView:n})=>{let o=Xl(()=>({scrollToIndex:s=>{let i=r.data[s];i&&(n==null||n(i))},scrollToItem:s=>{let i=r.toCollectionItem(s);i&&(n==null||n(i))},scrollTo:s=>{t!=null&&t.current&&(t.current.scrollTop=s)}}),[r,n,t]);jl(e,()=>t.current?o:Zl,[o,t])};import{useControlled as ql}from"@salt-ds/core";import{useCallback as dt,useMemo as Jl,useRef as an,useState as Yl}from"react";import{getElementByDataIndex as ir,isValidNumber as eu}from"@vuu-ui/vuu-utils";var un=-2;function ns(r,e,t){return e===Pt||e===rr?t>0?t-1:t:t===null?0:t===r-1?t:t+1}var ln=r=>{var t;let e=Array.isArray(r)?Bo(r):void 0;if(e){let n=document.getElementById(e);if(n){let o=parseInt((t=n.dataset.index)!=null?t:"-1");if(eu(o))return o}}return-1},tu=(r,e,t,n)=>r===rr?n:r===on?-1:e!==-1?e:t,ru=(r,e,t,n)=>{let{top:o}=e.getBoundingClientRect(),{scrollTop:s,clientHeight:i,scrollHeight:a}=r,l=t-1,u=Math.min(s+i,a-i);if(u!==s&&n<l){r.scrollTo(0,u);let d=n,p;do d+=1,p=ir(r,d,!0).getBoundingClientRect();while(p.top<o&&d<l);return d}},nu=async(r,e,t)=>{let{top:n}=e.getBoundingClientRect(),{scrollTop:o,clientHeight:s}=r,i=Math.max(o-s,0);if(i!==o&&t>0)return r.scrollTo(0,i),new Promise(a=>{requestAnimationFrame(()=>{let l=t,u;do l-=1,u=ir(r,l,!0).getBoundingClientRect();while(u.top>n&&l>0);a(l)})})},ou=r=>r!==void 0,os=(r,e)=>{let t=ir(r,e);return ou(t)},ss=({containerRef:r,defaultHighlightedIndex:e=-1,disableHighlightOnFocus:t,highlightedIndex:n,itemCount:o,onHighlight:s,onKeyboardNavigation:i,restoreLastFocus:a,selected:l,viewportItemCount:u})=>{let d=an(-1),[,p]=Yl({}),[c,m,f]=ql({controlled:n,default:e,name:"UseKeyboardNavigation"}),h=dt((w,D=!1)=>{s==null||s(w),m(w),D&&(d.current=w)},[s,m]),g=dt(async(w,D)=>{let O=ir(r.current,D,!0),x;if(O){let{current:L}=r;O&&L&&(x=w===nr?ru(L,O,o,D):await nu(L,O,D))}return x!=null?x:D},[r,o]),y=dt((w=Lt,D=w===Lt?-1:o)=>{if(o===0)return-1;{let O=w==="End",x=w==="Home",L=O||x||D===-1?-1:ln(l),N=tu(w,D,L,o),k=ns(o,w,N),{current:P}=r;if(k===0&&w===Pt&&P&&!os(P,0))return D;for(;((w===Lt||x)&&k<o||(w===Pt||O)&&k>0)&&P&&!os(P,k);)k=ns(o,w,k);return k}},[r,o,l]),E=an(!1),I=an(!1),b=w=>I.current=w,v=dt(()=>{if(I.current)I.current=!1;else if(E.current=!0,o===0)h(un);else if(c!==-1)p({});else if(a)if(d.current!==-1)h(d.current);else{let w=ln(l);h(w!==-1?w:0)}else if(Ue(l)){let w=ln(l);h(w)}else t!==!0&&h(y())},[t,c,o,y,a,l,h]),S=dt(async w=>{let D=w.key===nr||w.key===sn?await g(w.key,c):y(w.key,c);D!==c&&h(D,!0),i==null||i(w,D)},[c,y,g,i,h]),T=dt(w=>{o>0&&Jo(w)?(w.preventDefault(),w.stopPropagation(),E.current=!0,S(w)):or(w)&&(E.current=!0)},[o,S]),A=Jl(()=>({onBlur:w=>{let D=w.target.closest(".vuuList"),O=w.relatedTarget;D&&!(D!=null&&D.contains(O))&&(E.current=!1,m(-1),a||(d.current=-1))},onFocus:v,onKeyDown:T,onMouseDownCapture:()=>{E.current=!1,b(!0)},onMouseMove:()=>{E.current&&(E.current=!1)},onMouseLeave:()=>{E.current=!1,b(!1),h(-1)}}),[v,T,a,m,h]);return{focusVisible:E.current?c:-1,controlledHighlighting:f,highlightedIndex:c,setHighlightedIndex:h,keyboardNavigation:E,containerProps:A,setIgnoreFocus:b}};import{getElementByDataIndex as ar,getElementDataIndex as su,isSelectableElement as cn}from"@vuu-ui/vuu-utils";import{useCallback as Ge,useRef as iu}from"react";var ib="checkbox",au="none",ab="single",lb="cascade",lu=["Enter"," "],ub=r=>r&&r!==au,is=({containerRef:r,defaultSelected:e,disableSelection:t=!1,highlightedIndex:n,itemQuery:o,onClick:s,onSelect:i,onSelectionChange:a,selected:l,selectionStrategy:u,selectionKeys:d=lu,tabToSelect:p})=>{let c=u==="deselectable",m=u==="multiple",f=u==="extended",h=iu(-1),g=Ge(x=>d.includes(x.key),[d]),[y,E]=Jt({controlled:l,default:e!=null?e:[],name:"UseSelection",state:"selected"}),I=Ge(x=>y.includes(x),[y]),b=Ge(x=>I(x)?[]:[x],[I]),v=Ge(x=>{let L=I(x)?y.filter(N=>N!==x):y.concat(x);return L.sort(),L},[I,y]),S=Ge((x,L)=>{let N=L?y:[],[k]=y.slice(-1),P=k?su(document.getElementById(k)):0,R=Math.min(x,P),M=Math.max(x,P),V=r.current,F=Array.from(V.querySelectorAll(o)).slice(R,M+1).map(B=>B.id),H=[...new Set([...N,...F])];return H.sort(),H},[r,o,y]),T=Ge((x,L,N,k)=>{let{current:P}=r,{id:R}=ar(P,L,!0),M;m?M=v(R):f?k&&!N?M=v(R):N?M=S(L,k):M=[R]:c?M=b(R):M=[R],M!==y&&E(M),i==null||i(x,R),M!==y&&a&&a(x,M)},[r,m,f,c,y,i,v,S,b,E,a]),A=Ge(x=>{let{current:L}=r,N=ar(L,n);cn(N)&&(g(x)||p&&x.key==="Tab")&&(x.key!=="Tab"&&x.preventDefault(),T(x,n,!1,x.ctrlKey||x.metaKey),f&&(h.current=n))},[n,r,g,p,T,f]),w=Ge((x,L)=>{if(f&&x.shiftKey){let{current:N}=r,k=ar(N,L);cn(k)&&T(x,L,!0)}},[f,r,T]),D=Ge(x=>{let{current:L}=r,N=ar(L,n);!t&&cn(N)&&(x.preventDefault(),x.stopPropagation(),T(x,n,x.shiftKey,x.ctrlKey||x.metaKey),f&&(h.current=n)),s==null||s(x)},[r,n,t,s,T,f]);return{listHandlers:Vo(u)?{onClick:s}:{onClick:D,onKeyDown:A,onKeyboardNavigation:w},selected:y,setSelected:E}};import{useCallback as as,useRef as dn}from"react";var ls=({disableTypeToSelect:r,highlightedIdx:e,highlightItemAtIndex:t,typeToNavigate:n,items:o,applyIncrementalSearch:s=!0})=>{let i=dn(null),a=dn(""),l=dn(-1),u=as(p=>{if(p||!s){let c=new RegExp(`^${a.current}`,"i"),m=o.findIndex(({label:f},h)=>h>l.current&&c.test(f));m===-1&&(m=o.findIndex(({label:f},h)=>h<=l.current&&c.test(f))),m!==-1&&t(m)}else a.current="",i.current=null,l.current=-1},[s,t,o]),d=as(p=>{let c=l.current!==-1;(or(p)||c&&p.key===Zo)&&n&&(p.preventDefault(),p.stopPropagation(),(l.current===-1||p.key===a.current)&&(l.current=e),i.current!==null&&(clearTimeout(i.current),i.current=null),p.key!==a.current&&(a.current+=p.key),s&&u(!0),i.current=window.setTimeout(()=>{u()},100))},[n,s,e,u]);return{onKeyDown:r?void 0:d}};import{useCallback as pt,useRef as us}from"react";import{useIsomorphicLayoutEffect as uu}from"@salt-ds/core";var cs=["height"],cu=["height","scrollHeight"],du=[],ds={containerOnly:[cu,du],withContent:[cs,cs]},pu=r=>r?ds.containerOnly:ds.withContent,ps={current:null},fu=(r,e)=>{let{transform:t="none"}=getComputedStyle(r);if(t.startsWith("matrix")){let n=t.lastIndexOf(",");return parseInt(t.slice(n+1))}else{let n=r.offsetParent;if(n===e||e===null)return r.offsetTop;{let o=r.offsetTop;for(;n!==null&&n!==e;)o+=n.offsetTop,n=n.offsetParent;return o}}},fs=({containerRef:r,contentRef:e=ps,highlightedIdx:t=-1,indexPositions:n,stickyHeaders:o=!1})=>{let s=us(!1),i=us({height:0,contentHeight:0}),a=pt(h=>{s.current=!0,r.current&&(r.current.scrollTop=h),setTimeout(()=>{s.current=!1})},[]),l=pt(()=>a(0),[a]),u=pt(()=>{a(i.current.contentHeight-i.current.height)},[a]),d=pt(h=>{let g=e.current||r.current;if(h.id){let y=document.getElementById(h.id);if(y&&r.current){let{height:E}=i.current,I=y.ariaExpanded&&y.firstChild?y.firstChild:y,b=o?36:0,v=fu(I,g),S=I.offsetHeight,{scrollTop:T}=r.current,A=T+b,w=A+E-b;if(v+S>w||v<A){let D=v+S>w?T+(v+S)-w:v-b;a(D)}}}},[r,e,a,o]);uu(()=>{let{height:h,contentHeight:g}=i.current,y=n[t];if(g>h&&y){let[E]=n,[I]=n.slice(-1);y===E?l():y===I?u():d(n[t])}},[t,n,d,u,l]);let p=pt(({height:h,scrollHeight:g})=>{typeof h=="number"&&(i.current.height=h),typeof g=="number"&&(i.current.contentHeight=g)},[]),c=pt(({height:h})=>{typeof h=="number"&&(i.current.contentHeight=h)},[]),[m,f]=pu(e===ps);return ze(r,m,p,!0),ze(e,f,c,!0),{isScrolling:s,scrollIntoView:d}};import{makePrefixer as mu}from"@salt-ds/core";import{Fragment as gu,jsx as pn}from"react/jsx-runtime";var hu=mu("saltHighlighter"),ms=r=>{let{matchPattern:e,text:t=""}=r,n=typeof e=="string"?new RegExp(`(${Xt(e)})`,"gi"):e;return n===void 0?pn(gu,{children:t}):pn("span",{children:t.split(n).map((o,s)=>o.match(n)?pn("strong",{className:hu("highlight"),children:o},`${s}-${o}`):o)})};import{forwardRef as gs}from"react";import bs from"classnames";import bu from"classnames";import{jsx as xu}from"react/jsx-runtime";var hs="vuuCheckboxIcon",lr=({checked:r=!1,disabled:e=!1,...t})=>xu("span",{...t,className:bu(hs,{[`${hs}-checked-${e?"disabled":"enabled"}`]:r})});import{jsx as ur,jsxs as yu}from"react/jsx-runtime";var kt="vuuListItem",cr=gs(function({height:e,...t},n){return ur("div",{...t,"aria-hidden":!0,className:bs(kt,`${kt}-proxy`),ref:n,style:{height:e}})}),dr=gs(function({children:e,className:t,disabled:n,tabIndex:o,item:s,itemHeight:i,itemTextHighlightPattern:a,label:l,selectable:u,selected:d,showCheckbox:p,style:c,...m},f){let h=bs(kt,t,{vuuDisabled:n,[`${kt}-checkbox`]:p}),g=i!==void 0?{...c,height:i}:c;return yu("div",{className:h,...m,"aria-disabled":n||void 0,"aria-selected":d||void 0,ref:f,style:g,children:[p&&ur(lr,{"aria-hidden":!0,checked:d}),e&&typeof e!="string"?e:a==null?ur("span",{className:`${kt}-textWrapper`,children:l||e}):ur(ms,{matchPattern:a,text:l||e})]})});import{MeasuredContainer as hc,useId as gc}from"@vuu-ui/vuu-layout";import{useForkRef as bc}from"@salt-ds/core";import xn from"classnames";import{cloneElement as xc,forwardRef as yc,isValidElement as Sc,useCallback as vc,useRef as yn,useState as Ic}from"react";import{useLayoutEffectSkipFirst as sc}from"@vuu-ui/vuu-layout";import{useCallback as Nt,useMemo as ic,useRef as ac}from"react";var r1="fwd",n1="bwd";import{createContext as Iu,useCallback as Rt,useContext as Tu,useMemo as mr}from"react";import{boxContainsPoint as Su,dispatchCustomEvent as vu}from"@vuu-ui/vuu-utils";import{useCallback as pr,useRef as fr}from"react";var xs=({onDragOverDropTarget:r,onDrop:e})=>{let t=fr(),n=fr(),o=fr(null),s=fr({x:0,y:0}),i=pr((d,p)=>{let{current:c}=n;if(c){for(let[m,f]of Object.entries(c))if(Su(f,d,p))return m}},[]),a=pr(d=>{let{clientX:p,clientY:c}=d,{current:m}=o;if(s.current.x=p,s.current.y=c,m!=null&&m.draggableElement){let{draggableElement:f,mouseOffset:h}=m,g=s.current.x-h.x,y=s.current.y-h.y;f.style.top=`${y}px`,f.style.left=`${g}px`;let E=i(g,y);E?r(E,m)?(document.removeEventListener("mousemove",a,!1),document.removeEventListener("mouseup",l,!1),o.current=null,t.current=void 0):t.current=E:t.current=void 0}},[]),l=pr(()=>{document.removeEventListener("mousemove",a,!1),document.removeEventListener("mouseup",l,!1);let{current:d}=o;d&&(o.current=null,t.current&&e(t.current,d),d.draggableElement&&vu(d.draggableElement,"vuu-dropped"))},[a,e]),u=pr(d=>(console.log("resume drag of ",{el:d.draggableElement}),o.current=d,document.addEventListener("mousemove",a,!1),document.addEventListener("mouseup",l,!1),!0),[a,l]);return{measuredDropTargetsRef:n,resumeDrag:u}};import{jsx as Du}from"react/jsx-runtime";var Cu={isDragSource:void 0,isDropTarget:void 0,register:()=>{}},wu=()=>console.log("have you forgotten to provide a DragDrop Provider ?"),ys=Iu({registerDragDropParty:wu}),Eu=(r=[])=>r.reduce((e,t)=>{let n=document.getElementById(t);if(n){let{top:o,right:s,bottom:i,left:a}=n.getBoundingClientRect();e[t]={top:o,right:s,bottom:i,left:a}}return e},{}),m1=({children:r,dragSources:e})=>{let t=mr(()=>new Map,[]),n=mr(()=>new Map,[]),o=Rt((f,h)=>{let g=t.get(f);return g?g(h):!1},[t]),s=Rt((f,h)=>{let g=n.get(f);g&&g(h)},[n]),{measuredDropTargetsRef:i,resumeDrag:a}=xs({onDragOverDropTarget:o,onDrop:s}),[l,u]=mr(()=>{let f=new Map,h=new Map;for(let[g,{dropTargets:y}]of Object.entries(e)){let E=f.get(g),I=Array.isArray(y)?y:[y];E?E.push(...I):f.set(g,I);for(let b of I){let v=h.get(b);v?v.push(g):h.set(b,[g])}}return[f,h]},[e]),d=Rt((f,h)=>(i.current=Eu(l.get(f)),a(h),!0),[l,i,a]),p=Rt(f=>{console.log(`end of drag operation, id= ${f}`)},[]),c=Rt((f,h,g)=>{h?t.set(f,h):g&&n.set(f,g)},[n,t]),m=mr(()=>({dragSources:l,dropTargets:u,onDragOut:d,onEndOfDragOperation:p,registerDragDropParty:c}),[l,u,d,p,c]);return Du(ys.Provider,{value:m,children:r})},Ss=r=>{var i,a;let{dragSources:e,dropTargets:t,onDragOut:n,onEndOfDragOperation:o,registerDragDropParty:s}=Tu(ys);if(r&&(e||t)){let l=(i=e==null?void 0:e.has(r))!=null?i:!1,u=(a=t==null?void 0:t.has(r))!=null?a:!1;return{isDragSource:l,isDropTarget:u,onDragOut:n,onEndOfDragOperation:o,register:s}}else return Cu};import{isOverflowElement as Qu}from"@vuu-ui/vuu-layout";import{dispatchCustomEvent as ju}from"@vuu-ui/vuu-utils";import{useCallback as Se,useEffect as Xu,useLayoutEffect as Zu,useRef as Pe,useState as qu}from"react";var hr=class{constructor(e,t){this.draggableElement=null;this.payload=null;this.setDraggable=e=>{this.draggableElement=e};this.initialDragElement=t,this.mouseOffset=this.getMouseOffset(e,t)}setPayload(e){this.payload=e}getMouseOffset(e,t){let{clientX:n,clientY:o}=e,s=t.getBoundingClientRect();return{x:n-s.left,y:o-s.top}}};import{useForkRef as Mu}from"@salt-ds/core";import Pu from"classnames";import{forwardRef as Lu,useCallback as vs,useMemo as ku}from"react";import{PopupComponent as Ru,Portal as Hu}from"@vuu-ui/vuu-popups";import{jsx as fn}from"react/jsx-runtime";var Nu=r=>r.split(" ").map(e=>`vuuDraggable-${e}`),gr=Lu(function({wrapperClassName:e,element:t,onDropped:n,onTransitionEnd:o,style:s,scale:i=1},a){let l=vs(()=>{n==null||n()},[n]),u=vs(c=>{c&&(c.innerHTML="",c.appendChild(t),i!==1&&(c.style.transform=`scale(${i},${i})`),c.addEventListener("vuu-dropped",l))},[t,l,i]),d=Mu(a,u),p=ku(()=>({left:0,top:0}),[]);return fn(Hu,{children:fn(Ru,{anchorElement:{current:document.body},placement:"absolute",position:p,children:fn("div",{className:Pu("vuuDraggable",...Nu(e)),ref:d,onTransitionEnd:o,style:s})})})}),mn=r=>{let e=document.createElement("div");return e.className="vuuDraggable-spacer",r&&e.addEventListener("transitionend",()=>{r.current=!1}),e},Is=()=>{let r=document.createElement("div");return r.className="vuuDraggable-dropIndicatorPosition",r},Ts=r=>{let e=document.createElement("div");return e.className="vuuDraggable-dropIndicator",r&&e.addEventListener("transitionend",()=>{r.current=!1}),e};var Ou=["left","right"],Au=["top","bottom"],br=":not(.wrapped)",Cs=':not([aria-hidden="true"])',ws=r=>{let e=r.cloneNode(!0);return e.removeAttribute("id"),e.dataset.index="-1",e},Fu=(r,e="width",t=!1)=>{let n=e==="width"?"left":"top",{[e]:o,[n]:s}=r.getBoundingClientRect(),{padEnd:i=!1,padStart:a=!1}=r.dataset,l=getComputedStyle(r),[u,d]=e==="width"?Ou:Au,p=a&&!t?0:parseInt(l.getPropertyValue(`margin-${u}`),10),c=i&&!t?0:parseInt(l.getPropertyValue(`margin-${d}`),10),m=o;if(parseInt(l.getPropertyValue("flex-shrink"),10)>0){let h=parseInt(l.getPropertyValue("flex-basis"),10);!isNaN(h)&&h>0&&(m=h)}return[s,p+m+c]},Vu={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"}},Ce=r=>Vu[r],Es=(r,e)=>{let t=r.find(n=>n.id===e);if(t)return t},Ds=(r,e)=>{r.splice(e,1);for(let t=e;t<r.length;t++)r[t].currentIndex-=1},ft=(r,e,t,n,o)=>{let s=[],{DIMENSION:i}=Ce(e),a=Array.from(t?r.querySelectorAll(t):r.children),l=a.length,u=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,l-1):l-1;for(let p=u;p<=d;p++){let c=a[p],[m,f]=Fu(c,i),h=p===l-1,g=c.id;s.push({currentIndex:p,id:g,index:p,isDraggedItem:o===g,isLast:h,isOverflowIndicator:c.dataset.index==="overflow",element:c,start:m,end:m+f,size:f,mid:m+f/2})}return s},mt=(r,e=!1)=>{let t=r.findIndex(n=>n.isDraggedItem);if(e){let{index:n}=r[t],o=r.filter(i=>!i.isDraggedItem).reduce((i,a)=>Math.min(i,a.index),Number.MAX_SAFE_INTEGER);if(o>0&&!(n===0&&o===1))return o+t}return t},hn=(r,e)=>{let t=mt(r),n=e==="fwd"?t+1:t-1;if(n<0||n>=r.length)throw Error("switchDropTargetPosition index out of range");let o=r.at(t),s=r.at(n),i=s.size-o.size;if(e==="fwd"){let a=s.start+i,l=s.end,u={...o,start:a,mid:Math.floor(a+(l-a)/2),end:l},d=o.start,p=o.end+i,c={...s,start:d,mid:Math.floor(d+(p-d)/2),end:p};r.splice(t,2,c,u)}else{let a=s.start,l=s.end-i,u={...o,start:a,mid:Math.floor(a+(l-a)/2),end:l},d=o.start-i,p=o.end,c={...s,start:d,mid:Math.floor(d+(p-d)/2),end:p};r.splice(n,2,u,c)}},nt=(r,e,t,n)=>{let o=r.length,s=mt(r),i=r[s];if(n==="fwd"){let a=Math.round(e+t);for(let l=o-1;l>=0;l--){let u=r[l];if(a>u.mid)return i&&l<s?i:u}}else{let a=Math.round(e);for(let l=0;l<o;l++){let u=r[l];if(a<u.mid)return l>s?i:u}}throw Error("no dropTraget identified")};function Ms(r,e){let{height:t,left:n,top:o,width:s}=r,{height:i,width:a}=e;return{height:Math.min(t,i),left:n,top:o,width:Math.min(s,a)}}var R1=r=>r.map((e,t)=>{var n;return`
|
|
3
|
-
${e.isDraggedItem?"*":" "}[${t}] width : ${Math.floor(e.size)} ${Math.floor(e.start)} - ${Math.floor(e.end)} (mid ${Math.floor(e.mid)}) ${(n=e.element)==null?void 0:n.textContent} `}).join(""),Ps=(r,e)=>{let t=r.querySelector(`${e}:not([aria-hidden="true"])`),n=t==null?void 0:t.parentElement;return n===r?r:n==null?void 0:n.parentElement},Ls=(r,e)=>{let{SCROLL_SIZE:t,CLIENT_SIZE:n}=Ce(e),{[t]:o,[n]:s}=r;return o>s};import{useCallback as ks,useRef as xr}from"react";var Rs=({containerRef:r,onScrollingStopped:e,orientation:t="vertical"})=>{let n=xr(null),o=xr(!1),s=xr(0),i=xr("fwd"),a=ks((u=!1)=>{console.log("[useAutoScroll] stopScrolling"),n.current!==null&&(clearTimeout(n.current),n.current=null),o.current=!1,e==null||e(i.current,s.current,u)},[e]),l=ks((u,d,p=30)=>{let{current:c}=r;if(c){let{SCROLL_POS:m,SCROLL_SIZE:f,CLIENT_SIZE:h}=Ce(t),{[m]:g,[f]:y,[h]:E}=c,I=u==="fwd"?y-E-g:g,b=Math.min(I,p);u==="fwd"?(i.current="fwd",c[m]=s.current=g+b):(i.current="bwd",c[m]=s.current=g-b),b===I?a(!0):(o.current=!0,n.current=window.setTimeout(()=>{l(u,d,p)},100))}},[r,t,a]);return{isScrolling:o,startScrolling:l,stopScrolling:a}};import{useCallback as gn,useRef as Bu}from"react";var Hs=({selected:r,viewportRange:e})=>{let t=Bu();t.current=e;let n=gn(i=>{i.ariaSelected&&Array.isArray(r)&&r.length>1&&console.log("its a selected element, and we have a multi select")},[r]),o=gn(()=>{},[]),s=gn(()=>{},[]);return{beginDrag:n,drag:o,drop:s}};import{useCallback as ht,useRef as $e,useState as As}from"react";import{useCallback as Ns,useMemo as $u}from"react";var Os=()=>{let r=$u(()=>Is(),[]),e=Ns(()=>r.remove(),[r]);return{positionDropIndicator:Ns((n,o="end")=>(o==="end"?n.element.after(r):n.element.before(r),r),[r]),clearSpacer:e}};import{jsx as zu}from"react/jsx-runtime";var _u=':not([data-overflowed="true"])',Ku=':not([aria-hidden="true"])',Fs=({onDrop:r,orientation:e="horizontal",containerRef:t,itemQuery:n="*",selected:o,viewportRange:s})=>{let i=$e(),a=$e(null),l=$e(null),u=$e(""),d=$e(!1),p=$e(-1),c=$e([]),m=$e(!1),[f,h]=As(!1),[g,y]=As(),{clearSpacer:E,positionDropIndicator:I}=Os(),b=$e(),v=`:is(${n}${_u}${Ku},[data-overflow-indicator])`,S=k=>c.current.findIndex(P=>P.id===k.id),T=(k,P,R)=>{k.start+=P,k.mid+=P,k.end+=P,typeof R=="number"&&(k.currentIndex+=R)},A=$e();A.current=s;let w=ht(()=>{E()},[E]),D=ht((k,P,R)=>{let{current:M}=t,{current:V}=b;if(M&&V){c.current=ft(M,e,v,A.current);let{size:C}=V,H=p.current+C/2,{current:B}=c,z=nt(B,H,C,"fwd");z&&I(R&&k==="fwd"?B[B.length-1]:z,"start")}},[t,I,v,e]),O=ht(k=>{k.ariaSelected&&Array.isArray(o)&&o.length>1&&console.log("its a selected element, and we have a multi select");let{current:P}=t;if(P&&k){let{SCROLL_SIZE:R,CLIENT_SIZE:M}=Ce(e),{id:V}=k,{[R]:C,[M]:F}=P;d.current=C>F;let H=c.current=ft(P,e,v,s),B=Es(H,V);if(B&&P){let z=S(B);Ds(H,z),b.current=B;let{current:G}=A;if(G!=null&&G.atEnd)for(let oe=0;oe<H.length;oe++)T(H[oe],B.size);for(let oe=z;oe<H.length;oe++)T(H[oe],-B.size,-1);let[$,_]=B.isLast?[H[H.length-1],"end"]:[H[z],"start"];l.current=$,u.current=_;let Y=I($,_),{top:X,left:ce,width:te}=Y.getBoundingClientRect(),le={top:B.isLast?G!=null&&G.atEnd&&!G.atStart?X+B.size-2:X-2:X-B.size-2,left:ce,width:te,height:2};y(zu(gr,{wrapperClassName:"dropIndicatorContainer",style:le,ref:a,element:Ts()}))}}},[o,t,e,v,s,I]),x=ht((k,P)=>{let{current:R}=l,{current:M}=b;if(M&&t.current){let V=e==="horizontal"?"left":"top";p.current=k;let{current:C}=c,F=nt(C,k,M.size,P);if(F&&F.index!==(R==null?void 0:R.index)){if(F.isOverflowIndicator)h(m.current=!0);else if(a.current){if(S(F)===C.length-1){let B=C[C.length-1],G=I(B,"start").getBoundingClientRect();a.current.style[V]=`${G.top}px`}else{let z=I(F,"start").getBoundingClientRect();a.current.style[V]=`${z.top}px`}h(m.current=!1)}l.current=F,i.current=P}}},[t,e,I]),L=ht(()=>{E();let{current:k}=b,{current:P}=l,{current:R}=u,{current:M}=A;if(k&&M&&P){let{index:V}=k,C=R==="start",{index:F,currentIndex:H}=P;l.current=null,i.current=void 0,m.current?r(V,-1,{fromIndex:V,toIndex:-1}):V<F?r(V,C?H:H+1,{fromIndex:V,toIndex:C?H:H+1}):r(V,C?F:F+1,{fromIndex:V,toIndex:C?F:F+1}),y(void 0)}h(!1)},[E,r]),N=ht(()=>{},[]);return{beginDrag:O,drag:x,drop:L,dropIndicator:g,handleScrollStart:w,handleScrollStop:D,releaseDrag:N,revealOverflowedItems:f}};import{useCallback as gt,useMemo as Gu,useRef as ot,useState as Wu}from"react";import{useCallback as Ht,useMemo as Uu,useRef as Vs}from"react";var Bs=(r="horizontal")=>{let e=Vs(0),t=Vs(!1),n=Uu(()=>[mn(t),mn()],[]),o=Ht((u,d="width")=>{let[p,c]=n;e.current=requestAnimationFrame(()=>{t.current=!0,p.style.cssText=`${d}: 0px`,c.style.cssText=`${d}: ${u}px`,n[0]=c,n[1]=p})},[n]),s=Ht((u=!1)=>{if(u===!0){let[d]=n,p=()=>{d.removeEventListener("transitionend",p),s()},c=r==="horizontal"?"width":"height";d.addEventListener("transitionend",p),o(0,c)}else n.forEach(d=>d.remove())},[o,r,n]),i=Ht(()=>{e.current&&(cancelAnimationFrame(e.current),e.current=0)},[]),a=Ht((u,d,p,c=!1,m="static")=>{if(d){let f=r==="horizontal"?"width":"height",[h,g]=n;if(i(),c)t.current?(s(),h.style.cssText=`${f}: ${p}px`,g.style.cssText=`${f}: 0px`,m==="fwd"?(d.element.before(h),d.element.after(g)):(d.element.after(h),d.element.before(g))):m==="fwd"?d.element.after(g):d.element.before(g),o(p,f);else if(m==="static")h.style.cssText=`${f}: ${p}px`,d.element.before(h);else throw Error("useDragDisplacers currently only supports noTransition for static displacement");m!=="static"&&hn(u,m)}},[o,i,s,r,n]),l=Ht((u,d,p,c=!1,m="static")=>{let f=r==="horizontal"?"width":"height",[h,g]=n;i(),c?(t.current?(s(),h.style.cssText=`${f}: ${p}px`,g.style.cssText=`${f}: 0px`,d.element.before(h),d.element.after(g)):m==="fwd"?d.element.after(g):d.element.before(g),o(p,f)):(h.style.cssText=`${f}: ${p}px`,d.element.after(h)),m!=="static"&&hn(u,m)},[o,i,s,r,n]);return{displaceItem:a,displaceLastItem:l,clearSpacers:s}};import{dispatchMouseEvent as $s}from"@vuu-ui/vuu-utils";var _s=({onDrop:r,orientation:e="horizontal",containerRef:t,itemQuery:n="*",selected:o,viewportRange:s})=>{let i=ot(),a=ot(!1),l=ot(-1),u=ot([]),d=ot(!1),[p,c]=Wu(!1),{clearSpacers:m,displaceItem:f,displaceLastItem:h}=Bs(e),g=ot(),y=`:is(${n}${br}${Cs},.vuuOverflowContainer-OverflowIndicator)`,E=x=>u.current.findIndex(L=>L.id===x.id),I=ot();I.current=s;let b=gt(()=>{m()},[m]),v=gt((x,L,N)=>{let{current:k}=t,{current:P}=g;if(k&&P){u.current=ft(k,e,y,I.current),x==="fwd"?u.current.push(P):u.current.unshift(P);let{size:R}=P,V=l.current+R/2,{current:C}=u,F=nt(C,V,R,"fwd");if(F){let B=E(F),z=C[B];N&&x==="fwd"?h(C,C[C.length-1],R,!1,"static"):f(C,z,R,!0,"static")}}},[t,f,h,y,e]),S=gt(x=>{x.ariaSelected&&Array.isArray(o)&&o.length>1&&console.log("its a selected element, and we have a multi select");let{current:L}=t;if(L&&x){let N=L.contains(x),{SCROLL_SIZE:k,CLIENT_SIZE:P}=Ce(e),{id:R}=x,{[k]:M,[P]:V}=L;a.current=M>V;let C=u.current=ft(L,e,y,s,R);if(console.log({dropTargets:C}),N){let F=mt(C),H=C[F];H&&L&&(g.current=H,(H.isLast?h:f)(C,H,H.size,!1,"static"))}else{let{top:F,height:H}=x.getBoundingClientRect(),B=nt(C,F,H,"fwd"),z=C.indexOf(B),{start:G,end:$,mid:_}=B,Y=g.current={end:$,mid:_,start:G,isDraggedItem:!0,isExternal:!0,size:H},X=C.indexOf(B);C.splice(X,0,Y);for(let te=z+1;te<C.length;te++){let le=C[te];le.mid+=H,le.end+=H,le.start+=H}(B.isLast?h:f)(C,B,B.size,!0,"static")}}},[t,f,h,y,e,o,s]),[T,A]=Gu(()=>{let x=!1;return[k=>{if(!x){x=!0;let P=k.element.querySelector(".vuuPopupMenu");P&&$s(P,"click")}},k=>{if(x){x=!1;let P=k.element.querySelector(".vuuPopupMenu");P&&$s(P,"click")}}]},[]),w=gt((x,L)=>{let{current:N}=g;if(N&&t.current){l.current=x;let{current:k}=u,P=nt(k,x,N.size,L);if(P&&!P.isDraggedItem)if(P.isOverflowIndicator)c(d.current=!0),T(P);else{let{size:R}=N;(E(P)===k.length-1?h:f)(k,P,R,!0,L);let C=k.at(-1);A(C),c(d.current=!1)}i.current=L}},[t,f,h,A,T]),D=gt(()=>{var k;m();let{current:x}=u,L=mt(x),N=x[L];if(N)if(i.current=void 0,d.current)r(N.index,-1,{fromIndex:N.index,toIndex:-1,isExternal:N.isExternal});else{let P=mt(x,!0);r(N.index,P,{fromIndex:N.index,toIndex:P,isExternal:N.isExternal})}if(c(!1),t.current){let P=(k=t.current)==null?void 0:k.scrollTop;L<x.length&&(t.current.scrollTop=P)}},[m,t,r]),O=gt(()=>{m(!0)},[m]);return{beginDrag:S,drag:w,drop:D,handleScrollStart:b,handleScrollStop:v,releaseDrag:O,revealOverflowedItems:p}};import{jsx as nc}from"react/jsx-runtime";var Ju={beginDrag:()=>{},drag:()=>{},draggableRef:{current:null},drop:()=>{},isDragging:!1,isScrolling:!1,handleScrollStart:()=>{},handleScrollStop:()=>{},revealOverflowedItems:!1},Ks={start:0,end:1e3,contraStart:0,contraEnd:1e3},Yu=()=>Ju,ec=3,tc=(r,e)=>r.closest(e),rc=(r,e)=>{let t=`:is(${e}${br},.vuuOverflowContainer-OverflowIndicator)`,o=Array.from(r.querySelectorAll(t)).pop();return[o,Qu(o)]},yr=({allowDragDrop:r,containerRef:e,draggableClassName:t,getDragPayload:n,id:o,itemQuery:s="*",onDragStart:i,onDrop:a,onDropSettle:l,orientation:u,...d})=>{let p=Pe({start:0,end:0,contraStart:0,contraEnd:0}),[c,m]=qu({draggable:void 0,draggedItemIndex:-1,isDragging:!1}),f=Pe(null),h=Pe(null),g=Pe(!1),y=Pe({x:0,y:0}),E=Pe({x:0,y:0}),I=Pe(null),b=Pe(null),v=Pe(-1),S=Pe(-1),T=Pe(),{isDragSource:A,isDropTarget:w,onDragOut:D,onEndOfDragOperation:O,register:x}=Ss(o),L=Pe(),N=Pe(),k=Se(()=>{let{current:U}=L,{current:Q}=N;U&&Q&&(document.addEventListener("mousemove",U,!1),document.addEventListener("mouseup",Q,!1))},[]),P=Se(()=>{let{current:U}=L,{current:Q}=N;U&&Q&&(document.removeEventListener("mousemove",U,!1),document.removeEventListener("mouseup",Q,!1))},[]),R=Se((U,Q)=>{let{current:Z}=e;if(Z){let[q,W]=rc(Z,s),{CONTRA:J,CONTRA_END:ee,DIMENSION:ie,END:fe,START:K}=Ce(u),j=Q[ie],{[K]:xe,[fe]:ke}=q.getBoundingClientRect();p.current.start=U[K],p.current.end=W?Math.max(xe,U.right-j):g.current?U[K]+U[ie]-j:ke-j,p.current.contraStart=U[J],p.current.contraEnd=U[ee]}},[e,s,u]),M=Se(()=>{var q;let{current:U}=I;I.current=null;let{current:Q}=S,Z=(q=e.current)==null?void 0:q.querySelector(`${s}[data-index="${Q}"]`);Z&&Z.classList.remove("vuuDropTarget-settling"),S.current=-1,l==null||l(Q),m(W=>({...W,draggable:void 0})),U&&ju(U,"vuu-dropped")},[e,s,l]),V=Se(U=>{if(b.current&&f.current){let{mouseOffset:Q}=f.current,{POS:Z,SCROLL_POS:q,SCROLL_SIZE:W,CLIENT_SIZE:J}=Ce(u),{[q]:ee,[W]:ie,[J]:fe}=b.current,K=ie-fe,j=ee<K,xe=p.current.end,ke=ee>0&&U-Q[Z]<=p.current.start,Re=j&&U-Q[Z]>=xe;return ke?"bwd":Re?"fwd":""}},[b,u]),C=r===!0||r==="natural-movement"?_s:r==="drop-indicator"?Fs:r==="drag-copy"?Hs:Yu,F=Se((U,Q,Z)=>{var q;(q=T.current)==null||q.call(T,U,Q,Z)},[]),{isScrolling:H,startScrolling:B,stopScrolling:z}=Rs({containerRef:b,onScrollingStopped:F,orientation:u}),G=Se((U,Q,Z)=>{var q;v.current=Q,Z.isExternal?a==null||a(U,Q,{...Z,payload:(q=f.current)==null?void 0:q.payload}):a==null||a(U,Q,Z),S.current=Q,o&&(O==null||O(o)),f.current=null},[o,a,O]),{beginDrag:$,drag:_,drop:Y,handleScrollStart:X,handleScrollStop:ce,releaseDrag:te,...le}=C({...d,containerRef:e,isDragSource:A,isDropTarget:w,itemQuery:s,onDrop:G,orientation:u});T.current=ce;let oe=Se((U,Q)=>{let{CONTRA_POS:Z}=Ce(u),q=y.current[Z],W=A?Math.abs(q-Q):0;if(r===!0&&!A&&!w)return!1;let J=w===!1||W-U>5;if(f.current&&J)return D!=null&&D(o,f.current)&&(P(),te==null||te(),f.current=null),p.current=Ks,!0},[r,o,A,w,D,u,te,P]),ue=Se(U=>{let{CLIENT_POS:Q,CONTRA_CLIENT_POS:Z,POS:q}=Ce(u),{clientX:W,clientY:J}=U,{[Q]:ee,[Z]:ie}=U,fe=y.current[q],K=Math.abs(fe-ee),{current:j}=f;if(!oe(K,ie)&&(y.current.x=W,y.current.y=J,j)){let{draggableElement:xe,mouseOffset:ke}=j;if(p.current===Ks&&xe){let Re=y.current.x-ke.x,Oe=y.current.y-ke.y;xe.style.top=`${Oe}px`,xe.style.left=`${Re}px`}else if(K>0&&xe){let Re=fe<ee?"fwd":"bwd",Oe=V(ee),Qr=y.current[q]-ke[q];if(Oe&&g.current&&!H.current?(X==null||X(),B(Oe,1)):!Oe&&H.current&&z(),!H.current){let wt=Math.round(Math.max(p.current.start,Math.min(p.current.end,Qr))),zt=u==="horizontal"?"left":"top";xe.style[zt]=`${wt}px`,_(wt,Re)}}}},[_,oe,V,X,H,u,B,z]),he=Se(()=>{P(),f.current&&(I.current=f.current.draggableElement),Y(),m(U=>({...U,draggedItemIndex:-1,isDragging:!1}))},[Y,P]);L.current=ue,N.current=he;let ge=Se(U=>{f.current=U;let{draggableElement:Q,mouseOffset:Z}=U,{current:q}=e;if(q&&Q){let W=q.getBoundingClientRect(),J=Q.getBoundingClientRect();return R(W,J),y.current.x=J.left+Z.x,y.current.y=J.top+Z.y,$(Q),k(),!0}else return!1},[k,$,e,R]),re=Se(U=>{let{target:Q}=U,Z=tc(Q,s),{current:q}=e;if(q&&Z){let W=Ps(q,s);g.current=Ls(W,u),b.current=W;let J=q.getBoundingClientRect(),ee=Z.getBoundingClientRect(),ie=f.current=new hr(U,Z);R(J,ee),$(Z);let{dataset:{index:fe="-1"}}=Z;m({isDragging:!0,draggable:nc(gr,{element:ws(Z),onDropped:M,onTransitionEnd:M,ref:ie.setDraggable,style:Ms(ee,J),wrapperClassName:t}),draggedItemIndex:parseInt(fe)}),i==null||i(ie),k()}},[k,$,e,t,s,i,u,R,M]),ae=Se(U=>{let{CLIENT_POS:Q,POS:Z}=Ce(u),{[Q]:q}=U;Math.abs(q-E.current[Z])>ec&&e.current&&(h.current&&(window.clearTimeout(h.current),h.current=null),document.removeEventListener("mousemove",ae),document.removeEventListener("mouseup",pe,!1),re(U))},[e,$,u]),pe=Se(()=>{h.current&&(window.clearTimeout(h.current),h.current=null),document.removeEventListener("mousemove",ae,!1),document.removeEventListener("mouseup",pe,!1)},[ae]),Ne=Se(U=>{let{current:Q}=e;if(U.stopPropagation(),Q&&!U.defaultPrevented){let{clientX:Z,clientY:q}=U;y.current.x=E.current.x=Z,y.current.y=E.current.y=q,document.addEventListener("mousemove",ae,!1),document.addEventListener("mouseup",pe,!1),U.persist(),h.current=window.setTimeout(()=>{document.removeEventListener("mousemove",ae,!1),document.removeEventListener("mouseup",pe,!1),re(U.nativeEvent)},500)}},[e,re,ae,pe]),{current:se}=I;return Zu(()=>{if(se&&e.current){let U=v.current,Q=e.current.querySelector(`${s}[data-index="${U}"]`);Q&&(Q.classList.add("vuuDropTarget-settling"),requestAnimationFrame(()=>{let{top:Z,left:q}=Q.getBoundingClientRect(),W=getComputedStyle(se),J=parseInt(W.getPropertyValue("left")),ee=parseInt(W.getPropertyValue("top"));J!==q||ee!==Z?(se.classList.add("vuuDraggable-settling"),se.style.top=`${Z}px`,se.style.left=`${q}px`):M()}))}},[e,s,se,M]),Xu(()=>{o&&(A||w)&&x(o,r==="drop-only"?!1:ge,a)},[r,o,A,w,a,x,ge]),{...le,...c,isScrolling:H,onMouseDown:r&&r!=="drop-only"?Ne:void 0}};import{useCallback as Sr,useEffect as oc,useRef as zs}from"react";var Us=({dataHook:r,onDrop:e,onMoveListItem:t,selected:n,setHighlightedIndex:o,setSelected:s})=>{let i=zs([]),a=zs(r);a.current=r;let l=Sr((c,m,f)=>c===m?f:c<Math.min(m,f)||c>Math.max(m,f)?c:m<c?c-1:c+1,[]),u=Sr((c,m,f)=>c.map(g=>a.current.indexOfItemById(g)).map(g=>l(g,m,f)),[l]),d=Sr((c,m,f)=>{Ue(n)&&(i.current=u(n,c,m)),f.isExternal?e==null||e(c,m,f):t==null||t(c,m),o(-1)},[n,o,u,e,t]),p=Sr(c=>{o(c)},[o]);return oc(()=>{let{current:c}=i;if(Ue(c)){i.current=[];let m=Array.isArray(c)?c.map(f=>r.data[f].id):r.data[c].id;i.current=[],s(m)}},[r.data,s]),{handleDrop:d,onDropSettle:p}};var Xe=({allowDragDrop:r=!1,collapsibleHeaders:e,collectionHook:t,containerRef:n,contentRef:o,defaultHighlightedIndex:s,defaultSelected:i,disabled:a,disableAriaActiveDescendant:l,disableHighlightOnFocus:u,disableTypeToSelect:d,highlightedIndex:p,id:c,label:m="",listHandlers:f,onClick:h,onDragStart:g,onDrop:y,onHighlight:E,onKeyboardNavigation:I,onKeyDown:b,onMoveListItem:v,onSelect:S,onSelectionChange:T,restoreLastFocus:A,scrollContainerRef:w,selected:D,selectionStrategy:O,selectionKeys:x,stickyHeaders:L,tabToSelect:N,viewportRange:k})=>{let P=ac(D||i),R=(W,J)=>{var ee,ie;(ie=(ee=X.listHandlers).onKeyboardNavigation)==null||ie.call(ee,W,J),I==null||I(W,J)},M=Nt((W,J)=>{S&&J!==null&&S(W,t.itemById(J))},[t,S]),V=ic(()=>{var W,J;return w||{current:(J=(W=n.current)==null?void 0:W.querySelector(".vuuList-scrollContainer"))!=null?J:null}},[n,w]),C=Nt((W,J)=>{if(T){if(Fo(O)){let[ee]=J;T(W,t.itemById(ee))}else if(ut(O)){let ee=J.map(ie=>t.itemById(ie));T(W,ee)}}},[t,T,O]),{highlightedIndex:F,containerProps:{onKeyDown:H,onMouseMove:B,...z},setHighlightedIndex:G,...$}=ss({containerRef:V,defaultHighlightedIndex:s,disableHighlightOnFocus:u,highlightedIndex:p,itemCount:t.data.length,label:m,onHighlight:E,onKeyboardNavigation:R,restoreLastFocus:A,selected:P.current,viewportItemCount:10}),_=es({collapsibleHeaders:e,highlightedIdx:F,collectionHook:t}),Y=Nt(W=>{G(-1),g==null||g(W)},[g,G]),X=is({containerRef:n,defaultSelected:i,highlightedIndex:F,itemQuery:".vuuListItem",label:`${m}:useList`,onClick:h,onSelect:M,onSelectionChange:C,selected:D,selectionStrategy:O,selectionKeys:x,tabToSelect:N}),{handleDrop:ce,onDropSettle:te}=Us({dataHook:t,onDrop:y,onMoveListItem:v,selected:X.selected,setHighlightedIndex:G,setSelected:X.setSelected}),{setSelected:le}=X;sc(()=>{Ue(P.current)&&le([])},[D,t.data,le]);let{onMouseDown:oe,isDragging:ue,isScrolling:he,...ge}=yr({allowDragDrop:r,draggableClassName:"list-item",orientation:"vertical",containerRef:n,id:c,itemQuery:".vuuListItem",onDragStart:Y,onDrop:ce,onDropSettle:te,viewportRange:k}),{onKeyDown:re}=ls({disableTypeToSelect:d,highlightedIdx:F,highlightItemAtIndex:G,typeToNavigate:!0,items:t.data}),ae=Nt(W=>{var J,ee,ie;W.defaultPrevented||re==null||re(W),H(W),W.defaultPrevented||(ee=(J=X.listHandlers).onKeyDown)==null||ee.call(J,W),W.defaultPrevented||(ie=_==null?void 0:_.onKeyDown)==null||ie.call(_,W),W.defaultPrevented||b==null||b(W)},[_,H,b,X.listHandlers,re]),{isScrolling:pe,scrollIntoView:Ne}=fs({containerRef:V,contentRef:o,highlightedIdx:F,indexPositions:t.data,stickyHeaders:L}),se=pe.current||he.current,U=Nt(W=>{if(!se&&!a&&!ue){B();let J=rs(W.target);if(J!==-1&&J!==F){let ee=t.data[J];!ee||ee.disabled?G(-1):G(J)}}},[ue,se,a,G,B,F,t.data]),Q=()=>{var W;return F===void 0||F===-1||l||(W=t.data[F])==null?void 0:W.id};P.current=X.selected;let Z={"aria-activedescendant":Q(),onBlur:z.onBlur,onFocus:z.onFocus,onKeyDown:ae,onMouseDown:oe,onMouseDownCapture:z.onMouseDownCapture,onMouseLeave:z.onMouseLeave},q=f||{onClick:X.listHandlers.onClick,onMouseMove:U};return{focusVisible:$.focusVisible,controlledHighlighting:$.controlledHighlighting,highlightedIndex:F,keyboardNavigation:$.keyboardNavigation,listHandlers:q,listItemHeaderHandlers:_,listControlProps:Z,scrollIntoView:Ne,selected:X.selected,setHighlightedIndex:G,setIgnoreFocus:$.setIgnoreFocus,setSelected:X.setSelected,...ge}};import{useCallback as Gs,useMemo as lc,useRef as uc,useState as Ws}from"react";var cc=(r,e,t=0)=>r===0?0:t===0?r*e:r-1*(e+t)+e,vr=({displayedItemCount:r,getItemHeight:e,height:t,itemCount:n,itemGapSize:o,itemHeight:s=36,size:i})=>{let[a,l]=Ws(s),[,u]=Ws({}),d=uc(null),[p,c]=lc(()=>{let h=0,g=a!=null?a:s,y=cc(n,g,o);if(t!==void 0)return[y,void 0];let E=Math.min(r,n)||r;return typeof e=="function"?h+=Array(E).fill(0).reduce((b,v,S)=>b+e(S)+o,0)-o:h+=E*Number(g)+(E-1)*o,[y,h]},[r,e,t,n,o,s,a]),m=Gs(({height:h})=>{typeof h=="number"&&l(h)},[]),f=Gs(h=>{d.current=h,u({})},[]);return ze(d,Oo,m,!0),{computedListHeight:c,contentHeight:p,listClientHeight:i==null?void 0:i.height,listItemHeight:a,rowHeightProxyRef:f}};import{useIsomorphicLayoutEffect as dc}from"@salt-ds/core";import{useCallback as pc,useMemo as fc,useRef as bn,useState as mc}from"react";var Qs=(r,e,t,n)=>{let o=Math.ceil(e/n),s=Math.floor(r/n),i=Math.ceil(s+o-1);return{atStart:s===0,atEnd:i===t-1,from:s,to:i}},Ir=({containerSize:r,itemCount:e,itemGapSize:t=0,itemSize:n,onViewportScroll:o})=>{let s=bn(0),i=bn(0),a=bn(0),l=fc(()=>Qs(a.current,r,e,n+t),[r,e,n,t]),[u,d]=mc(l);return dc(()=>{d(l)},[l]),{onVerticalScroll:pc(c=>{let m=c.target.scrollTop;if(m!==a.current){a.current=m;let f=n+t,h=Qs(m,r,e,f);(h.from!==s.current||h.to!==i.current)&&(s.current=h.from,i.current=h.to,o==null||o(h.from,h.to),d(h))}},[n,t,r,e,o]),viewportRange:u}};import{Fragment as wc,jsx as st,jsxs as js}from"react/jsx-runtime";import{createElement as Cc}from"react";var Tc="No data to display",Ze="vuuList",Ot=yc(function({ListItem:e=dr,ListPlaceholder:t,allowDragDrop:n,children:o,className:s,collapsibleHeaders:i=!1,defaultHighlightedIndex:a,defaultSelected:l,disabled:u=!1,disableFocus:d=!1,disableTypeToSelect:p,displayedItemCount:c=10,emptyMessage:m,focusVisible:f,getItemHeight:h,getItemId:g,height:y,highlightedIndex:E,id:I,itemGapSize:b=0,itemHeight:v,itemTextHighlightPattern:S,itemToString:T=Ie,listHandlers:A,maxHeight:w,maxWidth:D,minHeight:O,minWidth:x,onClick:L,onDragStart:N,onDrop:k,onMoveListItem:P,onSelect:R,onSelectionChange:M,onHighlight:V,restoreLastFocus:C,selected:F,selectionStrategy:H,checkable:B=H==="multiple",scrollingApiRef:z,selectionKeys:G,showEmptyMessage:$=!1,source:_,style:Y,stickyHeaders:X,tabIndex:ce=0,tabToSelect:te,...le},oe){var mo,ho;let ue=gc(I),he=yn(null),ge=yn(null),re=yn(null),[ae,pe]=Ic(),Ne=vc(Ae=>{pe(Ae)},[]),se=je({id:ue,label:"List",source:_,children:o,options:{collapsibleHeaders:i,getItemId:g,itemToString:T}}),{listClientHeight:U,computedListHeight:Q,listItemHeight:Z,rowHeightProxyRef:q}=vr({displayedItemCount:c,getItemHeight:h,height:y,itemCount:se.data.length,itemGapSize:b,itemHeight:v,rootRef:he,size:ae}),{onVerticalScroll:W,viewportRange:J}=Ir({containerSize:(ho=(mo=U!=null?U:Q)!=null?mo:ae==null?void 0:ae.height)!=null?ho:0,itemCount:se.data.length,itemGapSize:b,itemSize:Z}),{draggable:ee,draggedItemIndex:ie,dropIndicator:fe,focusVisible:K,highlightedIndex:j,listControlProps:xe,listHandlers:ke,listItemHeaderHandlers:Re,scrollIntoView:Oe,selected:Qr}=Xe({allowDragDrop:n,collapsibleHeaders:i,collectionHook:se,containerRef:he,contentRef:re,defaultHighlightedIndex:a,defaultSelected:se.itemToCollectionItemId(l),disabled:u,disableTypeToSelect:p,highlightedIndex:E,id:ue,label:"List",listHandlers:A,onClick:L,onDragStart:N,onDrop:k,onMoveListItem:P,onSelect:R,onSelectionChange:M,onHighlight:V,restoreLastFocus:C,scrollContainerRef:ge,selected:se.itemToCollectionItemId(F),selectionStrategy:H,selectionKeys:G,stickyHeaders:X,tabToSelect:te,viewportRange:J});sr({collectionHook:se,forwardedRef:z,scrollableRef:he,scrollIntoView:Oe});let wt=f!=null?f:K,zt=function(de,De,Me,ye){let et=Cc(e,{...Re,className:xn(`${Ze}Header`,{focusVisible:i&&wt===de.value}),"aria-expanded":ye,"data-index":i?de.value:void 0,"data-highlighted":de.value===j||void 0,"data-sticky":X,"data-selectable":!1,id:De,itemHeight:co(de.value),key:`header-${de.value}`,label:Me});return de.value+=1,et},co=h===void 0?()=>v:h;function Aa(Ae,de,De){var Wt,go;let{disabled:Me,value:ye,id:et,label:Ut}=de,Gt=Sc(ye),Et={className:xn((Wt=ye==null?void 0:ye.props)==null?void 0:Wt.className,{vuuHighlighted:De.value===j,vuuFocusVisible:wt===De.value,["vuuDraggable-dragAway"]:ie===De.value}),disabled:Me||u,id:et,item:Gt?void 0:(go=de==null?void 0:de.value)!=null?go:void 0,itemHeight:co(De.value),itemTextHighlightPattern:S,key:et,"data-index":De.value,label:Ut,role:"option",selected:qt(Qr,de),showCheckbox:B};Ae.push(Gt?xc(ye,Et):st(e,{...Et})),De.value+=1}let Fa=function(de,De,Me){let{count:ye=0,id:et,expanded:Ut,label:Gt=""}=De[Me.value],Et=zt(Me,et,Gt,Ut),Wt=Ut!==!1?[Et].concat(po(De,Me,Me.value+ye)||[]):Et;de.push(st("div",{role:"group",children:Wt},et))},po=(Ae,de={value:0},De=Ae.length)=>{let Me=[];for(;de.value<De;){let ye=Ae[de.value];ye.header?Me.push(zt(de,ye.id,ye.label,ye.expanded===!1)):ye.childNodes?Fa(Me,Ae,de):Aa(Me,ye,de)}return Me};function Va(){return m||$?st("span",{className:`${Ze}-empty-message`,children:m!=null?m:Tc}):null}let fo=se.data.length===0,Ba=()=>{if(fo)Va();else{let Ae=se.data;return po(Ae)}},$a="auto",_a={"--list-borderWidth":"var(--vuuList-borderWidth, var(--salt-size-border, 0))","--list-item-gap":b?`${b}px`:void 0,"--computed-list-height":Q===void 0?void 0:`${Q}px`,minWidth:x,minHeight:O,maxWidth:D,maxHeight:w};return js(hc,{"aria-multiselectable":H==="multiple"||H==="extended"||H==="extended-multi-range"||void 0,...le,...ke,...xe,className:xn(Ze,s,{[`${Ze}-collapsible`]:i,[`${Ze}-contentSized`]:Q!==void 0,[`${Ze}-empty`]:fo,vuuFocusVisible:j===un}),height:Q!=null?Q:y,id:`${ue}`,onResize:Ne,ref:bc(he,oe),role:"listbox",onScroll:W,style:{...Y,..._a},tabIndex:u||d?void 0:ce,children:[st(cr,{ref:q,height:v}),se.data.length===0&&t!==void 0?st(wc,{children:st(t,{})}):st("div",{className:`${Ze}-viewport`,ref:ge,children:js("div",{className:`${Ze}-scrollingContentContainer`,ref:re,style:{height:$a},children:[Ba(),fe,ee]})})]})});import{makePrefixer as Mc,useForkRef as Pc,useIdMemo as Lc}from"@salt-ds/core";function Xs(r){var e,t,n="";if(typeof r=="string"||typeof r=="number")n+=r;else if(typeof r=="object")if(Array.isArray(r))for(e=0;e<r.length;e++)r[e]&&(t=Xs(r[e]))&&(n&&(n+=" "),n+=t);else for(e in r)r[e]&&(n&&(n+=" "),n+=e);return n}function Sn(){for(var r,e,t=0,n="";t<arguments.length;)(r=arguments[t++])&&(e=Xs(r))&&(n&&(n+=" "),n+=e);return n}import{forwardRef as kc,memo as Rc,useRef as Js}from"react";import{useMemo as Ec}from"react";var Tr=class{constructor(e=0,t=0){this.keys=new Map,this.free=[],this.nextKeyValue=0,this.reset(e,t)}next(){return this.free.length?this.free.pop():this.nextKeyValue++}reset(e,t){this.keys.forEach((o,s)=>{(s<e||s>=t)&&(this.free.push(o),this.keys.delete(s))});let n=t-e;this.keys.size+this.free.length>n&&(this.free.length=n-this.keys.size);for(let o=e;o<t;o++)if(!this.keys.has(o)){let s=this.next();this.keys.set(o,s)}}keyFor(e){return this.keys.get(e)}};var Dc=([r],[e])=>r-e,Zs=5,qs=({data:r,listItemGapSize:e=0,listItemHeight:t,viewportRange:n})=>{let o=Ec(()=>new Tr(0,1),[]),s=t+e,i=Math.max(0,n.from-Zs),a=Math.min(r.length,n.to+Zs);return o.reset(i,a),r.slice(i,a).map((u,d)=>[o.keyFor(d+i),(d+i)*s,d+i+1,u]).sort(Dc)};import{jsx as wr,jsxs as Oc}from"react/jsx-runtime";var Hc="No data to display",Cr=Mc("saltList"),Nc=Rc(dr),zy=kc(function({borderless:e,children:t,className:n,collapsibleHeaders:o=!1,defaultHighlightedIndex:s,defaultSelected:i,disabled:a=!1,disableFocus:l=!1,disableTypeToSelect:u,displayedItemCount:d=10,emptyMessage:p,getItemHeight:c,getItemId:m,height:f,highlightedIndex:h,id:g,itemGapSize:y=0,itemHeight:E,itemTextHighlightPattern:I,itemToString:b,maxHeight:v,maxWidth:S,minHeight:T,minWidth:A,onDragStart:w,onDrop:D,onSelect:O,onSelectionChange:x,onViewportScroll:L,onHighlight:N,restoreLastFocus:k,selected:P,selectionStrategy:R,scrollingApiRef:M,selectionKeys:V,showEmptyMessage:C=!1,source:F,style:H,stickyHeaders:B,tabToSelect:z,width:G,...$},_){let Y=Lc(g),X=Js(null),ce=Js(null),te=je({id:Y,label:"List",source:F,children:t,options:{collapsibleHeaders:o,getItemId:m,itemToString:b}}),{contentHeight:le,listItemHeight:oe,listHeight:ue}=vr({borderless:e,displayedItemCount:d,height:f,itemCount:te.data.length,itemGapSize:y,itemHeight:E,rootRef:X,rowHeightRef:ce}),{focusVisible:he,highlightedIndex:ge,listControlProps:re,listHandlers:ae,scrollIntoView:pe,selected:Ne}=Xe({collapsibleHeaders:o,collectionHook:te,containerRef:X,defaultHighlightedIndex:s,defaultSelected:te.itemToCollectionItemId(i),disabled:a,disableTypeToSelect:u,highlightedIndex:h,label:Y,onSelect:O,onSelectionChange:x,onHighlight:N,restoreLastFocus:k,selected:te.itemToCollectionItemId(P),selectionStrategy:R,selectionKeys:V,stickyHeaders:B,tabToSelect:z}),{onVerticalScroll:se,viewportRange:U}=Ir({containerSize:typeof ue=="number"?ue:0,itemCount:te.data.length,itemGapSize:y,itemSize:oe});console.log({viewPortRange:U});let Q=qs({data:te.data,listItemGapSize:y,listItemHeight:oe,viewportRange:U});sr({collectionHook:te,forwardedRef:M,scrollableRef:X,scrollIntoView:pe});function Z(ie,fe,K){let[j,xe,ke,Re]=fe,Oe=ke-1;ie.push(wr(Nc,{"aria-setsize":te.data.length,"aria-posinset":ke,className:Sn(n,{saltHighlighted:Oe===ge,saltFocusVisible:he===Oe}),"data-idx":Oe,item:Re,label:Re.label,"data-offset":xe,role:"option",selected:qt(Ne,Re),id:Re.id,translate3d:xe},j)),K.value+=1}function q(ie,fe={value:0},K=ie.length){let j=[];for(;fe.value<K;){let xe=ie[fe.value];Z(j,xe,fe)}return j}function W(){return p||C?wr("span",{className:Cr("empty-message"),children:p!=null?p:Hc}):null}let J=()=>{if(Q.length)return q(Q);W()},ee={"--list-item-gap":y?`${y}px`:void 0,minWidth:A,minHeight:T,width:G!=null?G:"100%",height:f!=null?f:"100%",maxWidth:S!=null?S:G,maxHeight:v!=null?v:ue};return wr("div",{...$,...ae,...re,className:Sn(Cr(),n,Cr("virtualized")),id:`${Y}`,ref:Pc(X,_),role:"listbox",onScroll:se,style:{...H,...ee},tabIndex:a||l?void 0:0,children:Oc("div",{className:Cr("scrollingContentContainer"),style:{height:le},children:[wr(cr,{ref:ce}),J()]})})});import Ac from"classnames";import{jsx as Fc}from"react/jsx-runtime";var Ys="vuuRadioIcon",ei=({checked:r=!1,...e})=>Fc("span",{...e,className:Ac(Ys,{[`${Ys}-checked`]:r})});import{useControlled as Vc}from"@salt-ds/core";import{useCallback as vn,useMemo as Bc}from"react";var ti=({collectionHook:r,defaultHighlightedIndex:e,defaultIsOpen:t,defaultSelected:n,highlightedIndex:o,isOpen:s,itemToString:i=Ie,listRef:a,onHighlight:l,onOpenChange:u,onSelectionChange:d,onSelect:p,selected:c,selectionStrategy:m})=>{let f=ut(m),[h,g]=Vc({controlled:s,default:t!=null?t:!1,name:"useDropdownList"}),y=vn((S,T)=>{f||(g(!1),u==null||u(!1)),(Array.isArray(T)||T)&&(d==null||d(S,T))},[f,u,d,g]),E=vn((S,T)=>{f||(g(!1),u==null||u(!1)),p==null||p(S,T)},[f,u,p,g]),I=Xe({collectionHook:r,defaultHighlightedIndex:(e!=null?e:o===void 0)?0:void 0,defaultSelected:n,label:"DropDown",onSelectionChange:y,onSelect:E,containerRef:a,highlightedIndex:o,onHighlight:l,selected:c,selectionStrategy:m,tabToSelect:!f}),b=vn(S=>{g(S),u==null||u(S)},[u,g]),v=Bc(()=>{if(Array.isArray(I.selected)){let S=I.selected.map(T=>r.itemById(T));if(S.length===0)return;if(S.length===1){let[T]=S;return T===null?void 0:i(T)}else return`${S.length} items selected`}},[r,i,I.selected]);return{isOpen:h,onOpenChange:b,triggerLabel:v,...I}};import{jsx as In,jsxs as Gc}from"react/jsx-runtime";var FS=Kc(function({"aria-label":e,children:t,defaultIsOpen:n,defaultSelected:o,id:s,isOpen:i,itemToString:a=Ie,onOpenChange:l,onSelectionChange:u,onSelect:d,selected:p,selectionStrategy:c,source:m,triggerComponent:f,ListItem:h,ListProps:g,width:y=180,...E},I){let b=Uc(s),v=ri(null),S=ri(null),T=$c(v,I),A=je({id:b,source:m,children:t,options:{itemToString:a}}),{highlightedIndex:w,triggerLabel:D,listHandlers:O,listControlProps:x,selected:L,...N}=ti({collectionHook:A,defaultHighlightedIndex:g==null?void 0:g.defaultHighlightedIndex,defaultIsOpen:n,defaultSelected:A.itemToCollectionItemId(o),highlightedIndex:g==null?void 0:g.highlightedIndex,isOpen:i,itemToString:a,listRef:S,onHighlight:g==null?void 0:g.onHighlight,onOpenChange:l,onSelectionChange:u,onSelect:d,selected:A.itemToCollectionItemId(p),selectionStrategy:c}),k=zc(R=>Array.isArray(R)?R.map(V=>A.itemById(V)):A.itemById(R),[A]),P=()=>{let R={"aria-activedescendant":N.isOpen?x==null?void 0:x["aria-activedescendant"]:void 0,"aria-label":e};if(f){let M=f.props;return _c(f,Zt(M,{...N.isOpen?x:{},...R}))}else return In(Qo,{label:D,...N.isOpen?x:{},...R})};return In(Qt,{collectionHook:A,children:Gc(ct,{...E,id:b,isOpen:N.isOpen,onOpenChange:N.onOpenChange,placement:(g==null?void 0:g.width)===void 0?"below-full-width":"below",ref:T,width:y,children:[P(),In(Ot,{ListItem:h,itemToString:a,...g,highlightedIndex:w,listHandlers:O,onSelectionChange:u,onSelect:d,ref:S,selected:L===void 0?void 0:k(L),selectionStrategy:c})]})})});import{useControlled as ni}from"@salt-ds/core";import{useLayoutEffectSkipFirst as Wc}from"@vuu-ui/vuu-layout";import{useCallback as ve,useRef as Tn,useState as Qc}from"react";var jc=["Enter"],oi=({allowBackspaceClearsSelection:r,allowFreeText:e,ariaLabel:t,collectionHook:n,defaultIsOpen:o,defaultSelected:s,defaultValue:i,onBlur:a,onFocus:l,onChange:u,onDeselect:d,onSelect:p,id:c,initialHighlightedIndex:m=-1,isOpen:f,itemCount:h,itemsToString:g,itemToString:y=Ie,listRef:E,onOpenChange:I,onSelectionChange:b,onSetSelectedText:v,selected:S,selectionKeys:T=jc,selectionStrategy:A,value:w,InputProps:D={onBlur:a,onFocus:l,onChange:u,onSelect:p}})=>{let O=ut(A),{data:x,setFilterPattern:L}=n,N=Tn(null),k=Tn(O?[]:null),P=Tn(!0),[R,M]=ni({controlled:f,default:o!=null?o:!1,name:"useDropdownList"}),[V,C]=ni({controlled:void 0,default:i!=null?i:w,name:"ComboBox",state:"value"}),[F,H]=Qc(!0),B=ve(K=>{var j;Array.isArray(K)||K==null&&((j=N.current)==null||j.call(N,-1))},[]),z=ve((K,j=!0)=>{C(K),j&&L(K===""?void 0:K)},[L,C]),G=ve(K=>{let j=e&&V!=null?V:"";return Array.isArray(K)?K.length===1?j=y(K[0]):K.length>1&&(j=(g==null?void 0:g(K))||""):K&&(j=y(K)),j!==V?(z(j,!O),v==null||v(j),!0):!1},[e,O,y,g,v,z,V]),$=ve(()=>{let{current:K}=k;G(K)&&K&&(Array.isArray(K)||K)&&(b==null||b(null,K))},[b,G]),_=ve(()=>{if(e){let K=V==null?void 0:V.trim(),{current:j}=k;if(K){if(h===0&&K)return O?b==null||b(null,[K]):b==null||b(null,K),k.current=null,!0;j&&!O&&j&&!Array.isArray(j)&&y(j)}}return!1},[e,V,h,O,b,y]),Y=ve((K,j)=>{K&&O&&z("",!1),M(K),I==null||I(K,j),!K&&j!=="Escape"&&(_()||$())},[$,O,I,_,M,z]),X=ve((K,j)=>{k.current=j,O||Y(!1,"select")},[Y,O]),ce=ve(()=>{H(!1)},[]),{focusVisible:te,setHighlightedIndex:le,highlightedIndex:oe,listControlProps:ue,listHandlers:he,selected:ge}=Xe({collectionHook:n,containerRef:E,defaultHighlightedIndex:m,defaultSelected:n.itemToCollectionItemId(s),disableAriaActiveDescendant:F,disableHighlightOnFocus:!0,disableTypeToSelect:!0,label:"combobox",onKeyboardNavigation:ce,onSelectionChange:X,selected:n.itemToCollectionItemId(S),selectionKeys:T,selectionStrategy:A,tabToSelect:!O});N.current=le;let{onClick:re}=he,ae=ve(K=>{var j;(j=document.getElementById(`${c}-input`))==null||j.focus(),re==null||re(K)},[c,re]),pe=ve(K=>{let j=K.target.value;C(j),j&&j.trim().length?L(j):L(void 0),M(!0)},[L,M,C]),Ne=ve(K=>{K.key==="Backspace"&&r&&(k.current=null,d==null||d())},[r,d]),{onFocus:se=l}=D,{onFocus:U}=ue,Q=ve(K=>{H(!1),U==null||U(K),se==null||se(K)},[se,U]),Z=ve(K=>{let j=K.relatedTarget;return(j==null?void 0:j.id)===`${c}-list`},[c]),{onBlur:q=a}=D,{onBlur:W}=ue,J=ve(K=>{Z(K)||(W==null||W(K),q==null||q(K),H(!0),P.current=!0)},[Z,W,q]),{onSelect:ee}=D,ie=ve(K=>{P.current?P.current=!1:H(!0),ee==null||ee(K)},[ee]);Wc(()=>{Ue(ge)?B(ge):le(m)},[B,h,m,ge,le,M]);let fe={...D.inputProps,"aria-label":t,autoComplete:"off",onKeyDown:Ne};return{focusVisible:te,highlightedIndex:oe,isOpen:R,onOpenChange:Y,inputProps:{...D,id:`${c}-input`,inputProps:fe,onChange:pe,onSelect:ie,role:"combobox",value:V},listControlProps:{...ue,onBlur:J,onFocus:Q},listHandlers:{...he,onClick:ae},selected:k.current}};import Xc from"classnames";import{jsx as qc}from"react/jsx-runtime";var Zc="vuuChevronIcon",si=r=>{let{direction:e,...t}=r;return qc("span",{...t,className:Xc(Zc,e)})};import{jsx as Er,jsxs as od}from"react/jsx-runtime";var nd=ed(function({InputProps:e,ListProps:t,PopupProps:n,ListItem:o,"aria-label":s,allowBackspaceClearsSelection:i,allowFreeText:a,children:l,defaultIsOpen:u,defaultSelected:d,defaultValue:p,disabled:c,disableFilter:m,onBlur:f,onFocus:h,onChange:g,onSelect:y,onSetSelectedText:E,getFilterRegex:I,id:b,initialHighlightedIndex:v=-1,isOpen:S,itemToString:T=Ie,itemsToString:A,onDeselect:w,onOpenChange:D,onSelectionChange:O,selected:x,selectionKeys:L,selectionStrategy:N,source:k,value:P,width:R=180,...M},V){let C=Jc(b),F=rd(null),H=re=>Array.isArray(re)&&re.length>0?re[0]:void 0,z=((re,ae)=>{let pe=re?H(re):ae?H(ae):void 0;return pe?T(pe):""})(x,d),G=je({id:C,source:k,children:l,options:{disableFilter:m,filterPattern:z,getFilterRegex:I,itemToString:T}}),{focusVisible:$,highlightedIndex:_,inputProps:{endAdornment:Y,...X},isOpen:ce,listHandlers:te,listControlProps:le,onOpenChange:oe,selected:ue}=oi({InputProps:e,allowBackspaceClearsSelection:i,allowFreeText:a,ariaLabel:s,collectionHook:G,defaultIsOpen:u,defaultSelected:d,defaultValue:p,disabled:c,initialHighlightedIndex:v,itemCount:G.data.length,label:M.title,listRef:F,onBlur:f,onDeselect:w,onFocus:h,onChange:g,onSelect:y,id:C,isOpen:S,itemToString:T,itemsToString:A,onOpenChange:D,onSelectionChange:O,onSetSelectedText:E,selected:x,selectionKeys:L,selectionStrategy:N,value:z}),he=td(()=>{ce?oe(!1,"toggle"):oe(!0)},[ce,oe]);return Er(Qt,{collectionHook:G,children:od(ct,{...M,PopupProps:n,id:C,isOpen:ce,onOpenChange:oe,openOnFocus:!0,ref:V,width:R,children:[Er(Yc,{...X,disabled:c,...le,endAdornment:Y===null?null:Er(si,{direction:ce?"up":"down",onClick:he})}),Er(Ot,{...t,ListItem:o,defaultSelected:void 0,focusVisible:$,highlightedIndex:_,itemTextHighlightPattern:String(X.value)||void 0,listHandlers:te,onSelectionChange:O,ref:F,selected:ue,selectionStrategy:N,tabIndex:-1})]})})});import{Button as sd}from"@salt-ds/core";import id from"classnames";import{forwardRef as ad,useCallback as ld}from"react";import{jsx as cd}from"react/jsx-runtime";var ii="vuuCycleStateButton",ud=(r,e)=>{let t=e.indexOf(r.toUpperCase());return t===e.length-1?e[0]:e[t+1]},Uv=ad(function({className:e,onCommit:t,value:n="",values:o,...s},i){let a=ld(l=>{let u=ud(n,o);t(l,u).then(d=>{d!==!0&&console.error(d)})},[t,n,o]);return cd(sd,{...s,className:id(ii,e,`${ii}-${n.toLowerCase()}`),onClick:a,ref:i,children:n})});import{getEditRuleValidator as dd}from"@vuu-ui/vuu-utils";var Zv=r=>e=>pd(r,e);function pd(r,e){let t;for(let n of r){let o=dd(n.name);if(o){let s=o(n,e);switch(s){case!0:break;case!1:t===void 0&&(t=!1);break;default:t===void 0||t===!1?t=s:t+=`::${s}`}}else throw Error(`editable-utils applyRules, no validator registered for rule '${n.name}'`)}return t}import{useLayoutEffectSkipFirst as fd}from"@vuu-ui/vuu-layout";import{dispatchCustomEvent as ai}from"@vuu-ui/vuu-utils";import{useCallback as Dr,useRef as Cn,useState as li}from"react";var oI=()=>(console.warn("onCommit handler has not been provided to InputCell cell renderer"),Promise.resolve(!0)),sI=({clientSideEditValidationCheck:r,initialValue:e,onCommit:t,type:n})=>{let[o,s]=li(),[i,a]=li(e),l=Cn(e),u=Cn(!1),d=Cn(!1);fd(()=>{a(e)},[e]);let p=Dr(h=>{if(u.current){d.current=!0;let g=r==null?void 0:r(i);g?s(g):(s(void 0),console.log(`commit value ${i}`),t(i).then(y=>{y===!0?(u.current=!1,ai(h,"vuu-commit")):s(y)}))}else ai(h,"vuu-commit"),d.current=!1},[r,t,i]),c=Dr(h=>{h.key==="Enter"?p(h.target):h.key==="ArrowRight"||h.key==="ArrowLeft"||h.key==="ArrowUp"||h.key==="ArrowDown"?h.stopPropagation():h.key==="Escape"&&u.current&&(u.current=!1,s(void 0),a(l.current))},[p]),m=Dr(h=>{u.current&&p(h.target)},[p]),f=Dr(h=>{let g=h.target.value;if(n==="number"&&!isNaN(parseFloat(g))&&(g=parseFloat(g)),u.current=i!==l.current,a(g),d.current&&i!==void 0){let y=r==null?void 0:r(i);y!==o&&y!==!1&&s(y)}},[r,o,n,i]);return{inputProps:{onBlur:m,onKeyDown:c},onChange:f,value:i!=null?i:"",warningMessage:o}};import md from"classnames";import{useCallback as ui,useLayoutEffect as hd,forwardRef as gd,useRef as wn}from"react";import{Input as bd,useControlled as ci}from"@salt-ds/core";import{jsx as En}from"react/jsx-runtime";var Mr="vuuEditableLabel",di=gd(function({className:e,defaultEditing:t,defaultValue:n,editing:o,onChange:s,onEnterEditMode:i,onExitEditMode:a,value:l,...u},d){let p=wn(null),c=wn(!1),[m,f]=ci({controlled:l,default:n!=null?n:"",name:"EditableLabel",state:"value"}),[h,g]=ci({controlled:o,default:t!=null?t:!1,name:"EditableLabel",state:"editing"}),y=ui(D=>{g(c.current=D)},[g]),E=wn(m);hd(()=>{h&&p.current!==null&&(p.current.select(),p.current.focus())},[h,p]);let I=ui(()=>{y(!0),i&&i()},[i,y]),b=({cancelEdit:D=!1,allowDeactivation:O=!1}={})=>{y(!1);let x=E.current;x!==m&&(D?f(x):E.current=m),a&&a(x,m,O,D)},v=D=>{let{value:O}=D.target;f(O),s&&s(O)},S=()=>{I()},T=()=>{c.current&&b({allowDeactivation:!0})},A=D=>{h&&D.key==="Enter"?(D.stopPropagation(),b()):D.key==="ArrowRight"||D.key==="ArrowLeft"?D.stopPropagation():D.key==="Escape"&&b({cancelEdit:!0})},w=md(Mr,e,{[`${Mr}-editing`]:h});return En("div",{...u,className:w,onDoubleClick:S,"data-text":m,ref:d,children:h?En(bd,{inputProps:{className:`${Mr}-input`,spellCheck:!1},value:m,onBlur:T,onChange:v,onKeyDown:A,inputRef:p,style:{padding:0},textAlign:"left",variant:"secondary"}):En("span",{className:`${Mr}-label`,children:m})})});import xd from"classnames";import{forwardRef as yd}from"react";import{jsx as pi}from"react/jsx-runtime";var Dn="vuuExpandoInput",Sd=()=>{},HI=yd(function({className:e,errorMessage:t,value:n,inputProps:o,onCommit:s=Sd,...i},a){return pi("div",{className:xd(Dn,e,{[`${Dn}-error`]:t}),"data-text":n,children:pi(Mn,{...i,errorMessage:t,inputProps:{...o,className:`${Dn}-input`},onCommit:s,ref:a,style:{padding:0},textAlign:"left",value:n,variant:"secondary"})})});import{jsx as Id,jsxs as Td}from"react/jsx-runtime";var vd=r=>{let{onToggle:e,checked:t,label:n}=r;return Td("div",{className:"vuuCheckbox",onClick:e,onKeyUp:o=>o.key===" "&&e(),children:[Id(lr,{tabIndex:0,checked:t}),n]})};import{jsx as fi,jsxs as mi}from"react/jsx-runtime";var Cd=r=>{let{onClick:e,checked:t,label:n,groupName:o}=r;return mi("div",{className:"vuuRadioButton",onClick:e,children:[mi("div",{className:"radio",children:[fi("input",{type:"radio",name:o}),fi(ei,{checked:t})]}),n]})};import{useId as Nd}from"@vuu-ui/vuu-layout";import{Table as Od}from"@vuu-ui/vuu-table";import{Input as Ad}from"@salt-ds/core";import{forwardRef as Fd,useMemo as Vd}from"react";import{registerComponent as wd}from"@vuu-ui/vuu-utils";import{jsx as Md,jsxs as Pd}from"react/jsx-runtime";var Ed="vuuSearchCell",Dd=({column:r,columnMap:e,row:t})=>{let n=e[r.name],o=t[n];return Pd("div",{className:Ed,tabIndex:-1,children:[Md("span",{"data-icon":"draggable"}),o]})};wd("search-cell",Dd,"cell-renderer",{serverDataType:"private"});import{useControlledTableNavigation as Ld}from"@vuu-ui/vuu-table";import{useCallback as Pn,useMemo as kd,useState as Rd}from"react";var Hd=(r,e)=>t=>r.map(({name:n})=>t[e[n]]).join(" "),hi=({columnMap:r,columns:e,dataSource:t,defaultIsOpen:n,isOpen:o,itemToString:s=Hd(e,r),onOpenChange:i,onSelect:a,searchColumns:l})=>{let[u,d]=Rd(""),[p,c]=Jt({controlled:o,default:n!=null?n:!1,name:"useDropdownList"}),{highlightedIndexRef:m,onKeyDown:f,tableRef:h}=Ld(-1,t.size),g=kd(()=>l.map(S=>`${S} starts "__VALUE__"`).join(" or "),[l]),y=Pn((S,T)=>{c(S),i==null||i(S,T)},[i,c]),E=Pn(S=>{let{value:T}=S.target;if(d(T),T&&T.trim().length){let A=g.replaceAll("__VALUE__",T);t.filter={filter:A}}else t.filter={filter:""};c(!0)},[g,t,c]),I=Pn(S=>{let T=s(S);d(T),a(S),y==null||y(!1,"select")},[y,s,a]),b={inputProps:{autoComplete:"off",onKeyDown:f},onChange:E},v={onSelect:I};return{highlightedIndex:m.current,inputProps:b,isOpen:p,onOpenChange:y,tableHandlers:v,tableRef:h,value:u}};import{jsx as Ln,jsxs as $d}from"react/jsx-runtime";var Bd="vuuInstrumentPicker",E0=Fd(function({TableProps:{dataSource:e,...t},className:n,columnMap:o,disabled:s,id:i,itemToString:a,onOpenChange:l,onSelect:u,schema:d,searchColumns:p,width:c,...m},f){let h=Nd(i),{highlightedIndex:g,inputProps:y,isOpen:E,onOpenChange:I,tableHandlers:b,tableRef:v,value:S}=hi({columnMap:o,columns:t.config.columns,dataSource:e,itemToString:a,onOpenChange:l,onSelect:u,searchColumns:p}),T=Vd(()=>Ln("span",{"data-icon":"chevron-down"}),[]),A={...t,config:{...t.config,zebraStripes:!1}};return $d(ct,{...m,fullWidth:!0,id:h,isOpen:E,onOpenChange:I,openOnFocus:!0,placement:"below-full-width",ref:f,width:c,children:[Ln(Ad,{...y,disabled:s,endAdornment:T,value:S}),Ln(Od,{rowHeight:25,renderBufferSize:100,...A,...b,className:`${Bd}-list`,height:200,highlightedIndex:g,dataSource:e,navigationStyle:"row",ref:v,showColumnHeaders:!1})]})});import{registerComponent as Vp}from"@vuu-ui/vuu-layout";import{Table as Bp,useControlledTableNavigation as $p}from"@vuu-ui/vuu-table";import{Input as _p}from"@salt-ds/core";import Kp from"classnames";import{useCallback as zp}from"react";import{registerComponent as _d}from"@vuu-ui/vuu-utils";import{jsx as Ud,jsxs as Gd}from"react/jsx-runtime";var Kd="vuuSearchCell",zd=({column:r,columnMap:e,row:t})=>{let n=e[r.name],o=t[n];return Gd("div",{className:Kd,tabIndex:-1,children:[Ud("span",{"data-icon":"draggable"}),o]})};_d("search-cell",zd,"cell-renderer",{serverDataType:"private"});import{RemoteDataSource as Op}from"@vuu-ui/vuu-data";import{getFullRange as $0,metadataKeys as Wd,WindowRange as _0}from"@vuu-ui/vuu-utils";import{useCallback as z0,useEffect as U0,useMemo as G0,useRef as W0,useState as Q0}from"react";var{SELECTED:j0}=Wd;import{RemoteDataSource as x4}from"@vuu-ui/vuu-data";import{useCallback as AT}from"react";import VT from"classnames";import{Toolbar as $T}from"@vuu-ui/vuu-layout";import{useCallback as lT,useEffect as uT,useRef as cT,useState as dT}from"react";import{Button as fT,FormField as mT,FormFieldLabel as hT}from"@salt-ds/core";import{useMemo as q0}from"react";import{jsx as Y0,jsxs as eT}from"react/jsx-runtime";import yT from"classnames";import{jsx as IT,jsxs as TT}from"react/jsx-runtime";import{getCookieValue as ET}from"@vuu-ui/vuu-utils";import{Button as UT}from"@salt-ds/core";import{jsx as WT,jsxs as QT}from"react/jsx-runtime";import eC,{useEffect as tC,useState as rC}from"react";import oC from"classnames";import{Fragment as lC,jsx as uC,jsxs as aC}from"react/jsx-runtime";import{useCallback as hC}from"react";import bC from"classnames";import{jsx as yC}from"react/jsx-runtime";import yi,{Suspense as qd,useEffect as Jd}from"react";import{registerComponent as Yd}from"@vuu-ui/vuu-layout";import Qd from"react";import{Fragment as jd,jsx as gi,jsxs as Xd}from"react/jsx-runtime";var Pr=class extends Qd.Component{constructor(e){super(e),this.state={errorMessage:null}}static getDerivedStateFromError(e){return{errorMessage:e.message}}componentDidCatch(e,t){console.log(`error creating component at ${this.props.url}`),console.log(e,t)}render(){return this.state.errorMessage?Xd(jd,{children:[gi("h1",{children:"An error occured while creating component."}),gi("p",{children:this.state.errorMessage})]}):this.props.children}};import{jsx as Zd}from"react/jsx-runtime";var bi=()=>Zd("div",{className:"hwLoader"});var xi=async r=>{let e=new CSSStyleSheet;return fetch(r).then(t=>t.text()).then(t=>e.replace(t))};import{jsx as kr}from"react/jsx-runtime";var Lr=new Map,ep=r=>{Jd(()=>()=>{Lr.delete(r)},[r]),Lr.has(r)||Lr.set(r,yi.lazy(()=>import(r)));let e=Lr.get(r);if(e)return e;throw Error(`Unable to load Lazy Feature at url ${r}`)};function tp({url:r,css:e,ComponentProps:t,...n}){e&&xi(e).then(s=>{document.adoptedStyleSheets=[...document.adoptedStyleSheets,s]});let o=ep(r);return kr(Pr,{url:r,children:kr(qd,{fallback:kr(bi,{}),children:kr(o,{...n,...t})})})}var kn=yi.memo(tp);kn.displayName="Feature";Yd("Feature",kn,"view");import{useEffect as GC,useState as WC}from"react";import{Input as jC,Button as XC,FormField as ZC,FormFieldLabel as qC,Text as JC}from"@salt-ds/core";import{takeScreenshot as tw}from"@vuu-ui/vuu-utils";import{jsx as sw,jsxs as iw}from"react/jsx-runtime";var rp="saveLayoutPanel",nw=`${rp}-formField`;import np,{useCallback as uw,useContext as cw,useEffect as dw,useRef as pw,useState as fw}from"react";import{loadingApplicationJson as bw,LocalLayoutPersistenceManager as Sw,resolveJSONPath as Iw,defaultApplicationJson as op}from"@vuu-ui/vuu-layout";import{NotificationLevel as ww,useNotifications as Ew}from"@vuu-ui/vuu-popups";import{jsx as Pw}from"react/jsx-runtime";var Dw=np.createContext({getApplicationSettings:()=>{},layoutMetadata:[],saveLayout:()=>{},applicationJson:op,saveApplicationLayout:()=>{},saveApplicationSettings:()=>{},loadLayoutById:()=>{}});import{Fragment as Vw,jsx as Fw,jsxs as Bw}from"react/jsx-runtime";import{memo as ip}from"react";import{jsx as He,jsxs as bt}from"react/jsx-runtime";var Si=ip(()=>bt("svg",{width:"44",height:"45",viewBox:"0 0 44 45",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[bt("g",{clipPath:"url(#clip0_217_6990)",children:[He("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)"}),He("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)"}),He("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"}),bt("g",{opacity:"0.86",children:[He("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"}),He("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"}),He("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"})]})]}),bt("defs",{children:[bt("linearGradient",{id:"paint0_linear_217_6990",x1:"24.6235",y1:"18.7363",x2:"42.3152",y2:"18.7363",gradientUnits:"userSpaceOnUse",children:[He("stop",{stopColor:"#4906A5"}),He("stop",{offset:"1",stopColor:"#D3423A"})]}),bt("linearGradient",{id:"paint1_linear_217_6990",x1:"-2.35794e-05",y1:"22.5009",x2:"42.7186",y2:"22.5009",gradientUnits:"userSpaceOnUse",children:[He("stop",{stopColor:"#7C06A5"}),He("stop",{offset:"1",stopColor:"#D3423A"})]}),He("clipPath",{id:"clip0_217_6990",children:He("rect",{width:"44",height:"45",fill:"white"})})]})]}));Si.displayName="VuuLogo";import{Stack as EE,useLayoutProviderDispatch as DE}from"@vuu-ui/vuu-layout";import LE from"classnames";import{useCallback as OE,useState as AE}from"react";import{Palette as eE,PaletteItem as tE}from"@vuu-ui/vuu-layout";import{jsx as iE,jsxs as aE}from"react/jsx-runtime";import{createContext as ap,isValidElement as lp,cloneElement as up,useContext as cp}from"react";import dp from"classnames";import{jsx as gp}from"react/jsx-runtime";var pp="medium",fp="salt-theme",mp="light",vi=ap({density:"high",theme:"vuu",themeMode:"light"});var hp=(r,e,t,n)=>{var o;return lp(r)?up(r,{className:dp((o=r.props)==null?void 0:o.className,`${e}-theme`,`${e}-density-${n}`),"data-mode":t}):(console.warn(`
|
|
2
|
+
`)),""):String(r)}import{useCallback as Te,useMemo as Yt,useRef as er,useState as ll,isValidElement as Ro}from"react";import{isValidElement as Xr,Children as Qa}from"react";var vo=r=>null;var Io=r=>null;var Zr=(r,e)=>r!==null&&Object.prototype.hasOwnProperty.call(r,e),qr=r=>Zr(r,"header"),To=r=>Zr(r,"childNodes"),Dt=(r,e)=>r&&Object.prototype.hasOwnProperty.call(r.props,e),Co=r=>{if(Xr(r)){if(Dt(r,"disabled"))return r.props.disabled===!0}else if(Zr(r,"disabled"))return r.disabled===!0;return!1},wo=r=>Xr(r)&&Dt(r,"focusable")?r.props.focusable:!0,Eo=(r,e,t)=>{if(r.childNodes)return r.childNodes.length;if(r.header){let n=t+1,o=0;for(;n<e.length&&!e[n].header;)o++,n++;return o}else return 0},ja=r=>{if(typeof r.props.children=="string")return r.props.children;if(r.props.title)return r.props.title;if(r.props.label)return r.props.label},Do=r=>r.type===Io||Dt(r,"data-header"),Mo=r=>r.type===vo||Dt(r,"data-group"),Xa=r=>Dt(r,"selectable")?r.props.selectable===!0:!Mo(r)&&!Do(r),Za=r=>{if(Mo(r)){let{props:{children:e}}=r;if(typeof e!="string")return Yr(e)}},qa=(r,e)=>{let t=[];return Qa.forEach(r,n=>{Xr(n)&&t.push(e(n))}),t},Jr=(r,e)=>{if(Array.isArray(r))return r.length===0&&(e!=null&&e.noChildrenLabel)?[{label:e.noChildrenLabel,value:null}]:r.map((t,n)=>{var o,s;return{childNodes:Jr(t.childNodes,e),description:t.description,expanded:t.expanded,value:t,label:(s=(o=e==null?void 0:e.itemToString)==null?void 0:o.call(e,t))!=null?s:Ie(t)}});if(r)throw Error("list-child-items expects source to be an array")},Yr=r=>{if(r)return qa(r,e=>{let{"data-id":t,disabled:n,id:o=t,"data-expanded":s,expanded:i=s}=e.props;return{childNodes:Za(e),disabled:n,expanded:i,header:Do(e),id:o,label:ja(e),selectable:Xa(e),value:e}})},Ja=new Set(["/","-","."]),Ya=r=>Ja.has(r),en=(r,e)=>e.startsWith(r)&&Ya(e[r.length]),el=new Set([".","/"]);function tl(r,e){return e.startsWith(r)?el.has(e.charAt(r.length)):!1}function jt(r,e,t){let n;return r.map(s=>s.id===e?{...s,...t}:tl(s.id,e)&&s.childNodes?(n=jt(s.childNodes,e,t),{...s,childNodes:n}):s)}var rl=/[.*+?^${}()|[\]\\]/g;function Xt(r){return r.replace(rl,"\\$&")}var Zt=(r,e)=>Object.keys(r).reduce((n,o)=>{let s=r[o],i=e[o];return typeof s=="function"&&typeof i=="function"&&(n[o]=(...a)=>{s(...a),i(...a)}),n},{...e});var nl=r=>r&&r.replace(/^\s+/g,""),tn=r=>new RegExp(`(${Xt(nl(r))})`,"gi"),Po=(r="",e=tn)=>(t="")=>!!t.length&&!!r.length&&t.match(e(r))!==null;function qt(r,e){return Array.isArray(r)?r.includes(e.id):r===e.id}import{isValidElement as ol,useCallback as sl,useEffect as Lo,useRef as ko,useState as il}from"react";function Jt({controlled:r,default:e,name:t,state:n="value"}){let{current:o}=ko(r!==void 0),[s,i]=il(e),a=r!==void 0?r:s,{current:l}=ko(e);Lo(()=>{},[n,t,r]),Lo(()=>{},[JSON.stringify(e,al)]);let u=sl(d=>{o||i(d)},[o]);return[a,u,o]}function al(r,e){return ol(e)?null:e}var ul={},je=({children:r,id:e,options:t=ul,source:n})=>{var M,V;let{getItemId:o}=t,[,s]=ll(null),i=So(),a=er([]),l=er([]),u=Yt(()=>[],[]),d=er((M=t.filterPattern)!=null?M:""),p=(V=t.disableFilter)!=null?V:!1,{getFilterRegex:c=tn,noChildrenLabel:m,itemToString:f=Ie}=t,h=Te(()=>t.defaultExpanded||!1,[t.defaultExpanded]),g=Te((C,F,H=1,B="",z=[],G=[],$=[])=>(C.forEach((_,Y,X)=>{var ae,pe;let ce=_.header&&t.collapsibleHeaders,te=_.childNodes&&t.collapsibleHeaders===!1,le=!_.childNodes||_.childNodes.length===0,oe=te||le&&!ce,ue=B?`${B}.${Y}`:`item-${Y}`,he=(ae=_.id)!=null?ae:o?o(Y):`${e}-${ue}`,ge=oe?void 0:(pe=_.expanded)!=null?pe:h(),re={..._,childNodes:void 0,count:!te&&ge===void 0?0:Eo(_,X,Y),description:_.description,disabled:Co(_.value),focusable:wo(_.value)?void 0:!1,id:he,index:F.value,expanded:ge,level:H};if(z.push(re),G.push(re),$.push(C[Y].value),F.value+=1,_.childNodes){let[Ne]=g(_.childNodes,F,H+1,ue,[],G,$);re.childNodes=Ne}}),[z,$,G]),[t.collapsibleHeaders,o,e,h]),y=Te(()=>d.current&&!p?Po(d.current,c):null,[p,c]),E=Te((C,F=y(),H=[],B={value:0})=>{let z=!1;for(let G of C)z&&!qr(G)||(G.value!==null&&(F===null||F(f(G.value)))&&(H[B.value]=G,B.value+=1),z=!1,qr(G)&&G.expanded===!1?z=!0:To(G)&&G.expanded!==!1&&G.childNodes&&E(G.childNodes,F,H,B));return H},[y,f]),I=Yt(()=>i?u:Jr(n,{itemToString:f,noChildrenLabel:m})||Yr(r)||[],[i,u,n,f,m,r]),[b,v,S]=Yt(()=>i?[u,u,u]:g(I,{value:0}),[u,g,i,I]);l.current=S,Yt(()=>i?u:a.current=E(b),[u,E,b,i]);let T=er(b),A=Te((C="")=>{typeof C=="string"&&(d.current=C,a.current=E(b),s({}))},[b,E]),w=Te((C,F=b)=>{let H=F.find(B=>{var z;return B.id===C||((z=B==null?void 0:B.childNodes)==null?void 0:z.length)&&en(B.id,C)});if((H==null?void 0:H.id)===C)return v==null?void 0:v[H.index];if(H)return w(C,H.childNodes);throw Error(`useCollectionData itemById, id ${C} not found `)},[v,b]),D=Te((C,F=b)=>{let H=F.find(z=>{var G;return z.id===C||((G=z==null?void 0:z.childNodes)==null?void 0:G.length)&&en(z.id,C)}),B=H?a.current.indexOf(H):-1;if(B!==-1)return B;throw Error(`useCollectionData indexOfItemById, id ${C} not found `)},[b]),O=Te(C=>{let F=l.current.find(H=>Ro(H.value)?H.label===C:H.value===C);if(F)return F;throw Error("useCollectionData toCollectionItem, item not found ")},[]),x=Te(C=>{if(C===null)return null;if(Array.isArray(C)){let F=[];for(let H of C){let B=O(H);F.push(B)}return F}else if(C!==void 0)return O(C)},[O]),L=Te(C=>{if(C===void 0)return;let F=x(C);return Array.isArray(F)?F.map(H=>H.id):F?[F.id]:[]},[x]),N=Te(C=>{let F=H=>{let B=l.current.find(z=>Ro(z.value)?z.label===H:z.value!==null&&f(z.value)===H);if(B)return B};if(C===null)return null;if(Array.isArray(C)){let H=[];for(let B of C){let z=F(B);z&&H.push(z)}return H}else if(C!==void 0)return F(C)},[f]),k=Te(C=>{for(let F of T.current)if(C===F.value)return F.id;throw Error("useCollectionData itemToId, item not found")},[]),P=Te(C=>{T.current=jt(T.current,C.id,{expanded:!1}),a.current=E(T.current),s({})},[E]),R=Te(C=>{T.current=jt(T.current,C.id,{expanded:!0}),a.current=E(T.current),s({})},[E]);return i||{collapseGroupItem:P,data:a.current,expandGroupItem:R,setFilterPattern:A,indexOfItemById:D,itemById:w,itemToId:k,toCollectionItem:O,itemToCollectionItem:x,itemToCollectionItemId:L,stringToCollectionItem:N}};import{useCallback as cl,useEffect as dl,useLayoutEffect as pl,useRef as fl}from"react";var Dh=["height","width"],No=["width"],Oo=["height"],tt=new Map,Ao=(r,e,t)=>{switch(t){case"height":return e.height;case"clientHeight":return r.clientHeight;case"clientWidth":return r.clientWidth;case"contentHeight":return e.contentHeight;case"contentWidth":return e.contentWidth;case"scrollHeight":return Math.ceil(r.scrollHeight);case"scrollWidth":return Math.ceil(r.scrollWidth);case"width":return e.width;default:return 0}};var Ho=new ResizeObserver(r=>{for(let e of r){let{target:t,borderBoxSize:n,contentBoxSize:o}=e,s=tt.get(t);if(s){let[{blockSize:i,inlineSize:a}]=n,[{blockSize:l,inlineSize:u}]=o,{onResize:d,measurements:p}=s,c=!1;for(let[m,f]of Object.entries(p)){let h=Ao(t,{height:i,width:a,contentHeight:l,contentWidth:u},m);h!==f&&(c=!0,p[m]=h)}c&&d&&d(p)}}});function ze(r,e,t,n=!1){let o=fl(e),s=r.current,i=cl(a=>{let{width:l,height:u}=a.getBoundingClientRect(),{clientWidth:d,clientHeight:p}=a;return o.current.reduce((c,m)=>(c[m]=Ao(a,{width:l,height:u,contentHeight:p,contentWidth:d},m),c),{})},[]);pl(()=>{async function a(){tt.set(s,{measurements:{}}),await document.fonts.ready;let l=tt.get(s);if(l){let u=i(s);l.measurements=u,Ho.observe(s),n&&t(u)}else console.log("%cuseResizeObserver an target expected to be under observation wa snot found. This warrants investigation","font-weight:bold; color:red;")}return s&&(tt.has(s)&&console.log("useResizeObserver attemping to observe same element twice",{target:s}),a()),()=>{s&&tt.has(s)&&(Ho.unobserve(s),tt.delete(s))}},[i,s]),dl(()=>{let a=r.current,l=tt.get(a);if(l){if(o.current!==e){o.current=e;let u=i(a);l.measurements=u}l.onResize=t}},[e,i,r,t])}var Fo=r=>r===void 0||r==="default"||r==="deselectable",ut=r=>r==="multiple"||(r==null?void 0:r.startsWith("extended"))===!0,Vo=r=>r==="none",Ph=(r,e=!1)=>r==="multiple"||r==="multiple-special-key"&&e,Lh=r=>r!=="none"&&r!=="default",Ue=r=>r!==void 0&&r.length>0,Bo=r=>r[0];import{useCallback as ml,useRef as hl,useState as gl}from"react";var bl=r=>typeof r!="function",Ah=r=>{let[e,t]=gl(r),n=hl(e),o=ml(s=>{if(bl(s))n.current=s,t(s);else{let{current:i}=n;n.current=s(i),t(n.current)}},[]);return[n,o]};import Uo from"classnames";import{useForkRef as Cl}from"@salt-ds/core";import{Children as wl,cloneElement as Go,forwardRef as El,useRef as Dl}from"react";import{useControlled as Sl,useForkRef as vl}from"@salt-ds/core";import{useCallback as rt,useRef as Ko,useState as Il}from"react";import{useEffect as $o,useRef as xl}from"react";var yl=[],_o=({popperRef:r,rootRef:e,isOpen:t,onClose:n})=>{let o=xl(t);$o(()=>{o.current=t},[t]),$o(()=>{let[s,i]=t?[a=>{var u,d;let l=a.target;!((u=r.current)!=null&&u.contains(l))&&!((d=e.current)!=null&&d.contains(l))&&n("click-away")},a=>{a.key==="Escape"&&o.current&&(n("Escape"),a.stopPropagation())}]:yl;return s&&i&&(document.body.addEventListener("mousedown",s,!0),document.body.addEventListener("keydown",i,!0)),()=>{s&&i&&(document.body.removeEventListener("mousedown",s,!0),document.body.removeEventListener("keydown",i,!0))}},[t,n,r,e])};var Tl=[],zo=({defaultIsOpen:r,disabled:e,fullWidth:t,id:n,isOpen:o,onOpenChange:s,onKeyDown:i,openKeys:a=["Enter","ArrowDown"," "],openOnFocus:l,popupComponent:u,popupWidth:d,rootRef:p,width:c})=>{var P;let m=Ko(null),f=Ko(null),h=rt(R=>{f.current=R},[]),[g,y]=Sl({controlled:o,default:!!r,name:"useDropdown",state:"isOpen"}),[E,I]=Il({width:(P=d!=null?d:c)!=null?P:0}),b=rt(()=>{y(!0),s==null||s(!0)},[s,y]),v=rt(R=>{y(!1),s==null||s(!1,R)},[s,y]);_o({popperRef:f,rootRef:p,isOpen:g,onClose:v});let S=rt(()=>{e||l&&(y(!0),s==null||s(!0),m.current=window.setTimeout(()=>{m.current=null},1e3))},[e,s,l,y]),T=rt(R=>{if(["Enter"," "].indexOf(R.key)===-1){let M=!g;y(M),s==null||s(M)}},[g,y,s]),A=rt(R=>{R.key==="Escape"&&g?(R.key==="Escape"&&(R.stopPropagation(),R.preventDefault()),v(R.key)):a.includes(R.key)&&!g?(R.preventDefault(),b()):i==null||i(R)},[v,g,i,a,b]),w=rt(R=>{var M;g&&((M=f.current)!=null&&M.contains(R.relatedTarget)||v("blur"))},[v,g]),D=t!=null?t:!1;ze(p,D?No:Tl,I,D);let x=`${n}-dropdown`,L={"aria-expanded":g,"aria-owns":g?x:void 0,id:`${n}-control`,onClick:e||l?void 0:T,onFocus:S,role:"listbox",onBlur:w,onKeyDown:e?void 0:A,style:{width:D?void 0:c}},N={id:x,width:E.width},k=vl(h,u.ref);return{componentProps:N,popupComponentRef:k,isOpen:g,label:"Dropdown Button",triggerProps:L}};import{useId as Ml}from"@vuu-ui/vuu-layout";import{PopupComponent as Pl,Portal as Ll}from"@vuu-ui/vuu-popups";import{jsx as Wo,jsxs as kl}from"react/jsx-runtime";var tr="vuuDropdown",ct=El(function({PopupProps:e,"aria-labelledby":t,children:n,className:o,defaultIsOpen:s,disabled:i,fullWidth:a,id:l,isOpen:u,onKeyDown:d,onOpenChange:p,openKeys:c,openOnFocus:m,placement:f="below-full-width",popupWidth:h,width:g,...y},E){let I=Dl(null),b=Uo(tr,o,{[`${tr}-fullWidth`]:a,[`${tr}-disabled`]:i}),[v,S]=wl.toArray(n),T=Ml(l),{componentProps:A,isOpen:w,popupComponentRef:D,triggerProps:O}=zo({ariaLabelledBy:t,defaultIsOpen:s,disabled:i,fullWidth:a,id:T,isOpen:u,onOpenChange:p,onKeyDown:d,openKeys:c,openOnFocus:m,popupComponent:S,popupWidth:h,rootRef:I,width:g}),x=()=>{let{id:k,role:P,...R}=O,{id:M=k,role:V=P,...C}=v.props;return Go(v,Zt(C,{...R,id:M,role:V}))},L=()=>{let{id:k,width:P,...R}=A,{className:M,id:V=k,width:C,...F}=S.props;return Go(S,{...F,...R,className:Uo(M,`${tr}-popup-component`),id:V,ref:D,width:f.endsWith("full-width")?"auto":C!=null?C:P})},N=Cl(I,E);return kl("div",{...y,className:b,id:l,ref:N,children:[x(),w&&Wo(Ll,{children:Wo(Pl,{...e,anchorElement:I,placement:f,children:L()})})]})});import{Button as Rl}from"@salt-ds/core";import Hl from"classnames";import{forwardRef as Nl}from"react";import{jsx as rn,jsxs as Ol}from"react/jsx-runtime";var Mt="vuuDropdownButton",Qo=Nl(function({ariaHideOptionRole:e,className:t,disabled:n,icon:o="chevron-down",isOpen:s,label:i,labelId:a,fullWidth:l,posInSet:u,setSize:d,labelAriaAttributes:p,...c},m){return rn(Rl,{className:Hl(Mt,{[`${Mt}-fullWidth`]:l},t),disabled:n,variant:"secondary",...c,ref:m,children:Ol("div",{className:`${Mt}-content`,children:[rn("span",{"aria-hidden":e?"true":void 0,...p,className:`${Mt}-buttonLabel`,id:a,role:"option",children:i}),rn("span",{className:`${Mt}-buttonIcon`,"data-icon":o,"aria-hidden":"true"})]})})});import{useForkRef as $c}from"@salt-ds/core";import{cloneElement as _c,forwardRef as Kc,useCallback as zc,useRef as ri}from"react";import{useId as Uc}from"@vuu-ui/vuu-layout";function Al(r,...e){let t=new Set(r);for(let n of e)for(let o of n)t.add(o);return t}var Pt="ArrowUp",Lt="ArrowDown",jo="ArrowLeft",Xo="ArrowRight",nn="Enter",Mg="Escape",on="Home",rr="End",sn="PageUp",nr="PageDown",Zo=" ",Fl=new Set(["Enter","Delete"," "]),Vl=new Set(["Tab"]),Bl=new Set(["ArrowRight","ArrowLeft"]),qo=new Set([on,rr,sn,nr,Lt,Pt]),$l=new Set(["F1","F2","F3","F4","F5","F6","F7","F8","F9","F10","F11","F12"]),_l=Al(Fl,qo,Bl,$l,Vl),or=r=>_l.has(r.key)?!1:r.key.length===1&&!r.ctrlKey&&!r.metaKey&&!r.altKey,Jo=({key:r})=>qo.has(r);import{useCallback as Yo}from"react";var Kl={},zl=r=>Array.isArray(r.childNodes),Ul=r=>!0,Gl=r=>r.closest("[data-toggle],[aria-expanded]").dataset.toggle==="true",es=({collapsibleHeaders:r,collectionHook:e,highlightedIdx:t,onToggle:n})=>{let o=Yo(a=>{if(a.key===Xo||a.key===nn){let l=e.data[t];l&&l.expanded===!1&&l.value&&(a.preventDefault(),e.expandGroupItem(l),n==null||n(l.value))}if(a.key===jo||a.key===nn){let l=e.data[t];l&&l.expanded&&l.value&&(a.preventDefault(),e.collapseGroupItem(l),n==null||n(l.value))}},[e.collapseGroupItem,e.data,e.expandGroupItem,t]),i={onClick:Yo(a=>{console.log(`useCollapsibleGroups idx=${t}`);let l=e.data[t];console.log(a.target,a.currentTarget),l&&zl(l)&&(!Ul(l)||Gl(a.target))&&(a.stopPropagation(),a.preventDefault(),l.expanded===!1&&l.value?(e.expandGroupItem(l),n==null||n(l.value)):l.expanded===!0&&l.value&&(e.collapseGroupItem(l),n==null||n(l.value)))},[e.collapseGroupItem,e.data,e.expandGroupItem,t]),onKeyDown:o};return r?i:Kl};var Ng=(r,e)=>r.querySelector(`:scope > [data-idx="${e}"]`);function Wl(r){if(r){let e=r.dataset.index;if(e)return parseInt(e,10);if(e=r.ariaPosInSet)return parseInt(e,10)-1}return-1}var Ql=r=>r==null?void 0:r.id,ts=r=>r.closest("[data-index],[aria-posinset]"),Og=r=>Ql(ts(r)),rs=r=>Wl(ts(r));import{useImperativeHandle as jl,useMemo as Xl}from"react";var Zl={scrollToIndex:()=>{},scrollToItem:()=>{},scrollTo:()=>{}},sr=({collectionHook:r,forwardedRef:e,scrollableRef:t,scrollIntoView:n})=>{let o=Xl(()=>({scrollToIndex:s=>{let i=r.data[s];i&&(n==null||n(i))},scrollToItem:s=>{let i=r.toCollectionItem(s);i&&(n==null||n(i))},scrollTo:s=>{t!=null&&t.current&&(t.current.scrollTop=s)}}),[r,n,t]);jl(e,()=>t.current?o:Zl,[o,t])};import{useControlled as ql}from"@salt-ds/core";import{useCallback as dt,useMemo as Jl,useRef as an,useState as Yl}from"react";import{getElementByDataIndex as ir,isValidNumber as eu}from"@vuu-ui/vuu-utils";var un=-2;function ns(r,e,t){return e===Pt||e===rr?t>0?t-1:t:t===null?0:t===r-1?t:t+1}var ln=r=>{var t;let e=Array.isArray(r)?Bo(r):void 0;if(e){let n=document.getElementById(e);if(n){let o=parseInt((t=n.dataset.index)!=null?t:"-1");if(eu(o))return o}}return-1},tu=(r,e,t,n)=>r===rr?n:r===on?-1:e!==-1?e:t,ru=(r,e,t,n)=>{let{top:o}=e.getBoundingClientRect(),{scrollTop:s,clientHeight:i,scrollHeight:a}=r,l=t-1,u=Math.min(s+i,a-i);if(u!==s&&n<l){r.scrollTo(0,u);let d=n,p;do d+=1,p=ir(r,d,!0).getBoundingClientRect();while(p.top<o&&d<l);return d}},nu=async(r,e,t)=>{let{top:n}=e.getBoundingClientRect(),{scrollTop:o,clientHeight:s}=r,i=Math.max(o-s,0);if(i!==o&&t>0)return r.scrollTo(0,i),new Promise(a=>{requestAnimationFrame(()=>{let l=t,u;do l-=1,u=ir(r,l,!0).getBoundingClientRect();while(u.top>n&&l>0);a(l)})})},ou=r=>r!==void 0,os=(r,e)=>{let t=ir(r,e);return ou(t)},ss=({containerRef:r,defaultHighlightedIndex:e=-1,disableHighlightOnFocus:t,highlightedIndex:n,itemCount:o,onHighlight:s,onKeyboardNavigation:i,restoreLastFocus:a,selected:l,viewportItemCount:u})=>{let d=an(-1),[,p]=Yl({}),[c,m,f]=ql({controlled:n,default:e,name:"UseKeyboardNavigation"}),h=dt((w,D=!1)=>{s==null||s(w),m(w),D&&(d.current=w)},[s,m]),g=dt(async(w,D)=>{let O=ir(r.current,D,!0),x;if(O){let{current:L}=r;O&&L&&(x=w===nr?ru(L,O,o,D):await nu(L,O,D))}return x!=null?x:D},[r,o]),y=dt((w=Lt,D=w===Lt?-1:o)=>{if(o===0)return-1;{let O=w==="End",x=w==="Home",L=O||x||D===-1?-1:ln(l),N=tu(w,D,L,o),k=ns(o,w,N),{current:P}=r;if(k===0&&w===Pt&&P&&!os(P,0))return D;for(;((w===Lt||x)&&k<o||(w===Pt||O)&&k>0)&&P&&!os(P,k);)k=ns(o,w,k);return k}},[r,o,l]),E=an(!1),I=an(!1),b=w=>I.current=w,v=dt(()=>{if(I.current)I.current=!1;else if(E.current=!0,o===0)h(un);else if(c!==-1)p({});else if(a)if(d.current!==-1)h(d.current);else{let w=ln(l);h(w!==-1?w:0)}else if(Ue(l)){let w=ln(l);h(w)}else t!==!0&&h(y())},[t,c,o,y,a,l,h]),S=dt(async w=>{let D=w.key===nr||w.key===sn?await g(w.key,c):y(w.key,c);D!==c&&h(D,!0),i==null||i(w,D)},[c,y,g,i,h]),T=dt(w=>{o>0&&Jo(w)?(w.preventDefault(),w.stopPropagation(),E.current=!0,S(w)):or(w)&&(E.current=!0)},[o,S]),A=Jl(()=>({onBlur:w=>{let D=w.target.closest(".vuuList"),O=w.relatedTarget;D&&!(D!=null&&D.contains(O))&&(E.current=!1,m(-1),a||(d.current=-1))},onFocus:v,onKeyDown:T,onMouseDownCapture:()=>{E.current=!1,b(!0)},onMouseMove:()=>{E.current&&(E.current=!1)},onMouseLeave:()=>{E.current=!1,b(!1),h(-1)}}),[v,T,a,m,h]);return{focusVisible:E.current?c:-1,controlledHighlighting:f,highlightedIndex:c,setHighlightedIndex:h,keyboardNavigation:E,containerProps:A,setIgnoreFocus:b}};import{getElementByDataIndex as ar,getElementDataIndex as su,isSelectableElement as cn}from"@vuu-ui/vuu-utils";import{useCallback as Ge,useRef as iu}from"react";var ib="checkbox",au="none",ab="single",lb="cascade",lu=["Enter"," "],ub=r=>r&&r!==au,is=({containerRef:r,defaultSelected:e,disableSelection:t=!1,highlightedIndex:n,itemQuery:o,onClick:s,onSelect:i,onSelectionChange:a,selected:l,selectionStrategy:u,selectionKeys:d=lu,tabToSelect:p})=>{let c=u==="deselectable",m=u==="multiple",f=u==="extended",h=iu(-1),g=Ge(x=>d.includes(x.key),[d]),[y,E]=Jt({controlled:l,default:e!=null?e:[],name:"UseSelection",state:"selected"}),I=Ge(x=>y.includes(x),[y]),b=Ge(x=>I(x)?[]:[x],[I]),v=Ge(x=>{let L=I(x)?y.filter(N=>N!==x):y.concat(x);return L.sort(),L},[I,y]),S=Ge((x,L)=>{let N=L?y:[],[k]=y.slice(-1),P=k?su(document.getElementById(k)):0,R=Math.min(x,P),M=Math.max(x,P),V=r.current,F=Array.from(V.querySelectorAll(o)).slice(R,M+1).map(B=>B.id),H=[...new Set([...N,...F])];return H.sort(),H},[r,o,y]),T=Ge((x,L,N,k)=>{let{current:P}=r,{id:R}=ar(P,L,!0),M;m?M=v(R):f?k&&!N?M=v(R):N?M=S(L,k):M=[R]:c?M=b(R):M=[R],M!==y&&E(M),i==null||i(x,R),M!==y&&a&&a(x,M)},[r,m,f,c,y,i,v,S,b,E,a]),A=Ge(x=>{let{current:L}=r,N=ar(L,n);cn(N)&&(g(x)||p&&x.key==="Tab")&&(x.key!=="Tab"&&x.preventDefault(),T(x,n,!1,x.ctrlKey||x.metaKey),f&&(h.current=n))},[n,r,g,p,T,f]),w=Ge((x,L)=>{if(f&&x.shiftKey){let{current:N}=r,k=ar(N,L);cn(k)&&T(x,L,!0)}},[f,r,T]),D=Ge(x=>{let{current:L}=r,N=ar(L,n);!t&&cn(N)&&(x.preventDefault(),x.stopPropagation(),T(x,n,x.shiftKey,x.ctrlKey||x.metaKey),f&&(h.current=n)),s==null||s(x)},[r,n,t,s,T,f]);return{listHandlers:Vo(u)?{onClick:s}:{onClick:D,onKeyDown:A,onKeyboardNavigation:w},selected:y,setSelected:E}};import{useCallback as as,useRef as dn}from"react";var ls=({disableTypeToSelect:r,highlightedIdx:e,highlightItemAtIndex:t,typeToNavigate:n,items:o,applyIncrementalSearch:s=!0})=>{let i=dn(null),a=dn(""),l=dn(-1),u=as(p=>{if(p||!s){let c=new RegExp(`^${a.current}`,"i"),m=o.findIndex(({label:f},h)=>h>l.current&&c.test(f));m===-1&&(m=o.findIndex(({label:f},h)=>h<=l.current&&c.test(f))),m!==-1&&t(m)}else a.current="",i.current=null,l.current=-1},[s,t,o]),d=as(p=>{let c=l.current!==-1;(or(p)||c&&p.key===Zo)&&n&&(p.preventDefault(),p.stopPropagation(),(l.current===-1||p.key===a.current)&&(l.current=e),i.current!==null&&(clearTimeout(i.current),i.current=null),p.key!==a.current&&(a.current+=p.key),s&&u(!0),i.current=window.setTimeout(()=>{u()},100))},[n,s,e,u]);return{onKeyDown:r?void 0:d}};import{useCallback as pt,useRef as us}from"react";import{useIsomorphicLayoutEffect as uu}from"@salt-ds/core";var cs=["height"],cu=["height","scrollHeight"],du=[],ds={containerOnly:[cu,du],withContent:[cs,cs]},pu=r=>r?ds.containerOnly:ds.withContent,ps={current:null},fu=(r,e)=>{let{transform:t="none"}=getComputedStyle(r);if(t.startsWith("matrix")){let n=t.lastIndexOf(",");return parseInt(t.slice(n+1))}else{let n=r.offsetParent;if(n===e||e===null)return r.offsetTop;{let o=r.offsetTop;for(;n!==null&&n!==e;)o+=n.offsetTop,n=n.offsetParent;return o}}},fs=({containerRef:r,contentRef:e=ps,highlightedIdx:t=-1,indexPositions:n,stickyHeaders:o=!1})=>{let s=us(!1),i=us({height:0,contentHeight:0}),a=pt(h=>{s.current=!0,r.current&&(r.current.scrollTop=h),setTimeout(()=>{s.current=!1})},[]),l=pt(()=>a(0),[a]),u=pt(()=>{a(i.current.contentHeight-i.current.height)},[a]),d=pt(h=>{let g=e.current||r.current;if(h.id){let y=document.getElementById(h.id);if(y&&r.current){let{height:E}=i.current,I=y.ariaExpanded&&y.firstChild?y.firstChild:y,b=o?36:0,v=fu(I,g),S=I.offsetHeight,{scrollTop:T}=r.current,A=T+b,w=A+E-b;if(v+S>w||v<A){let D=v+S>w?T+(v+S)-w:v-b;a(D)}}}},[r,e,a,o]);uu(()=>{let{height:h,contentHeight:g}=i.current,y=n[t];if(g>h&&y){let[E]=n,[I]=n.slice(-1);y===E?l():y===I?u():d(n[t])}},[t,n,d,u,l]);let p=pt(({height:h,scrollHeight:g})=>{typeof h=="number"&&(i.current.height=h),typeof g=="number"&&(i.current.contentHeight=g)},[]),c=pt(({height:h})=>{typeof h=="number"&&(i.current.contentHeight=h)},[]),[m,f]=pu(e===ps);return ze(r,m,p,!0),ze(e,f,c,!0),{isScrolling:s,scrollIntoView:d}};import{makePrefixer as mu}from"@salt-ds/core";import{Fragment as gu,jsx as pn}from"react/jsx-runtime";var hu=mu("saltHighlighter"),ms=r=>{let{matchPattern:e,text:t=""}=r,n=typeof e=="string"?new RegExp(`(${Xt(e)})`,"gi"):e;return n===void 0?pn(gu,{children:t}):pn("span",{children:t.split(n).map((o,s)=>o.match(n)?pn("strong",{className:hu("highlight"),children:o},`${s}-${o}`):o)})};import{forwardRef as gs}from"react";import bs from"classnames";import bu from"react";import xu from"classnames";var hs="vuuCheckboxIcon",lr=({checked:r=!1,disabled:e=!1,...t})=>bu.createElement("span",{...t,className:xu(hs,{[`${hs}-checked-${e?"disabled":"enabled"}`]:r})});import{jsx as ur,jsxs as yu}from"react/jsx-runtime";var kt="vuuListItem",cr=gs(function({height:e,...t},n){return ur("div",{...t,"aria-hidden":!0,className:bs(kt,`${kt}-proxy`),ref:n,style:{height:e}})}),dr=gs(function({children:e,className:t,disabled:n,tabIndex:o,item:s,itemHeight:i,itemTextHighlightPattern:a,label:l,selectable:u,selected:d,showCheckbox:p,style:c,...m},f){let h=bs(kt,t,{vuuDisabled:n,[`${kt}-checkbox`]:p}),g=i!==void 0?{...c,height:i}:c;return yu("div",{className:h,...m,"aria-disabled":n||void 0,"aria-selected":d||void 0,ref:f,style:g,children:[p&&ur(lr,{"aria-hidden":!0,checked:d}),e&&typeof e!="string"?e:a==null?ur("span",{className:`${kt}-textWrapper`,children:l||e}):ur(ms,{matchPattern:a,text:l||e})]})});import{MeasuredContainer as hc,useId as gc}from"@vuu-ui/vuu-layout";import{useForkRef as bc}from"@salt-ds/core";import xn from"classnames";import{cloneElement as xc,forwardRef as yc,isValidElement as Sc,useCallback as vc,useRef as yn,useState as Ic}from"react";import{useLayoutEffectSkipFirst as sc}from"@vuu-ui/vuu-layout";import{useCallback as Nt,useMemo as ic,useRef as ac}from"react";var n1="fwd",o1="bwd";import{createContext as Iu,useCallback as Rt,useContext as Tu,useMemo as mr}from"react";import{boxContainsPoint as Su,dispatchCustomEvent as vu}from"@vuu-ui/vuu-utils";import{useCallback as pr,useRef as fr}from"react";var xs=({onDragOverDropTarget:r,onDrop:e})=>{let t=fr(),n=fr(),o=fr(null),s=fr({x:0,y:0}),i=pr((d,p)=>{let{current:c}=n;if(c){for(let[m,f]of Object.entries(c))if(Su(f,d,p))return m}},[]),a=pr(d=>{let{clientX:p,clientY:c}=d,{current:m}=o;if(s.current.x=p,s.current.y=c,m!=null&&m.draggableElement){let{draggableElement:f,mouseOffset:h}=m,g=s.current.x-h.x,y=s.current.y-h.y;f.style.top=`${y}px`,f.style.left=`${g}px`;let E=i(g,y);E?r(E,m)?(document.removeEventListener("mousemove",a,!1),document.removeEventListener("mouseup",l,!1),o.current=null,t.current=void 0):t.current=E:t.current=void 0}},[]),l=pr(()=>{document.removeEventListener("mousemove",a,!1),document.removeEventListener("mouseup",l,!1);let{current:d}=o;d&&(o.current=null,t.current&&e(t.current,d),d.draggableElement&&vu(d.draggableElement,"vuu-dropped"))},[a,e]),u=pr(d=>(console.log("resume drag of ",{el:d.draggableElement}),o.current=d,document.addEventListener("mousemove",a,!1),document.addEventListener("mouseup",l,!1),!0),[a,l]);return{measuredDropTargetsRef:n,resumeDrag:u}};import{jsx as Du}from"react/jsx-runtime";var Cu={isDragSource:void 0,isDropTarget:void 0,register:()=>{}},wu=()=>console.log("have you forgotten to provide a DragDrop Provider ?"),ys=Iu({registerDragDropParty:wu}),Eu=(r=[])=>r.reduce((e,t)=>{let n=document.getElementById(t);if(n){let{top:o,right:s,bottom:i,left:a}=n.getBoundingClientRect();e[t]={top:o,right:s,bottom:i,left:a}}return e},{}),h1=({children:r,dragSources:e})=>{let t=mr(()=>new Map,[]),n=mr(()=>new Map,[]),o=Rt((f,h)=>{let g=t.get(f);return g?g(h):!1},[t]),s=Rt((f,h)=>{let g=n.get(f);g&&g(h)},[n]),{measuredDropTargetsRef:i,resumeDrag:a}=xs({onDragOverDropTarget:o,onDrop:s}),[l,u]=mr(()=>{let f=new Map,h=new Map;for(let[g,{dropTargets:y}]of Object.entries(e)){let E=f.get(g),I=Array.isArray(y)?y:[y];E?E.push(...I):f.set(g,I);for(let b of I){let v=h.get(b);v?v.push(g):h.set(b,[g])}}return[f,h]},[e]),d=Rt((f,h)=>(i.current=Eu(l.get(f)),a(h),!0),[l,i,a]),p=Rt(f=>{console.log(`end of drag operation, id= ${f}`)},[]),c=Rt((f,h,g)=>{h?t.set(f,h):g&&n.set(f,g)},[n,t]),m=mr(()=>({dragSources:l,dropTargets:u,onDragOut:d,onEndOfDragOperation:p,registerDragDropParty:c}),[l,u,d,p,c]);return Du(ys.Provider,{value:m,children:r})},Ss=r=>{var i,a;let{dragSources:e,dropTargets:t,onDragOut:n,onEndOfDragOperation:o,registerDragDropParty:s}=Tu(ys);if(r&&(e||t)){let l=(i=e==null?void 0:e.has(r))!=null?i:!1,u=(a=t==null?void 0:t.has(r))!=null?a:!1;return{isDragSource:l,isDropTarget:u,onDragOut:n,onEndOfDragOperation:o,register:s}}else return Cu};import{isOverflowElement as Qu}from"@vuu-ui/vuu-layout";import{dispatchCustomEvent as ju}from"@vuu-ui/vuu-utils";import{useCallback as Se,useEffect as Xu,useLayoutEffect as Zu,useRef as Pe,useState as qu}from"react";var hr=class{constructor(e,t){this.draggableElement=null;this.payload=null;this.setDraggable=e=>{this.draggableElement=e};this.initialDragElement=t,this.mouseOffset=this.getMouseOffset(e,t)}setPayload(e){this.payload=e}getMouseOffset(e,t){let{clientX:n,clientY:o}=e,s=t.getBoundingClientRect();return{x:n-s.left,y:o-s.top}}};import{useForkRef as Mu}from"@salt-ds/core";import Pu from"classnames";import{forwardRef as Lu,useCallback as vs,useMemo as ku}from"react";import{PopupComponent as Ru,Portal as Hu}from"@vuu-ui/vuu-popups";import{jsx as fn}from"react/jsx-runtime";var Nu=r=>r.split(" ").map(e=>`vuuDraggable-${e}`),gr=Lu(function({wrapperClassName:e,element:t,onDropped:n,onTransitionEnd:o,style:s,scale:i=1},a){let l=vs(()=>{n==null||n()},[n]),u=vs(c=>{c&&(c.innerHTML="",c.appendChild(t),i!==1&&(c.style.transform=`scale(${i},${i})`),c.addEventListener("vuu-dropped",l))},[t,l,i]),d=Mu(a,u),p=ku(()=>({left:0,top:0}),[]);return fn(Hu,{children:fn(Ru,{anchorElement:{current:document.body},placement:"absolute",position:p,children:fn("div",{className:Pu("vuuDraggable",...Nu(e)),ref:d,onTransitionEnd:o,style:s})})})}),mn=r=>{let e=document.createElement("div");return e.className="vuuDraggable-spacer",r&&e.addEventListener("transitionend",()=>{r.current=!1}),e},Is=()=>{let r=document.createElement("div");return r.className="vuuDraggable-dropIndicatorPosition",r},Ts=r=>{let e=document.createElement("div");return e.className="vuuDraggable-dropIndicator",r&&e.addEventListener("transitionend",()=>{r.current=!1}),e};var Ou=["left","right"],Au=["top","bottom"],br=":not(.wrapped)",Cs=':not([aria-hidden="true"])',ws=r=>{let e=r.cloneNode(!0);return e.removeAttribute("id"),e.dataset.index="-1",e},Fu=(r,e="width",t=!1)=>{let n=e==="width"?"left":"top",{[e]:o,[n]:s}=r.getBoundingClientRect(),{padEnd:i=!1,padStart:a=!1}=r.dataset,l=getComputedStyle(r),[u,d]=e==="width"?Ou:Au,p=a&&!t?0:parseInt(l.getPropertyValue(`margin-${u}`),10),c=i&&!t?0:parseInt(l.getPropertyValue(`margin-${d}`),10),m=o;if(parseInt(l.getPropertyValue("flex-shrink"),10)>0){let h=parseInt(l.getPropertyValue("flex-basis"),10);!isNaN(h)&&h>0&&(m=h)}return[s,p+m+c]},Vu={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"}},Ce=r=>Vu[r],Es=(r,e)=>{let t=r.find(n=>n.id===e);if(t)return t},Ds=(r,e)=>{r.splice(e,1);for(let t=e;t<r.length;t++)r[t].currentIndex-=1},ft=(r,e,t,n,o)=>{let s=[],{DIMENSION:i}=Ce(e),a=Array.from(t?r.querySelectorAll(t):r.children),l=a.length,u=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,l-1):l-1;for(let p=u;p<=d;p++){let c=a[p],[m,f]=Fu(c,i),h=p===l-1,g=c.id;s.push({currentIndex:p,id:g,index:p,isDraggedItem:o===g,isLast:h,isOverflowIndicator:c.dataset.index==="overflow",element:c,start:m,end:m+f,size:f,mid:m+f/2})}return s},mt=(r,e=!1)=>{let t=r.findIndex(n=>n.isDraggedItem);if(e){let{index:n}=r[t],o=r.filter(i=>!i.isDraggedItem).reduce((i,a)=>Math.min(i,a.index),Number.MAX_SAFE_INTEGER);if(o>0&&!(n===0&&o===1))return o+t}return t},hn=(r,e)=>{let t=mt(r),n=e==="fwd"?t+1:t-1;if(n<0||n>=r.length)throw Error("switchDropTargetPosition index out of range");let o=r.at(t),s=r.at(n),i=s.size-o.size;if(e==="fwd"){let a=s.start+i,l=s.end,u={...o,start:a,mid:Math.floor(a+(l-a)/2),end:l},d=o.start,p=o.end+i,c={...s,start:d,mid:Math.floor(d+(p-d)/2),end:p};r.splice(t,2,c,u)}else{let a=s.start,l=s.end-i,u={...o,start:a,mid:Math.floor(a+(l-a)/2),end:l},d=o.start-i,p=o.end,c={...s,start:d,mid:Math.floor(d+(p-d)/2),end:p};r.splice(n,2,u,c)}},nt=(r,e,t,n)=>{let o=r.length,s=mt(r),i=r[s];if(n==="fwd"){let a=Math.round(e+t);for(let l=o-1;l>=0;l--){let u=r[l];if(a>u.mid)return i&&l<s?i:u}}else{let a=Math.round(e);for(let l=0;l<o;l++){let u=r[l];if(a<u.mid)return l>s?i:u}}throw Error("no dropTraget identified")};function Ms(r,e){let{height:t,left:n,top:o,width:s}=r,{height:i,width:a}=e;return{height:Math.min(t,i),left:n,top:o,width:Math.min(s,a)}}var H1=r=>r.map((e,t)=>{var n;return`
|
|
3
|
+
${e.isDraggedItem?"*":" "}[${t}] width : ${Math.floor(e.size)} ${Math.floor(e.start)} - ${Math.floor(e.end)} (mid ${Math.floor(e.mid)}) ${(n=e.element)==null?void 0:n.textContent} `}).join(""),Ps=(r,e)=>{let t=r.querySelector(`${e}:not([aria-hidden="true"])`),n=t==null?void 0:t.parentElement;return n===r?r:n==null?void 0:n.parentElement},Ls=(r,e)=>{let{SCROLL_SIZE:t,CLIENT_SIZE:n}=Ce(e),{[t]:o,[n]:s}=r;return o>s};import{useCallback as ks,useRef as xr}from"react";var Rs=({containerRef:r,onScrollingStopped:e,orientation:t="vertical"})=>{let n=xr(null),o=xr(!1),s=xr(0),i=xr("fwd"),a=ks((u=!1)=>{console.log("[useAutoScroll] stopScrolling"),n.current!==null&&(clearTimeout(n.current),n.current=null),o.current=!1,e==null||e(i.current,s.current,u)},[e]),l=ks((u,d,p=30)=>{let{current:c}=r;if(c){let{SCROLL_POS:m,SCROLL_SIZE:f,CLIENT_SIZE:h}=Ce(t),{[m]:g,[f]:y,[h]:E}=c,I=u==="fwd"?y-E-g:g,b=Math.min(I,p);u==="fwd"?(i.current="fwd",c[m]=s.current=g+b):(i.current="bwd",c[m]=s.current=g-b),b===I?a(!0):(o.current=!0,n.current=window.setTimeout(()=>{l(u,d,p)},100))}},[r,t,a]);return{isScrolling:o,startScrolling:l,stopScrolling:a}};import{useCallback as gn,useRef as Bu}from"react";var Hs=({selected:r,viewportRange:e})=>{let t=Bu();t.current=e;let n=gn(i=>{i.ariaSelected&&Array.isArray(r)&&r.length>1&&console.log("its a selected element, and we have a multi select")},[r]),o=gn(()=>{},[]),s=gn(()=>{},[]);return{beginDrag:n,drag:o,drop:s}};import{useCallback as ht,useRef as $e,useState as As}from"react";import{useCallback as Ns,useMemo as $u}from"react";var Os=()=>{let r=$u(()=>Is(),[]),e=Ns(()=>r.remove(),[r]);return{positionDropIndicator:Ns((n,o="end")=>(o==="end"?n.element.after(r):n.element.before(r),r),[r]),clearSpacer:e}};import{jsx as zu}from"react/jsx-runtime";var _u=':not([data-overflowed="true"])',Ku=':not([aria-hidden="true"])',Fs=({onDrop:r,orientation:e="horizontal",containerRef:t,itemQuery:n="*",selected:o,viewportRange:s})=>{let i=$e(),a=$e(null),l=$e(null),u=$e(""),d=$e(!1),p=$e(-1),c=$e([]),m=$e(!1),[f,h]=As(!1),[g,y]=As(),{clearSpacer:E,positionDropIndicator:I}=Os(),b=$e(),v=`:is(${n}${_u}${Ku},[data-overflow-indicator])`,S=k=>c.current.findIndex(P=>P.id===k.id),T=(k,P,R)=>{k.start+=P,k.mid+=P,k.end+=P,typeof R=="number"&&(k.currentIndex+=R)},A=$e();A.current=s;let w=ht(()=>{E()},[E]),D=ht((k,P,R)=>{let{current:M}=t,{current:V}=b;if(M&&V){c.current=ft(M,e,v,A.current);let{size:C}=V,H=p.current+C/2,{current:B}=c,z=nt(B,H,C,"fwd");z&&I(R&&k==="fwd"?B[B.length-1]:z,"start")}},[t,I,v,e]),O=ht(k=>{k.ariaSelected&&Array.isArray(o)&&o.length>1&&console.log("its a selected element, and we have a multi select");let{current:P}=t;if(P&&k){let{SCROLL_SIZE:R,CLIENT_SIZE:M}=Ce(e),{id:V}=k,{[R]:C,[M]:F}=P;d.current=C>F;let H=c.current=ft(P,e,v,s),B=Es(H,V);if(B&&P){let z=S(B);Ds(H,z),b.current=B;let{current:G}=A;if(G!=null&&G.atEnd)for(let oe=0;oe<H.length;oe++)T(H[oe],B.size);for(let oe=z;oe<H.length;oe++)T(H[oe],-B.size,-1);let[$,_]=B.isLast?[H[H.length-1],"end"]:[H[z],"start"];l.current=$,u.current=_;let Y=I($,_),{top:X,left:ce,width:te}=Y.getBoundingClientRect(),le={top:B.isLast?G!=null&&G.atEnd&&!G.atStart?X+B.size-2:X-2:X-B.size-2,left:ce,width:te,height:2};y(zu(gr,{wrapperClassName:"dropIndicatorContainer",style:le,ref:a,element:Ts()}))}}},[o,t,e,v,s,I]),x=ht((k,P)=>{let{current:R}=l,{current:M}=b;if(M&&t.current){let V=e==="horizontal"?"left":"top";p.current=k;let{current:C}=c,F=nt(C,k,M.size,P);if(F&&F.index!==(R==null?void 0:R.index)){if(F.isOverflowIndicator)h(m.current=!0);else if(a.current){if(S(F)===C.length-1){let B=C[C.length-1],G=I(B,"start").getBoundingClientRect();a.current.style[V]=`${G.top}px`}else{let z=I(F,"start").getBoundingClientRect();a.current.style[V]=`${z.top}px`}h(m.current=!1)}l.current=F,i.current=P}}},[t,e,I]),L=ht(()=>{E();let{current:k}=b,{current:P}=l,{current:R}=u,{current:M}=A;if(k&&M&&P){let{index:V}=k,C=R==="start",{index:F,currentIndex:H}=P;l.current=null,i.current=void 0,m.current?r(V,-1,{fromIndex:V,toIndex:-1}):V<F?r(V,C?H:H+1,{fromIndex:V,toIndex:C?H:H+1}):r(V,C?F:F+1,{fromIndex:V,toIndex:C?F:F+1}),y(void 0)}h(!1)},[E,r]),N=ht(()=>{},[]);return{beginDrag:O,drag:x,drop:L,dropIndicator:g,handleScrollStart:w,handleScrollStop:D,releaseDrag:N,revealOverflowedItems:f}};import{useCallback as gt,useMemo as Gu,useRef as ot,useState as Wu}from"react";import{useCallback as Ht,useMemo as Uu,useRef as Vs}from"react";var Bs=(r="horizontal")=>{let e=Vs(0),t=Vs(!1),n=Uu(()=>[mn(t),mn()],[]),o=Ht((u,d="width")=>{let[p,c]=n;e.current=requestAnimationFrame(()=>{t.current=!0,p.style.cssText=`${d}: 0px`,c.style.cssText=`${d}: ${u}px`,n[0]=c,n[1]=p})},[n]),s=Ht((u=!1)=>{if(u===!0){let[d]=n,p=()=>{d.removeEventListener("transitionend",p),s()},c=r==="horizontal"?"width":"height";d.addEventListener("transitionend",p),o(0,c)}else n.forEach(d=>d.remove())},[o,r,n]),i=Ht(()=>{e.current&&(cancelAnimationFrame(e.current),e.current=0)},[]),a=Ht((u,d,p,c=!1,m="static")=>{if(d){let f=r==="horizontal"?"width":"height",[h,g]=n;if(i(),c)t.current?(s(),h.style.cssText=`${f}: ${p}px`,g.style.cssText=`${f}: 0px`,m==="fwd"?(d.element.before(h),d.element.after(g)):(d.element.after(h),d.element.before(g))):m==="fwd"?d.element.after(g):d.element.before(g),o(p,f);else if(m==="static")h.style.cssText=`${f}: ${p}px`,d.element.before(h);else throw Error("useDragDisplacers currently only supports noTransition for static displacement");m!=="static"&&hn(u,m)}},[o,i,s,r,n]),l=Ht((u,d,p,c=!1,m="static")=>{let f=r==="horizontal"?"width":"height",[h,g]=n;i(),c?(t.current?(s(),h.style.cssText=`${f}: ${p}px`,g.style.cssText=`${f}: 0px`,d.element.before(h),d.element.after(g)):m==="fwd"?d.element.after(g):d.element.before(g),o(p,f)):(h.style.cssText=`${f}: ${p}px`,d.element.after(h)),m!=="static"&&hn(u,m)},[o,i,s,r,n]);return{displaceItem:a,displaceLastItem:l,clearSpacers:s}};import{dispatchMouseEvent as $s}from"@vuu-ui/vuu-utils";var _s=({onDrop:r,orientation:e="horizontal",containerRef:t,itemQuery:n="*",selected:o,viewportRange:s})=>{let i=ot(),a=ot(!1),l=ot(-1),u=ot([]),d=ot(!1),[p,c]=Wu(!1),{clearSpacers:m,displaceItem:f,displaceLastItem:h}=Bs(e),g=ot(),y=`:is(${n}${br}${Cs},.vuuOverflowContainer-OverflowIndicator)`,E=x=>u.current.findIndex(L=>L.id===x.id),I=ot();I.current=s;let b=gt(()=>{m()},[m]),v=gt((x,L,N)=>{let{current:k}=t,{current:P}=g;if(k&&P){u.current=ft(k,e,y,I.current),x==="fwd"?u.current.push(P):u.current.unshift(P);let{size:R}=P,V=l.current+R/2,{current:C}=u,F=nt(C,V,R,"fwd");if(F){let B=E(F),z=C[B];N&&x==="fwd"?h(C,C[C.length-1],R,!1,"static"):f(C,z,R,!0,"static")}}},[t,f,h,y,e]),S=gt(x=>{x.ariaSelected&&Array.isArray(o)&&o.length>1&&console.log("its a selected element, and we have a multi select");let{current:L}=t;if(L&&x){let N=L.contains(x),{SCROLL_SIZE:k,CLIENT_SIZE:P}=Ce(e),{id:R}=x,{[k]:M,[P]:V}=L;a.current=M>V;let C=u.current=ft(L,e,y,s,R);if(console.log({dropTargets:C}),N){let F=mt(C),H=C[F];H&&L&&(g.current=H,(H.isLast?h:f)(C,H,H.size,!1,"static"))}else{let{top:F,height:H}=x.getBoundingClientRect(),B=nt(C,F,H,"fwd"),z=C.indexOf(B),{start:G,end:$,mid:_}=B,Y=g.current={end:$,mid:_,start:G,isDraggedItem:!0,isExternal:!0,size:H},X=C.indexOf(B);C.splice(X,0,Y);for(let te=z+1;te<C.length;te++){let le=C[te];le.mid+=H,le.end+=H,le.start+=H}(B.isLast?h:f)(C,B,B.size,!0,"static")}}},[t,f,h,y,e,o,s]),[T,A]=Gu(()=>{let x=!1;return[k=>{if(!x){x=!0;let P=k.element.querySelector(".vuuPopupMenu");P&&$s(P,"click")}},k=>{if(x){x=!1;let P=k.element.querySelector(".vuuPopupMenu");P&&$s(P,"click")}}]},[]),w=gt((x,L)=>{let{current:N}=g;if(N&&t.current){l.current=x;let{current:k}=u,P=nt(k,x,N.size,L);if(P&&!P.isDraggedItem)if(P.isOverflowIndicator)c(d.current=!0),T(P);else{let{size:R}=N;(E(P)===k.length-1?h:f)(k,P,R,!0,L);let C=k.at(-1);A(C),c(d.current=!1)}i.current=L}},[t,f,h,A,T]),D=gt(()=>{var k;m();let{current:x}=u,L=mt(x),N=x[L];if(N)if(i.current=void 0,d.current)r(N.index,-1,{fromIndex:N.index,toIndex:-1,isExternal:N.isExternal});else{let P=mt(x,!0);r(N.index,P,{fromIndex:N.index,toIndex:P,isExternal:N.isExternal})}if(c(!1),t.current){let P=(k=t.current)==null?void 0:k.scrollTop;L<x.length&&(t.current.scrollTop=P)}},[m,t,r]),O=gt(()=>{m(!0)},[m]);return{beginDrag:S,drag:w,drop:D,handleScrollStart:b,handleScrollStop:v,releaseDrag:O,revealOverflowedItems:p}};import{jsx as nc}from"react/jsx-runtime";var Ju={beginDrag:()=>{},drag:()=>{},draggableRef:{current:null},drop:()=>{},isDragging:!1,isScrolling:!1,handleScrollStart:()=>{},handleScrollStop:()=>{},revealOverflowedItems:!1},Ks={start:0,end:1e3,contraStart:0,contraEnd:1e3},Yu=()=>Ju,ec=3,tc=(r,e)=>r.closest(e),rc=(r,e)=>{let t=`:is(${e}${br},.vuuOverflowContainer-OverflowIndicator)`,o=Array.from(r.querySelectorAll(t)).pop();return[o,Qu(o)]},yr=({allowDragDrop:r,containerRef:e,draggableClassName:t,getDragPayload:n,id:o,itemQuery:s="*",onDragStart:i,onDrop:a,onDropSettle:l,orientation:u,...d})=>{let p=Pe({start:0,end:0,contraStart:0,contraEnd:0}),[c,m]=qu({draggable:void 0,draggedItemIndex:-1,isDragging:!1}),f=Pe(null),h=Pe(null),g=Pe(!1),y=Pe({x:0,y:0}),E=Pe({x:0,y:0}),I=Pe(null),b=Pe(null),v=Pe(-1),S=Pe(-1),T=Pe(),{isDragSource:A,isDropTarget:w,onDragOut:D,onEndOfDragOperation:O,register:x}=Ss(o),L=Pe(),N=Pe(),k=Se(()=>{let{current:U}=L,{current:Q}=N;U&&Q&&(document.addEventListener("mousemove",U,!1),document.addEventListener("mouseup",Q,!1))},[]),P=Se(()=>{let{current:U}=L,{current:Q}=N;U&&Q&&(document.removeEventListener("mousemove",U,!1),document.removeEventListener("mouseup",Q,!1))},[]),R=Se((U,Q)=>{let{current:Z}=e;if(Z){let[q,W]=rc(Z,s),{CONTRA:J,CONTRA_END:ee,DIMENSION:ie,END:fe,START:K}=Ce(u),j=Q[ie],{[K]:xe,[fe]:ke}=q.getBoundingClientRect();p.current.start=U[K],p.current.end=W?Math.max(xe,U.right-j):g.current?U[K]+U[ie]-j:ke-j,p.current.contraStart=U[J],p.current.contraEnd=U[ee]}},[e,s,u]),M=Se(()=>{var q;let{current:U}=I;I.current=null;let{current:Q}=S,Z=(q=e.current)==null?void 0:q.querySelector(`${s}[data-index="${Q}"]`);Z&&Z.classList.remove("vuuDropTarget-settling"),S.current=-1,l==null||l(Q),m(W=>({...W,draggable:void 0})),U&&ju(U,"vuu-dropped")},[e,s,l]),V=Se(U=>{if(b.current&&f.current){let{mouseOffset:Q}=f.current,{POS:Z,SCROLL_POS:q,SCROLL_SIZE:W,CLIENT_SIZE:J}=Ce(u),{[q]:ee,[W]:ie,[J]:fe}=b.current,K=ie-fe,j=ee<K,xe=p.current.end,ke=ee>0&&U-Q[Z]<=p.current.start,Re=j&&U-Q[Z]>=xe;return ke?"bwd":Re?"fwd":""}},[b,u]),C=r===!0||r==="natural-movement"?_s:r==="drop-indicator"?Fs:r==="drag-copy"?Hs:Yu,F=Se((U,Q,Z)=>{var q;(q=T.current)==null||q.call(T,U,Q,Z)},[]),{isScrolling:H,startScrolling:B,stopScrolling:z}=Rs({containerRef:b,onScrollingStopped:F,orientation:u}),G=Se((U,Q,Z)=>{var q;v.current=Q,Z.isExternal?a==null||a(U,Q,{...Z,payload:(q=f.current)==null?void 0:q.payload}):a==null||a(U,Q,Z),S.current=Q,o&&(O==null||O(o)),f.current=null},[o,a,O]),{beginDrag:$,drag:_,drop:Y,handleScrollStart:X,handleScrollStop:ce,releaseDrag:te,...le}=C({...d,containerRef:e,isDragSource:A,isDropTarget:w,itemQuery:s,onDrop:G,orientation:u});T.current=ce;let oe=Se((U,Q)=>{let{CONTRA_POS:Z}=Ce(u),q=y.current[Z],W=A?Math.abs(q-Q):0;if(r===!0&&!A&&!w)return!1;let J=w===!1||W-U>5;if(f.current&&J)return D!=null&&D(o,f.current)&&(P(),te==null||te(),f.current=null),p.current=Ks,!0},[r,o,A,w,D,u,te,P]),ue=Se(U=>{let{CLIENT_POS:Q,CONTRA_CLIENT_POS:Z,POS:q}=Ce(u),{clientX:W,clientY:J}=U,{[Q]:ee,[Z]:ie}=U,fe=y.current[q],K=Math.abs(fe-ee),{current:j}=f;if(!oe(K,ie)&&(y.current.x=W,y.current.y=J,j)){let{draggableElement:xe,mouseOffset:ke}=j;if(p.current===Ks&&xe){let Re=y.current.x-ke.x,Oe=y.current.y-ke.y;xe.style.top=`${Oe}px`,xe.style.left=`${Re}px`}else if(K>0&&xe){let Re=fe<ee?"fwd":"bwd",Oe=V(ee),Qr=y.current[q]-ke[q];if(Oe&&g.current&&!H.current?(X==null||X(),B(Oe,1)):!Oe&&H.current&&z(),!H.current){let wt=Math.round(Math.max(p.current.start,Math.min(p.current.end,Qr))),zt=u==="horizontal"?"left":"top";xe.style[zt]=`${wt}px`,_(wt,Re)}}}},[_,oe,V,X,H,u,B,z]),he=Se(()=>{P(),f.current&&(I.current=f.current.draggableElement),Y(),m(U=>({...U,draggedItemIndex:-1,isDragging:!1}))},[Y,P]);L.current=ue,N.current=he;let ge=Se(U=>{f.current=U;let{draggableElement:Q,mouseOffset:Z}=U,{current:q}=e;if(q&&Q){let W=q.getBoundingClientRect(),J=Q.getBoundingClientRect();return R(W,J),y.current.x=J.left+Z.x,y.current.y=J.top+Z.y,$(Q),k(),!0}else return!1},[k,$,e,R]),re=Se(U=>{let{target:Q}=U,Z=tc(Q,s),{current:q}=e;if(q&&Z){let W=Ps(q,s);g.current=Ls(W,u),b.current=W;let J=q.getBoundingClientRect(),ee=Z.getBoundingClientRect(),ie=f.current=new hr(U,Z);R(J,ee),$(Z);let{dataset:{index:fe="-1"}}=Z;m({isDragging:!0,draggable:nc(gr,{element:ws(Z),onDropped:M,onTransitionEnd:M,ref:ie.setDraggable,style:Ms(ee,J),wrapperClassName:t}),draggedItemIndex:parseInt(fe)}),i==null||i(ie),k()}},[k,$,e,t,s,i,u,R,M]),ae=Se(U=>{let{CLIENT_POS:Q,POS:Z}=Ce(u),{[Q]:q}=U;Math.abs(q-E.current[Z])>ec&&e.current&&(h.current&&(window.clearTimeout(h.current),h.current=null),document.removeEventListener("mousemove",ae),document.removeEventListener("mouseup",pe,!1),re(U))},[e,$,u]),pe=Se(()=>{h.current&&(window.clearTimeout(h.current),h.current=null),document.removeEventListener("mousemove",ae,!1),document.removeEventListener("mouseup",pe,!1)},[ae]),Ne=Se(U=>{let{current:Q}=e;if(U.stopPropagation(),Q&&!U.defaultPrevented){let{clientX:Z,clientY:q}=U;y.current.x=E.current.x=Z,y.current.y=E.current.y=q,document.addEventListener("mousemove",ae,!1),document.addEventListener("mouseup",pe,!1),U.persist(),h.current=window.setTimeout(()=>{document.removeEventListener("mousemove",ae,!1),document.removeEventListener("mouseup",pe,!1),re(U.nativeEvent)},500)}},[e,re,ae,pe]),{current:se}=I;return Zu(()=>{if(se&&e.current){let U=v.current,Q=e.current.querySelector(`${s}[data-index="${U}"]`);Q&&(Q.classList.add("vuuDropTarget-settling"),requestAnimationFrame(()=>{let{top:Z,left:q}=Q.getBoundingClientRect(),W=getComputedStyle(se),J=parseInt(W.getPropertyValue("left")),ee=parseInt(W.getPropertyValue("top"));J!==q||ee!==Z?(se.classList.add("vuuDraggable-settling"),se.style.top=`${Z}px`,se.style.left=`${q}px`):M()}))}},[e,s,se,M]),Xu(()=>{o&&(A||w)&&x(o,r==="drop-only"?!1:ge,a)},[r,o,A,w,a,x,ge]),{...le,...c,isScrolling:H,onMouseDown:r&&r!=="drop-only"?Ne:void 0}};import{useCallback as Sr,useEffect as oc,useRef as zs}from"react";var Us=({dataHook:r,onDrop:e,onMoveListItem:t,selected:n,setHighlightedIndex:o,setSelected:s})=>{let i=zs([]),a=zs(r);a.current=r;let l=Sr((c,m,f)=>c===m?f:c<Math.min(m,f)||c>Math.max(m,f)?c:m<c?c-1:c+1,[]),u=Sr((c,m,f)=>c.map(g=>a.current.indexOfItemById(g)).map(g=>l(g,m,f)),[l]),d=Sr((c,m,f)=>{Ue(n)&&(i.current=u(n,c,m)),f.isExternal?e==null||e(c,m,f):t==null||t(c,m),o(-1)},[n,o,u,e,t]),p=Sr(c=>{o(c)},[o]);return oc(()=>{let{current:c}=i;if(Ue(c)){i.current=[];let m=Array.isArray(c)?c.map(f=>r.data[f].id):r.data[c].id;i.current=[],s(m)}},[r.data,s]),{handleDrop:d,onDropSettle:p}};var Xe=({allowDragDrop:r=!1,collapsibleHeaders:e,collectionHook:t,containerRef:n,contentRef:o,defaultHighlightedIndex:s,defaultSelected:i,disabled:a,disableAriaActiveDescendant:l,disableHighlightOnFocus:u,disableTypeToSelect:d,highlightedIndex:p,id:c,label:m="",listHandlers:f,onClick:h,onDragStart:g,onDrop:y,onHighlight:E,onKeyboardNavigation:I,onKeyDown:b,onMoveListItem:v,onSelect:S,onSelectionChange:T,restoreLastFocus:A,scrollContainerRef:w,selected:D,selectionStrategy:O,selectionKeys:x,stickyHeaders:L,tabToSelect:N,viewportRange:k})=>{let P=ac(D||i),R=(W,J)=>{var ee,ie;(ie=(ee=X.listHandlers).onKeyboardNavigation)==null||ie.call(ee,W,J),I==null||I(W,J)},M=Nt((W,J)=>{S&&J!==null&&S(W,t.itemById(J))},[t,S]),V=ic(()=>{var W,J;return w||{current:(J=(W=n.current)==null?void 0:W.querySelector(".vuuList-scrollContainer"))!=null?J:null}},[n,w]),C=Nt((W,J)=>{if(T){if(Fo(O)){let[ee]=J;T(W,t.itemById(ee))}else if(ut(O)){let ee=J.map(ie=>t.itemById(ie));T(W,ee)}}},[t,T,O]),{highlightedIndex:F,containerProps:{onKeyDown:H,onMouseMove:B,...z},setHighlightedIndex:G,...$}=ss({containerRef:V,defaultHighlightedIndex:s,disableHighlightOnFocus:u,highlightedIndex:p,itemCount:t.data.length,label:m,onHighlight:E,onKeyboardNavigation:R,restoreLastFocus:A,selected:P.current,viewportItemCount:10}),_=es({collapsibleHeaders:e,highlightedIdx:F,collectionHook:t}),Y=Nt(W=>{G(-1),g==null||g(W)},[g,G]),X=is({containerRef:n,defaultSelected:i,highlightedIndex:F,itemQuery:".vuuListItem",label:`${m}:useList`,onClick:h,onSelect:M,onSelectionChange:C,selected:D,selectionStrategy:O,selectionKeys:x,tabToSelect:N}),{handleDrop:ce,onDropSettle:te}=Us({dataHook:t,onDrop:y,onMoveListItem:v,selected:X.selected,setHighlightedIndex:G,setSelected:X.setSelected}),{setSelected:le}=X;sc(()=>{Ue(P.current)&&le([])},[D,t.data,le]);let{onMouseDown:oe,isDragging:ue,isScrolling:he,...ge}=yr({allowDragDrop:r,draggableClassName:"list-item",orientation:"vertical",containerRef:n,id:c,itemQuery:".vuuListItem",onDragStart:Y,onDrop:ce,onDropSettle:te,viewportRange:k}),{onKeyDown:re}=ls({disableTypeToSelect:d,highlightedIdx:F,highlightItemAtIndex:G,typeToNavigate:!0,items:t.data}),ae=Nt(W=>{var J,ee,ie;W.defaultPrevented||re==null||re(W),H(W),W.defaultPrevented||(ee=(J=X.listHandlers).onKeyDown)==null||ee.call(J,W),W.defaultPrevented||(ie=_==null?void 0:_.onKeyDown)==null||ie.call(_,W),W.defaultPrevented||b==null||b(W)},[_,H,b,X.listHandlers,re]),{isScrolling:pe,scrollIntoView:Ne}=fs({containerRef:V,contentRef:o,highlightedIdx:F,indexPositions:t.data,stickyHeaders:L}),se=pe.current||he.current,U=Nt(W=>{if(!se&&!a&&!ue){B();let J=rs(W.target);if(J!==-1&&J!==F){let ee=t.data[J];!ee||ee.disabled?G(-1):G(J)}}},[ue,se,a,G,B,F,t.data]),Q=()=>{var W;return F===void 0||F===-1||l||(W=t.data[F])==null?void 0:W.id};P.current=X.selected;let Z={"aria-activedescendant":Q(),onBlur:z.onBlur,onFocus:z.onFocus,onKeyDown:ae,onMouseDown:oe,onMouseDownCapture:z.onMouseDownCapture,onMouseLeave:z.onMouseLeave},q=f||{onClick:X.listHandlers.onClick,onMouseMove:U};return{focusVisible:$.focusVisible,controlledHighlighting:$.controlledHighlighting,highlightedIndex:F,keyboardNavigation:$.keyboardNavigation,listHandlers:q,listItemHeaderHandlers:_,listControlProps:Z,scrollIntoView:Ne,selected:X.selected,setHighlightedIndex:G,setIgnoreFocus:$.setIgnoreFocus,setSelected:X.setSelected,...ge}};import{useCallback as Gs,useMemo as lc,useRef as uc,useState as Ws}from"react";var cc=(r,e,t=0)=>r===0?0:t===0?r*e:r-1*(e+t)+e,vr=({displayedItemCount:r,getItemHeight:e,height:t,itemCount:n,itemGapSize:o,itemHeight:s=36,size:i})=>{let[a,l]=Ws(s),[,u]=Ws({}),d=uc(null),[p,c]=lc(()=>{let h=0,g=a!=null?a:s,y=cc(n,g,o);if(t!==void 0)return[y,void 0];let E=Math.min(r,n)||r;return typeof e=="function"?h+=Array(E).fill(0).reduce((b,v,S)=>b+e(S)+o,0)-o:h+=E*Number(g)+(E-1)*o,[y,h]},[r,e,t,n,o,s,a]),m=Gs(({height:h})=>{typeof h=="number"&&l(h)},[]),f=Gs(h=>{d.current=h,u({})},[]);return ze(d,Oo,m,!0),{computedListHeight:c,contentHeight:p,listClientHeight:i==null?void 0:i.height,listItemHeight:a,rowHeightProxyRef:f}};import{useIsomorphicLayoutEffect as dc}from"@salt-ds/core";import{useCallback as pc,useMemo as fc,useRef as bn,useState as mc}from"react";var Qs=(r,e,t,n)=>{let o=Math.ceil(e/n),s=Math.floor(r/n),i=Math.ceil(s+o-1);return{atStart:s===0,atEnd:i===t-1,from:s,to:i}},Ir=({containerSize:r,itemCount:e,itemGapSize:t=0,itemSize:n,onViewportScroll:o})=>{let s=bn(0),i=bn(0),a=bn(0),l=fc(()=>Qs(a.current,r,e,n+t),[r,e,n,t]),[u,d]=mc(l);return dc(()=>{d(l)},[l]),{onVerticalScroll:pc(c=>{let m=c.target.scrollTop;if(m!==a.current){a.current=m;let f=n+t,h=Qs(m,r,e,f);(h.from!==s.current||h.to!==i.current)&&(s.current=h.from,i.current=h.to,o==null||o(h.from,h.to),d(h))}},[n,t,r,e,o]),viewportRange:u}};import{Fragment as wc,jsx as st,jsxs as js}from"react/jsx-runtime";import{createElement as Cc}from"react";var Tc="No data to display",Ze="vuuList",Ot=yc(function({ListItem:e=dr,ListPlaceholder:t,allowDragDrop:n,children:o,className:s,collapsibleHeaders:i=!1,defaultHighlightedIndex:a,defaultSelected:l,disabled:u=!1,disableFocus:d=!1,disableTypeToSelect:p,displayedItemCount:c=10,emptyMessage:m,focusVisible:f,getItemHeight:h,getItemId:g,height:y,highlightedIndex:E,id:I,itemGapSize:b=0,itemHeight:v,itemTextHighlightPattern:S,itemToString:T=Ie,listHandlers:A,maxHeight:w,maxWidth:D,minHeight:O,minWidth:x,onClick:L,onDragStart:N,onDrop:k,onMoveListItem:P,onSelect:R,onSelectionChange:M,onHighlight:V,restoreLastFocus:C,selected:F,selectionStrategy:H,checkable:B=H==="multiple",scrollingApiRef:z,selectionKeys:G,showEmptyMessage:$=!1,source:_,style:Y,stickyHeaders:X,tabIndex:ce=0,tabToSelect:te,...le},oe){var mo,ho;let ue=gc(I),he=yn(null),ge=yn(null),re=yn(null),[ae,pe]=Ic(),Ne=vc(Ae=>{pe(Ae)},[]),se=je({id:ue,label:"List",source:_,children:o,options:{collapsibleHeaders:i,getItemId:g,itemToString:T}}),{listClientHeight:U,computedListHeight:Q,listItemHeight:Z,rowHeightProxyRef:q}=vr({displayedItemCount:c,getItemHeight:h,height:y,itemCount:se.data.length,itemGapSize:b,itemHeight:v,rootRef:he,size:ae}),{onVerticalScroll:W,viewportRange:J}=Ir({containerSize:(ho=(mo=U!=null?U:Q)!=null?mo:ae==null?void 0:ae.height)!=null?ho:0,itemCount:se.data.length,itemGapSize:b,itemSize:Z}),{draggable:ee,draggedItemIndex:ie,dropIndicator:fe,focusVisible:K,highlightedIndex:j,listControlProps:xe,listHandlers:ke,listItemHeaderHandlers:Re,scrollIntoView:Oe,selected:Qr}=Xe({allowDragDrop:n,collapsibleHeaders:i,collectionHook:se,containerRef:he,contentRef:re,defaultHighlightedIndex:a,defaultSelected:se.itemToCollectionItemId(l),disabled:u,disableTypeToSelect:p,highlightedIndex:E,id:ue,label:"List",listHandlers:A,onClick:L,onDragStart:N,onDrop:k,onMoveListItem:P,onSelect:R,onSelectionChange:M,onHighlight:V,restoreLastFocus:C,scrollContainerRef:ge,selected:se.itemToCollectionItemId(F),selectionStrategy:H,selectionKeys:G,stickyHeaders:X,tabToSelect:te,viewportRange:J});sr({collectionHook:se,forwardedRef:z,scrollableRef:he,scrollIntoView:Oe});let wt=f!=null?f:K,zt=function(de,De,Me,ye){let et=Cc(e,{...Re,className:xn(`${Ze}Header`,{focusVisible:i&&wt===de.value}),"aria-expanded":ye,"data-index":i?de.value:void 0,"data-highlighted":de.value===j||void 0,"data-sticky":X,"data-selectable":!1,id:De,itemHeight:co(de.value),key:`header-${de.value}`,label:Me});return de.value+=1,et},co=h===void 0?()=>v:h;function Aa(Ae,de,De){var Wt,go;let{disabled:Me,value:ye,id:et,label:Ut}=de,Gt=Sc(ye),Et={className:xn((Wt=ye==null?void 0:ye.props)==null?void 0:Wt.className,{vuuHighlighted:De.value===j,vuuFocusVisible:wt===De.value,["vuuDraggable-dragAway"]:ie===De.value}),disabled:Me||u,id:et,item:Gt?void 0:(go=de==null?void 0:de.value)!=null?go:void 0,itemHeight:co(De.value),itemTextHighlightPattern:S,key:et,"data-index":De.value,label:Ut,role:"option",selected:qt(Qr,de),showCheckbox:B};Ae.push(Gt?xc(ye,Et):st(e,{...Et})),De.value+=1}let Fa=function(de,De,Me){let{count:ye=0,id:et,expanded:Ut,label:Gt=""}=De[Me.value],Et=zt(Me,et,Gt,Ut),Wt=Ut!==!1?[Et].concat(po(De,Me,Me.value+ye)||[]):Et;de.push(st("div",{role:"group",children:Wt},et))},po=(Ae,de={value:0},De=Ae.length)=>{let Me=[];for(;de.value<De;){let ye=Ae[de.value];ye.header?Me.push(zt(de,ye.id,ye.label,ye.expanded===!1)):ye.childNodes?Fa(Me,Ae,de):Aa(Me,ye,de)}return Me};function Va(){return m||$?st("span",{className:`${Ze}-empty-message`,children:m!=null?m:Tc}):null}let fo=se.data.length===0,Ba=()=>{if(fo)Va();else{let Ae=se.data;return po(Ae)}},$a="auto",_a={"--list-borderWidth":"var(--vuuList-borderWidth, var(--salt-size-border, 0))","--list-item-gap":b?`${b}px`:void 0,"--computed-list-height":Q===void 0?void 0:`${Q}px`,minWidth:x,minHeight:O,maxWidth:D,maxHeight:w};return js(hc,{"aria-multiselectable":H==="multiple"||H==="extended"||H==="extended-multi-range"||void 0,...le,...ke,...xe,className:xn(Ze,s,{[`${Ze}-collapsible`]:i,[`${Ze}-contentSized`]:Q!==void 0,[`${Ze}-empty`]:fo,vuuFocusVisible:j===un}),height:Q!=null?Q:y,id:`${ue}`,onResize:Ne,ref:bc(he,oe),role:"listbox",onScroll:W,style:{...Y,..._a},tabIndex:u||d?void 0:ce,children:[st(cr,{ref:q,height:v}),se.data.length===0&&t!==void 0?st(wc,{children:st(t,{})}):st("div",{className:`${Ze}-viewport`,ref:ge,children:js("div",{className:`${Ze}-scrollingContentContainer`,ref:re,style:{height:$a},children:[Ba(),fe,ee]})})]})});import{makePrefixer as Mc,useForkRef as Pc,useIdMemo as Lc}from"@salt-ds/core";function Xs(r){var e,t,n="";if(typeof r=="string"||typeof r=="number")n+=r;else if(typeof r=="object")if(Array.isArray(r))for(e=0;e<r.length;e++)r[e]&&(t=Xs(r[e]))&&(n&&(n+=" "),n+=t);else for(e in r)r[e]&&(n&&(n+=" "),n+=e);return n}function Sn(){for(var r,e,t=0,n="";t<arguments.length;)(r=arguments[t++])&&(e=Xs(r))&&(n&&(n+=" "),n+=e);return n}import{forwardRef as kc,memo as Rc,useRef as Js}from"react";import{useMemo as Ec}from"react";var Tr=class{constructor(e=0,t=0){this.keys=new Map,this.free=[],this.nextKeyValue=0,this.reset(e,t)}next(){return this.free.length?this.free.pop():this.nextKeyValue++}reset(e,t){this.keys.forEach((o,s)=>{(s<e||s>=t)&&(this.free.push(o),this.keys.delete(s))});let n=t-e;this.keys.size+this.free.length>n&&(this.free.length=n-this.keys.size);for(let o=e;o<t;o++)if(!this.keys.has(o)){let s=this.next();this.keys.set(o,s)}}keyFor(e){return this.keys.get(e)}};var Dc=([r],[e])=>r-e,Zs=5,qs=({data:r,listItemGapSize:e=0,listItemHeight:t,viewportRange:n})=>{let o=Ec(()=>new Tr(0,1),[]),s=t+e,i=Math.max(0,n.from-Zs),a=Math.min(r.length,n.to+Zs);return o.reset(i,a),r.slice(i,a).map((u,d)=>[o.keyFor(d+i),(d+i)*s,d+i+1,u]).sort(Dc)};import{jsx as wr,jsxs as Oc}from"react/jsx-runtime";var Hc="No data to display",Cr=Mc("saltList"),Nc=Rc(dr),Uy=kc(function({borderless:e,children:t,className:n,collapsibleHeaders:o=!1,defaultHighlightedIndex:s,defaultSelected:i,disabled:a=!1,disableFocus:l=!1,disableTypeToSelect:u,displayedItemCount:d=10,emptyMessage:p,getItemHeight:c,getItemId:m,height:f,highlightedIndex:h,id:g,itemGapSize:y=0,itemHeight:E,itemTextHighlightPattern:I,itemToString:b,maxHeight:v,maxWidth:S,minHeight:T,minWidth:A,onDragStart:w,onDrop:D,onSelect:O,onSelectionChange:x,onViewportScroll:L,onHighlight:N,restoreLastFocus:k,selected:P,selectionStrategy:R,scrollingApiRef:M,selectionKeys:V,showEmptyMessage:C=!1,source:F,style:H,stickyHeaders:B,tabToSelect:z,width:G,...$},_){let Y=Lc(g),X=Js(null),ce=Js(null),te=je({id:Y,label:"List",source:F,children:t,options:{collapsibleHeaders:o,getItemId:m,itemToString:b}}),{contentHeight:le,listItemHeight:oe,listHeight:ue}=vr({borderless:e,displayedItemCount:d,height:f,itemCount:te.data.length,itemGapSize:y,itemHeight:E,rootRef:X,rowHeightRef:ce}),{focusVisible:he,highlightedIndex:ge,listControlProps:re,listHandlers:ae,scrollIntoView:pe,selected:Ne}=Xe({collapsibleHeaders:o,collectionHook:te,containerRef:X,defaultHighlightedIndex:s,defaultSelected:te.itemToCollectionItemId(i),disabled:a,disableTypeToSelect:u,highlightedIndex:h,label:Y,onSelect:O,onSelectionChange:x,onHighlight:N,restoreLastFocus:k,selected:te.itemToCollectionItemId(P),selectionStrategy:R,selectionKeys:V,stickyHeaders:B,tabToSelect:z}),{onVerticalScroll:se,viewportRange:U}=Ir({containerSize:typeof ue=="number"?ue:0,itemCount:te.data.length,itemGapSize:y,itemSize:oe});console.log({viewPortRange:U});let Q=qs({data:te.data,listItemGapSize:y,listItemHeight:oe,viewportRange:U});sr({collectionHook:te,forwardedRef:M,scrollableRef:X,scrollIntoView:pe});function Z(ie,fe,K){let[j,xe,ke,Re]=fe,Oe=ke-1;ie.push(wr(Nc,{"aria-setsize":te.data.length,"aria-posinset":ke,className:Sn(n,{saltHighlighted:Oe===ge,saltFocusVisible:he===Oe}),"data-idx":Oe,item:Re,label:Re.label,"data-offset":xe,role:"option",selected:qt(Ne,Re),id:Re.id,translate3d:xe},j)),K.value+=1}function q(ie,fe={value:0},K=ie.length){let j=[];for(;fe.value<K;){let xe=ie[fe.value];Z(j,xe,fe)}return j}function W(){return p||C?wr("span",{className:Cr("empty-message"),children:p!=null?p:Hc}):null}let J=()=>{if(Q.length)return q(Q);W()},ee={"--list-item-gap":y?`${y}px`:void 0,minWidth:A,minHeight:T,width:G!=null?G:"100%",height:f!=null?f:"100%",maxWidth:S!=null?S:G,maxHeight:v!=null?v:ue};return wr("div",{...$,...ae,...re,className:Sn(Cr(),n,Cr("virtualized")),id:`${Y}`,ref:Pc(X,_),role:"listbox",onScroll:se,style:{...H,...ee},tabIndex:a||l?void 0:0,children:Oc("div",{className:Cr("scrollingContentContainer"),style:{height:le},children:[wr(cr,{ref:ce}),J()]})})});import Ac from"classnames";import{jsx as Fc}from"react/jsx-runtime";var Ys="vuuRadioIcon",ei=({checked:r=!1,...e})=>Fc("span",{...e,className:Ac(Ys,{[`${Ys}-checked`]:r})});import{useControlled as Vc}from"@salt-ds/core";import{useCallback as vn,useMemo as Bc}from"react";var ti=({collectionHook:r,defaultHighlightedIndex:e,defaultIsOpen:t,defaultSelected:n,highlightedIndex:o,isOpen:s,itemToString:i=Ie,listRef:a,onHighlight:l,onOpenChange:u,onSelectionChange:d,onSelect:p,selected:c,selectionStrategy:m})=>{let f=ut(m),[h,g]=Vc({controlled:s,default:t!=null?t:!1,name:"useDropdownList"}),y=vn((S,T)=>{f||(g(!1),u==null||u(!1)),(Array.isArray(T)||T)&&(d==null||d(S,T))},[f,u,d,g]),E=vn((S,T)=>{f||(g(!1),u==null||u(!1)),p==null||p(S,T)},[f,u,p,g]),I=Xe({collectionHook:r,defaultHighlightedIndex:(e!=null?e:o===void 0)?0:void 0,defaultSelected:n,label:"DropDown",onSelectionChange:y,onSelect:E,containerRef:a,highlightedIndex:o,onHighlight:l,selected:c,selectionStrategy:m,tabToSelect:!f}),b=vn(S=>{g(S),u==null||u(S)},[u,g]),v=Bc(()=>{if(Array.isArray(I.selected)){let S=I.selected.map(T=>r.itemById(T));if(S.length===0)return;if(S.length===1){let[T]=S;return T===null?void 0:i(T)}else return`${S.length} items selected`}},[r,i,I.selected]);return{isOpen:h,onOpenChange:b,triggerLabel:v,...I}};import{jsx as In,jsxs as Gc}from"react/jsx-runtime";var VS=Kc(function({"aria-label":e,children:t,defaultIsOpen:n,defaultSelected:o,id:s,isOpen:i,itemToString:a=Ie,onOpenChange:l,onSelectionChange:u,onSelect:d,selected:p,selectionStrategy:c,source:m,triggerComponent:f,ListItem:h,ListProps:g,width:y=180,...E},I){let b=Uc(s),v=ri(null),S=ri(null),T=$c(v,I),A=je({id:b,source:m,children:t,options:{itemToString:a}}),{highlightedIndex:w,triggerLabel:D,listHandlers:O,listControlProps:x,selected:L,...N}=ti({collectionHook:A,defaultHighlightedIndex:g==null?void 0:g.defaultHighlightedIndex,defaultIsOpen:n,defaultSelected:A.itemToCollectionItemId(o),highlightedIndex:g==null?void 0:g.highlightedIndex,isOpen:i,itemToString:a,listRef:S,onHighlight:g==null?void 0:g.onHighlight,onOpenChange:l,onSelectionChange:u,onSelect:d,selected:A.itemToCollectionItemId(p),selectionStrategy:c}),k=zc(R=>Array.isArray(R)?R.map(V=>A.itemById(V)):A.itemById(R),[A]),P=()=>{let R={"aria-activedescendant":N.isOpen?x==null?void 0:x["aria-activedescendant"]:void 0,"aria-label":e};if(f){let M=f.props;return _c(f,Zt(M,{...N.isOpen?x:{},...R}))}else return In(Qo,{label:D,...N.isOpen?x:{},...R})};return In(Qt,{collectionHook:A,children:Gc(ct,{...E,id:b,isOpen:N.isOpen,onOpenChange:N.onOpenChange,placement:(g==null?void 0:g.width)===void 0?"below-full-width":"below",ref:T,width:y,children:[P(),In(Ot,{ListItem:h,itemToString:a,...g,highlightedIndex:w,listHandlers:O,onSelectionChange:u,onSelect:d,ref:S,selected:L===void 0?void 0:k(L),selectionStrategy:c})]})})});import{useControlled as ni}from"@salt-ds/core";import{useLayoutEffectSkipFirst as Wc}from"@vuu-ui/vuu-layout";import{useCallback as ve,useRef as Tn,useState as Qc}from"react";var jc=["Enter"],oi=({allowBackspaceClearsSelection:r,allowFreeText:e,ariaLabel:t,collectionHook:n,defaultIsOpen:o,defaultSelected:s,defaultValue:i,onBlur:a,onFocus:l,onChange:u,onDeselect:d,onSelect:p,id:c,initialHighlightedIndex:m=-1,isOpen:f,itemCount:h,itemsToString:g,itemToString:y=Ie,listRef:E,onOpenChange:I,onSelectionChange:b,onSetSelectedText:v,selected:S,selectionKeys:T=jc,selectionStrategy:A,value:w,InputProps:D={onBlur:a,onFocus:l,onChange:u,onSelect:p}})=>{let O=ut(A),{data:x,setFilterPattern:L}=n,N=Tn(null),k=Tn(O?[]:null),P=Tn(!0),[R,M]=ni({controlled:f,default:o!=null?o:!1,name:"useDropdownList"}),[V,C]=ni({controlled:void 0,default:i!=null?i:w,name:"ComboBox",state:"value"}),[F,H]=Qc(!0),B=ve(K=>{var j;Array.isArray(K)||K==null&&((j=N.current)==null||j.call(N,-1))},[]),z=ve((K,j=!0)=>{C(K),j&&L(K===""?void 0:K)},[L,C]),G=ve(K=>{let j=e&&V!=null?V:"";return Array.isArray(K)?K.length===1?j=y(K[0]):K.length>1&&(j=(g==null?void 0:g(K))||""):K&&(j=y(K)),j!==V?(z(j,!O),v==null||v(j),!0):!1},[e,O,y,g,v,z,V]),$=ve(()=>{let{current:K}=k;G(K)&&K&&(Array.isArray(K)||K)&&(b==null||b(null,K))},[b,G]),_=ve(()=>{if(e){let K=V==null?void 0:V.trim(),{current:j}=k;if(K){if(h===0&&K)return O?b==null||b(null,[K]):b==null||b(null,K),k.current=null,!0;j&&!O&&j&&!Array.isArray(j)&&y(j)}}return!1},[e,V,h,O,b,y]),Y=ve((K,j)=>{K&&O&&z("",!1),M(K),I==null||I(K,j),!K&&j!=="Escape"&&(_()||$())},[$,O,I,_,M,z]),X=ve((K,j)=>{k.current=j,O||Y(!1,"select")},[Y,O]),ce=ve(()=>{H(!1)},[]),{focusVisible:te,setHighlightedIndex:le,highlightedIndex:oe,listControlProps:ue,listHandlers:he,selected:ge}=Xe({collectionHook:n,containerRef:E,defaultHighlightedIndex:m,defaultSelected:n.itemToCollectionItemId(s),disableAriaActiveDescendant:F,disableHighlightOnFocus:!0,disableTypeToSelect:!0,label:"combobox",onKeyboardNavigation:ce,onSelectionChange:X,selected:n.itemToCollectionItemId(S),selectionKeys:T,selectionStrategy:A,tabToSelect:!O});N.current=le;let{onClick:re}=he,ae=ve(K=>{var j;(j=document.getElementById(`${c}-input`))==null||j.focus(),re==null||re(K)},[c,re]),pe=ve(K=>{let j=K.target.value;C(j),j&&j.trim().length?L(j):L(void 0),M(!0)},[L,M,C]),Ne=ve(K=>{K.key==="Backspace"&&r&&(k.current=null,d==null||d())},[r,d]),{onFocus:se=l}=D,{onFocus:U}=ue,Q=ve(K=>{H(!1),U==null||U(K),se==null||se(K)},[se,U]),Z=ve(K=>{let j=K.relatedTarget;return(j==null?void 0:j.id)===`${c}-list`},[c]),{onBlur:q=a}=D,{onBlur:W}=ue,J=ve(K=>{Z(K)||(W==null||W(K),q==null||q(K),H(!0),P.current=!0)},[Z,W,q]),{onSelect:ee}=D,ie=ve(K=>{P.current?P.current=!1:H(!0),ee==null||ee(K)},[ee]);Wc(()=>{Ue(ge)?B(ge):le(m)},[B,h,m,ge,le,M]);let fe={...D.inputProps,"aria-label":t,autoComplete:"off",onKeyDown:Ne};return{focusVisible:te,highlightedIndex:oe,isOpen:R,onOpenChange:Y,inputProps:{...D,id:`${c}-input`,inputProps:fe,onChange:pe,onSelect:ie,role:"combobox",value:V},listControlProps:{...ue,onBlur:J,onFocus:Q},listHandlers:{...he,onClick:ae},selected:k.current}};import Xc from"classnames";import{jsx as qc}from"react/jsx-runtime";var Zc="vuuChevronIcon",si=r=>{let{direction:e,...t}=r;return qc("span",{...t,className:Xc(Zc,e)})};import{jsx as Er,jsxs as od}from"react/jsx-runtime";var nd=ed(function({InputProps:e,ListProps:t,PopupProps:n,ListItem:o,"aria-label":s,allowBackspaceClearsSelection:i,allowFreeText:a,children:l,defaultIsOpen:u,defaultSelected:d,defaultValue:p,disabled:c,disableFilter:m,onBlur:f,onFocus:h,onChange:g,onSelect:y,onSetSelectedText:E,getFilterRegex:I,id:b,initialHighlightedIndex:v=-1,isOpen:S,itemToString:T=Ie,itemsToString:A,onDeselect:w,onOpenChange:D,onSelectionChange:O,selected:x,selectionKeys:L,selectionStrategy:N,source:k,value:P,width:R=180,...M},V){let C=Jc(b),F=rd(null),H=re=>Array.isArray(re)&&re.length>0?re[0]:void 0,z=((re,ae)=>{let pe=re?H(re):ae?H(ae):void 0;return pe?T(pe):""})(x,d),G=je({id:C,source:k,children:l,options:{disableFilter:m,filterPattern:z,getFilterRegex:I,itemToString:T}}),{focusVisible:$,highlightedIndex:_,inputProps:{endAdornment:Y,...X},isOpen:ce,listHandlers:te,listControlProps:le,onOpenChange:oe,selected:ue}=oi({InputProps:e,allowBackspaceClearsSelection:i,allowFreeText:a,ariaLabel:s,collectionHook:G,defaultIsOpen:u,defaultSelected:d,defaultValue:p,disabled:c,initialHighlightedIndex:v,itemCount:G.data.length,label:M.title,listRef:F,onBlur:f,onDeselect:w,onFocus:h,onChange:g,onSelect:y,id:C,isOpen:S,itemToString:T,itemsToString:A,onOpenChange:D,onSelectionChange:O,onSetSelectedText:E,selected:x,selectionKeys:L,selectionStrategy:N,value:z}),he=td(()=>{ce?oe(!1,"toggle"):oe(!0)},[ce,oe]);return Er(Qt,{collectionHook:G,children:od(ct,{...M,PopupProps:n,id:C,isOpen:ce,onOpenChange:oe,openOnFocus:!0,ref:V,width:R,children:[Er(Yc,{...X,disabled:c,...le,endAdornment:Y===null?null:Er(si,{direction:ce?"up":"down",onClick:he})}),Er(Ot,{...t,ListItem:o,defaultSelected:void 0,focusVisible:$,highlightedIndex:_,itemTextHighlightPattern:String(X.value)||void 0,listHandlers:te,onSelectionChange:O,ref:F,selected:ue,selectionStrategy:N,tabIndex:-1})]})})});import{Button as sd}from"@salt-ds/core";import id from"classnames";import{forwardRef as ad,useCallback as ld}from"react";import{jsx as cd}from"react/jsx-runtime";var ii="vuuCycleStateButton",ud=(r,e)=>{let t=e.indexOf(r.toUpperCase());return t===e.length-1?e[0]:e[t+1]},Gv=ad(function({className:e,onCommit:t,value:n="",values:o,...s},i){let a=ld(l=>{let u=ud(n,o);t(l,u).then(d=>{d!==!0&&console.error(d)})},[t,n,o]);return cd(sd,{...s,className:id(ii,e,`${ii}-${n.toLowerCase()}`),onClick:a,ref:i,children:n})});import{getEditRuleValidator as dd}from"@vuu-ui/vuu-utils";var qv=r=>e=>pd(r,e);function pd(r,e){let t;for(let n of r){let o=dd(n.name);if(o){let s=o(n,e);switch(s){case!0:break;case!1:t===void 0&&(t=!1);break;default:t===void 0||t===!1?t=s:t+=`::${s}`}}else throw Error(`editable-utils applyRules, no validator registered for rule '${n.name}'`)}return t}import{useLayoutEffectSkipFirst as fd}from"@vuu-ui/vuu-layout";import{dispatchCustomEvent as ai}from"@vuu-ui/vuu-utils";import{useCallback as Dr,useRef as Cn,useState as li}from"react";var sI=()=>(console.warn("onCommit handler has not been provided to InputCell cell renderer"),Promise.resolve(!0)),iI=({clientSideEditValidationCheck:r,initialValue:e,onCommit:t,type:n})=>{let[o,s]=li(),[i,a]=li(e),l=Cn(e),u=Cn(!1),d=Cn(!1);fd(()=>{a(e)},[e]);let p=Dr(h=>{if(u.current){d.current=!0;let g=r==null?void 0:r(i);g?s(g):(s(void 0),console.log(`commit value ${i}`),t(i).then(y=>{y===!0?(u.current=!1,ai(h,"vuu-commit")):s(y)}))}else ai(h,"vuu-commit"),d.current=!1},[r,t,i]),c=Dr(h=>{h.key==="Enter"?p(h.target):h.key==="ArrowRight"||h.key==="ArrowLeft"||h.key==="ArrowUp"||h.key==="ArrowDown"?h.stopPropagation():h.key==="Escape"&&u.current&&(u.current=!1,s(void 0),a(l.current))},[p]),m=Dr(h=>{u.current&&p(h.target)},[p]),f=Dr(h=>{let g=h.target.value;if(n==="number"&&!isNaN(parseFloat(g))&&(g=parseFloat(g)),u.current=i!==l.current,a(g),d.current&&i!==void 0){let y=r==null?void 0:r(i);y!==o&&y!==!1&&s(y)}},[r,o,n,i]);return{inputProps:{onBlur:m,onKeyDown:c},onChange:f,value:i!=null?i:"",warningMessage:o}};import md from"classnames";import{useCallback as ui,useLayoutEffect as hd,forwardRef as gd,useRef as wn}from"react";import{Input as bd,useControlled as ci}from"@salt-ds/core";import{jsx as En}from"react/jsx-runtime";var Mr="vuuEditableLabel",di=gd(function({className:e,defaultEditing:t,defaultValue:n,editing:o,onChange:s,onEnterEditMode:i,onExitEditMode:a,value:l,...u},d){let p=wn(null),c=wn(!1),[m,f]=ci({controlled:l,default:n!=null?n:"",name:"EditableLabel",state:"value"}),[h,g]=ci({controlled:o,default:t!=null?t:!1,name:"EditableLabel",state:"editing"}),y=ui(D=>{g(c.current=D)},[g]),E=wn(m);hd(()=>{h&&p.current!==null&&(p.current.select(),p.current.focus())},[h,p]);let I=ui(()=>{y(!0),i&&i()},[i,y]),b=({cancelEdit:D=!1,allowDeactivation:O=!1}={})=>{y(!1);let x=E.current;x!==m&&(D?f(x):E.current=m),a&&a(x,m,O,D)},v=D=>{let{value:O}=D.target;f(O),s&&s(O)},S=()=>{I()},T=()=>{c.current&&b({allowDeactivation:!0})},A=D=>{h&&D.key==="Enter"?(D.stopPropagation(),b()):D.key==="ArrowRight"||D.key==="ArrowLeft"?D.stopPropagation():D.key==="Escape"&&b({cancelEdit:!0})},w=md(Mr,e,{[`${Mr}-editing`]:h});return En("div",{...u,className:w,onDoubleClick:S,"data-text":m,ref:d,children:h?En(bd,{inputProps:{className:`${Mr}-input`,spellCheck:!1},value:m,onBlur:T,onChange:v,onKeyDown:A,inputRef:p,style:{padding:0},textAlign:"left",variant:"secondary"}):En("span",{className:`${Mr}-label`,children:m})})});import xd from"classnames";import{forwardRef as yd}from"react";import{jsx as pi}from"react/jsx-runtime";var Dn="vuuExpandoInput",Sd=()=>{},NI=yd(function({className:e,errorMessage:t,value:n,inputProps:o,onCommit:s=Sd,...i},a){return pi("div",{className:xd(Dn,e,{[`${Dn}-error`]:t}),"data-text":n,children:pi(Mn,{...i,errorMessage:t,inputProps:{...o,className:`${Dn}-input`},onCommit:s,ref:a,style:{padding:0},textAlign:"left",value:n,variant:"secondary"})})});import{jsx as Id,jsxs as Td}from"react/jsx-runtime";var vd=r=>{let{onToggle:e,checked:t,label:n}=r;return Td("div",{className:"vuuCheckbox",onClick:e,onKeyUp:o=>o.key===" "&&e(),children:[Id(lr,{tabIndex:0,checked:t}),n]})};import{jsx as fi,jsxs as mi}from"react/jsx-runtime";var Cd=r=>{let{onClick:e,checked:t,label:n,groupName:o}=r;return mi("div",{className:"vuuRadioButton",onClick:e,children:[mi("div",{className:"radio",children:[fi("input",{type:"radio",name:o}),fi(ei,{checked:t})]}),n]})};import{useId as Nd}from"@vuu-ui/vuu-layout";import{Table as Od}from"@vuu-ui/vuu-table";import{Input as Ad}from"@salt-ds/core";import{forwardRef as Fd,useMemo as Vd}from"react";import{registerComponent as wd}from"@vuu-ui/vuu-utils";import{jsx as Md,jsxs as Pd}from"react/jsx-runtime";var Ed="vuuSearchCell",Dd=({column:r,columnMap:e,row:t})=>{let n=e[r.name],o=t[n];return Pd("div",{className:Ed,tabIndex:-1,children:[Md("span",{"data-icon":"draggable"}),o]})};wd("search-cell",Dd,"cell-renderer",{serverDataType:"private"});import{useControlledTableNavigation as Ld}from"@vuu-ui/vuu-table";import{useCallback as Pn,useMemo as kd,useState as Rd}from"react";var Hd=(r,e)=>t=>r.map(({name:n})=>t[e[n]]).join(" "),hi=({columnMap:r,columns:e,dataSource:t,defaultIsOpen:n,isOpen:o,itemToString:s=Hd(e,r),onOpenChange:i,onSelect:a,searchColumns:l})=>{let[u,d]=Rd(""),[p,c]=Jt({controlled:o,default:n!=null?n:!1,name:"useDropdownList"}),{highlightedIndexRef:m,onKeyDown:f,tableRef:h}=Ld(-1,t.size),g=kd(()=>l.map(S=>`${S} starts "__VALUE__"`).join(" or "),[l]),y=Pn((S,T)=>{c(S),i==null||i(S,T)},[i,c]),E=Pn(S=>{let{value:T}=S.target;if(d(T),T&&T.trim().length){let A=g.replaceAll("__VALUE__",T);t.filter={filter:A}}else t.filter={filter:""};c(!0)},[g,t,c]),I=Pn(S=>{let T=s(S);d(T),a(S),y==null||y(!1,"select")},[y,s,a]),b={inputProps:{autoComplete:"off",onKeyDown:f},onChange:E},v={onSelect:I};return{highlightedIndex:m.current,inputProps:b,isOpen:p,onOpenChange:y,tableHandlers:v,tableRef:h,value:u}};import{jsx as Ln,jsxs as $d}from"react/jsx-runtime";var Bd="vuuInstrumentPicker",D0=Fd(function({TableProps:{dataSource:e,...t},className:n,columnMap:o,disabled:s,id:i,itemToString:a,onOpenChange:l,onSelect:u,schema:d,searchColumns:p,width:c,...m},f){let h=Nd(i),{highlightedIndex:g,inputProps:y,isOpen:E,onOpenChange:I,tableHandlers:b,tableRef:v,value:S}=hi({columnMap:o,columns:t.config.columns,dataSource:e,itemToString:a,onOpenChange:l,onSelect:u,searchColumns:p}),T=Vd(()=>Ln("span",{"data-icon":"chevron-down"}),[]),A={...t,config:{...t.config,zebraStripes:!1}};return $d(ct,{...m,fullWidth:!0,id:h,isOpen:E,onOpenChange:I,openOnFocus:!0,placement:"below-full-width",ref:f,width:c,children:[Ln(Ad,{...y,disabled:s,endAdornment:T,value:S}),Ln(Od,{rowHeight:25,renderBufferSize:100,...A,...b,className:`${Bd}-list`,height:200,highlightedIndex:g,dataSource:e,navigationStyle:"row",ref:v,showColumnHeaders:!1})]})});import{registerComponent as Vp}from"@vuu-ui/vuu-layout";import{Table as Bp,useControlledTableNavigation as $p}from"@vuu-ui/vuu-table";import{Input as _p}from"@salt-ds/core";import Kp from"classnames";import{useCallback as zp}from"react";import{registerComponent as _d}from"@vuu-ui/vuu-utils";import{jsx as Ud,jsxs as Gd}from"react/jsx-runtime";var Kd="vuuSearchCell",zd=({column:r,columnMap:e,row:t})=>{let n=e[r.name],o=t[n];return Gd("div",{className:Kd,tabIndex:-1,children:[Ud("span",{"data-icon":"draggable"}),o]})};_d("search-cell",zd,"cell-renderer",{serverDataType:"private"});import{RemoteDataSource as Op}from"@vuu-ui/vuu-data";import{getFullRange as _0,metadataKeys as Wd,WindowRange as K0}from"@vuu-ui/vuu-utils";import{useCallback as U0,useEffect as G0,useMemo as W0,useRef as Q0,useState as j0}from"react";var{SELECTED:X0}=Wd;import{RemoteDataSource as y4}from"@vuu-ui/vuu-data";import{useCallback as FT}from"react";import BT from"classnames";import{Toolbar as _T}from"@vuu-ui/vuu-layout";import{useCallback as uT,useEffect as cT,useRef as dT,useState as pT}from"react";import{Button as mT,FormField as hT,FormFieldLabel as gT}from"@salt-ds/core";import{useMemo as J0}from"react";import{jsx as eT,jsxs as tT}from"react/jsx-runtime";import ST from"classnames";import{jsx as TT,jsxs as CT}from"react/jsx-runtime";import{getCookieValue as DT}from"@vuu-ui/vuu-utils";import{Button as GT}from"@salt-ds/core";import{jsx as QT,jsxs as jT}from"react/jsx-runtime";import tC,{useEffect as rC,useState as nC}from"react";import sC from"classnames";import{Fragment as uC,jsx as cC,jsxs as lC}from"react/jsx-runtime";import{useCallback as gC}from"react";import xC from"classnames";import{jsx as SC}from"react/jsx-runtime";import yi,{Suspense as qd,useEffect as Jd}from"react";import{registerComponent as Yd}from"@vuu-ui/vuu-layout";import Qd from"react";import{Fragment as jd,jsx as gi,jsxs as Xd}from"react/jsx-runtime";var Pr=class extends Qd.Component{constructor(e){super(e),this.state={errorMessage:null}}static getDerivedStateFromError(e){return{errorMessage:e.message}}componentDidCatch(e,t){console.log(`error creating component at ${this.props.url}`),console.log(e,t)}render(){return this.state.errorMessage?Xd(jd,{children:[gi("h1",{children:"An error occured while creating component."}),gi("p",{children:this.state.errorMessage})]}):this.props.children}};import{jsx as Zd}from"react/jsx-runtime";var bi=()=>Zd("div",{className:"hwLoader"});var xi=async r=>{let e=new CSSStyleSheet;return fetch(r).then(t=>t.text()).then(t=>e.replace(t))};import{jsx as kr}from"react/jsx-runtime";var Lr=new Map,ep=r=>{Jd(()=>()=>{Lr.delete(r)},[r]),Lr.has(r)||Lr.set(r,yi.lazy(()=>import(r)));let e=Lr.get(r);if(e)return e;throw Error(`Unable to load Lazy Feature at url ${r}`)};function tp({url:r,css:e,ComponentProps:t,...n}){e&&xi(e).then(s=>{document.adoptedStyleSheets=[...document.adoptedStyleSheets,s]});let o=ep(r);return kr(Pr,{url:r,children:kr(qd,{fallback:kr(bi,{}),children:kr(o,{...n,...t})})})}var kn=yi.memo(tp);kn.displayName="Feature";Yd("Feature",kn,"view");import{useEffect as WC,useState as QC}from"react";import{Input as XC,Button as ZC,FormField as qC,FormFieldLabel as JC,Text as YC}from"@salt-ds/core";import{takeScreenshot as rw}from"@vuu-ui/vuu-utils";import{jsx as iw,jsxs as aw}from"react/jsx-runtime";var rp="saveLayoutPanel",ow=`${rp}-formField`;import np,{useCallback as cw,useContext as dw,useEffect as pw,useRef as fw,useState as mw}from"react";import{loadingApplicationJson as xw,LocalLayoutPersistenceManager as vw,resolveJSONPath as Tw,defaultApplicationJson as op}from"@vuu-ui/vuu-layout";import{NotificationLevel as Ew,useNotifications as Dw}from"@vuu-ui/vuu-popups";import{jsx as Lw}from"react/jsx-runtime";var Mw=np.createContext({getApplicationSettings:()=>{},layoutMetadata:[],saveLayout:()=>{},applicationJson:op,saveApplicationLayout:()=>{},saveApplicationSettings:()=>{},loadLayoutById:()=>{}});import{Fragment as Bw,jsx as Vw,jsxs as $w}from"react/jsx-runtime";import{memo as ip}from"react";import{jsx as He,jsxs as bt}from"react/jsx-runtime";var Si=ip(()=>bt("svg",{width:"44",height:"45",viewBox:"0 0 44 45",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[bt("g",{clipPath:"url(#clip0_217_6990)",children:[He("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)"}),He("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)"}),He("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"}),bt("g",{opacity:"0.86",children:[He("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"}),He("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"}),He("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"})]})]}),bt("defs",{children:[bt("linearGradient",{id:"paint0_linear_217_6990",x1:"24.6235",y1:"18.7363",x2:"42.3152",y2:"18.7363",gradientUnits:"userSpaceOnUse",children:[He("stop",{stopColor:"#4906A5"}),He("stop",{offset:"1",stopColor:"#D3423A"})]}),bt("linearGradient",{id:"paint1_linear_217_6990",x1:"-2.35794e-05",y1:"22.5009",x2:"42.7186",y2:"22.5009",gradientUnits:"userSpaceOnUse",children:[He("stop",{stopColor:"#7C06A5"}),He("stop",{offset:"1",stopColor:"#D3423A"})]}),He("clipPath",{id:"clip0_217_6990",children:He("rect",{width:"44",height:"45",fill:"white"})})]})]}));Si.displayName="VuuLogo";import{Stack as DE,useLayoutProviderDispatch as ME}from"@vuu-ui/vuu-layout";import kE from"classnames";import{useCallback as AE,useState as FE}from"react";import{Palette as tE,PaletteItem as rE}from"@vuu-ui/vuu-layout";import{jsx as aE,jsxs as lE}from"react/jsx-runtime";import{createContext as ap,isValidElement as lp,cloneElement as up,useContext as cp}from"react";import dp from"classnames";import{jsx as gp}from"react/jsx-runtime";var pp="medium",fp="salt-theme",mp="light",vi=ap({density:"high",theme:"vuu",themeMode:"light"});var hp=(r,e,t,n)=>{var o;return lp(r)?up(r,{className:dp((o=r.props)==null?void 0:o.className,`${e}-theme`,`${e}-density-${n}`),"data-mode":t}):(console.warn(`
|
|
4
4
|
ThemeProvider can only apply CSS classes for theming to a single nested child element of the ThemeProvider.
|
|
5
|
-
Wrap elements with a single container`),r)},Ii=({applyThemeClasses:r=!1,children:e,theme:t,themeMode:n,density:o})=>{var c,m,f;let{density:s,themeMode:i,theme:a}=cp(vi),l=(c=o!=null?o:s)!=null?c:pp,u=(m=n!=null?n:i)!=null?m:mp,d=(f=t!=null?t:a)!=null?f:fp,p=r?hp(e,d,u,l):e;return gp(vi.Provider,{value:{themeMode:u,density:l,theme:d},children:p})};Ii.displayName="ThemeProvider";import{jsx as _E,jsxs as KE}from"react/jsx-runtime";import{useCallback as JE,useEffect as YE,useMemo as e3,useRef as t3,useState as r3}from"react";import o3 from"classnames";import{useIdMemo as i3}from"@salt-ds/core";import{Button as l3}from"@salt-ds/core";import{hasAction as d3,isErrorResponse as p3,RemoteDataSource as f3}from"@vuu-ui/vuu-data";import{buildColumnMap as g3,isValidNumber as b3,shallowEquals as x3}from"@vuu-ui/vuu-utils";import{jsx as v3,jsxs as I3}from"react/jsx-runtime";import{connectToServer as j2}from"@vuu-ui/vuu-data";import{DraggableLayout as Z2,LayoutProvider as q2,loadingApplicationJson as Y2,useLayoutContextMenuItems as eD}from"@vuu-ui/vuu-layout";import{logger as Sp}from"@vuu-ui/vuu-utils";import nD from"classnames";import{useCallback as lD,useEffect as uD,useRef as cD}from"react";import{Button as P3}from"@salt-ds/core";import k3 from"classnames";import{useCallback as H3,useMemo as N3}from"react";import{layoutFromJson as A3,View as V3,useLayoutProviderDispatch as B3}from"@vuu-ui/vuu-layout";import{jsx as K3,jsxs as z3}from"react/jsx-runtime";import{DraggableLayout as c2,Flexbox as d2}from"@vuu-ui/vuu-layout";import{useMemo as J3}from"react";import e2 from"classnames";import{jsx as n2}from"react/jsx-runtime";import{jsx as h2,jsxs as g2}from"react/jsx-runtime";import{DockLayout as y2,DraggableLayout as S2,Drawer as v2,Flexbox as I2,View as T2}from"@vuu-ui/vuu-layout";import{useCallback as D2,useRef as M2,useState as P2}from"react";import{jsx as k2,jsxs as R2}from"react/jsx-runtime";import{ContextMenuProvider as xD,useDialog as yD}from"@vuu-ui/vuu-popups";import{jsx as TD,jsxs as CD}from"react/jsx-runtime";var{error:vD}=Sp("Shell");import{createContext as vp,useContext as LD}from"react";import{jsx as HD}from"react/jsx-runtime";var Ip={},kD=vp(Ip);import VD from"classnames";import{ToggleButton as $D,ToggleButtonGroup as _D,useControlled as KD}from"@salt-ds/core";import{useCallback as WD}from"react";import{jsx as XD,jsxs as ZD}from"react/jsx-runtime";import{buildColumnMap as v4,isLookupRenderer as I4,isTypeDescriptor as T4}from"@vuu-ui/vuu-utils";import{useMemo as w4,useState as E4}from"react";import{useCallback as P4,useEffect as L4,useState as k4}from"react";import{ConnectionManager as H4}from"@vuu-ui/vuu-data";import{useCallback as F4,useEffect as V4,useState as B4}from"react";import{ConnectionManager as _4}from"@vuu-ui/vuu-data";import{useCallback as U4}from"react";import{makeRpcCall as W4}from"@vuu-ui/vuu-data";var Tp=0,At=class{constructor(e,t){this.from=e,this.to=t}},ne=class{constructor(e={}){this.id=Tp++,this.perNode=!!e.perNode,this.deserialize=e.deserialize||(()=>{throw new Error("This node type doesn't define a deserialize function")})}add(e){if(this.perNode)throw new RangeError("Can't add per-node props to node types");return typeof e!="function"&&(e=we.match(e)),t=>{let n=e(t);return n===void 0?null:[this,n]}}};ne.closedBy=new ne({deserialize:r=>r.split(" ")});ne.openedBy=new ne({deserialize:r=>r.split(" ")});ne.group=new ne({deserialize:r=>r.split(" ")});ne.contextHash=new ne({perNode:!0});ne.lookAhead=new ne({perNode:!0});ne.mounted=new ne({perNode:!0});var Cp=Object.create(null),we=class{constructor(e,t,n,o=0){this.name=e,this.props=t,this.id=n,this.flags=o}static define(e){let t=e.props&&e.props.length?Object.create(null):Cp,n=(e.top?1:0)|(e.skipped?2:0)|(e.error?4:0)|(e.name==null?8:0),o=new we(e.name||"",t,e.id,n);if(e.props){for(let s of e.props)if(Array.isArray(s)||(s=s(o)),s){if(s[0].perNode)throw new RangeError("Can't store a per-node prop on a node type");t[s[0].id]=s[1]}}return o}prop(e){return this.props[e.id]}get isTop(){return(this.flags&1)>0}get isSkipped(){return(this.flags&2)>0}get isError(){return(this.flags&4)>0}get isAnonymous(){return(this.flags&8)>0}is(e){if(typeof e=="string"){if(this.name==e)return!0;let t=this.prop(ne.group);return t?t.indexOf(e)>-1:!1}return this.id==e}static match(e){let t=Object.create(null);for(let n in e)for(let o of n.split(" "))t[o]=e[n];return n=>{for(let o=n.prop(ne.group),s=-1;s<(o?o.length:0);s++){let i=t[s<0?n.name:o[s]];if(i)return i}}}};we.none=new we("",Object.create(null),0,8);var xt=class{constructor(e){this.types=e;for(let t=0;t<e.length;t++)if(e[t].id!=t)throw new RangeError("Node type ids should correspond to array positions when creating a node set")}extend(...e){let t=[];for(let n of this.types){let o=null;for(let s of e){let i=s(n);i&&(o||(o=Object.assign({},n.props)),o[i[0].id]=i[1])}t.push(o?new we(n.name,o,n.id,n.flags):n)}return new xt(t)}},Rr=new WeakMap,Ti=new WeakMap,me;(function(r){r[r.ExcludeBuffers=1]="ExcludeBuffers",r[r.IncludeAnonymous=2]="IncludeAnonymous",r[r.IgnoreMounts=4]="IgnoreMounts",r[r.IgnoreOverlays=8]="IgnoreOverlays"})(me||(me={}));var be=class{constructor(e,t,n,o,s){if(this.type=e,this.children=t,this.positions=n,this.length=o,this.props=null,s&&s.length){this.props=Object.create(null);for(let[i,a]of s)this.props[typeof i=="number"?i:i.id]=a}}toString(){let e=this.prop(ne.mounted);if(e&&!e.overlay)return e.tree.toString();let t="";for(let n of this.children){let o=n.toString();o&&(t&&(t+=","),t+=o)}return this.type.name?(/\W/.test(this.type.name)&&!this.type.isError?JSON.stringify(this.type.name):this.type.name)+(t.length?"("+t+")":""):t}cursor(e=0){return new St(this.topNode,e)}cursorAt(e,t=0,n=0){let o=Rr.get(this)||this.topNode,s=new St(o);return s.moveTo(e,t),Rr.set(this,s._tree),s}get topNode(){return new Fe(this,0,0,null)}resolve(e,t=0){let n=yt(Rr.get(this)||this.topNode,e,t,!1);return Rr.set(this,n),n}resolveInner(e,t=0){let n=yt(Ti.get(this)||this.topNode,e,t,!0);return Ti.set(this,n),n}iterate(e){let{enter:t,leave:n,from:o=0,to:s=this.length}=e,i=e.mode||0,a=(i&me.IncludeAnonymous)>0;for(let l=this.cursor(i|me.IncludeAnonymous);;){let u=!1;if(l.from<=s&&l.to>=o&&(!a&&l.type.isAnonymous||t(l)!==!1)){if(l.firstChild())continue;u=!0}for(;u&&n&&(a||!l.type.isAnonymous)&&n(l),!l.nextSibling();){if(!l.parent())return;u=!0}}}prop(e){return e.perNode?this.props?this.props[e.id]:void 0:this.type.prop(e)}get propValues(){let e=[];if(this.props)for(let t in this.props)e.push([+t,this.props[t]]);return e}balance(e={}){return this.children.length<=8?this:On(we.none,this.children,this.positions,0,this.children.length,0,this.length,(t,n,o)=>new be(this.type,t,n,o,this.propValues),e.makeTree||((t,n,o)=>new be(we.none,t,n,o)))}static build(e){return wp(e)}};be.empty=new be(we.none,[],[],0);var Ft=class{constructor(e,t){this.buffer=e,this.index=t}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}get pos(){return this.index}next(){this.index-=4}fork(){return new Ft(this.buffer,this.index)}},We=class{constructor(e,t,n){this.buffer=e,this.length=t,this.set=n}get type(){return we.none}toString(){let e=[];for(let t=0;t<this.buffer.length;)e.push(this.childString(t)),t=this.buffer[t+3];return e.join(",")}childString(e){let t=this.buffer[e],n=this.buffer[e+3],o=this.set.types[t],s=o.name;if(/\W/.test(s)&&!o.isError&&(s=JSON.stringify(s)),e+=4,n==e)return s;let i=[];for(;e<n;)i.push(this.childString(e)),e=this.buffer[e+3];return s+"("+i.join(",")+")"}findChild(e,t,n,o,s){let{buffer:i}=this,a=-1;for(let l=e;l!=t&&!(wi(s,o,i[l+1],i[l+2])&&(a=l,n>0));l=i[l+3]);return a}slice(e,t,n){let o=this.buffer,s=new Uint16Array(t-e),i=0;for(let a=e,l=0;a<t;){s[l++]=o[a++],s[l++]=o[a++]-n;let u=s[l++]=o[a++]-n;s[l++]=o[a++]-e,i=Math.max(i,u)}return new We(s,i,this.set)}};function wi(r,e,t,n){switch(r){case-2:return t<e;case-1:return n>=e&&t<e;case 0:return t<e&&n>e;case 1:return t<=e&&n>e;case 2:return n>e;case 4:return!0}}function Ei(r,e){let t=r.childBefore(e);for(;t;){let n=t.lastChild;if(!n||n.to!=t.to)break;n.type.isError&&n.from==n.to?(r=t,t=n.prevSibling):t=n}return r}function yt(r,e,t,n){for(var o;r.from==r.to||(t<1?r.from>=e:r.from>e)||(t>-1?r.to<=e:r.to<e);){let i=!n&&r instanceof Fe&&r.index<0?null:r.parent;if(!i)return r;r=i}let s=n?0:me.IgnoreOverlays;if(n)for(let i=r,a=i.parent;a;i=a,a=i.parent)i instanceof Fe&&i.index<0&&((o=a.enter(e,t,s))===null||o===void 0?void 0:o.from)!=i.from&&(r=a);for(;;){let i=r.enter(e,t,s);if(!i)return r;r=i}}var Fe=class{constructor(e,t,n,o){this._tree=e,this.from=t,this.index=n,this._parent=o}get type(){return this._tree.type}get name(){return this._tree.type.name}get to(){return this.from+this._tree.length}nextChild(e,t,n,o,s=0){for(let i=this;;){for(let{children:a,positions:l}=i._tree,u=t>0?a.length:-1;e!=u;e+=t){let d=a[e],p=l[e]+i.from;if(wi(o,n,p,p+d.length)){if(d instanceof We){if(s&me.ExcludeBuffers)continue;let c=d.findChild(0,d.buffer.length,t,n-p,o);if(c>-1)return new _e(new Rn(i,d,e,p),null,c)}else if(s&me.IncludeAnonymous||!d.type.isAnonymous||Nn(d)){let c;if(!(s&me.IgnoreMounts)&&d.props&&(c=d.prop(ne.mounted))&&!c.overlay)return new Fe(c.tree,p,e,i);let m=new Fe(d,p,e,i);return s&me.IncludeAnonymous||!m.type.isAnonymous?m:m.nextChild(t<0?d.children.length-1:0,t,n,o)}}}if(s&me.IncludeAnonymous||!i.type.isAnonymous||(i.index>=0?e=i.index+t:e=t<0?-1:i._parent._tree.children.length,i=i._parent,!i))return null}}get firstChild(){return this.nextChild(0,1,0,4)}get lastChild(){return this.nextChild(this._tree.children.length-1,-1,0,4)}childAfter(e){return this.nextChild(0,1,e,2)}childBefore(e){return this.nextChild(this._tree.children.length-1,-1,e,-2)}enter(e,t,n=0){let o;if(!(n&me.IgnoreOverlays)&&(o=this._tree.prop(ne.mounted))&&o.overlay){let s=e-this.from;for(let{from:i,to:a}of o.overlay)if((t>0?i<=s:i<s)&&(t<0?a>=s:a>s))return new Fe(o.tree,o.overlay[0].from+this.from,-1,this)}return this.nextChild(0,1,e,t,n)}nextSignificantParent(){let e=this;for(;e.type.isAnonymous&&e._parent;)e=e._parent;return e}get parent(){return this._parent?this._parent.nextSignificantParent():null}get nextSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index+1,1,0,4):null}get prevSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index-1,-1,0,4):null}cursor(e=0){return new St(this,e)}get tree(){return this._tree}toTree(){return this._tree}resolve(e,t=0){return yt(this,e,t,!1)}resolveInner(e,t=0){return yt(this,e,t,!0)}enterUnfinishedNodesBefore(e){return Ei(this,e)}getChild(e,t=null,n=null){let o=Nr(this,e,t,n);return o.length?o[0]:null}getChildren(e,t=null,n=null){return Nr(this,e,t,n)}toString(){return this._tree.toString()}get node(){return this}matchContext(e){return Or(this,e)}};function Nr(r,e,t,n){let o=r.cursor(),s=[];if(!o.firstChild())return s;if(t!=null){for(;!o.type.is(t);)if(!o.nextSibling())return s}for(;;){if(n!=null&&o.type.is(n))return s;if(o.type.is(e)&&s.push(o.node),!o.nextSibling())return n==null?s:[]}}function Or(r,e,t=e.length-1){for(let n=r.parent;t>=0;n=n.parent){if(!n)return!1;if(!n.type.isAnonymous){if(e[t]&&e[t]!=n.name)return!1;t--}}return!0}var Rn=class{constructor(e,t,n,o){this.parent=e,this.buffer=t,this.index=n,this.start=o}},_e=class{get name(){return this.type.name}get from(){return this.context.start+this.context.buffer.buffer[this.index+1]}get to(){return this.context.start+this.context.buffer.buffer[this.index+2]}constructor(e,t,n){this.context=e,this._parent=t,this.index=n,this.type=e.buffer.set.types[e.buffer.buffer[n]]}child(e,t,n){let{buffer:o}=this.context,s=o.findChild(this.index+4,o.buffer[this.index+3],e,t-this.context.start,n);return s<0?null:new _e(this.context,this,s)}get firstChild(){return this.child(1,0,4)}get lastChild(){return this.child(-1,0,4)}childAfter(e){return this.child(1,e,2)}childBefore(e){return this.child(-1,e,-2)}enter(e,t,n=0){if(n&me.ExcludeBuffers)return null;let{buffer:o}=this.context,s=o.findChild(this.index+4,o.buffer[this.index+3],t>0?1:-1,e-this.context.start,t);return s<0?null:new _e(this.context,this,s)}get parent(){return this._parent||this.context.parent.nextSignificantParent()}externalSibling(e){return this._parent?null:this.context.parent.nextChild(this.context.index+e,e,0,4)}get nextSibling(){let{buffer:e}=this.context,t=e.buffer[this.index+3];return t<(this._parent?e.buffer[this._parent.index+3]:e.buffer.length)?new _e(this.context,this._parent,t):this.externalSibling(1)}get prevSibling(){let{buffer:e}=this.context,t=this._parent?this._parent.index+4:0;return this.index==t?this.externalSibling(-1):new _e(this.context,this._parent,e.findChild(t,this.index,-1,0,4))}cursor(e=0){return new St(this,e)}get tree(){return null}toTree(){let e=[],t=[],{buffer:n}=this.context,o=this.index+4,s=n.buffer[this.index+3];if(s>o){let i=n.buffer[this.index+1];e.push(n.slice(o,s,i)),t.push(0)}return new be(this.type,e,t,this.to-this.from)}resolve(e,t=0){return yt(this,e,t,!1)}resolveInner(e,t=0){return yt(this,e,t,!0)}enterUnfinishedNodesBefore(e){return Ei(this,e)}toString(){return this.context.buffer.childString(this.index)}getChild(e,t=null,n=null){let o=Nr(this,e,t,n);return o.length?o[0]:null}getChildren(e,t=null,n=null){return Nr(this,e,t,n)}get node(){return this}matchContext(e){return Or(this,e)}},St=class{get name(){return this.type.name}constructor(e,t=0){if(this.mode=t,this.buffer=null,this.stack=[],this.index=0,this.bufferNode=null,e instanceof Fe)this.yieldNode(e);else{this._tree=e.context.parent,this.buffer=e.context;for(let n=e._parent;n;n=n._parent)this.stack.unshift(n.index);this.bufferNode=e,this.yieldBuf(e.index)}}yieldNode(e){return e?(this._tree=e,this.type=e.type,this.from=e.from,this.to=e.to,!0):!1}yieldBuf(e,t){this.index=e;let{start:n,buffer:o}=this.buffer;return this.type=t||o.set.types[o.buffer[e]],this.from=n+o.buffer[e+1],this.to=n+o.buffer[e+2],!0}yield(e){return e?e instanceof Fe?(this.buffer=null,this.yieldNode(e)):(this.buffer=e.context,this.yieldBuf(e.index,e.type)):!1}toString(){return this.buffer?this.buffer.buffer.childString(this.index):this._tree.toString()}enterChild(e,t,n){if(!this.buffer)return this.yield(this._tree.nextChild(e<0?this._tree._tree.children.length-1:0,e,t,n,this.mode));let{buffer:o}=this.buffer,s=o.findChild(this.index+4,o.buffer[this.index+3],e,t-this.buffer.start,n);return s<0?!1:(this.stack.push(this.index),this.yieldBuf(s))}firstChild(){return this.enterChild(1,0,4)}lastChild(){return this.enterChild(-1,0,4)}childAfter(e){return this.enterChild(1,e,2)}childBefore(e){return this.enterChild(-1,e,-2)}enter(e,t,n=this.mode){return this.buffer?n&me.ExcludeBuffers?!1:this.enterChild(1,e,t):this.yield(this._tree.enter(e,t,n))}parent(){if(!this.buffer)return this.yieldNode(this.mode&me.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let e=this.mode&me.IncludeAnonymous?this.buffer.parent:this.buffer.parent.nextSignificantParent();return this.buffer=null,this.yieldNode(e)}sibling(e){if(!this.buffer)return this._tree._parent?this.yield(this._tree.index<0?null:this._tree._parent.nextChild(this._tree.index+e,e,0,4,this.mode)):!1;let{buffer:t}=this.buffer,n=this.stack.length-1;if(e<0){let o=n<0?0:this.stack[n]+4;if(this.index!=o)return this.yieldBuf(t.findChild(o,this.index,-1,0,4))}else{let o=t.buffer[this.index+3];if(o<(n<0?t.buffer.length:t.buffer[this.stack[n]+3]))return this.yieldBuf(o)}return n<0?this.yield(this.buffer.parent.nextChild(this.buffer.index+e,e,0,4,this.mode)):!1}nextSibling(){return this.sibling(1)}prevSibling(){return this.sibling(-1)}atLastNode(e){let t,n,{buffer:o}=this;if(o){if(e>0){if(this.index<o.buffer.buffer.length)return!1}else for(let s=0;s<this.index;s++)if(o.buffer.buffer[s+3]<this.index)return!1;({index:t,parent:n}=o)}else({index:t,_parent:n}=this._tree);for(;n;{index:t,_parent:n}=n)if(t>-1)for(let s=t+e,i=e<0?-1:n._tree.children.length;s!=i;s+=e){let a=n._tree.children[s];if(this.mode&me.IncludeAnonymous||a instanceof We||!a.type.isAnonymous||Nn(a))return!1}return!0}move(e,t){if(t&&this.enterChild(e,0,4))return!0;for(;;){if(this.sibling(e))return!0;if(this.atLastNode(e)||!this.parent())return!1}}next(e=!0){return this.move(1,e)}prev(e=!0){return this.move(-1,e)}moveTo(e,t=0){for(;(this.from==this.to||(t<1?this.from>=e:this.from>e)||(t>-1?this.to<=e:this.to<e))&&this.parent(););for(;this.enterChild(1,e,t););return this}get node(){if(!this.buffer)return this._tree;let e=this.bufferNode,t=null,n=0;if(e&&e.context==this.buffer)e:for(let o=this.index,s=this.stack.length;s>=0;){for(let i=e;i;i=i._parent)if(i.index==o){if(o==this.index)return i;t=i,n=s+1;break e}o=this.stack[--s]}for(let o=n;o<this.stack.length;o++)t=new _e(this.buffer,t,this.stack[o]);return this.bufferNode=new _e(this.buffer,t,this.index)}get tree(){return this.buffer?null:this._tree._tree}iterate(e,t){for(let n=0;;){let o=!1;if(this.type.isAnonymous||e(this)!==!1){if(this.firstChild()){n++;continue}this.type.isAnonymous||(o=!0)}for(;o&&t&&t(this),o=this.type.isAnonymous,!this.nextSibling();){if(!n)return;this.parent(),n--,o=!0}}}matchContext(e){if(!this.buffer)return Or(this.node,e);let{buffer:t}=this.buffer,{types:n}=t.set;for(let o=e.length-1,s=this.stack.length-1;o>=0;s--){if(s<0)return Or(this.node,e,o);let i=n[t.buffer[this.stack[s]]];if(!i.isAnonymous){if(e[o]&&e[o]!=i.name)return!1;o--}}return!0}};function Nn(r){return r.children.some(e=>e instanceof We||!e.type.isAnonymous||Nn(e))}function wp(r){var e;let{buffer:t,nodeSet:n,maxBufferLength:o=1024,reused:s=[],minRepeatType:i=n.types.length}=r,a=Array.isArray(t)?new Ft(t,t.length):t,l=n.types,u=0,d=0;function p(b,v,S,T,A){let{id:w,start:D,end:O,size:x}=a,L=d;for(;x<0;)if(a.next(),x==-1){let M=s[w];S.push(M),T.push(D-b);return}else if(x==-3){u=w;return}else if(x==-4){d=w;return}else throw new RangeError(`Unrecognized record size: ${x}`);let N=l[w],k,P,R=D-b;if(O-D<=o&&(P=h(a.pos-v,A))){let M=new Uint16Array(P.size-P.skip),V=a.pos-P.size,C=M.length;for(;a.pos>V;)C=g(P.start,M,C);k=new We(M,O-P.start,n),R=P.start-b}else{let M=a.pos-x;a.next();let V=[],C=[],F=w>=i?w:-1,H=0,B=O;for(;a.pos>M;)F>=0&&a.id==F&&a.size>=0?(a.end<=B-o&&(m(V,C,D,H,a.end,B,F,L),H=V.length,B=a.end),a.next()):p(D,M,V,C,F);if(F>=0&&H>0&&H<V.length&&m(V,C,D,H,D,B,F,L),V.reverse(),C.reverse(),F>-1&&H>0){let z=c(N);k=On(N,V,C,0,V.length,0,O-D,z,z)}else k=f(N,V,C,O-D,L-O)}S.push(k),T.push(R)}function c(b){return(v,S,T)=>{let A=0,w=v.length-1,D,O;if(w>=0&&(D=v[w])instanceof be){if(!w&&D.type==b&&D.length==T)return D;(O=D.prop(ne.lookAhead))&&(A=S[w]+D.length+O)}return f(b,v,S,T,A)}}function m(b,v,S,T,A,w,D,O){let x=[],L=[];for(;b.length>T;)x.push(b.pop()),L.push(v.pop()+S-A);b.push(f(n.types[D],x,L,w-A,O-w)),v.push(A-S)}function f(b,v,S,T,A=0,w){if(u){let D=[ne.contextHash,u];w=w?[D].concat(w):[D]}if(A>25){let D=[ne.lookAhead,A];w=w?[D].concat(w):[D]}return new be(b,v,S,T,w)}function h(b,v){let S=a.fork(),T=0,A=0,w=0,D=S.end-o,O={size:0,start:0,skip:0};e:for(let x=S.pos-b;S.pos>x;){let L=S.size;if(S.id==v&&L>=0){O.size=T,O.start=A,O.skip=w,w+=4,T+=4,S.next();continue}let N=S.pos-L;if(L<0||N<x||S.start<D)break;let k=S.id>=i?4:0,P=S.start;for(S.next();S.pos>N;){if(S.size<0)if(S.size==-3)k+=4;else break e;else S.id>=i&&(k+=4);S.next()}A=P,T+=L,w+=k}return(v<0||T==b)&&(O.size=T,O.start=A,O.skip=w),O.size>4?O:void 0}function g(b,v,S){let{id:T,start:A,end:w,size:D}=a;if(a.next(),D>=0&&T<i){let O=S;if(D>4){let x=a.pos-(D-4);for(;a.pos>x;)S=g(b,v,S)}v[--S]=O,v[--S]=w-b,v[--S]=A-b,v[--S]=T}else D==-3?u=T:D==-4&&(d=T);return S}let y=[],E=[];for(;a.pos>0;)p(r.start||0,r.bufferStart||0,y,E,-1);let I=(e=r.length)!==null&&e!==void 0?e:y.length?E[0]+y[0].length:0;return new be(l[r.topID],y.reverse(),E.reverse(),I)}var Ci=new WeakMap;function Hr(r,e){if(!r.isAnonymous||e instanceof We||e.type!=r)return 1;let t=Ci.get(e);if(t==null){t=1;for(let n of e.children){if(n.type!=r||!(n instanceof be)){t=1;break}t+=Hr(r,n)}Ci.set(e,t)}return t}function On(r,e,t,n,o,s,i,a,l){let u=0;for(let f=n;f<o;f++)u+=Hr(r,e[f]);let d=Math.ceil(u*1.5/8),p=[],c=[];function m(f,h,g,y,E){for(let I=g;I<y;){let b=I,v=h[I],S=Hr(r,f[I]);for(I++;I<y;I++){let T=Hr(r,f[I]);if(S+T>=d)break;S+=T}if(I==b+1){if(S>d){let T=f[b];m(T.children,T.positions,0,T.children.length,h[b]+E);continue}p.push(f[b])}else{let T=h[I-1]+f[I-1].length-v;p.push(On(r,f,h,b,I,v,T,null,l))}c.push(v+E-s)}}return m(e,t,n,o,0),(a||l)(p,c,i)}var Ar=class{startParse(e,t,n){return typeof e=="string"&&(e=new Hn(e)),n=n?n.length?n.map(o=>new At(o.from,o.to)):[new At(0,0)]:[new At(0,e.length)],this.createParse(e,t||[],n)}parse(e,t,n){let o=this.startParse(e,t,n);for(;;){let s=o.advance();if(s)return s}}},Hn=class{constructor(e){this.string=e}get length(){return this.string.length}chunk(e){return this.string.slice(e)}get lineChunks(){return!1}read(e,t){return this.string.slice(e,t)}};var j4=new ne({perNode:!0});var It=class{constructor(e,t,n,o,s,i,a,l,u,d=0,p){this.p=e,this.stack=t,this.state=n,this.reducePos=o,this.pos=s,this.score=i,this.buffer=a,this.bufferBase=l,this.curContext=u,this.lookAhead=d,this.parent=p}toString(){return`[${this.stack.filter((e,t)=>t%3==0).concat(this.state)}]@${this.pos}${this.score?"!"+this.score:""}`}static start(e,t,n=0){let o=e.parser.context;return new It(e,[],t,n,n,0,[],0,o?new Fr(o,o.start):null,0,null)}get context(){return this.curContext?this.curContext.context:null}pushState(e,t){this.stack.push(this.state,t,this.bufferBase+this.buffer.length),this.state=e}reduce(e){var t;let n=e>>19,o=e&65535,{parser:s}=this.p,i=s.dynamicPrecedence(o);if(i&&(this.score+=i),n==0){this.pushState(s.getGoto(this.state,o,!0),this.reducePos),o<s.minRepeatTerm&&this.storeNode(o,this.reducePos,this.reducePos,4,!0),this.reduceContext(o,this.reducePos);return}let a=this.stack.length-(n-1)*3-(e&262144?6:0),l=a?this.stack[a-2]:this.p.ranges[0].from,u=this.reducePos-l;u>=2e3&&!(!((t=this.p.parser.nodeSet.types[o])===null||t===void 0)&&t.isAnonymous)&&(l==this.p.lastBigReductionStart?(this.p.bigReductionCount++,this.p.lastBigReductionSize=u):this.p.lastBigReductionSize<u&&(this.p.bigReductionCount=1,this.p.lastBigReductionStart=l,this.p.lastBigReductionSize=u));let d=a?this.stack[a-1]:0,p=this.bufferBase+this.buffer.length-d;if(o<s.minRepeatTerm||e&131072){let c=s.stateFlag(this.state,1)?this.pos:this.reducePos;this.storeNode(o,l,c,p+4,!0)}if(e&262144)this.state=this.stack[a];else{let c=this.stack[a-3];this.state=s.getGoto(c,o,!0)}for(;this.stack.length>a;)this.stack.pop();this.reduceContext(o,l)}storeNode(e,t,n,o=4,s=!1){if(e==0&&(!this.stack.length||this.stack[this.stack.length-1]<this.buffer.length+this.bufferBase)){let i=this,a=this.buffer.length;if(a==0&&i.parent&&(a=i.bufferBase-i.parent.bufferBase,i=i.parent),a>0&&i.buffer[a-4]==0&&i.buffer[a-1]>-1){if(t==n)return;if(i.buffer[a-2]>=t){i.buffer[a-2]=n;return}}}if(!s||this.pos==n)this.buffer.push(e,t,n,o);else{let i=this.buffer.length;if(i>0&&this.buffer[i-4]!=0)for(;i>0&&this.buffer[i-2]>n;)this.buffer[i]=this.buffer[i-4],this.buffer[i+1]=this.buffer[i-3],this.buffer[i+2]=this.buffer[i-2],this.buffer[i+3]=this.buffer[i-1],i-=4,o>4&&(o-=4);this.buffer[i]=e,this.buffer[i+1]=t,this.buffer[i+2]=n,this.buffer[i+3]=o}}shift(e,t,n){let o=this.pos;if(e&131072)this.pushState(e&65535,this.pos);else if(e&262144)this.pos=n,this.shiftContext(t,o),t<=this.p.parser.maxNode&&this.buffer.push(t,o,n,4);else{let s=e,{parser:i}=this.p;(n>this.pos||t<=i.maxNode)&&(this.pos=n,i.stateFlag(s,1)||(this.reducePos=n)),this.pushState(s,o),this.shiftContext(t,o),t<=i.maxNode&&this.buffer.push(t,o,n,4)}}apply(e,t,n){e&65536?this.reduce(e):this.shift(e,t,n)}useNode(e,t){let n=this.p.reused.length-1;(n<0||this.p.reused[n]!=e)&&(this.p.reused.push(e),n++);let o=this.pos;this.reducePos=this.pos=o+e.length,this.pushState(t,o),this.buffer.push(n,o,this.reducePos,-1),this.curContext&&this.updateContext(this.curContext.tracker.reuse(this.curContext.context,e,this,this.p.stream.reset(this.pos-e.length)))}split(){let e=this,t=e.buffer.length;for(;t>0&&e.buffer[t-2]>e.reducePos;)t-=4;let n=e.buffer.slice(t),o=e.bufferBase+t;for(;e&&o==e.bufferBase;)e=e.parent;return new It(this.p,this.stack.slice(),this.state,this.reducePos,this.pos,this.score,n,o,this.curContext,this.lookAhead,e)}recoverByDelete(e,t){let n=e<=this.p.parser.maxNode;n&&this.storeNode(e,this.pos,t,4),this.storeNode(0,this.pos,t,n?8:4),this.pos=this.reducePos=t,this.score-=190}canShift(e){for(let t=new Fn(this);;){let n=this.p.parser.stateSlot(t.state,4)||this.p.parser.hasAction(t.state,e);if(n==0)return!1;if(!(n&65536))return!0;t.reduce(n)}}recoverByInsert(e){if(this.stack.length>=300)return[];let t=this.p.parser.nextStates(this.state);if(t.length>4<<1||this.stack.length>=120){let o=[];for(let s=0,i;s<t.length;s+=2)(i=t[s+1])!=this.state&&this.p.parser.hasAction(i,e)&&o.push(t[s],i);if(this.stack.length<120)for(let s=0;o.length<4<<1&&s<t.length;s+=2){let i=t[s+1];o.some((a,l)=>l&1&&a==i)||o.push(t[s],i)}t=o}let n=[];for(let o=0;o<t.length&&n.length<4;o+=2){let s=t[o+1];if(s==this.state)continue;let i=this.split();i.pushState(s,this.pos),i.storeNode(0,i.pos,i.pos,4,!0),i.shiftContext(t[o],this.pos),i.score-=200,n.push(i)}return n}forceReduce(){let{parser:e}=this.p,t=e.stateSlot(this.state,5);if(!(t&65536))return!1;if(!e.validAction(this.state,t)){let n=t>>19,o=t&65535,s=this.stack.length-n*3;if(s<0||e.getGoto(this.stack[s],o,!1)<0){let i=this.findForcedReduction();if(i==null)return!1;t=i}this.storeNode(0,this.pos,this.pos,4,!0),this.score-=100}return this.reducePos=this.pos,this.reduce(t),!0}findForcedReduction(){let{parser:e}=this.p,t=[],n=(o,s)=>{if(!t.includes(o))return t.push(o),e.allActions(o,i=>{if(!(i&393216))if(i&65536){let a=(i>>19)-s;if(a>1){let l=i&65535,u=this.stack.length-a*3;if(u>=0&&e.getGoto(this.stack[u],l,!1)>=0)return a<<19|65536|l}}else{let a=n(i,s+1);if(a!=null)return a}})};return n(this.state,0)}forceAll(){for(;!this.p.parser.stateFlag(this.state,2);)if(!this.forceReduce()){this.storeNode(0,this.pos,this.pos,4,!0);break}return this}get deadEnd(){if(this.stack.length!=3)return!1;let{parser:e}=this.p;return e.data[e.stateSlot(this.state,1)]==65535&&!e.stateSlot(this.state,4)}restart(){this.state=this.stack[0],this.stack.length=0}sameState(e){if(this.state!=e.state||this.stack.length!=e.stack.length)return!1;for(let t=0;t<this.stack.length;t+=3)if(this.stack[t]!=e.stack[t])return!1;return!0}get parser(){return this.p.parser}dialectEnabled(e){return this.p.parser.dialect.flags[e]}shiftContext(e,t){this.curContext&&this.updateContext(this.curContext.tracker.shift(this.curContext.context,e,this,this.p.stream.reset(t)))}reduceContext(e,t){this.curContext&&this.updateContext(this.curContext.tracker.reduce(this.curContext.context,e,this,this.p.stream.reset(t)))}emitContext(){let e=this.buffer.length-1;(e<0||this.buffer[e]!=-3)&&this.buffer.push(this.curContext.hash,this.pos,this.pos,-3)}emitLookAhead(){let e=this.buffer.length-1;(e<0||this.buffer[e]!=-4)&&this.buffer.push(this.lookAhead,this.pos,this.pos,-4)}updateContext(e){if(e!=this.curContext.context){let t=new Fr(this.curContext.tracker,e);t.hash!=this.curContext.hash&&this.emitContext(),this.curContext=t}}setLookAhead(e){e>this.lookAhead&&(this.emitLookAhead(),this.lookAhead=e)}close(){this.curContext&&this.curContext.tracker.strict&&this.emitContext(),this.lookAhead>0&&this.emitLookAhead()}},Fr=class{constructor(e,t){this.tracker=e,this.context=t,this.hash=e.strict?e.hash(t):0}},Di;(function(r){r[r.Insert=200]="Insert",r[r.Delete=190]="Delete",r[r.Reduce=100]="Reduce",r[r.MaxNext=4]="MaxNext",r[r.MaxInsertStackDepth=300]="MaxInsertStackDepth",r[r.DampenInsertStackDepth=120]="DampenInsertStackDepth",r[r.MinBigReduction=2e3]="MinBigReduction"})(Di||(Di={}));var Fn=class{constructor(e){this.start=e,this.state=e.state,this.stack=e.stack,this.base=this.stack.length}reduce(e){let t=e&65535,n=e>>19;n==0?(this.stack==this.start.stack&&(this.stack=this.stack.slice()),this.stack.push(this.state,0,0),this.base+=3):this.base-=(n-1)*3;let o=this.start.p.parser.getGoto(this.stack[this.base-3],t,!0);this.state=o}},Tt=class{constructor(e,t,n){this.stack=e,this.pos=t,this.index=n,this.buffer=e.buffer,this.index==0&&this.maybeNext()}static create(e,t=e.bufferBase+e.buffer.length){return new Tt(e,t,t-e.bufferBase)}maybeNext(){let e=this.stack.parent;e!=null&&(this.index=this.stack.bufferBase-e.bufferBase,this.stack=e,this.buffer=e.buffer)}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}next(){this.index-=4,this.pos-=4,this.index==0&&this.maybeNext()}fork(){return new Tt(this.stack,this.pos,this.index)}};function Vt(r,e=Uint16Array){if(typeof r!="string")return r;let t=null;for(let n=0,o=0;n<r.length;){let s=0;for(;;){let i=r.charCodeAt(n++),a=!1;if(i==126){s=65535;break}i>=92&&i--,i>=34&&i--;let l=i-32;if(l>=46&&(l-=46,a=!0),s+=l,a)break;s*=46}t?t[o++]=s:t=new e(s)}return t}var vt=class{constructor(){this.start=-1,this.value=-1,this.end=-1,this.extended=-1,this.lookAhead=0,this.mask=0,this.context=0}},Mi=new vt,Vn=class{constructor(e,t){this.input=e,this.ranges=t,this.chunk="",this.chunkOff=0,this.chunk2="",this.chunk2Pos=0,this.next=-1,this.token=Mi,this.rangeIndex=0,this.pos=this.chunkPos=t[0].from,this.range=t[0],this.end=t[t.length-1].to,this.readNext()}resolveOffset(e,t){let n=this.range,o=this.rangeIndex,s=this.pos+e;for(;s<n.from;){if(!o)return null;let i=this.ranges[--o];s-=n.from-i.to,n=i}for(;t<0?s>n.to:s>=n.to;){if(o==this.ranges.length-1)return null;let i=this.ranges[++o];s+=i.from-n.to,n=i}return s}clipPos(e){if(e>=this.range.from&&e<this.range.to)return e;for(let t of this.ranges)if(t.to>e)return Math.max(e,t.from);return this.end}peek(e){let t=this.chunkOff+e,n,o;if(t>=0&&t<this.chunk.length)n=this.pos+e,o=this.chunk.charCodeAt(t);else{let s=this.resolveOffset(e,1);if(s==null)return-1;if(n=s,n>=this.chunk2Pos&&n<this.chunk2Pos+this.chunk2.length)o=this.chunk2.charCodeAt(n-this.chunk2Pos);else{let i=this.rangeIndex,a=this.range;for(;a.to<=n;)a=this.ranges[++i];this.chunk2=this.input.chunk(this.chunk2Pos=n),n+this.chunk2.length>a.to&&(this.chunk2=this.chunk2.slice(0,a.to-n)),o=this.chunk2.charCodeAt(0)}}return n>=this.token.lookAhead&&(this.token.lookAhead=n+1),o}acceptToken(e,t=0){let n=t?this.resolveOffset(t,-1):this.pos;if(n==null||n<this.token.start)throw new RangeError("Token end out of bounds");this.token.value=e,this.token.end=n}getChunk(){if(this.pos>=this.chunk2Pos&&this.pos<this.chunk2Pos+this.chunk2.length){let{chunk:e,chunkPos:t}=this;this.chunk=this.chunk2,this.chunkPos=this.chunk2Pos,this.chunk2=e,this.chunk2Pos=t,this.chunkOff=this.pos-this.chunkPos}else{this.chunk2=this.chunk,this.chunk2Pos=this.chunkPos;let e=this.input.chunk(this.pos),t=this.pos+e.length;this.chunk=t>this.range.to?e.slice(0,this.range.to-this.pos):e,this.chunkPos=this.pos,this.chunkOff=0}}readNext(){return this.chunkOff>=this.chunk.length&&(this.getChunk(),this.chunkOff==this.chunk.length)?this.next=-1:this.next=this.chunk.charCodeAt(this.chunkOff)}advance(e=1){for(this.chunkOff+=e;this.pos+e>=this.range.to;){if(this.rangeIndex==this.ranges.length-1)return this.setDone();e-=this.range.to-this.pos,this.range=this.ranges[++this.rangeIndex],this.pos=this.range.from}return this.pos+=e,this.pos>=this.token.lookAhead&&(this.token.lookAhead=this.pos+1),this.readNext()}setDone(){return this.pos=this.chunkPos=this.end,this.range=this.ranges[this.rangeIndex=this.ranges.length-1],this.chunk="",this.next=-1}reset(e,t){if(t?(this.token=t,t.start=e,t.lookAhead=e+1,t.value=t.extended=-1):this.token=Mi,this.pos!=e){if(this.pos=e,e==this.end)return this.setDone(),this;for(;e<this.range.from;)this.range=this.ranges[--this.rangeIndex];for(;e>=this.range.to;)this.range=this.ranges[++this.rangeIndex];e>=this.chunkPos&&e<this.chunkPos+this.chunk.length?this.chunkOff=e-this.chunkPos:(this.chunk="",this.chunkOff=0),this.readNext()}return this}read(e,t){if(e>=this.chunkPos&&t<=this.chunkPos+this.chunk.length)return this.chunk.slice(e-this.chunkPos,t-this.chunkPos);if(e>=this.chunk2Pos&&t<=this.chunk2Pos+this.chunk2.length)return this.chunk2.slice(e-this.chunk2Pos,t-this.chunk2Pos);if(e>=this.range.from&&t<=this.range.to)return this.input.read(e,t);let n="";for(let o of this.ranges){if(o.from>=t)break;o.to>e&&(n+=this.input.read(Math.max(o.from,e),Math.min(o.to,t)))}return n}},qe=class{constructor(e,t){this.data=e,this.id=t}token(e,t){let{parser:n}=t.p;Oi(this.data,e,t,this.id,n.data,n.tokenPrecTable)}};qe.prototype.contextual=qe.prototype.fallback=qe.prototype.extend=!1;var Bn=class{constructor(e,t,n){this.precTable=t,this.elseToken=n,this.data=typeof e=="string"?Vt(e):e}token(e,t){let n=e.pos,o=0;for(;;){let s=e.next<0,i=e.resolveOffset(1,1);if(Oi(this.data,e,t,0,this.data,this.precTable),e.token.value>-1)break;if(this.elseToken==null)return;if(s||o++,i==null)break;e.reset(i,e.token)}o&&(e.reset(n,e.token),e.acceptToken(this.elseToken,o))}};Bn.prototype.contextual=qe.prototype.fallback=qe.prototype.extend=!1;function Oi(r,e,t,n,o,s){let i=0,a=1<<n,{dialect:l}=t.p.parser;e:for(;a&r[i];){let u=r[i+1];for(let m=i+3;m<u;m+=2)if((r[m+1]&a)>0){let f=r[m];if(l.allows(f)&&(e.token.value==-1||e.token.value==f||Dp(f,e.token.value,o,s))){e.acceptToken(f);break}}let d=e.next,p=0,c=r[i+2];if(e.next<0&&c>p&&r[u+c*3-3]==65535&&r[u+c*3-3]==65535){i=r[u+c*3-1];continue e}for(;p<c;){let m=p+c>>1,f=u+m+(m<<1),h=r[f],g=r[f+1]||65536;if(d<h)c=m;else if(d>=g)p=m+1;else{i=r[f+2],e.advance();continue e}}break}}function Pi(r,e,t){for(let n=e,o;(o=r[n])!=65535;n++)if(o==t)return n-e;return-1}function Dp(r,e,t,n){let o=Pi(t,n,e);return o<0||Pi(t,n,r)<o}var Ve=typeof process<"u"&&process.env&&/\bparse\b/.test(process.env.LOG),An=null,Li;(function(r){r[r.Margin=25]="Margin"})(Li||(Li={}));function ki(r,e,t){let n=r.cursor(me.IncludeAnonymous);for(n.moveTo(e);;)if(!(t<0?n.childBefore(e):n.childAfter(e)))for(;;){if((t<0?n.to<e:n.from>e)&&!n.type.isError)return t<0?Math.max(0,Math.min(n.to-1,e-25)):Math.min(r.length,Math.max(n.from+1,e+25));if(t<0?n.prevSibling():n.nextSibling())break;if(!n.parent())return t<0?0:r.length}}var $n=class{constructor(e,t){this.fragments=e,this.nodeSet=t,this.i=0,this.fragment=null,this.safeFrom=-1,this.safeTo=-1,this.trees=[],this.start=[],this.index=[],this.nextFragment()}nextFragment(){let e=this.fragment=this.i==this.fragments.length?null:this.fragments[this.i++];if(e){for(this.safeFrom=e.openStart?ki(e.tree,e.from+e.offset,1)-e.offset:e.from,this.safeTo=e.openEnd?ki(e.tree,e.to+e.offset,-1)-e.offset:e.to;this.trees.length;)this.trees.pop(),this.start.pop(),this.index.pop();this.trees.push(e.tree),this.start.push(-e.offset),this.index.push(0),this.nextStart=this.safeFrom}else this.nextStart=1e9}nodeAt(e){if(e<this.nextStart)return null;for(;this.fragment&&this.safeTo<=e;)this.nextFragment();if(!this.fragment)return null;for(;;){let t=this.trees.length-1;if(t<0)return this.nextFragment(),null;let n=this.trees[t],o=this.index[t];if(o==n.children.length){this.trees.pop(),this.start.pop(),this.index.pop();continue}let s=n.children[o],i=this.start[t]+n.positions[o];if(i>e)return this.nextStart=i,null;if(s instanceof be){if(i==e){if(i<this.safeFrom)return null;let a=i+s.length;if(a<=this.safeTo){let l=s.prop(ne.lookAhead);if(!l||a+l<this.fragment.to)return s}}this.index[t]++,i+s.length>=Math.max(this.safeFrom,e)&&(this.trees.push(s),this.start.push(i),this.index.push(0))}else this.index[t]++,this.nextStart=i+s.length}}},_n=class{constructor(e,t){this.stream=t,this.tokens=[],this.mainToken=null,this.actions=[],this.tokens=e.tokenizers.map(n=>new vt)}getActions(e){let t=0,n=null,{parser:o}=e.p,{tokenizers:s}=o,i=o.stateSlot(e.state,3),a=e.curContext?e.curContext.hash:0,l=0;for(let u=0;u<s.length;u++){if(!(1<<u&i))continue;let d=s[u],p=this.tokens[u];if(!(n&&!d.fallback)&&((d.contextual||p.start!=e.pos||p.mask!=i||p.context!=a)&&(this.updateCachedToken(p,d,e),p.mask=i,p.context=a),p.lookAhead>p.end+25&&(l=Math.max(p.lookAhead,l)),p.value!=0)){let c=t;if(p.extended>-1&&(t=this.addActions(e,p.extended,p.end,t)),t=this.addActions(e,p.value,p.end,t),!d.extend&&(n=p,t>c))break}}for(;this.actions.length>t;)this.actions.pop();return l&&e.setLookAhead(l),!n&&e.pos==this.stream.end&&(n=new vt,n.value=e.p.parser.eofTerm,n.start=n.end=e.pos,t=this.addActions(e,n.value,n.end,t)),this.mainToken=n,this.actions}getMainToken(e){if(this.mainToken)return this.mainToken;let t=new vt,{pos:n,p:o}=e;return t.start=n,t.end=Math.min(n+1,o.stream.end),t.value=n==o.stream.end?o.parser.eofTerm:0,t}updateCachedToken(e,t,n){let o=this.stream.clipPos(n.pos);if(t.token(this.stream.reset(o,e),n),e.value>-1){let{parser:s}=n.p;for(let i=0;i<s.specialized.length;i++)if(s.specialized[i]==e.value){let a=s.specializers[i](this.stream.read(e.start,e.end),n);if(a>=0&&n.p.parser.dialect.allows(a>>1)){a&1?e.extended=a>>1:e.value=a>>1;break}}}else e.value=0,e.end=this.stream.clipPos(o+1)}putAction(e,t,n,o){for(let s=0;s<o;s+=3)if(this.actions[s]==e)return o;return this.actions[o++]=e,this.actions[o++]=t,this.actions[o++]=n,o}addActions(e,t,n,o){let{state:s}=e,{parser:i}=e.p,{data:a}=i;for(let l=0;l<2;l++)for(let u=i.stateSlot(s,l?2:1);;u+=3){if(a[u]==65535)if(a[u+1]==1)u=Qe(a,u+2);else{o==0&&a[u+1]==2&&(o=this.putAction(Qe(a,u+2),t,n,o));break}a[u]==t&&(o=this.putAction(Qe(a,u+1),t,n,o))}return o}},Ri;(function(r){r[r.Distance=5]="Distance",r[r.MaxRemainingPerStep=3]="MaxRemainingPerStep",r[r.MinBufferLengthPrune=500]="MinBufferLengthPrune",r[r.ForceReduceLimit=10]="ForceReduceLimit",r[r.CutDepth=15e3]="CutDepth",r[r.CutTo=9e3]="CutTo",r[r.MaxLeftAssociativeReductionCount=300]="MaxLeftAssociativeReductionCount",r[r.MaxStackCount=12]="MaxStackCount"})(Ri||(Ri={}));var Kn=class{constructor(e,t,n,o){this.parser=e,this.input=t,this.ranges=o,this.recovering=0,this.nextStackID=9812,this.minStackPos=0,this.reused=[],this.stoppedAt=null,this.lastBigReductionStart=-1,this.lastBigReductionSize=0,this.bigReductionCount=0,this.stream=new Vn(t,o),this.tokens=new _n(e,this.stream),this.topTerm=e.top[1];let{from:s}=o[0];this.stacks=[It.start(this,e.top[0],s)],this.fragments=n.length&&this.stream.end-s>e.bufferLength*4?new $n(n,e.nodeSet):null}get parsedPos(){return this.minStackPos}advance(){let e=this.stacks,t=this.minStackPos,n=this.stacks=[],o,s;if(this.bigReductionCount>300&&e.length==1){let[i]=e;for(;i.forceReduce()&&i.stack.length&&i.stack[i.stack.length-2]>=this.lastBigReductionStart;);this.bigReductionCount=this.lastBigReductionSize=0}for(let i=0;i<e.length;i++){let a=e[i];for(;;){if(this.tokens.mainToken=null,a.pos>t)n.push(a);else{if(this.advanceStack(a,n,e))continue;{o||(o=[],s=[]),o.push(a);let l=this.tokens.getMainToken(a);s.push(l.value,l.end)}}break}}if(!n.length){let i=o&&Mp(o);if(i)return this.stackToTree(i);if(this.parser.strict)throw Ve&&o&&console.log("Stuck with token "+(this.tokens.mainToken?this.parser.getName(this.tokens.mainToken.value):"none")),new SyntaxError("No parse at "+t);this.recovering||(this.recovering=5)}if(this.recovering&&o){let i=this.stoppedAt!=null&&o[0].pos>this.stoppedAt?o[0]:this.runRecovery(o,s,n);if(i)return this.stackToTree(i.forceAll())}if(this.recovering){let i=this.recovering==1?1:this.recovering*3;if(n.length>i)for(n.sort((a,l)=>l.score-a.score);n.length>i;)n.pop();n.some(a=>a.reducePos>t)&&this.recovering--}else if(n.length>1){e:for(let i=0;i<n.length-1;i++){let a=n[i];for(let l=i+1;l<n.length;l++){let u=n[l];if(a.sameState(u)||a.buffer.length>500&&u.buffer.length>500)if((a.score-u.score||a.buffer.length-u.buffer.length)>0)n.splice(l--,1);else{n.splice(i--,1);continue e}}}n.length>12&&n.splice(12,n.length-12)}this.minStackPos=n[0].pos;for(let i=1;i<n.length;i++)n[i].pos<this.minStackPos&&(this.minStackPos=n[i].pos);return null}stopAt(e){if(this.stoppedAt!=null&&this.stoppedAt<e)throw new RangeError("Can't move stoppedAt forward");this.stoppedAt=e}advanceStack(e,t,n){let o=e.pos,{parser:s}=this,i=Ve?this.stackID(e)+" -> ":"";if(this.stoppedAt!=null&&o>this.stoppedAt)return e.forceReduce()?e:null;if(this.fragments){let u=e.curContext&&e.curContext.tracker.strict,d=u?e.curContext.hash:0;for(let p=this.fragments.nodeAt(o);p;){let c=this.parser.nodeSet.types[p.type.id]==p.type?s.getGoto(e.state,p.type.id):-1;if(c>-1&&p.length&&(!u||(p.prop(ne.contextHash)||0)==d))return e.useNode(p,c),Ve&&console.log(i+this.stackID(e)+` (via reuse of ${s.getName(p.type.id)})`),!0;if(!(p instanceof be)||p.children.length==0||p.positions[0]>0)break;let m=p.children[0];if(m instanceof be&&p.positions[0]==0)p=m;else break}}let a=s.stateSlot(e.state,4);if(a>0)return e.reduce(a),Ve&&console.log(i+this.stackID(e)+` (via always-reduce ${s.getName(a&65535)})`),!0;if(e.stack.length>=15e3)for(;e.stack.length>9e3&&e.forceReduce(););let l=this.tokens.getActions(e);for(let u=0;u<l.length;){let d=l[u++],p=l[u++],c=l[u++],m=u==l.length||!n,f=m?e:e.split();if(f.apply(d,p,c),Ve&&console.log(i+this.stackID(f)+` (via ${d&65536?`reduce of ${s.getName(d&65535)}`:"shift"} for ${s.getName(p)} @ ${o}${f==e?"":", split"})`),m)return!0;f.pos>o?t.push(f):n.push(f)}return!1}advanceFully(e,t){let n=e.pos;for(;;){if(!this.advanceStack(e,null,null))return!1;if(e.pos>n)return Hi(e,t),!0}}runRecovery(e,t,n){let o=null,s=!1;for(let i=0;i<e.length;i++){let a=e[i],l=t[i<<1],u=t[(i<<1)+1],d=Ve?this.stackID(a)+" -> ":"";if(a.deadEnd&&(s||(s=!0,a.restart(),Ve&&console.log(d+this.stackID(a)+" (restarted)"),this.advanceFully(a,n))))continue;let p=a.split(),c=d;for(let m=0;p.forceReduce()&&m<10&&(Ve&&console.log(c+this.stackID(p)+" (via force-reduce)"),!this.advanceFully(p,n));m++)Ve&&(c=this.stackID(p)+" -> ");for(let m of a.recoverByInsert(l))Ve&&console.log(d+this.stackID(m)+" (via recover-insert)"),this.advanceFully(m,n);this.stream.end>a.pos?(u==a.pos&&(u++,l=0),a.recoverByDelete(l,u),Ve&&console.log(d+this.stackID(a)+` (via recover-delete ${this.parser.getName(l)})`),Hi(a,n)):(!o||o.score<a.score)&&(o=a)}return o}stackToTree(e){return e.close(),be.build({buffer:Tt.create(e),nodeSet:this.parser.nodeSet,topID:this.topTerm,maxBufferLength:this.parser.bufferLength,reused:this.reused,start:this.ranges[0].from,length:e.pos-this.ranges[0].from,minRepeatType:this.parser.minRepeatTerm})}stackID(e){let t=(An||(An=new WeakMap)).get(e);return t||An.set(e,t=String.fromCodePoint(this.nextStackID++)),t+e}};function Hi(r,e){for(let t=0;t<e.length;t++){let n=e[t];if(n.pos==r.pos&&n.sameState(r)){e[t].score<r.score&&(e[t]=r);return}}e.push(r)}var zn=class{constructor(e,t,n){this.source=e,this.flags=t,this.disabled=n}allows(e){return!this.disabled||this.disabled[e]==0}};var it=class extends Ar{constructor(e){if(super(),this.wrappers=[],e.version!=14)throw new RangeError(`Parser version (${e.version}) doesn't match runtime version (14)`);let t=e.nodeNames.split(" ");this.minRepeatTerm=t.length;for(let a=0;a<e.repeatNodeCount;a++)t.push("");let n=Object.keys(e.topRules).map(a=>e.topRules[a][1]),o=[];for(let a=0;a<t.length;a++)o.push([]);function s(a,l,u){o[a].push([l,l.deserialize(String(u))])}if(e.nodeProps)for(let a of e.nodeProps){let l=a[0];typeof l=="string"&&(l=ne[l]);for(let u=1;u<a.length;){let d=a[u++];if(d>=0)s(d,l,a[u++]);else{let p=a[u+-d];for(let c=-d;c>0;c--)s(a[u++],l,p);u++}}}this.nodeSet=new xt(t.map((a,l)=>we.define({name:l>=this.minRepeatTerm?void 0:a,id:l,props:o[l],top:n.indexOf(l)>-1,error:l==0,skipped:e.skippedNodes&&e.skippedNodes.indexOf(l)>-1}))),e.propSources&&(this.nodeSet=this.nodeSet.extend(...e.propSources)),this.strict=!1,this.bufferLength=1024;let i=Vt(e.tokenData);this.context=e.context,this.specializerSpecs=e.specialized||[],this.specialized=new Uint16Array(this.specializerSpecs.length);for(let a=0;a<this.specializerSpecs.length;a++)this.specialized[a]=this.specializerSpecs[a].term;this.specializers=this.specializerSpecs.map(Ni),this.states=Vt(e.states,Uint32Array),this.data=Vt(e.stateData),this.goto=Vt(e.goto),this.maxTerm=e.maxTerm,this.tokenizers=e.tokenizers.map(a=>typeof a=="number"?new qe(i,a):a),this.topRules=e.topRules,this.dialects=e.dialects||{},this.dynamicPrecedences=e.dynamicPrecedences||null,this.tokenPrecTable=e.tokenPrec,this.termNames=e.termNames||null,this.maxNode=this.nodeSet.types.length-1,this.dialect=this.parseDialect(),this.top=this.topRules[Object.keys(this.topRules)[0]]}createParse(e,t,n){let o=new Kn(this,e,t,n);for(let s of this.wrappers)o=s(o,e,t,n);return o}getGoto(e,t,n=!1){let o=this.goto;if(t>=o[0])return-1;for(let s=o[t+1];;){let i=o[s++],a=i&1,l=o[s++];if(a&&n)return l;for(let u=s+(i>>1);s<u;s++)if(o[s]==e)return l;if(a)return-1}}hasAction(e,t){let n=this.data;for(let o=0;o<2;o++)for(let s=this.stateSlot(e,o?2:1),i;;s+=3){if((i=n[s])==65535)if(n[s+1]==1)i=n[s=Qe(n,s+2)];else{if(n[s+1]==2)return Qe(n,s+2);break}if(i==t||i==0)return Qe(n,s+1)}return 0}stateSlot(e,t){return this.states[e*6+t]}stateFlag(e,t){return(this.stateSlot(e,0)&t)>0}validAction(e,t){return!!this.allActions(e,n=>n==t?!0:null)}allActions(e,t){let n=this.stateSlot(e,4),o=n?t(n):void 0;for(let s=this.stateSlot(e,1);o==null;s+=3){if(this.data[s]==65535)if(this.data[s+1]==1)s=Qe(this.data,s+2);else break;o=t(Qe(this.data,s+1))}return o}nextStates(e){let t=[];for(let n=this.stateSlot(e,1);;n+=3){if(this.data[n]==65535)if(this.data[n+1]==1)n=Qe(this.data,n+2);else break;if(!(this.data[n+2]&1)){let o=this.data[n+1];t.some((s,i)=>i&1&&s==o)||t.push(this.data[n],o)}}return t}configure(e){let t=Object.assign(Object.create(it.prototype),this);if(e.props&&(t.nodeSet=this.nodeSet.extend(...e.props)),e.top){let n=this.topRules[e.top];if(!n)throw new RangeError(`Invalid top rule name ${e.top}`);t.top=n}return e.tokenizers&&(t.tokenizers=this.tokenizers.map(n=>{let o=e.tokenizers.find(s=>s.from==n);return o?o.to:n})),e.specializers&&(t.specializers=this.specializers.slice(),t.specializerSpecs=this.specializerSpecs.map((n,o)=>{let s=e.specializers.find(a=>a.from==n.external);if(!s)return n;let i=Object.assign(Object.assign({},n),{external:s.to});return t.specializers[o]=Ni(i),i})),e.contextTracker&&(t.context=e.contextTracker),e.dialect&&(t.dialect=this.parseDialect(e.dialect)),e.strict!=null&&(t.strict=e.strict),e.wrap&&(t.wrappers=t.wrappers.concat(e.wrap)),e.bufferLength!=null&&(t.bufferLength=e.bufferLength),t}hasWrappers(){return this.wrappers.length>0}getName(e){return this.termNames?this.termNames[e]:String(e<=this.maxNode&&this.nodeSet.types[e].name||e)}get eofTerm(){return this.maxNode+1}get topNode(){return this.nodeSet.types[this.top[1]]}dynamicPrecedence(e){let t=this.dynamicPrecedences;return t==null?0:t[e]||0}parseDialect(e){let t=Object.keys(this.dialects),n=t.map(()=>!1);if(e)for(let s of e.split(" ")){let i=t.indexOf(s);i>=0&&(n[i]=!0)}let o=null;for(let s=0;s<t.length;s++)if(!n[s])for(let i=this.dialects[t[s]],a;(a=this.data[i++])!=65535;)(o||(o=new Uint8Array(this.maxTerm+1)))[a]=1;return new zn(e,n,o)}static deserialize(e){return new it(e)}};function Qe(r,e){return r[e]|r[e+1]<<16}function Mp(r){let e=null;for(let t of r){let n=t.p.stoppedAt;(t.pos==t.p.stream.end||n!=null&&t.pos>n)&&t.p.parser.stateFlag(t.state,2)&&(!e||e.score<t.score)&&(e=t)}return e}function Ni(r){if(r.external){let e=r.extend?1:0;return(t,n)=>r.external(t,n)<<1|e}return r.get}var Un=it.deserialize({version:14,states:"%QOVQPOOOOQO'#C_'#C_O_QQO'#C^OOQO'#DO'#DOOvQQO'#C|OOQO'#DR'#DROVQPO'#CuOOQO'#C}'#C}QOQPOOOOQO'#C`'#C`O!UQQO,58xO!dQPO,59VOVQPO,59]OVQPO,59_O!iQPO,59hO!nQQO,59aOOQO'#DQ'#DQOOQO1G.d1G.dO!UQQO1G.qO!yQQO1G.wOOQO1G.y1G.yOOQO'#Cw'#CwOOQO1G/S1G/SOOQO1G.{1G.{O#[QPO'#CnO#dQPO7+$]O!UQQO'#CxO#iQPO,59YOOQO<<Gw<<GwOOQO,59d,59dOOQO-E6v-E6v",stateData:"#q~OoOS~OsPOvUO~OTXOUXOVXOWXOXXOYXO`ZO~Of[Oh]Oj^OmpX~OZ`O[`O]`O^`O~OabO~OseO~Of[Oh]OwgO~Oh]Ofeijeimeiwei~OcjOdbX~OdlO~OcjOdba~O",goto:"#YvPPw}!TPPPPPPPPPPwPP!WPP!ZP!ZP!aP!g!jPPP!p!s!aP#P!aXROU[]XQOU[]RYQRibXTOU[]XVOU[]Rf^QkhRnkRWOQSOQ_UQc[Rd]QaYQhbRmj",nodeNames:"\u26A0 Filter ColumnValueExpression Column Operator Eq NotEq Gt Lt Starts Ends Number String True False ColumnSetExpression In LBrack Values Comma RBrack AndExpression And OrExpression Or ParenthesizedExpression As FilterName",maxTerm:39,skippedNodes:[0],repeatNodeCount:1,tokenData:"6p~RnXY#PYZ#P]^#Ppq#Pqr#brs#mxy$eyz$j|}$o!O!P$t!Q![%S!^!_%_!_!`%d!`!a%i!c!}%n!}#O&V#P#Q&[#R#S%n#T#U&a#U#X%n#X#Y(w#Y#Z+]#Z#]%n#]#^.]#^#c%n#c#d/e#d#g%n#g#h0m#h#i4[#i#o%n~#USo~XY#PYZ#P]^#Ppq#P~#eP!_!`#h~#mOU~~#pWOX#mZ]#m^r#mrs$Ys#O#m#P;'S#m;'S;=`$_<%lO#m~$_O[~~$bP;=`<%l#m~$jOv~~$oOw~~$tOc~~$wP!Q![$z~%PPZ~!Q![$z~%XQZ~!O!P$t!Q![%S~%dOW~~%iOT~~%nOV~P%sUsP}!O%n!O!P%n!Q![%n!c!}%n#R#S%n#T#o%n~&[Oa~~&aOd~R&fYsP}!O%n!O!P%n!Q![%n!c!}%n#R#S%n#T#b%n#b#c'U#c#g%n#g#h(^#h#o%nR'ZWsP}!O%n!O!P%n!Q![%n!c!}%n#R#S%n#T#W%n#W#X's#X#o%nR'zUfQsP}!O%n!O!P%n!Q![%n!c!}%n#R#S%n#T#o%nR(eUjQsP}!O%n!O!P%n!Q![%n!c!}%n#R#S%n#T#o%nR(|WsP}!O%n!O!P%n!Q![%n!c!}%n#R#S%n#T#b%n#b#c)f#c#o%nR)kWsP}!O%n!O!P%n!Q![%n!c!}%n#R#S%n#T#W%n#W#X*T#X#o%nR*YWsP}!O%n!O!P%n!Q![%n!c!}%n#R#S%n#T#g%n#g#h*r#h#o%nR*yUYQsP}!O%n!O!P%n!Q![%n!c!}%n#R#S%n#T#o%nR+bVsP}!O%n!O!P%n!Q![%n!c!}%n#R#S%n#T#U+w#U#o%nR+|WsP}!O%n!O!P%n!Q![%n!c!}%n#R#S%n#T#`%n#`#a,f#a#o%nR,kWsP}!O%n!O!P%n!Q![%n!c!}%n#R#S%n#T#g%n#g#h-T#h#o%nR-YWsP}!O%n!O!P%n!Q![%n!c!}%n#R#S%n#T#X%n#X#Y-r#Y#o%nR-yU^QsP}!O%n!O!P%n!Q![%n!c!}%n#R#S%n#T#o%nR.bWsP}!O%n!O!P%n!Q![%n!c!}%n#R#S%n#T#b%n#b#c.z#c#o%nR/RU`QsP}!O%n!O!P%n!Q![%n!c!}%n#R#S%n#T#o%nR/jWsP}!O%n!O!P%n!Q![%n!c!}%n#R#S%n#T#f%n#f#g0S#g#o%nR0ZUhQsP}!O%n!O!P%n!Q![%n!c!}%n#R#S%n#T#o%nR0rWsP}!O%n!O!P%n!Q![%n!c!}%n#R#S%n#T#h%n#h#i1[#i#o%nR1aVsP}!O%n!O!P%n!Q![%n!c!}%n#R#S%n#T#U1v#U#o%nR1{WsP}!O%n!O!P%n!Q![%n!c!}%n#R#S%n#T#f%n#f#g2e#g#o%nR2jWsP}!O%n!O!P%n!Q![%n!c!}%n#R#S%n#T#h%n#h#i3S#i#o%nR3XWsP}!O%n!O!P%n!Q![%n!c!}%n#R#S%n#T#g%n#g#h3q#h#o%nR3xUXQsP}!O%n!O!P%n!Q![%n!c!}%n#R#S%n#T#o%nR4aWsP}!O%n!O!P%n!Q![%n!c!}%n#R#S%n#T#f%n#f#g4y#g#o%nR5OWsP}!O%n!O!P%n!Q![%n!c!}%n#R#S%n#T#i%n#i#j5h#j#o%nR5mWsP}!O%n!O!P%n!Q![%n!c!}%n#R#S%n#T#X%n#X#Y6V#Y#o%nR6^U]QsP}!O%n!O!P%n!Q![%n!c!}%n#R#S%n#T#o%n",tokenizers:[0,1],topRules:{Filter:[0,1]},tokenPrec:0});import{isMultiClauseFilter as Bt,isMultiValueFilter as Pp,isSingleValueFilter as Lp}from"@vuu-ui/vuu-utils";var Ee,Ai=class{constructor(){xo(this,Ee,void 0)}setFilterCombinatorOp(e,t=Be(this,Ee)){Bt(t)&&t.op===e||jr(this,Ee,{op:e,filters:[Be(this,Ee)]})}add(e){if(Be(this,Ee)===void 0)jr(this,Ee,e);else if(Bt(Be(this,Ee)))Be(this,Ee).filters.push(e);else throw Error("Invalid filter passed to FilterExpression")}setColumn(e,t=Be(this,Ee)){if(Bt(t)){let n=t.filters.at(-1);n&&this.setColumn(e,n)}else t&&(t.column=e)}setOp(e,t=Be(this,Ee)){if(Bt(t)){let n=t.filters.at(-1);n&&this.setOp(e,n)}else t&&(t.op=e)}setValue(e,t=Be(this,Ee)){var n;if(Bt(t)){let o=t.filters.at(-1);o&&this.setValue(e,o)}else Pp(t)?((n=t.values)!=null||(t.values=[]),t.values.push(e)):Lp(t)&&(t.value=e)}toJSON(e=Be(this,Ee)){return this.name?{...e,name:this.name}:e}};Ee=new WeakMap;var sM=Un.configure({strict:!0});import{getRowRecord as xM,isGroupMenuItemDescriptor as yM,metadataKeys as Hp}from"@vuu-ui/vuu-utils";import{useCallback as vM}from"react";var{KEY:IM}=Hp;import{getServerAPI as Np}from"@vuu-ui/vuu-data";import{useCallback as DM,useEffect as MM,useState as LM}from"react";var Fi=r=>Np().then(e=>e.getTableSchema(r));import{useViewContext as Ap}from"@vuu-ui/vuu-layout";import{useCallback as Fp,useMemo as Vi,useState as Bi}from"react";var $i=({dataSource:r,searchColumns:e=["description"],table:t})=>{let[n,o]=Bi(r),{loadSession:s,saveSession:i}=Ap(),[a,l]=Bi({searchText:"",filter:""}),u=Vi(()=>e.map(p=>`${p} starts "__VALUE__"`).join(" or "),[e]);Vi(()=>{if(r===void 0)if(t){let p=`instrument-search-${t.module}-${t.table}`,c=s==null?void 0:s(p);c?o(c):Fi(t).then(m=>{let f=new Op({columns:m.columns.map(h=>h.name),table:m.table});o(f),i==null||i(f,p)})}else throw Error("useInstrumentSearch, if dataSource ismnot provided as prop, Vuu table must be provided")},[r,s,i,t]);let d=Fp(p=>{let{value:c}=p.target,m=u.replaceAll("__VALUE__",c);l({searchText:c,filter:m}),n&&(n.filter={filter:m})},[u,n]);return{dataSource:n,onChange:d,searchState:a}};import{jsx as Vr,jsxs as Qp}from"react/jsx-runtime";var Gn="vuuInstrumentSearch",Up={columns:[{name:"bbg",hidden:!0},{name:"description",width:200,type:{name:"string",renderer:{name:"search-cell"}}}],rowSeparators:!0},Gp=Vr("span",{"data-icon":"search"}),Wp=({TableProps:r,autoFocus:e=!1,className:t,dataSource:n,placeHolder:o,searchColumns:s,table:i,...a})=>{var g;let{dataSource:l,onChange:u,searchState:d}=$i({dataSource:n,searchColumns:s,table:i}),{highlightedIndexRef:p,onHighlight:c,onKeyDown:m,tableRef:f}=$p(-1,(g=l==null?void 0:l.size)!=null?g:0),h=zp(y=>{setTimeout(()=>{var E;(E=y==null?void 0:y.querySelector("input"))==null||E.focus()},100)},[]);return Qp("div",{...a,className:Kp(Gn,t),children:[Vr("div",{className:`${Gn}-inputField`,children:Vr(_p,{inputProps:{onKeyDown:m},endAdornment:Gp,placeholder:o,ref:e?h:null,value:d.searchText,onChange:u})}),l?Vr(Bp,{disableFocus:!0,id:"instrument-search",rowHeight:25,config:Up,highlightedIndex:p.current,renderBufferSize:100,...r,className:`${Gn}-list`,dataSource:l,navigationStyle:"row",onHighlight:c,ref:f,showColumnHeaders:!1}):null]})},_i;(_i=Vp)==null||_i("InstrumentSearch",Wp,"view");import{getMovingValueDirection as jp,isValidNumber as Xp,numericFormatter as Zp}from"@vuu-ui/vuu-utils";import{memo as qp,useMemo as Jp,useRef as Yp}from"react";import ef from"classnames";import{jsx as sf,jsxs as af}from"react/jsx-runtime";var tf="vuuPriceTicker",rf=r=>Zp({type:{name:"number",formatting:{decimals:r,zeroPad:!0}}}),nf=[void 0,void 0],of=qp(({className:r,decimals:e=2,price:t,showArrow:n,...o})=>{let s=Yp(nf),[i,a]=s.current,l=Jp(()=>rf(e),[e]),u=Xp(i)?jp(t,a,i,e):"";return s.current=[t,u],af("div",{...o,className:ef(tf,r,u),children:[l(t),n?sf("span",{"data-icon":"price-arrow"}):null]})});of.displayName="PriceTicker";import{asReactElements as Mf,OverflowContainer as Pf,useId as Lf}from"@vuu-ui/vuu-layout";import{Button as kf}from"@salt-ds/core";import Zn from"classnames";import Rf,{useMemo as Hf,useRef as Nf}from"react";import{dispatchMouseEvent as Tf}from"@vuu-ui/vuu-utils";import{useCallback as Le,useRef as Cf}from"react";var Ki=r=>typeof r=="object"&&r!==null&&"tabIndex"in r&&typeof r.tabIndex=="number",zi=r=>({label:"Close",location:"tab",action:"close-tab",options:r}),Ui=r=>({label:"Rename",location:"tab",action:"rename-tab",options:r});import{getElementDataIndex as lf}from"@vuu-ui/vuu-utils";var Gi=(r,e)=>{if(r){let t=r.querySelector(`[data-index]:has(${e})`);return lf(t)}return-1},Wn=r=>Gi(r,'[aria-selected="true"]'),Wi=r=>Gi(r,".vuuEditableLabel-editing");import{isValidNumber as Qn,MEASURES as uf}from"@vuu-ui/vuu-utils";import{useCallback as jn,useMemo as cf,useRef as Qi}from"react";var ji=(r,e,t="horizontal")=>{let n=Qi(!1),o=jn(()=>{n.current=!0},[]),s=jn(()=>{n.current=!1},[]),i=jn(()=>{var l,u;(l=r.current)==null||l.style.setProperty("--tab-thumb-transition","none"),(u=r.current)==null||u.removeEventListener("transitionend",i)},[r]),a=Qi(-1);return cf(()=>{var d,p;let l=0,u=0;if(a.current!==-1){let c=(d=r.current)==null?void 0:d.querySelector(".vuuTab-selected"),m=(p=r.current)==null?void 0:p.querySelector(`[data-index="${e}"] .vuuTab`),{positionProp:f,sizeProp:h}=uf[t];if(c&&m&&!n.current){let{[f]:g,[h]:y}=c.getBoundingClientRect(),{[f]:E}=m.getBoundingClientRect();if(Qn(g)&&Qn(E)&&Qn(y)){l=g-E,u=y;let b=Math.abs(l/(t==="horizontal"?1100:700));requestAnimationFrame(()=>{var v,S,T,A;(v=r.current)==null||v.style.setProperty("--tab-thumb-offset","0px"),(S=r.current)==null||S.style.setProperty("--tab-thumb-size","100%"),(T=r.current)==null||T.style.setProperty("--tab-thumb-transition",`all ${b}s ease`),(A=r.current)==null||A.addEventListener("transitionend",i)})}}}return a.current=e,n.current?{containerStyle:{"--tab-thumb-offset":"0px","--tab-thumb-size":"100%"},resumeAnimation:s,suspendAnimation:o}:{containerStyle:{"--tab-thumb-offset":`${l}px`,"--tab-thumb-size":u?`${u}px`:void 0},resumeAnimation:s,suspendAnimation:o}},[e,r,t,i,s,o])};import{useControlled as df}from"@salt-ds/core";import{dispatchMouseEvent as pf,getFocusableElement as ff}from"@vuu-ui/vuu-utils";import{useCallback as Ke,useRef as Xn,useState as Xi}from"react";import{ArrowDown as Yi,ArrowUp as mf,ArrowLeft as hf,ArrowRight as gf,Home as Zi,End as qi}from"@vuu-ui/vuu-utils";var ea={horizontal:{[Zi]:"start",[qi]:"end",[hf]:"bwd",[gf]:"fwd"},vertical:{[Zi]:"start",[qi]:"end",[mf]:"bwd",[Yi]:"fwd"}},bf=(r,e="horizontal")=>ea[e][r]!==void 0,xf=r=>r===Yi;function Ji(r,e,t){return e==="start"?0:e==="end"?r-1:e==="bwd"?t>0?t-1:t:t===null?0:t===r-1?t:t+1}var yf=r=>r!==null&&!r.classList.contains("wrapped"),Br=(r,e)=>r?r.querySelector(`[data-index="${e}"]`):null,ta=({containerRef:r,defaultHighlightedIdx:e=-1,highlightedIdx:t,keyBoardActivation:n,orientation:o,selectedIndex:s=0})=>{let i=n==="manual",a=Xn(!1),l=Xn(-1),[u,d]=Xi(!1),[,p]=Xi({}),[c,m]=df({controlled:t,default:e,name:"UseKeyboardNavigation"}),f=Ke(x=>{m(l.current=x)},[m]),h=Xn(!1),g=Ke((x,L=!1,N,k=70)=>{f(x),N===!0&&!h.current&&(h.current=!0);let P=()=>{let R=Br(r.current,x);if(R){let M=ff(R);M==null||M.focus()}};L?P():setTimeout(P,k)},[r,f]),y=x=>{if(l.current===-1&&x.target.tabIndex!==-1){let L=Wi(r.current);L!==-1?requestAnimationFrame(()=>{f(L)}):setTimeout(()=>{l.current===-1&&s!==null&&f(s)},200)}},E=Ke(()=>{var x,L;return(L=(x=r.current)==null?void 0:x.querySelectorAll("[data-index]").length)!=null?L:0},[r]),I=Ke((x="fwd",L)=>{let N=E(),P=Ji(N,x,typeof L=="number"?L:N),R=x==="start"?"fwd":x==="end"?"bwd":x;for(;(R==="fwd"&&P<N||R==="bwd"&&P>0)&&!yf(Br(r.current,P));){let M=Ji(N,R,P);if(M===P)break;P=M}return P},[r,E]),b=Ke((x,L=!1)=>{let N=ea[o][x.key],k=I(N,c);k!==c?i&&g(k,!0):L&&p({})},[c,i,I,g,o]),v=Ke(()=>{let x=Br(r.current,c);return x?x.querySelector(".vuuPopupMenu")!=null:!1},[r,c]),S=Ke(()=>{let x=Br(r.current,c),L=x==null?void 0:x.querySelector(".vuuPopupMenu");return L&&pf(L,"click"),!1},[r,c]),T=Ke(x=>{E()>0&&bf(x.key,o)?(x.preventDefault(),h.current?b(x):(h.current=!0,b(x,!0))):xf(x.key)&&v()&&S()},[S,E,v,b,o]),A=(x,L)=>{f(L)},w=Ke(()=>{u||(d(!0),a.current?a.current=!1:h.current=!0)},[u]),D=Ke(()=>{u||(a.current=!0),h.current=!1},[u]);return{containerProps:{onBlur:x=>{let L=x.target.closest(".vuuTabstrip"),N=x.relatedTarget;L&&!(L!=null&&L.contains(N))&&(f(-1),d(!1))},onMouseDownCapture:D,onFocus:w,onMouseLeave:()=>{h.current=!0,f(-1),a.current=!1}},focusVisible:h.current?c:-1,focusIsWithinComponent:u,highlightedIdx:c,focusTab:g,onClick:A,onFocus:y,onKeyDown:T,setHighlightedIdx:f}};import{useControlled as Sf}from"@salt-ds/core";import{useCallback as $r}from"react";var vf=["Enter"," "],If=r=>r&&r.matches('[class*="vuuTab "]'),ra=({defaultSelected:r,highlightedIdx:e,onSelectionChange:t,selected:n})=>{let[o,s,i]=Sf({controlled:n,default:r!=null?r:0,name:"Tabstrip",state:"value"}),a=$r(p=>vf.includes(p.key),[]),l=$r(p=>{s(p),t==null||t(p)},[t,s]),u=$r(p=>{let c=p.target;a(p)&&e!==o&&If(c)&&(p.stopPropagation(),p.preventDefault(),l(e))},[a,e,o,l]),d=$r((p,c)=>{c!==o&&l(c)},[l,o]);return{activateTab:l,isControlled:i,onClick:d,onKeyDown:u,selected:o}};var wf=new Set(["Enter"," "]),Ef=r=>wf.has(r),Df=(r,e)=>r?r.querySelector(`[data-index="${e}"]`):null,na=({activeTabIndex:r,allowDragDrop:e,animateSelectionThumb:t,containerRef:n,onActiveChange:o,onAddTab:s,onCloseTab:i,onExitEditMode:a,onMoveTab:l,orientation:u,keyBoardActivation:d})=>{let p=Cf(r),{focusTab:c,highlightedIdx:m,onClick:f,onKeyDown:h,setHighlightedIdx:g,...y}=ta({containerRef:n,keyBoardActivation:d,orientation:u,selectedIndex:p.current}),{activateTab:E,onClick:I,onKeyDown:b,selected:v}=ra({highlightedIdx:m,onSelectionChange:o,selected:r});p.current=v;let{containerStyle:S,resumeAnimation:T,suspendAnimation:A}=ji(n,t?v:-1,u),w=Le(($,_)=>{let{current:Y}=p;console.log(`useTabstrip handleDrop ${$} - ${_} ${Y}`),l==null||l($,_);let X=-1;_!==-1&&(Y===$?X=_:$>Y&&_<=Y?X=Y+1:$<Y&&_>=Y&&(X=Y-1),X!==-1&&(A(),E(X),requestAnimationFrame(T)),c(_,!1,!1,350))},[c,l,T,E,A]),{onMouseDown:D,...O}=yr({allowDragDrop:e,containerRef:n,draggableClassName:`tabstrip-${u}`,onDrop:w,orientation:"horizontal",itemQuery:".vuuOverflowContainer-item"}),x=Le(($,_,Y,X)=>{console.log(`handleExitEditMode ${$} ${_} ${Y} ${X}`),a==null||a($,_,Y,X),Y||c(X,!1,!0)},[c,a]),L=Le(($,_)=>{f($,_),I($,_)},[f,I]),N=Le(($=m)=>{let _=Df(n.current,$);if(_)return _.querySelector(".vuuEditableLabel")},[n,m]),k=Le(($=m)=>{let _=N($);return _?_.classList.contains("vuuEditableLabel-editing"):!1},[N,m]),P=Le(($=m)=>{let _=N($);_&&Tf(_,"dblclick")},[N,m]),R=Le($=>{h($),$.defaultPrevented||b($),!$.defaultPrevented&&Ef($.key)&&P()},[P,h,b]),M=Le($=>{let _=Wn(n.current),Y=_>$?_-1:_===$?0:_;return A(),i==null||i($,Y),setTimeout(()=>{T()},200),!0},[n,i,T,A]),V=Le($=>(P($),!0),[P]),C=Le($=>{if(Ki($.options))switch($.menuId){case"close-tab":return M($.options.tabIndex);case"rename-tab":return V($.options.tabIndex);default:console.log(`tab menu action ${$.menuId}`)}return!1},[M,V]),F=Le(()=>{k()?g(m):c(m)},[m,c,g,k]),H=Le($=>{let _=parseInt($.index);isNaN(_)||E(_)},[E]),B={onFocus:y.onFocus,onKeyDown:R},z=Le(()=>{s==null||s(),requestAnimationFrame(()=>{let $=Wn(n.current);$!==-1&&c($)})},[n,c,s]),G={onClick:L,onKeyDown:R,onExitEditMode:x,onMenuAction:C,onMenuClose:F,onMouseDown:D};return{activeTabIndex:v,containerStyle:S,focusVisible:y.focusVisible,containerProps:{...y.containerProps,onSwitchWrappedItemIntoView:H},navigationProps:B,onClickAddTab:z,tabProps:G,...O}};import{Fragment as Ff,jsx as Af,jsxs as Vf}from"react/jsx-runtime";import{createElement as Of}from"react";var qn="vuuTabstrip",xp=({activeTabIndex:r,allowAddTab:e,allowCloseTab:t,allowDragDrop:n=!1,allowRenameTab:o=!1,animateSelectionThumb:s=!1,children:i,className:a,id:l,keyBoardActivation:u="manual",location:d,onActiveChange:p,onAddTab:c,onCloseTab:m,onExitEditMode:f,onMoveTab:h,orientation:g="horizontal",showTabMenuButton:y,style:E,tabClassName:I,...b})=>{let v=Nf(null),{activeTabIndex:S,focusVisible:T,containerStyle:A,draggedItemIndex:w,onClickAddTab:D,tabProps:O,...x}=na({activeTabIndex:r,allowDragDrop:n,animateSelectionThumb:s,containerRef:v,keyBoardActivation:u,onActiveChange:p,onAddTab:c,onCloseTab:m,onExitEditMode:f,onMoveTab:h,orientation:g}),L=Lf(l),N=Zn(qn,`${qn}-${g}`,a),k=E||A?{...E,...A}:void 0,P=Hf(()=>Mf(i).map((R,M)=>{let{id:V=`${L}-tab-${M}`,className:C,closeable:F=t,editable:H=o,location:B,showMenuButton:z=y}=R.props,G=M===S;return Rf.cloneElement(R,{...O,...x.navigationProps,className:Zn(C,I),closeable:F,"data-overflow-priority":G?"1":void 0,dragging:w===M,editable:H,focusVisible:T===M,id:V,index:M,key:M,location:Zn(d,B),selected:G,showMenuButton:z,tabIndex:G?0:-1})}).concat(e?Of(kf,{...x.navigationProps,"aria-label":"Create Tab",className:`${qn}-addTabButton`,"data-icon":"add","data-overflow-priority":"1",key:"addButton",onClick:D,variant:"secondary",tabIndex:-1}):[]),[i,e,x.navigationProps,D,L,t,o,y,S,O,I,w,T,d]);return Vf(Ff,{children:[Af(Pf,{...b,...x.containerProps,className:N,height:29,id:L,orientation:g,overflowIcon:"more-horiz",ref:v,style:k,children:P}),x.draggable]})};import{useForkRef as Uf}from"@salt-ds/core";import Gf from"classnames";import{forwardRef as Wf,useCallback as Qf,useRef as sa}from"react";import{PopupMenu as Bf}from"@vuu-ui/vuu-popups";import{useMemo as $f}from"react";import _f from"classnames";import{jsx as zf}from"react/jsx-runtime";var Kf="vuuTabMenu",oa=({allowClose:r,allowRename:e,controlledComponentId:t,controlledComponentTitle:n,location:o,onMenuAction:s,onMenuClose:i,index:a})=>{let[l,u]=$f(()=>[(d,p)=>{let c=[];return e&&c.push(Ui(p)),r&&c.push(zi(p)),c},{controlledComponentId:t,controlledComponentTitle:n,tabIndex:a}],[r,e,t,a]);return zf(Bf,{className:Kf,menuBuilder:l,menuActionHandler:s,menuLocation:_f("tab",o),menuOptions:u,onMenuClose:i,tabIndex:-1})};import{jsx as _r,jsxs as jf}from"react/jsx-runtime";var at="vuuTab",ia=()=>{},yp=Wf(function({ariaControls:e,children:t,className:n,closeable:o=!1,dragging:s,editable:i=!1,editing:a,focusVisible:l,index:u=-1,label:d,location:p,onClick:c,onClose:m,onEnterEditMode:f=ia,onExitEditMode:h=ia,onFocus:g,onKeyUp:y,onMenuAction:E,onMenuClose:I,orientation:b,selected:v,showMenuButton:S=o||i||!!p,tabIndex:T,...A},w){if(S&&typeof E!="function")throw Error("Tab onMenuAction must be provided if showMenuButton is set");let D=sa(null),O=sa(null),x=Uf(w,D),L=Qf(M=>{a||(M.preventDefault(),c==null||c(M,u))},[a,u,c]),N=(M="",V="",C=!0)=>h(M,V,C,u),k=M=>{switch(M.key){case"Backspace":case"Delete":o&&(M.stopPropagation(),m&&m(u));break;default:y&&y(M,u)}},P=()=>i?_r(di,{editing:a,defaultValue:d,onEnterEditMode:f,onExitEditMode:N,ref:O},d):d,R=M=>{if(O.current){let C=O.current.querySelector(".vuuEditableLabel-input");C==null||C.focus()}g==null||g(M)};return jf("div",{...A,"aria-controls":e,"aria-selected":v,className:Gf(at,n,{[`${at}-closeable`]:o,"vuuDraggable-dragAway":s,[`${at}-editing`]:a,[`${at}-selected`]:v||void 0,[`${at}-vertical`]:b==="vertical",vuuFocusVisible:l}),onClick:L,onFocus:R,onKeyUp:k,ref:x,role:"tab",tabIndex:T,children:[_r("div",{className:`${at}-main`,children:_r("span",{className:`${at}-text`,"data-text":i?void 0:d,children:t!=null?t:P()})}),S?_r(oa,{allowClose:o,allowRename:i,controlledComponentId:e,controlledComponentTitle:d,location:p,onMenuAction:E,onMenuClose:I,index:u}):null]})});import{useForkRef as Cm,useIdMemo as wm}from"@salt-ds/core";import io from"classnames";import{forwardRef as Em,useRef as Dm}from"react";function Xf(r){var e;if(r){let t=r.dataset.idx;if(t)return parseInt(t,10);if(t=(e=r.ariaPosInSet)!=null?e:"-1")return parseInt(t,10)-1}}var Jn=r=>r.closest("[data-idx],[aria-posinset]");var aa=r=>Xf(Jn(r));import{useCallback as Yn,useMemo as Zf}from"react";var qf=new Set(["/","-","."]),Jf=r=>qf.has(r),la=(r,e)=>e.startsWith(r)&&Jf(e[r.length]),ua=(r,e="root",{collapsibleHeaders:t=void 0,defaultExpanded:n=!1,revealSelected:o=!1}={})=>{let s=(c,m,f)=>{if(c.childNodes)return c.childNodes.length;if(c.header){let h=f+1,g=0;for(;h<m.length&&!m[h].header;)g++,h++;return g}else return 0},i=Yn(c=>Array.isArray(o)?o.some(m=>la(c,m)):n,[n,o]),a=Yn((c,m,f=1,h="",g=[],y=[])=>{let E=0;return c.forEach((I,b,v)=>{var N;let S=I.header&&t,T=I.childNodes&&t===!1,A=!I.childNodes||I.childNodes.length===0,w=T||A&&!S,D=h?`${h}.${b}`:`${b}`,O=(N=I.id)!=null?N:`${e}-${D}`,x=w?void 0:i(O),L={...I,childNodes:void 0,id:O,count:!T&&x===void 0?0:s(I,v,b),expanded:x,index:m.index,level:f};if(g.push(L),y.push(c[b]),E+=1,m.index+=1,I.childNodes){let[k,P]=a(I.childNodes,m,f+1,D,[],y);L.childNodes=P,(x===!0||T)&&(E+=k)}}),[E,g,y]},[t,e,i]),[l,u,d]=Zf(()=>a(r,{index:0}),[a,r]),p=Yn((c,m=u)=>{let f=m.find(h=>{var g;return h.id===c||((g=h==null?void 0:h.childNodes)==null?void 0:g.length)&&la(h.id,c)});if((f==null?void 0:f.id)===c)return d[f.index];if(f)return p(c,f.childNodes)},[d,u]);return[l,u,p]};import{useCallback as $t,useRef as Yf}from"react";import{useControlled as em}from"@salt-ds/core";var ca="single",tm="checkbox",rm="multi",nm="extended",om=["Enter"," "],da={},sm=r=>r.expanded!==void 0,pa=r=>r&&r!=="none",fa=({defaultSelected:r,highlightedIdx:e,treeNodes:t,onChange:n,selected:o,selection:s=ca,selectionKeys:i=om})=>{let a=s===ca,l=s===rm||s.startsWith(tm),u=s===nm,d=Yf(-1),p=$t(b=>i.includes(b.key),[i]),[c,m]=em({controlled:o,default:r!=null?r:[],name:"selected"}),f=$t((b,v,S,T,A=!1)=>{let{current:w}=d,D=c==null?void 0:c.includes(S),x=a||u&&!A&&(!T||w===-1),L=l||u&&A&&!T,N=[];if(x&&D)N=[];else if(x)N=[S];else if(L&&D)N=c.filter(k=>k!==S);else if(L)N=c.concat(S);else if(u){let[k,P]=v>w?[w,v]:[v,w];N=c.slice();for(let R=k;R<=P;R++){let{id:M}=t[R];c.includes(M)||N.push(M)}}m(N),n&&n(b,N)},[u,t,l,n,c,m,a]),h=$t(b=>{if(~e&&p(b)){b.preventDefault();let v=t[e];f(b,e,v.id,!1,b.ctrlKey||b.metaKey),u&&(d.current=e)}},[u,e,t,p,f]),g=$t((b,v)=>{if(u&&b.shiftKey){let S=t[v];f(b,v,S.id,!0)}},[u,t,f]),y=s==="none"?da:{onKeyDown:h,onKeyboardNavigation:g},E=$t(b=>{if(e!==-1){let v=t[e];sm(v)||(b.preventDefault(),b.stopPropagation(),f(b,e,v.id,b.shiftKey,b.ctrlKey||b.metaKey),u&&(d.current=e))}},[u,e,t,f]);return{listHandlers:y,listItemHandlers:s==="none"?da:{onClick:E},selected:c,setSelected:m}};import{useCallback as eo,useEffect as ma,useLayoutEffect as im,useRef as Kr}from"react";var am=["height","scrollHeight"],ha=(r,e,t=!1)=>{let n=Kr(0),o=Kr(!1),s=Kr(0),i=Kr(0),a=eo(d=>{let p=d.ariaExpanded?d.firstChild:d,c=t?30:0,m=p.offsetTop,f=p.offsetHeight,h=n.current+c,g=h+s.current-c;(m+f>g||m<h)&&(n.current=m+f>g?n.current+(m+f)-g:m-c,o.current=!0,r.current&&(r.current.scrollTop=n.current),setTimeout(()=>{o.current=!1}))},[r,t]),l=eo(d=>{n.current=d.target.scrollTop},[]);ma(()=>{let{current:d}=r;return d&&d.addEventListener("scroll",l),()=>{d&&d.removeEventListener("scroll",l)}},[r,l]),im(()=>{if(e!==-1&&i.current>s.current&&r.current){let d=r.current.querySelector(`
|
|
5
|
+
Wrap elements with a single container`),r)},Ii=({applyThemeClasses:r=!1,children:e,theme:t,themeMode:n,density:o})=>{var c,m,f;let{density:s,themeMode:i,theme:a}=cp(vi),l=(c=o!=null?o:s)!=null?c:pp,u=(m=n!=null?n:i)!=null?m:mp,d=(f=t!=null?t:a)!=null?f:fp,p=r?hp(e,d,u,l):e;return gp(vi.Provider,{value:{themeMode:u,density:l,theme:d},children:p})};Ii.displayName="ThemeProvider";import{jsx as KE,jsxs as zE}from"react/jsx-runtime";import{useCallback as YE,useEffect as e3,useMemo as t3,useRef as r3,useState as n3}from"react";import s3 from"classnames";import{useIdMemo as a3}from"@salt-ds/core";import{Button as u3}from"@salt-ds/core";import{hasAction as p3,isErrorResponse as f3,RemoteDataSource as m3}from"@vuu-ui/vuu-data";import{buildColumnMap as b3,isValidNumber as x3,shallowEquals as y3}from"@vuu-ui/vuu-utils";import{jsx as I3,jsxs as T3}from"react/jsx-runtime";import{connectToServer as X2}from"@vuu-ui/vuu-data";import{DraggableLayout as q2,LayoutProvider as J2,loadingApplicationJson as eD,useLayoutContextMenuItems as tD}from"@vuu-ui/vuu-layout";import{logger as Sp}from"@vuu-ui/vuu-utils";import oD from"classnames";import{useCallback as uD,useEffect as cD,useRef as dD}from"react";import{Button as L3}from"@salt-ds/core";import R3 from"classnames";import{useCallback as N3,useMemo as O3}from"react";import{layoutFromJson as F3,View as B3,useLayoutProviderDispatch as $3}from"@vuu-ui/vuu-layout";import{jsx as z3,jsxs as U3}from"react/jsx-runtime";import{DraggableLayout as d2,Flexbox as p2}from"@vuu-ui/vuu-layout";import{useMemo as Y3}from"react";import t2 from"classnames";import{jsx as o2}from"react/jsx-runtime";import{jsx as g2,jsxs as b2}from"react/jsx-runtime";import{DockLayout as S2,DraggableLayout as v2,Drawer as I2,Flexbox as T2,View as C2}from"@vuu-ui/vuu-layout";import{useCallback as M2,useRef as P2,useState as L2}from"react";import{jsx as R2,jsxs as H2}from"react/jsx-runtime";import{ContextMenuProvider as yD,useDialog as SD}from"@vuu-ui/vuu-popups";import{jsx as CD,jsxs as wD}from"react/jsx-runtime";var{error:ID}=Sp("Shell");import{createContext as vp,useContext as kD}from"react";import{jsx as ND}from"react/jsx-runtime";var Ip={},RD=vp(Ip);import BD from"classnames";import{ToggleButton as _D,ToggleButtonGroup as KD,useControlled as zD}from"@salt-ds/core";import{useCallback as QD}from"react";import{jsx as ZD,jsxs as qD}from"react/jsx-runtime";import{buildColumnMap as I4,isLookupRenderer as T4,isTypeDescriptor as C4}from"@vuu-ui/vuu-utils";import{useMemo as E4,useState as D4}from"react";import{useCallback as L4,useEffect as k4,useState as R4}from"react";import{ConnectionManager as N4}from"@vuu-ui/vuu-data";import{useCallback as V4,useEffect as B4,useState as $4}from"react";import{ConnectionManager as K4}from"@vuu-ui/vuu-data";import{useCallback as G4}from"react";import{makeRpcCall as Q4}from"@vuu-ui/vuu-data";var Tp=0,At=class{constructor(e,t){this.from=e,this.to=t}},ne=class{constructor(e={}){this.id=Tp++,this.perNode=!!e.perNode,this.deserialize=e.deserialize||(()=>{throw new Error("This node type doesn't define a deserialize function")})}add(e){if(this.perNode)throw new RangeError("Can't add per-node props to node types");return typeof e!="function"&&(e=we.match(e)),t=>{let n=e(t);return n===void 0?null:[this,n]}}};ne.closedBy=new ne({deserialize:r=>r.split(" ")});ne.openedBy=new ne({deserialize:r=>r.split(" ")});ne.group=new ne({deserialize:r=>r.split(" ")});ne.contextHash=new ne({perNode:!0});ne.lookAhead=new ne({perNode:!0});ne.mounted=new ne({perNode:!0});var Cp=Object.create(null),we=class{constructor(e,t,n,o=0){this.name=e,this.props=t,this.id=n,this.flags=o}static define(e){let t=e.props&&e.props.length?Object.create(null):Cp,n=(e.top?1:0)|(e.skipped?2:0)|(e.error?4:0)|(e.name==null?8:0),o=new we(e.name||"",t,e.id,n);if(e.props){for(let s of e.props)if(Array.isArray(s)||(s=s(o)),s){if(s[0].perNode)throw new RangeError("Can't store a per-node prop on a node type");t[s[0].id]=s[1]}}return o}prop(e){return this.props[e.id]}get isTop(){return(this.flags&1)>0}get isSkipped(){return(this.flags&2)>0}get isError(){return(this.flags&4)>0}get isAnonymous(){return(this.flags&8)>0}is(e){if(typeof e=="string"){if(this.name==e)return!0;let t=this.prop(ne.group);return t?t.indexOf(e)>-1:!1}return this.id==e}static match(e){let t=Object.create(null);for(let n in e)for(let o of n.split(" "))t[o]=e[n];return n=>{for(let o=n.prop(ne.group),s=-1;s<(o?o.length:0);s++){let i=t[s<0?n.name:o[s]];if(i)return i}}}};we.none=new we("",Object.create(null),0,8);var xt=class{constructor(e){this.types=e;for(let t=0;t<e.length;t++)if(e[t].id!=t)throw new RangeError("Node type ids should correspond to array positions when creating a node set")}extend(...e){let t=[];for(let n of this.types){let o=null;for(let s of e){let i=s(n);i&&(o||(o=Object.assign({},n.props)),o[i[0].id]=i[1])}t.push(o?new we(n.name,o,n.id,n.flags):n)}return new xt(t)}},Rr=new WeakMap,Ti=new WeakMap,me;(function(r){r[r.ExcludeBuffers=1]="ExcludeBuffers",r[r.IncludeAnonymous=2]="IncludeAnonymous",r[r.IgnoreMounts=4]="IgnoreMounts",r[r.IgnoreOverlays=8]="IgnoreOverlays"})(me||(me={}));var be=class{constructor(e,t,n,o,s){if(this.type=e,this.children=t,this.positions=n,this.length=o,this.props=null,s&&s.length){this.props=Object.create(null);for(let[i,a]of s)this.props[typeof i=="number"?i:i.id]=a}}toString(){let e=this.prop(ne.mounted);if(e&&!e.overlay)return e.tree.toString();let t="";for(let n of this.children){let o=n.toString();o&&(t&&(t+=","),t+=o)}return this.type.name?(/\W/.test(this.type.name)&&!this.type.isError?JSON.stringify(this.type.name):this.type.name)+(t.length?"("+t+")":""):t}cursor(e=0){return new St(this.topNode,e)}cursorAt(e,t=0,n=0){let o=Rr.get(this)||this.topNode,s=new St(o);return s.moveTo(e,t),Rr.set(this,s._tree),s}get topNode(){return new Fe(this,0,0,null)}resolve(e,t=0){let n=yt(Rr.get(this)||this.topNode,e,t,!1);return Rr.set(this,n),n}resolveInner(e,t=0){let n=yt(Ti.get(this)||this.topNode,e,t,!0);return Ti.set(this,n),n}iterate(e){let{enter:t,leave:n,from:o=0,to:s=this.length}=e,i=e.mode||0,a=(i&me.IncludeAnonymous)>0;for(let l=this.cursor(i|me.IncludeAnonymous);;){let u=!1;if(l.from<=s&&l.to>=o&&(!a&&l.type.isAnonymous||t(l)!==!1)){if(l.firstChild())continue;u=!0}for(;u&&n&&(a||!l.type.isAnonymous)&&n(l),!l.nextSibling();){if(!l.parent())return;u=!0}}}prop(e){return e.perNode?this.props?this.props[e.id]:void 0:this.type.prop(e)}get propValues(){let e=[];if(this.props)for(let t in this.props)e.push([+t,this.props[t]]);return e}balance(e={}){return this.children.length<=8?this:On(we.none,this.children,this.positions,0,this.children.length,0,this.length,(t,n,o)=>new be(this.type,t,n,o,this.propValues),e.makeTree||((t,n,o)=>new be(we.none,t,n,o)))}static build(e){return wp(e)}};be.empty=new be(we.none,[],[],0);var Ft=class{constructor(e,t){this.buffer=e,this.index=t}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}get pos(){return this.index}next(){this.index-=4}fork(){return new Ft(this.buffer,this.index)}},We=class{constructor(e,t,n){this.buffer=e,this.length=t,this.set=n}get type(){return we.none}toString(){let e=[];for(let t=0;t<this.buffer.length;)e.push(this.childString(t)),t=this.buffer[t+3];return e.join(",")}childString(e){let t=this.buffer[e],n=this.buffer[e+3],o=this.set.types[t],s=o.name;if(/\W/.test(s)&&!o.isError&&(s=JSON.stringify(s)),e+=4,n==e)return s;let i=[];for(;e<n;)i.push(this.childString(e)),e=this.buffer[e+3];return s+"("+i.join(",")+")"}findChild(e,t,n,o,s){let{buffer:i}=this,a=-1;for(let l=e;l!=t&&!(wi(s,o,i[l+1],i[l+2])&&(a=l,n>0));l=i[l+3]);return a}slice(e,t,n){let o=this.buffer,s=new Uint16Array(t-e),i=0;for(let a=e,l=0;a<t;){s[l++]=o[a++],s[l++]=o[a++]-n;let u=s[l++]=o[a++]-n;s[l++]=o[a++]-e,i=Math.max(i,u)}return new We(s,i,this.set)}};function wi(r,e,t,n){switch(r){case-2:return t<e;case-1:return n>=e&&t<e;case 0:return t<e&&n>e;case 1:return t<=e&&n>e;case 2:return n>e;case 4:return!0}}function Ei(r,e){let t=r.childBefore(e);for(;t;){let n=t.lastChild;if(!n||n.to!=t.to)break;n.type.isError&&n.from==n.to?(r=t,t=n.prevSibling):t=n}return r}function yt(r,e,t,n){for(var o;r.from==r.to||(t<1?r.from>=e:r.from>e)||(t>-1?r.to<=e:r.to<e);){let i=!n&&r instanceof Fe&&r.index<0?null:r.parent;if(!i)return r;r=i}let s=n?0:me.IgnoreOverlays;if(n)for(let i=r,a=i.parent;a;i=a,a=i.parent)i instanceof Fe&&i.index<0&&((o=a.enter(e,t,s))===null||o===void 0?void 0:o.from)!=i.from&&(r=a);for(;;){let i=r.enter(e,t,s);if(!i)return r;r=i}}var Fe=class{constructor(e,t,n,o){this._tree=e,this.from=t,this.index=n,this._parent=o}get type(){return this._tree.type}get name(){return this._tree.type.name}get to(){return this.from+this._tree.length}nextChild(e,t,n,o,s=0){for(let i=this;;){for(let{children:a,positions:l}=i._tree,u=t>0?a.length:-1;e!=u;e+=t){let d=a[e],p=l[e]+i.from;if(wi(o,n,p,p+d.length)){if(d instanceof We){if(s&me.ExcludeBuffers)continue;let c=d.findChild(0,d.buffer.length,t,n-p,o);if(c>-1)return new _e(new Rn(i,d,e,p),null,c)}else if(s&me.IncludeAnonymous||!d.type.isAnonymous||Nn(d)){let c;if(!(s&me.IgnoreMounts)&&d.props&&(c=d.prop(ne.mounted))&&!c.overlay)return new Fe(c.tree,p,e,i);let m=new Fe(d,p,e,i);return s&me.IncludeAnonymous||!m.type.isAnonymous?m:m.nextChild(t<0?d.children.length-1:0,t,n,o)}}}if(s&me.IncludeAnonymous||!i.type.isAnonymous||(i.index>=0?e=i.index+t:e=t<0?-1:i._parent._tree.children.length,i=i._parent,!i))return null}}get firstChild(){return this.nextChild(0,1,0,4)}get lastChild(){return this.nextChild(this._tree.children.length-1,-1,0,4)}childAfter(e){return this.nextChild(0,1,e,2)}childBefore(e){return this.nextChild(this._tree.children.length-1,-1,e,-2)}enter(e,t,n=0){let o;if(!(n&me.IgnoreOverlays)&&(o=this._tree.prop(ne.mounted))&&o.overlay){let s=e-this.from;for(let{from:i,to:a}of o.overlay)if((t>0?i<=s:i<s)&&(t<0?a>=s:a>s))return new Fe(o.tree,o.overlay[0].from+this.from,-1,this)}return this.nextChild(0,1,e,t,n)}nextSignificantParent(){let e=this;for(;e.type.isAnonymous&&e._parent;)e=e._parent;return e}get parent(){return this._parent?this._parent.nextSignificantParent():null}get nextSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index+1,1,0,4):null}get prevSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index-1,-1,0,4):null}cursor(e=0){return new St(this,e)}get tree(){return this._tree}toTree(){return this._tree}resolve(e,t=0){return yt(this,e,t,!1)}resolveInner(e,t=0){return yt(this,e,t,!0)}enterUnfinishedNodesBefore(e){return Ei(this,e)}getChild(e,t=null,n=null){let o=Nr(this,e,t,n);return o.length?o[0]:null}getChildren(e,t=null,n=null){return Nr(this,e,t,n)}toString(){return this._tree.toString()}get node(){return this}matchContext(e){return Or(this,e)}};function Nr(r,e,t,n){let o=r.cursor(),s=[];if(!o.firstChild())return s;if(t!=null){for(;!o.type.is(t);)if(!o.nextSibling())return s}for(;;){if(n!=null&&o.type.is(n))return s;if(o.type.is(e)&&s.push(o.node),!o.nextSibling())return n==null?s:[]}}function Or(r,e,t=e.length-1){for(let n=r.parent;t>=0;n=n.parent){if(!n)return!1;if(!n.type.isAnonymous){if(e[t]&&e[t]!=n.name)return!1;t--}}return!0}var Rn=class{constructor(e,t,n,o){this.parent=e,this.buffer=t,this.index=n,this.start=o}},_e=class{get name(){return this.type.name}get from(){return this.context.start+this.context.buffer.buffer[this.index+1]}get to(){return this.context.start+this.context.buffer.buffer[this.index+2]}constructor(e,t,n){this.context=e,this._parent=t,this.index=n,this.type=e.buffer.set.types[e.buffer.buffer[n]]}child(e,t,n){let{buffer:o}=this.context,s=o.findChild(this.index+4,o.buffer[this.index+3],e,t-this.context.start,n);return s<0?null:new _e(this.context,this,s)}get firstChild(){return this.child(1,0,4)}get lastChild(){return this.child(-1,0,4)}childAfter(e){return this.child(1,e,2)}childBefore(e){return this.child(-1,e,-2)}enter(e,t,n=0){if(n&me.ExcludeBuffers)return null;let{buffer:o}=this.context,s=o.findChild(this.index+4,o.buffer[this.index+3],t>0?1:-1,e-this.context.start,t);return s<0?null:new _e(this.context,this,s)}get parent(){return this._parent||this.context.parent.nextSignificantParent()}externalSibling(e){return this._parent?null:this.context.parent.nextChild(this.context.index+e,e,0,4)}get nextSibling(){let{buffer:e}=this.context,t=e.buffer[this.index+3];return t<(this._parent?e.buffer[this._parent.index+3]:e.buffer.length)?new _e(this.context,this._parent,t):this.externalSibling(1)}get prevSibling(){let{buffer:e}=this.context,t=this._parent?this._parent.index+4:0;return this.index==t?this.externalSibling(-1):new _e(this.context,this._parent,e.findChild(t,this.index,-1,0,4))}cursor(e=0){return new St(this,e)}get tree(){return null}toTree(){let e=[],t=[],{buffer:n}=this.context,o=this.index+4,s=n.buffer[this.index+3];if(s>o){let i=n.buffer[this.index+1];e.push(n.slice(o,s,i)),t.push(0)}return new be(this.type,e,t,this.to-this.from)}resolve(e,t=0){return yt(this,e,t,!1)}resolveInner(e,t=0){return yt(this,e,t,!0)}enterUnfinishedNodesBefore(e){return Ei(this,e)}toString(){return this.context.buffer.childString(this.index)}getChild(e,t=null,n=null){let o=Nr(this,e,t,n);return o.length?o[0]:null}getChildren(e,t=null,n=null){return Nr(this,e,t,n)}get node(){return this}matchContext(e){return Or(this,e)}},St=class{get name(){return this.type.name}constructor(e,t=0){if(this.mode=t,this.buffer=null,this.stack=[],this.index=0,this.bufferNode=null,e instanceof Fe)this.yieldNode(e);else{this._tree=e.context.parent,this.buffer=e.context;for(let n=e._parent;n;n=n._parent)this.stack.unshift(n.index);this.bufferNode=e,this.yieldBuf(e.index)}}yieldNode(e){return e?(this._tree=e,this.type=e.type,this.from=e.from,this.to=e.to,!0):!1}yieldBuf(e,t){this.index=e;let{start:n,buffer:o}=this.buffer;return this.type=t||o.set.types[o.buffer[e]],this.from=n+o.buffer[e+1],this.to=n+o.buffer[e+2],!0}yield(e){return e?e instanceof Fe?(this.buffer=null,this.yieldNode(e)):(this.buffer=e.context,this.yieldBuf(e.index,e.type)):!1}toString(){return this.buffer?this.buffer.buffer.childString(this.index):this._tree.toString()}enterChild(e,t,n){if(!this.buffer)return this.yield(this._tree.nextChild(e<0?this._tree._tree.children.length-1:0,e,t,n,this.mode));let{buffer:o}=this.buffer,s=o.findChild(this.index+4,o.buffer[this.index+3],e,t-this.buffer.start,n);return s<0?!1:(this.stack.push(this.index),this.yieldBuf(s))}firstChild(){return this.enterChild(1,0,4)}lastChild(){return this.enterChild(-1,0,4)}childAfter(e){return this.enterChild(1,e,2)}childBefore(e){return this.enterChild(-1,e,-2)}enter(e,t,n=this.mode){return this.buffer?n&me.ExcludeBuffers?!1:this.enterChild(1,e,t):this.yield(this._tree.enter(e,t,n))}parent(){if(!this.buffer)return this.yieldNode(this.mode&me.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let e=this.mode&me.IncludeAnonymous?this.buffer.parent:this.buffer.parent.nextSignificantParent();return this.buffer=null,this.yieldNode(e)}sibling(e){if(!this.buffer)return this._tree._parent?this.yield(this._tree.index<0?null:this._tree._parent.nextChild(this._tree.index+e,e,0,4,this.mode)):!1;let{buffer:t}=this.buffer,n=this.stack.length-1;if(e<0){let o=n<0?0:this.stack[n]+4;if(this.index!=o)return this.yieldBuf(t.findChild(o,this.index,-1,0,4))}else{let o=t.buffer[this.index+3];if(o<(n<0?t.buffer.length:t.buffer[this.stack[n]+3]))return this.yieldBuf(o)}return n<0?this.yield(this.buffer.parent.nextChild(this.buffer.index+e,e,0,4,this.mode)):!1}nextSibling(){return this.sibling(1)}prevSibling(){return this.sibling(-1)}atLastNode(e){let t,n,{buffer:o}=this;if(o){if(e>0){if(this.index<o.buffer.buffer.length)return!1}else for(let s=0;s<this.index;s++)if(o.buffer.buffer[s+3]<this.index)return!1;({index:t,parent:n}=o)}else({index:t,_parent:n}=this._tree);for(;n;{index:t,_parent:n}=n)if(t>-1)for(let s=t+e,i=e<0?-1:n._tree.children.length;s!=i;s+=e){let a=n._tree.children[s];if(this.mode&me.IncludeAnonymous||a instanceof We||!a.type.isAnonymous||Nn(a))return!1}return!0}move(e,t){if(t&&this.enterChild(e,0,4))return!0;for(;;){if(this.sibling(e))return!0;if(this.atLastNode(e)||!this.parent())return!1}}next(e=!0){return this.move(1,e)}prev(e=!0){return this.move(-1,e)}moveTo(e,t=0){for(;(this.from==this.to||(t<1?this.from>=e:this.from>e)||(t>-1?this.to<=e:this.to<e))&&this.parent(););for(;this.enterChild(1,e,t););return this}get node(){if(!this.buffer)return this._tree;let e=this.bufferNode,t=null,n=0;if(e&&e.context==this.buffer)e:for(let o=this.index,s=this.stack.length;s>=0;){for(let i=e;i;i=i._parent)if(i.index==o){if(o==this.index)return i;t=i,n=s+1;break e}o=this.stack[--s]}for(let o=n;o<this.stack.length;o++)t=new _e(this.buffer,t,this.stack[o]);return this.bufferNode=new _e(this.buffer,t,this.index)}get tree(){return this.buffer?null:this._tree._tree}iterate(e,t){for(let n=0;;){let o=!1;if(this.type.isAnonymous||e(this)!==!1){if(this.firstChild()){n++;continue}this.type.isAnonymous||(o=!0)}for(;o&&t&&t(this),o=this.type.isAnonymous,!this.nextSibling();){if(!n)return;this.parent(),n--,o=!0}}}matchContext(e){if(!this.buffer)return Or(this.node,e);let{buffer:t}=this.buffer,{types:n}=t.set;for(let o=e.length-1,s=this.stack.length-1;o>=0;s--){if(s<0)return Or(this.node,e,o);let i=n[t.buffer[this.stack[s]]];if(!i.isAnonymous){if(e[o]&&e[o]!=i.name)return!1;o--}}return!0}};function Nn(r){return r.children.some(e=>e instanceof We||!e.type.isAnonymous||Nn(e))}function wp(r){var e;let{buffer:t,nodeSet:n,maxBufferLength:o=1024,reused:s=[],minRepeatType:i=n.types.length}=r,a=Array.isArray(t)?new Ft(t,t.length):t,l=n.types,u=0,d=0;function p(b,v,S,T,A){let{id:w,start:D,end:O,size:x}=a,L=d;for(;x<0;)if(a.next(),x==-1){let M=s[w];S.push(M),T.push(D-b);return}else if(x==-3){u=w;return}else if(x==-4){d=w;return}else throw new RangeError(`Unrecognized record size: ${x}`);let N=l[w],k,P,R=D-b;if(O-D<=o&&(P=h(a.pos-v,A))){let M=new Uint16Array(P.size-P.skip),V=a.pos-P.size,C=M.length;for(;a.pos>V;)C=g(P.start,M,C);k=new We(M,O-P.start,n),R=P.start-b}else{let M=a.pos-x;a.next();let V=[],C=[],F=w>=i?w:-1,H=0,B=O;for(;a.pos>M;)F>=0&&a.id==F&&a.size>=0?(a.end<=B-o&&(m(V,C,D,H,a.end,B,F,L),H=V.length,B=a.end),a.next()):p(D,M,V,C,F);if(F>=0&&H>0&&H<V.length&&m(V,C,D,H,D,B,F,L),V.reverse(),C.reverse(),F>-1&&H>0){let z=c(N);k=On(N,V,C,0,V.length,0,O-D,z,z)}else k=f(N,V,C,O-D,L-O)}S.push(k),T.push(R)}function c(b){return(v,S,T)=>{let A=0,w=v.length-1,D,O;if(w>=0&&(D=v[w])instanceof be){if(!w&&D.type==b&&D.length==T)return D;(O=D.prop(ne.lookAhead))&&(A=S[w]+D.length+O)}return f(b,v,S,T,A)}}function m(b,v,S,T,A,w,D,O){let x=[],L=[];for(;b.length>T;)x.push(b.pop()),L.push(v.pop()+S-A);b.push(f(n.types[D],x,L,w-A,O-w)),v.push(A-S)}function f(b,v,S,T,A=0,w){if(u){let D=[ne.contextHash,u];w=w?[D].concat(w):[D]}if(A>25){let D=[ne.lookAhead,A];w=w?[D].concat(w):[D]}return new be(b,v,S,T,w)}function h(b,v){let S=a.fork(),T=0,A=0,w=0,D=S.end-o,O={size:0,start:0,skip:0};e:for(let x=S.pos-b;S.pos>x;){let L=S.size;if(S.id==v&&L>=0){O.size=T,O.start=A,O.skip=w,w+=4,T+=4,S.next();continue}let N=S.pos-L;if(L<0||N<x||S.start<D)break;let k=S.id>=i?4:0,P=S.start;for(S.next();S.pos>N;){if(S.size<0)if(S.size==-3)k+=4;else break e;else S.id>=i&&(k+=4);S.next()}A=P,T+=L,w+=k}return(v<0||T==b)&&(O.size=T,O.start=A,O.skip=w),O.size>4?O:void 0}function g(b,v,S){let{id:T,start:A,end:w,size:D}=a;if(a.next(),D>=0&&T<i){let O=S;if(D>4){let x=a.pos-(D-4);for(;a.pos>x;)S=g(b,v,S)}v[--S]=O,v[--S]=w-b,v[--S]=A-b,v[--S]=T}else D==-3?u=T:D==-4&&(d=T);return S}let y=[],E=[];for(;a.pos>0;)p(r.start||0,r.bufferStart||0,y,E,-1);let I=(e=r.length)!==null&&e!==void 0?e:y.length?E[0]+y[0].length:0;return new be(l[r.topID],y.reverse(),E.reverse(),I)}var Ci=new WeakMap;function Hr(r,e){if(!r.isAnonymous||e instanceof We||e.type!=r)return 1;let t=Ci.get(e);if(t==null){t=1;for(let n of e.children){if(n.type!=r||!(n instanceof be)){t=1;break}t+=Hr(r,n)}Ci.set(e,t)}return t}function On(r,e,t,n,o,s,i,a,l){let u=0;for(let f=n;f<o;f++)u+=Hr(r,e[f]);let d=Math.ceil(u*1.5/8),p=[],c=[];function m(f,h,g,y,E){for(let I=g;I<y;){let b=I,v=h[I],S=Hr(r,f[I]);for(I++;I<y;I++){let T=Hr(r,f[I]);if(S+T>=d)break;S+=T}if(I==b+1){if(S>d){let T=f[b];m(T.children,T.positions,0,T.children.length,h[b]+E);continue}p.push(f[b])}else{let T=h[I-1]+f[I-1].length-v;p.push(On(r,f,h,b,I,v,T,null,l))}c.push(v+E-s)}}return m(e,t,n,o,0),(a||l)(p,c,i)}var Ar=class{startParse(e,t,n){return typeof e=="string"&&(e=new Hn(e)),n=n?n.length?n.map(o=>new At(o.from,o.to)):[new At(0,0)]:[new At(0,e.length)],this.createParse(e,t||[],n)}parse(e,t,n){let o=this.startParse(e,t,n);for(;;){let s=o.advance();if(s)return s}}},Hn=class{constructor(e){this.string=e}get length(){return this.string.length}chunk(e){return this.string.slice(e)}get lineChunks(){return!1}read(e,t){return this.string.slice(e,t)}};var X4=new ne({perNode:!0});var It=class{constructor(e,t,n,o,s,i,a,l,u,d=0,p){this.p=e,this.stack=t,this.state=n,this.reducePos=o,this.pos=s,this.score=i,this.buffer=a,this.bufferBase=l,this.curContext=u,this.lookAhead=d,this.parent=p}toString(){return`[${this.stack.filter((e,t)=>t%3==0).concat(this.state)}]@${this.pos}${this.score?"!"+this.score:""}`}static start(e,t,n=0){let o=e.parser.context;return new It(e,[],t,n,n,0,[],0,o?new Fr(o,o.start):null,0,null)}get context(){return this.curContext?this.curContext.context:null}pushState(e,t){this.stack.push(this.state,t,this.bufferBase+this.buffer.length),this.state=e}reduce(e){var t;let n=e>>19,o=e&65535,{parser:s}=this.p,i=s.dynamicPrecedence(o);if(i&&(this.score+=i),n==0){this.pushState(s.getGoto(this.state,o,!0),this.reducePos),o<s.minRepeatTerm&&this.storeNode(o,this.reducePos,this.reducePos,4,!0),this.reduceContext(o,this.reducePos);return}let a=this.stack.length-(n-1)*3-(e&262144?6:0),l=a?this.stack[a-2]:this.p.ranges[0].from,u=this.reducePos-l;u>=2e3&&!(!((t=this.p.parser.nodeSet.types[o])===null||t===void 0)&&t.isAnonymous)&&(l==this.p.lastBigReductionStart?(this.p.bigReductionCount++,this.p.lastBigReductionSize=u):this.p.lastBigReductionSize<u&&(this.p.bigReductionCount=1,this.p.lastBigReductionStart=l,this.p.lastBigReductionSize=u));let d=a?this.stack[a-1]:0,p=this.bufferBase+this.buffer.length-d;if(o<s.minRepeatTerm||e&131072){let c=s.stateFlag(this.state,1)?this.pos:this.reducePos;this.storeNode(o,l,c,p+4,!0)}if(e&262144)this.state=this.stack[a];else{let c=this.stack[a-3];this.state=s.getGoto(c,o,!0)}for(;this.stack.length>a;)this.stack.pop();this.reduceContext(o,l)}storeNode(e,t,n,o=4,s=!1){if(e==0&&(!this.stack.length||this.stack[this.stack.length-1]<this.buffer.length+this.bufferBase)){let i=this,a=this.buffer.length;if(a==0&&i.parent&&(a=i.bufferBase-i.parent.bufferBase,i=i.parent),a>0&&i.buffer[a-4]==0&&i.buffer[a-1]>-1){if(t==n)return;if(i.buffer[a-2]>=t){i.buffer[a-2]=n;return}}}if(!s||this.pos==n)this.buffer.push(e,t,n,o);else{let i=this.buffer.length;if(i>0&&this.buffer[i-4]!=0)for(;i>0&&this.buffer[i-2]>n;)this.buffer[i]=this.buffer[i-4],this.buffer[i+1]=this.buffer[i-3],this.buffer[i+2]=this.buffer[i-2],this.buffer[i+3]=this.buffer[i-1],i-=4,o>4&&(o-=4);this.buffer[i]=e,this.buffer[i+1]=t,this.buffer[i+2]=n,this.buffer[i+3]=o}}shift(e,t,n){let o=this.pos;if(e&131072)this.pushState(e&65535,this.pos);else if(e&262144)this.pos=n,this.shiftContext(t,o),t<=this.p.parser.maxNode&&this.buffer.push(t,o,n,4);else{let s=e,{parser:i}=this.p;(n>this.pos||t<=i.maxNode)&&(this.pos=n,i.stateFlag(s,1)||(this.reducePos=n)),this.pushState(s,o),this.shiftContext(t,o),t<=i.maxNode&&this.buffer.push(t,o,n,4)}}apply(e,t,n){e&65536?this.reduce(e):this.shift(e,t,n)}useNode(e,t){let n=this.p.reused.length-1;(n<0||this.p.reused[n]!=e)&&(this.p.reused.push(e),n++);let o=this.pos;this.reducePos=this.pos=o+e.length,this.pushState(t,o),this.buffer.push(n,o,this.reducePos,-1),this.curContext&&this.updateContext(this.curContext.tracker.reuse(this.curContext.context,e,this,this.p.stream.reset(this.pos-e.length)))}split(){let e=this,t=e.buffer.length;for(;t>0&&e.buffer[t-2]>e.reducePos;)t-=4;let n=e.buffer.slice(t),o=e.bufferBase+t;for(;e&&o==e.bufferBase;)e=e.parent;return new It(this.p,this.stack.slice(),this.state,this.reducePos,this.pos,this.score,n,o,this.curContext,this.lookAhead,e)}recoverByDelete(e,t){let n=e<=this.p.parser.maxNode;n&&this.storeNode(e,this.pos,t,4),this.storeNode(0,this.pos,t,n?8:4),this.pos=this.reducePos=t,this.score-=190}canShift(e){for(let t=new Fn(this);;){let n=this.p.parser.stateSlot(t.state,4)||this.p.parser.hasAction(t.state,e);if(n==0)return!1;if(!(n&65536))return!0;t.reduce(n)}}recoverByInsert(e){if(this.stack.length>=300)return[];let t=this.p.parser.nextStates(this.state);if(t.length>4<<1||this.stack.length>=120){let o=[];for(let s=0,i;s<t.length;s+=2)(i=t[s+1])!=this.state&&this.p.parser.hasAction(i,e)&&o.push(t[s],i);if(this.stack.length<120)for(let s=0;o.length<4<<1&&s<t.length;s+=2){let i=t[s+1];o.some((a,l)=>l&1&&a==i)||o.push(t[s],i)}t=o}let n=[];for(let o=0;o<t.length&&n.length<4;o+=2){let s=t[o+1];if(s==this.state)continue;let i=this.split();i.pushState(s,this.pos),i.storeNode(0,i.pos,i.pos,4,!0),i.shiftContext(t[o],this.pos),i.score-=200,n.push(i)}return n}forceReduce(){let{parser:e}=this.p,t=e.stateSlot(this.state,5);if(!(t&65536))return!1;if(!e.validAction(this.state,t)){let n=t>>19,o=t&65535,s=this.stack.length-n*3;if(s<0||e.getGoto(this.stack[s],o,!1)<0){let i=this.findForcedReduction();if(i==null)return!1;t=i}this.storeNode(0,this.pos,this.pos,4,!0),this.score-=100}return this.reducePos=this.pos,this.reduce(t),!0}findForcedReduction(){let{parser:e}=this.p,t=[],n=(o,s)=>{if(!t.includes(o))return t.push(o),e.allActions(o,i=>{if(!(i&393216))if(i&65536){let a=(i>>19)-s;if(a>1){let l=i&65535,u=this.stack.length-a*3;if(u>=0&&e.getGoto(this.stack[u],l,!1)>=0)return a<<19|65536|l}}else{let a=n(i,s+1);if(a!=null)return a}})};return n(this.state,0)}forceAll(){for(;!this.p.parser.stateFlag(this.state,2);)if(!this.forceReduce()){this.storeNode(0,this.pos,this.pos,4,!0);break}return this}get deadEnd(){if(this.stack.length!=3)return!1;let{parser:e}=this.p;return e.data[e.stateSlot(this.state,1)]==65535&&!e.stateSlot(this.state,4)}restart(){this.state=this.stack[0],this.stack.length=0}sameState(e){if(this.state!=e.state||this.stack.length!=e.stack.length)return!1;for(let t=0;t<this.stack.length;t+=3)if(this.stack[t]!=e.stack[t])return!1;return!0}get parser(){return this.p.parser}dialectEnabled(e){return this.p.parser.dialect.flags[e]}shiftContext(e,t){this.curContext&&this.updateContext(this.curContext.tracker.shift(this.curContext.context,e,this,this.p.stream.reset(t)))}reduceContext(e,t){this.curContext&&this.updateContext(this.curContext.tracker.reduce(this.curContext.context,e,this,this.p.stream.reset(t)))}emitContext(){let e=this.buffer.length-1;(e<0||this.buffer[e]!=-3)&&this.buffer.push(this.curContext.hash,this.pos,this.pos,-3)}emitLookAhead(){let e=this.buffer.length-1;(e<0||this.buffer[e]!=-4)&&this.buffer.push(this.lookAhead,this.pos,this.pos,-4)}updateContext(e){if(e!=this.curContext.context){let t=new Fr(this.curContext.tracker,e);t.hash!=this.curContext.hash&&this.emitContext(),this.curContext=t}}setLookAhead(e){e>this.lookAhead&&(this.emitLookAhead(),this.lookAhead=e)}close(){this.curContext&&this.curContext.tracker.strict&&this.emitContext(),this.lookAhead>0&&this.emitLookAhead()}},Fr=class{constructor(e,t){this.tracker=e,this.context=t,this.hash=e.strict?e.hash(t):0}},Di;(function(r){r[r.Insert=200]="Insert",r[r.Delete=190]="Delete",r[r.Reduce=100]="Reduce",r[r.MaxNext=4]="MaxNext",r[r.MaxInsertStackDepth=300]="MaxInsertStackDepth",r[r.DampenInsertStackDepth=120]="DampenInsertStackDepth",r[r.MinBigReduction=2e3]="MinBigReduction"})(Di||(Di={}));var Fn=class{constructor(e){this.start=e,this.state=e.state,this.stack=e.stack,this.base=this.stack.length}reduce(e){let t=e&65535,n=e>>19;n==0?(this.stack==this.start.stack&&(this.stack=this.stack.slice()),this.stack.push(this.state,0,0),this.base+=3):this.base-=(n-1)*3;let o=this.start.p.parser.getGoto(this.stack[this.base-3],t,!0);this.state=o}},Tt=class{constructor(e,t,n){this.stack=e,this.pos=t,this.index=n,this.buffer=e.buffer,this.index==0&&this.maybeNext()}static create(e,t=e.bufferBase+e.buffer.length){return new Tt(e,t,t-e.bufferBase)}maybeNext(){let e=this.stack.parent;e!=null&&(this.index=this.stack.bufferBase-e.bufferBase,this.stack=e,this.buffer=e.buffer)}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}next(){this.index-=4,this.pos-=4,this.index==0&&this.maybeNext()}fork(){return new Tt(this.stack,this.pos,this.index)}};function Vt(r,e=Uint16Array){if(typeof r!="string")return r;let t=null;for(let n=0,o=0;n<r.length;){let s=0;for(;;){let i=r.charCodeAt(n++),a=!1;if(i==126){s=65535;break}i>=92&&i--,i>=34&&i--;let l=i-32;if(l>=46&&(l-=46,a=!0),s+=l,a)break;s*=46}t?t[o++]=s:t=new e(s)}return t}var vt=class{constructor(){this.start=-1,this.value=-1,this.end=-1,this.extended=-1,this.lookAhead=0,this.mask=0,this.context=0}},Mi=new vt,Vn=class{constructor(e,t){this.input=e,this.ranges=t,this.chunk="",this.chunkOff=0,this.chunk2="",this.chunk2Pos=0,this.next=-1,this.token=Mi,this.rangeIndex=0,this.pos=this.chunkPos=t[0].from,this.range=t[0],this.end=t[t.length-1].to,this.readNext()}resolveOffset(e,t){let n=this.range,o=this.rangeIndex,s=this.pos+e;for(;s<n.from;){if(!o)return null;let i=this.ranges[--o];s-=n.from-i.to,n=i}for(;t<0?s>n.to:s>=n.to;){if(o==this.ranges.length-1)return null;let i=this.ranges[++o];s+=i.from-n.to,n=i}return s}clipPos(e){if(e>=this.range.from&&e<this.range.to)return e;for(let t of this.ranges)if(t.to>e)return Math.max(e,t.from);return this.end}peek(e){let t=this.chunkOff+e,n,o;if(t>=0&&t<this.chunk.length)n=this.pos+e,o=this.chunk.charCodeAt(t);else{let s=this.resolveOffset(e,1);if(s==null)return-1;if(n=s,n>=this.chunk2Pos&&n<this.chunk2Pos+this.chunk2.length)o=this.chunk2.charCodeAt(n-this.chunk2Pos);else{let i=this.rangeIndex,a=this.range;for(;a.to<=n;)a=this.ranges[++i];this.chunk2=this.input.chunk(this.chunk2Pos=n),n+this.chunk2.length>a.to&&(this.chunk2=this.chunk2.slice(0,a.to-n)),o=this.chunk2.charCodeAt(0)}}return n>=this.token.lookAhead&&(this.token.lookAhead=n+1),o}acceptToken(e,t=0){let n=t?this.resolveOffset(t,-1):this.pos;if(n==null||n<this.token.start)throw new RangeError("Token end out of bounds");this.token.value=e,this.token.end=n}getChunk(){if(this.pos>=this.chunk2Pos&&this.pos<this.chunk2Pos+this.chunk2.length){let{chunk:e,chunkPos:t}=this;this.chunk=this.chunk2,this.chunkPos=this.chunk2Pos,this.chunk2=e,this.chunk2Pos=t,this.chunkOff=this.pos-this.chunkPos}else{this.chunk2=this.chunk,this.chunk2Pos=this.chunkPos;let e=this.input.chunk(this.pos),t=this.pos+e.length;this.chunk=t>this.range.to?e.slice(0,this.range.to-this.pos):e,this.chunkPos=this.pos,this.chunkOff=0}}readNext(){return this.chunkOff>=this.chunk.length&&(this.getChunk(),this.chunkOff==this.chunk.length)?this.next=-1:this.next=this.chunk.charCodeAt(this.chunkOff)}advance(e=1){for(this.chunkOff+=e;this.pos+e>=this.range.to;){if(this.rangeIndex==this.ranges.length-1)return this.setDone();e-=this.range.to-this.pos,this.range=this.ranges[++this.rangeIndex],this.pos=this.range.from}return this.pos+=e,this.pos>=this.token.lookAhead&&(this.token.lookAhead=this.pos+1),this.readNext()}setDone(){return this.pos=this.chunkPos=this.end,this.range=this.ranges[this.rangeIndex=this.ranges.length-1],this.chunk="",this.next=-1}reset(e,t){if(t?(this.token=t,t.start=e,t.lookAhead=e+1,t.value=t.extended=-1):this.token=Mi,this.pos!=e){if(this.pos=e,e==this.end)return this.setDone(),this;for(;e<this.range.from;)this.range=this.ranges[--this.rangeIndex];for(;e>=this.range.to;)this.range=this.ranges[++this.rangeIndex];e>=this.chunkPos&&e<this.chunkPos+this.chunk.length?this.chunkOff=e-this.chunkPos:(this.chunk="",this.chunkOff=0),this.readNext()}return this}read(e,t){if(e>=this.chunkPos&&t<=this.chunkPos+this.chunk.length)return this.chunk.slice(e-this.chunkPos,t-this.chunkPos);if(e>=this.chunk2Pos&&t<=this.chunk2Pos+this.chunk2.length)return this.chunk2.slice(e-this.chunk2Pos,t-this.chunk2Pos);if(e>=this.range.from&&t<=this.range.to)return this.input.read(e,t);let n="";for(let o of this.ranges){if(o.from>=t)break;o.to>e&&(n+=this.input.read(Math.max(o.from,e),Math.min(o.to,t)))}return n}},qe=class{constructor(e,t){this.data=e,this.id=t}token(e,t){let{parser:n}=t.p;Oi(this.data,e,t,this.id,n.data,n.tokenPrecTable)}};qe.prototype.contextual=qe.prototype.fallback=qe.prototype.extend=!1;var Bn=class{constructor(e,t,n){this.precTable=t,this.elseToken=n,this.data=typeof e=="string"?Vt(e):e}token(e,t){let n=e.pos,o=0;for(;;){let s=e.next<0,i=e.resolveOffset(1,1);if(Oi(this.data,e,t,0,this.data,this.precTable),e.token.value>-1)break;if(this.elseToken==null)return;if(s||o++,i==null)break;e.reset(i,e.token)}o&&(e.reset(n,e.token),e.acceptToken(this.elseToken,o))}};Bn.prototype.contextual=qe.prototype.fallback=qe.prototype.extend=!1;function Oi(r,e,t,n,o,s){let i=0,a=1<<n,{dialect:l}=t.p.parser;e:for(;a&r[i];){let u=r[i+1];for(let m=i+3;m<u;m+=2)if((r[m+1]&a)>0){let f=r[m];if(l.allows(f)&&(e.token.value==-1||e.token.value==f||Dp(f,e.token.value,o,s))){e.acceptToken(f);break}}let d=e.next,p=0,c=r[i+2];if(e.next<0&&c>p&&r[u+c*3-3]==65535&&r[u+c*3-3]==65535){i=r[u+c*3-1];continue e}for(;p<c;){let m=p+c>>1,f=u+m+(m<<1),h=r[f],g=r[f+1]||65536;if(d<h)c=m;else if(d>=g)p=m+1;else{i=r[f+2],e.advance();continue e}}break}}function Pi(r,e,t){for(let n=e,o;(o=r[n])!=65535;n++)if(o==t)return n-e;return-1}function Dp(r,e,t,n){let o=Pi(t,n,e);return o<0||Pi(t,n,r)<o}var Ve=typeof process<"u"&&process.env&&/\bparse\b/.test(process.env.LOG),An=null,Li;(function(r){r[r.Margin=25]="Margin"})(Li||(Li={}));function ki(r,e,t){let n=r.cursor(me.IncludeAnonymous);for(n.moveTo(e);;)if(!(t<0?n.childBefore(e):n.childAfter(e)))for(;;){if((t<0?n.to<e:n.from>e)&&!n.type.isError)return t<0?Math.max(0,Math.min(n.to-1,e-25)):Math.min(r.length,Math.max(n.from+1,e+25));if(t<0?n.prevSibling():n.nextSibling())break;if(!n.parent())return t<0?0:r.length}}var $n=class{constructor(e,t){this.fragments=e,this.nodeSet=t,this.i=0,this.fragment=null,this.safeFrom=-1,this.safeTo=-1,this.trees=[],this.start=[],this.index=[],this.nextFragment()}nextFragment(){let e=this.fragment=this.i==this.fragments.length?null:this.fragments[this.i++];if(e){for(this.safeFrom=e.openStart?ki(e.tree,e.from+e.offset,1)-e.offset:e.from,this.safeTo=e.openEnd?ki(e.tree,e.to+e.offset,-1)-e.offset:e.to;this.trees.length;)this.trees.pop(),this.start.pop(),this.index.pop();this.trees.push(e.tree),this.start.push(-e.offset),this.index.push(0),this.nextStart=this.safeFrom}else this.nextStart=1e9}nodeAt(e){if(e<this.nextStart)return null;for(;this.fragment&&this.safeTo<=e;)this.nextFragment();if(!this.fragment)return null;for(;;){let t=this.trees.length-1;if(t<0)return this.nextFragment(),null;let n=this.trees[t],o=this.index[t];if(o==n.children.length){this.trees.pop(),this.start.pop(),this.index.pop();continue}let s=n.children[o],i=this.start[t]+n.positions[o];if(i>e)return this.nextStart=i,null;if(s instanceof be){if(i==e){if(i<this.safeFrom)return null;let a=i+s.length;if(a<=this.safeTo){let l=s.prop(ne.lookAhead);if(!l||a+l<this.fragment.to)return s}}this.index[t]++,i+s.length>=Math.max(this.safeFrom,e)&&(this.trees.push(s),this.start.push(i),this.index.push(0))}else this.index[t]++,this.nextStart=i+s.length}}},_n=class{constructor(e,t){this.stream=t,this.tokens=[],this.mainToken=null,this.actions=[],this.tokens=e.tokenizers.map(n=>new vt)}getActions(e){let t=0,n=null,{parser:o}=e.p,{tokenizers:s}=o,i=o.stateSlot(e.state,3),a=e.curContext?e.curContext.hash:0,l=0;for(let u=0;u<s.length;u++){if(!(1<<u&i))continue;let d=s[u],p=this.tokens[u];if(!(n&&!d.fallback)&&((d.contextual||p.start!=e.pos||p.mask!=i||p.context!=a)&&(this.updateCachedToken(p,d,e),p.mask=i,p.context=a),p.lookAhead>p.end+25&&(l=Math.max(p.lookAhead,l)),p.value!=0)){let c=t;if(p.extended>-1&&(t=this.addActions(e,p.extended,p.end,t)),t=this.addActions(e,p.value,p.end,t),!d.extend&&(n=p,t>c))break}}for(;this.actions.length>t;)this.actions.pop();return l&&e.setLookAhead(l),!n&&e.pos==this.stream.end&&(n=new vt,n.value=e.p.parser.eofTerm,n.start=n.end=e.pos,t=this.addActions(e,n.value,n.end,t)),this.mainToken=n,this.actions}getMainToken(e){if(this.mainToken)return this.mainToken;let t=new vt,{pos:n,p:o}=e;return t.start=n,t.end=Math.min(n+1,o.stream.end),t.value=n==o.stream.end?o.parser.eofTerm:0,t}updateCachedToken(e,t,n){let o=this.stream.clipPos(n.pos);if(t.token(this.stream.reset(o,e),n),e.value>-1){let{parser:s}=n.p;for(let i=0;i<s.specialized.length;i++)if(s.specialized[i]==e.value){let a=s.specializers[i](this.stream.read(e.start,e.end),n);if(a>=0&&n.p.parser.dialect.allows(a>>1)){a&1?e.extended=a>>1:e.value=a>>1;break}}}else e.value=0,e.end=this.stream.clipPos(o+1)}putAction(e,t,n,o){for(let s=0;s<o;s+=3)if(this.actions[s]==e)return o;return this.actions[o++]=e,this.actions[o++]=t,this.actions[o++]=n,o}addActions(e,t,n,o){let{state:s}=e,{parser:i}=e.p,{data:a}=i;for(let l=0;l<2;l++)for(let u=i.stateSlot(s,l?2:1);;u+=3){if(a[u]==65535)if(a[u+1]==1)u=Qe(a,u+2);else{o==0&&a[u+1]==2&&(o=this.putAction(Qe(a,u+2),t,n,o));break}a[u]==t&&(o=this.putAction(Qe(a,u+1),t,n,o))}return o}},Ri;(function(r){r[r.Distance=5]="Distance",r[r.MaxRemainingPerStep=3]="MaxRemainingPerStep",r[r.MinBufferLengthPrune=500]="MinBufferLengthPrune",r[r.ForceReduceLimit=10]="ForceReduceLimit",r[r.CutDepth=15e3]="CutDepth",r[r.CutTo=9e3]="CutTo",r[r.MaxLeftAssociativeReductionCount=300]="MaxLeftAssociativeReductionCount",r[r.MaxStackCount=12]="MaxStackCount"})(Ri||(Ri={}));var Kn=class{constructor(e,t,n,o){this.parser=e,this.input=t,this.ranges=o,this.recovering=0,this.nextStackID=9812,this.minStackPos=0,this.reused=[],this.stoppedAt=null,this.lastBigReductionStart=-1,this.lastBigReductionSize=0,this.bigReductionCount=0,this.stream=new Vn(t,o),this.tokens=new _n(e,this.stream),this.topTerm=e.top[1];let{from:s}=o[0];this.stacks=[It.start(this,e.top[0],s)],this.fragments=n.length&&this.stream.end-s>e.bufferLength*4?new $n(n,e.nodeSet):null}get parsedPos(){return this.minStackPos}advance(){let e=this.stacks,t=this.minStackPos,n=this.stacks=[],o,s;if(this.bigReductionCount>300&&e.length==1){let[i]=e;for(;i.forceReduce()&&i.stack.length&&i.stack[i.stack.length-2]>=this.lastBigReductionStart;);this.bigReductionCount=this.lastBigReductionSize=0}for(let i=0;i<e.length;i++){let a=e[i];for(;;){if(this.tokens.mainToken=null,a.pos>t)n.push(a);else{if(this.advanceStack(a,n,e))continue;{o||(o=[],s=[]),o.push(a);let l=this.tokens.getMainToken(a);s.push(l.value,l.end)}}break}}if(!n.length){let i=o&&Mp(o);if(i)return this.stackToTree(i);if(this.parser.strict)throw Ve&&o&&console.log("Stuck with token "+(this.tokens.mainToken?this.parser.getName(this.tokens.mainToken.value):"none")),new SyntaxError("No parse at "+t);this.recovering||(this.recovering=5)}if(this.recovering&&o){let i=this.stoppedAt!=null&&o[0].pos>this.stoppedAt?o[0]:this.runRecovery(o,s,n);if(i)return this.stackToTree(i.forceAll())}if(this.recovering){let i=this.recovering==1?1:this.recovering*3;if(n.length>i)for(n.sort((a,l)=>l.score-a.score);n.length>i;)n.pop();n.some(a=>a.reducePos>t)&&this.recovering--}else if(n.length>1){e:for(let i=0;i<n.length-1;i++){let a=n[i];for(let l=i+1;l<n.length;l++){let u=n[l];if(a.sameState(u)||a.buffer.length>500&&u.buffer.length>500)if((a.score-u.score||a.buffer.length-u.buffer.length)>0)n.splice(l--,1);else{n.splice(i--,1);continue e}}}n.length>12&&n.splice(12,n.length-12)}this.minStackPos=n[0].pos;for(let i=1;i<n.length;i++)n[i].pos<this.minStackPos&&(this.minStackPos=n[i].pos);return null}stopAt(e){if(this.stoppedAt!=null&&this.stoppedAt<e)throw new RangeError("Can't move stoppedAt forward");this.stoppedAt=e}advanceStack(e,t,n){let o=e.pos,{parser:s}=this,i=Ve?this.stackID(e)+" -> ":"";if(this.stoppedAt!=null&&o>this.stoppedAt)return e.forceReduce()?e:null;if(this.fragments){let u=e.curContext&&e.curContext.tracker.strict,d=u?e.curContext.hash:0;for(let p=this.fragments.nodeAt(o);p;){let c=this.parser.nodeSet.types[p.type.id]==p.type?s.getGoto(e.state,p.type.id):-1;if(c>-1&&p.length&&(!u||(p.prop(ne.contextHash)||0)==d))return e.useNode(p,c),Ve&&console.log(i+this.stackID(e)+` (via reuse of ${s.getName(p.type.id)})`),!0;if(!(p instanceof be)||p.children.length==0||p.positions[0]>0)break;let m=p.children[0];if(m instanceof be&&p.positions[0]==0)p=m;else break}}let a=s.stateSlot(e.state,4);if(a>0)return e.reduce(a),Ve&&console.log(i+this.stackID(e)+` (via always-reduce ${s.getName(a&65535)})`),!0;if(e.stack.length>=15e3)for(;e.stack.length>9e3&&e.forceReduce(););let l=this.tokens.getActions(e);for(let u=0;u<l.length;){let d=l[u++],p=l[u++],c=l[u++],m=u==l.length||!n,f=m?e:e.split();if(f.apply(d,p,c),Ve&&console.log(i+this.stackID(f)+` (via ${d&65536?`reduce of ${s.getName(d&65535)}`:"shift"} for ${s.getName(p)} @ ${o}${f==e?"":", split"})`),m)return!0;f.pos>o?t.push(f):n.push(f)}return!1}advanceFully(e,t){let n=e.pos;for(;;){if(!this.advanceStack(e,null,null))return!1;if(e.pos>n)return Hi(e,t),!0}}runRecovery(e,t,n){let o=null,s=!1;for(let i=0;i<e.length;i++){let a=e[i],l=t[i<<1],u=t[(i<<1)+1],d=Ve?this.stackID(a)+" -> ":"";if(a.deadEnd&&(s||(s=!0,a.restart(),Ve&&console.log(d+this.stackID(a)+" (restarted)"),this.advanceFully(a,n))))continue;let p=a.split(),c=d;for(let m=0;p.forceReduce()&&m<10&&(Ve&&console.log(c+this.stackID(p)+" (via force-reduce)"),!this.advanceFully(p,n));m++)Ve&&(c=this.stackID(p)+" -> ");for(let m of a.recoverByInsert(l))Ve&&console.log(d+this.stackID(m)+" (via recover-insert)"),this.advanceFully(m,n);this.stream.end>a.pos?(u==a.pos&&(u++,l=0),a.recoverByDelete(l,u),Ve&&console.log(d+this.stackID(a)+` (via recover-delete ${this.parser.getName(l)})`),Hi(a,n)):(!o||o.score<a.score)&&(o=a)}return o}stackToTree(e){return e.close(),be.build({buffer:Tt.create(e),nodeSet:this.parser.nodeSet,topID:this.topTerm,maxBufferLength:this.parser.bufferLength,reused:this.reused,start:this.ranges[0].from,length:e.pos-this.ranges[0].from,minRepeatType:this.parser.minRepeatTerm})}stackID(e){let t=(An||(An=new WeakMap)).get(e);return t||An.set(e,t=String.fromCodePoint(this.nextStackID++)),t+e}};function Hi(r,e){for(let t=0;t<e.length;t++){let n=e[t];if(n.pos==r.pos&&n.sameState(r)){e[t].score<r.score&&(e[t]=r);return}}e.push(r)}var zn=class{constructor(e,t,n){this.source=e,this.flags=t,this.disabled=n}allows(e){return!this.disabled||this.disabled[e]==0}};var it=class extends Ar{constructor(e){if(super(),this.wrappers=[],e.version!=14)throw new RangeError(`Parser version (${e.version}) doesn't match runtime version (14)`);let t=e.nodeNames.split(" ");this.minRepeatTerm=t.length;for(let a=0;a<e.repeatNodeCount;a++)t.push("");let n=Object.keys(e.topRules).map(a=>e.topRules[a][1]),o=[];for(let a=0;a<t.length;a++)o.push([]);function s(a,l,u){o[a].push([l,l.deserialize(String(u))])}if(e.nodeProps)for(let a of e.nodeProps){let l=a[0];typeof l=="string"&&(l=ne[l]);for(let u=1;u<a.length;){let d=a[u++];if(d>=0)s(d,l,a[u++]);else{let p=a[u+-d];for(let c=-d;c>0;c--)s(a[u++],l,p);u++}}}this.nodeSet=new xt(t.map((a,l)=>we.define({name:l>=this.minRepeatTerm?void 0:a,id:l,props:o[l],top:n.indexOf(l)>-1,error:l==0,skipped:e.skippedNodes&&e.skippedNodes.indexOf(l)>-1}))),e.propSources&&(this.nodeSet=this.nodeSet.extend(...e.propSources)),this.strict=!1,this.bufferLength=1024;let i=Vt(e.tokenData);this.context=e.context,this.specializerSpecs=e.specialized||[],this.specialized=new Uint16Array(this.specializerSpecs.length);for(let a=0;a<this.specializerSpecs.length;a++)this.specialized[a]=this.specializerSpecs[a].term;this.specializers=this.specializerSpecs.map(Ni),this.states=Vt(e.states,Uint32Array),this.data=Vt(e.stateData),this.goto=Vt(e.goto),this.maxTerm=e.maxTerm,this.tokenizers=e.tokenizers.map(a=>typeof a=="number"?new qe(i,a):a),this.topRules=e.topRules,this.dialects=e.dialects||{},this.dynamicPrecedences=e.dynamicPrecedences||null,this.tokenPrecTable=e.tokenPrec,this.termNames=e.termNames||null,this.maxNode=this.nodeSet.types.length-1,this.dialect=this.parseDialect(),this.top=this.topRules[Object.keys(this.topRules)[0]]}createParse(e,t,n){let o=new Kn(this,e,t,n);for(let s of this.wrappers)o=s(o,e,t,n);return o}getGoto(e,t,n=!1){let o=this.goto;if(t>=o[0])return-1;for(let s=o[t+1];;){let i=o[s++],a=i&1,l=o[s++];if(a&&n)return l;for(let u=s+(i>>1);s<u;s++)if(o[s]==e)return l;if(a)return-1}}hasAction(e,t){let n=this.data;for(let o=0;o<2;o++)for(let s=this.stateSlot(e,o?2:1),i;;s+=3){if((i=n[s])==65535)if(n[s+1]==1)i=n[s=Qe(n,s+2)];else{if(n[s+1]==2)return Qe(n,s+2);break}if(i==t||i==0)return Qe(n,s+1)}return 0}stateSlot(e,t){return this.states[e*6+t]}stateFlag(e,t){return(this.stateSlot(e,0)&t)>0}validAction(e,t){return!!this.allActions(e,n=>n==t?!0:null)}allActions(e,t){let n=this.stateSlot(e,4),o=n?t(n):void 0;for(let s=this.stateSlot(e,1);o==null;s+=3){if(this.data[s]==65535)if(this.data[s+1]==1)s=Qe(this.data,s+2);else break;o=t(Qe(this.data,s+1))}return o}nextStates(e){let t=[];for(let n=this.stateSlot(e,1);;n+=3){if(this.data[n]==65535)if(this.data[n+1]==1)n=Qe(this.data,n+2);else break;if(!(this.data[n+2]&1)){let o=this.data[n+1];t.some((s,i)=>i&1&&s==o)||t.push(this.data[n],o)}}return t}configure(e){let t=Object.assign(Object.create(it.prototype),this);if(e.props&&(t.nodeSet=this.nodeSet.extend(...e.props)),e.top){let n=this.topRules[e.top];if(!n)throw new RangeError(`Invalid top rule name ${e.top}`);t.top=n}return e.tokenizers&&(t.tokenizers=this.tokenizers.map(n=>{let o=e.tokenizers.find(s=>s.from==n);return o?o.to:n})),e.specializers&&(t.specializers=this.specializers.slice(),t.specializerSpecs=this.specializerSpecs.map((n,o)=>{let s=e.specializers.find(a=>a.from==n.external);if(!s)return n;let i=Object.assign(Object.assign({},n),{external:s.to});return t.specializers[o]=Ni(i),i})),e.contextTracker&&(t.context=e.contextTracker),e.dialect&&(t.dialect=this.parseDialect(e.dialect)),e.strict!=null&&(t.strict=e.strict),e.wrap&&(t.wrappers=t.wrappers.concat(e.wrap)),e.bufferLength!=null&&(t.bufferLength=e.bufferLength),t}hasWrappers(){return this.wrappers.length>0}getName(e){return this.termNames?this.termNames[e]:String(e<=this.maxNode&&this.nodeSet.types[e].name||e)}get eofTerm(){return this.maxNode+1}get topNode(){return this.nodeSet.types[this.top[1]]}dynamicPrecedence(e){let t=this.dynamicPrecedences;return t==null?0:t[e]||0}parseDialect(e){let t=Object.keys(this.dialects),n=t.map(()=>!1);if(e)for(let s of e.split(" ")){let i=t.indexOf(s);i>=0&&(n[i]=!0)}let o=null;for(let s=0;s<t.length;s++)if(!n[s])for(let i=this.dialects[t[s]],a;(a=this.data[i++])!=65535;)(o||(o=new Uint8Array(this.maxTerm+1)))[a]=1;return new zn(e,n,o)}static deserialize(e){return new it(e)}};function Qe(r,e){return r[e]|r[e+1]<<16}function Mp(r){let e=null;for(let t of r){let n=t.p.stoppedAt;(t.pos==t.p.stream.end||n!=null&&t.pos>n)&&t.p.parser.stateFlag(t.state,2)&&(!e||e.score<t.score)&&(e=t)}return e}function Ni(r){if(r.external){let e=r.extend?1:0;return(t,n)=>r.external(t,n)<<1|e}return r.get}var Un=it.deserialize({version:14,states:"%QOVQPOOOOQO'#C_'#C_O_QQO'#C^OOQO'#DO'#DOOvQQO'#C|OOQO'#DR'#DROVQPO'#CuOOQO'#C}'#C}QOQPOOOOQO'#C`'#C`O!UQQO,58xO!dQPO,59VOVQPO,59]OVQPO,59_O!iQPO,59hO!nQQO,59aOOQO'#DQ'#DQOOQO1G.d1G.dO!UQQO1G.qO!yQQO1G.wOOQO1G.y1G.yOOQO'#Cw'#CwOOQO1G/S1G/SOOQO1G.{1G.{O#[QPO'#CnO#dQPO7+$]O!UQQO'#CxO#iQPO,59YOOQO<<Gw<<GwOOQO,59d,59dOOQO-E6v-E6v",stateData:"#q~OoOS~OsPOvUO~OTXOUXOVXOWXOXXOYXO`ZO~Of[Oh]Oj^OmpX~OZ`O[`O]`O^`O~OabO~OseO~Of[Oh]OwgO~Oh]Ofeijeimeiwei~OcjOdbX~OdlO~OcjOdba~O",goto:"#YvPPw}!TPPPPPPPPPPwPP!WPP!ZP!ZP!aP!g!jPPP!p!s!aP#P!aXROU[]XQOU[]RYQRibXTOU[]XVOU[]Rf^QkhRnkRWOQSOQ_UQc[Rd]QaYQhbRmj",nodeNames:"\u26A0 Filter ColumnValueExpression Column Operator Eq NotEq Gt Lt Starts Ends Number String True False ColumnSetExpression In LBrack Values Comma RBrack AndExpression And OrExpression Or ParenthesizedExpression As FilterName",maxTerm:39,skippedNodes:[0],repeatNodeCount:1,tokenData:"6p~RnXY#PYZ#P]^#Ppq#Pqr#brs#mxy$eyz$j|}$o!O!P$t!Q![%S!^!_%_!_!`%d!`!a%i!c!}%n!}#O&V#P#Q&[#R#S%n#T#U&a#U#X%n#X#Y(w#Y#Z+]#Z#]%n#]#^.]#^#c%n#c#d/e#d#g%n#g#h0m#h#i4[#i#o%n~#USo~XY#PYZ#P]^#Ppq#P~#eP!_!`#h~#mOU~~#pWOX#mZ]#m^r#mrs$Ys#O#m#P;'S#m;'S;=`$_<%lO#m~$_O[~~$bP;=`<%l#m~$jOv~~$oOw~~$tOc~~$wP!Q![$z~%PPZ~!Q![$z~%XQZ~!O!P$t!Q![%S~%dOW~~%iOT~~%nOV~P%sUsP}!O%n!O!P%n!Q![%n!c!}%n#R#S%n#T#o%n~&[Oa~~&aOd~R&fYsP}!O%n!O!P%n!Q![%n!c!}%n#R#S%n#T#b%n#b#c'U#c#g%n#g#h(^#h#o%nR'ZWsP}!O%n!O!P%n!Q![%n!c!}%n#R#S%n#T#W%n#W#X's#X#o%nR'zUfQsP}!O%n!O!P%n!Q![%n!c!}%n#R#S%n#T#o%nR(eUjQsP}!O%n!O!P%n!Q![%n!c!}%n#R#S%n#T#o%nR(|WsP}!O%n!O!P%n!Q![%n!c!}%n#R#S%n#T#b%n#b#c)f#c#o%nR)kWsP}!O%n!O!P%n!Q![%n!c!}%n#R#S%n#T#W%n#W#X*T#X#o%nR*YWsP}!O%n!O!P%n!Q![%n!c!}%n#R#S%n#T#g%n#g#h*r#h#o%nR*yUYQsP}!O%n!O!P%n!Q![%n!c!}%n#R#S%n#T#o%nR+bVsP}!O%n!O!P%n!Q![%n!c!}%n#R#S%n#T#U+w#U#o%nR+|WsP}!O%n!O!P%n!Q![%n!c!}%n#R#S%n#T#`%n#`#a,f#a#o%nR,kWsP}!O%n!O!P%n!Q![%n!c!}%n#R#S%n#T#g%n#g#h-T#h#o%nR-YWsP}!O%n!O!P%n!Q![%n!c!}%n#R#S%n#T#X%n#X#Y-r#Y#o%nR-yU^QsP}!O%n!O!P%n!Q![%n!c!}%n#R#S%n#T#o%nR.bWsP}!O%n!O!P%n!Q![%n!c!}%n#R#S%n#T#b%n#b#c.z#c#o%nR/RU`QsP}!O%n!O!P%n!Q![%n!c!}%n#R#S%n#T#o%nR/jWsP}!O%n!O!P%n!Q![%n!c!}%n#R#S%n#T#f%n#f#g0S#g#o%nR0ZUhQsP}!O%n!O!P%n!Q![%n!c!}%n#R#S%n#T#o%nR0rWsP}!O%n!O!P%n!Q![%n!c!}%n#R#S%n#T#h%n#h#i1[#i#o%nR1aVsP}!O%n!O!P%n!Q![%n!c!}%n#R#S%n#T#U1v#U#o%nR1{WsP}!O%n!O!P%n!Q![%n!c!}%n#R#S%n#T#f%n#f#g2e#g#o%nR2jWsP}!O%n!O!P%n!Q![%n!c!}%n#R#S%n#T#h%n#h#i3S#i#o%nR3XWsP}!O%n!O!P%n!Q![%n!c!}%n#R#S%n#T#g%n#g#h3q#h#o%nR3xUXQsP}!O%n!O!P%n!Q![%n!c!}%n#R#S%n#T#o%nR4aWsP}!O%n!O!P%n!Q![%n!c!}%n#R#S%n#T#f%n#f#g4y#g#o%nR5OWsP}!O%n!O!P%n!Q![%n!c!}%n#R#S%n#T#i%n#i#j5h#j#o%nR5mWsP}!O%n!O!P%n!Q![%n!c!}%n#R#S%n#T#X%n#X#Y6V#Y#o%nR6^U]QsP}!O%n!O!P%n!Q![%n!c!}%n#R#S%n#T#o%n",tokenizers:[0,1],topRules:{Filter:[0,1]},tokenPrec:0});import{isMultiClauseFilter as Bt,isMultiValueFilter as Pp,isSingleValueFilter as Lp}from"@vuu-ui/vuu-utils";var Ee,Ai=class{constructor(){xo(this,Ee,void 0)}setFilterCombinatorOp(e,t=Be(this,Ee)){Bt(t)&&t.op===e||jr(this,Ee,{op:e,filters:[Be(this,Ee)]})}add(e){if(Be(this,Ee)===void 0)jr(this,Ee,e);else if(Bt(Be(this,Ee)))Be(this,Ee).filters.push(e);else throw Error("Invalid filter passed to FilterExpression")}setColumn(e,t=Be(this,Ee)){if(Bt(t)){let n=t.filters.at(-1);n&&this.setColumn(e,n)}else t&&(t.column=e)}setOp(e,t=Be(this,Ee)){if(Bt(t)){let n=t.filters.at(-1);n&&this.setOp(e,n)}else t&&(t.op=e)}setValue(e,t=Be(this,Ee)){var n;if(Bt(t)){let o=t.filters.at(-1);o&&this.setValue(e,o)}else Pp(t)?((n=t.values)!=null||(t.values=[]),t.values.push(e)):Lp(t)&&(t.value=e)}toJSON(e=Be(this,Ee)){return this.name?{...e,name:this.name}:e}};Ee=new WeakMap;var iM=Un.configure({strict:!0});import{getRowRecord as yM,isGroupMenuItemDescriptor as SM,metadataKeys as Hp}from"@vuu-ui/vuu-utils";import{useCallback as IM}from"react";var{KEY:TM}=Hp;import{getServerAPI as Np}from"@vuu-ui/vuu-data";import{useCallback as MM,useEffect as PM,useState as kM}from"react";var Fi=r=>Np().then(e=>e.getTableSchema(r));import{useViewContext as Ap}from"@vuu-ui/vuu-layout";import{useCallback as Fp,useMemo as Vi,useState as Bi}from"react";var $i=({dataSource:r,searchColumns:e=["description"],table:t})=>{let[n,o]=Bi(r),{loadSession:s,saveSession:i}=Ap(),[a,l]=Bi({searchText:"",filter:""}),u=Vi(()=>e.map(p=>`${p} starts "__VALUE__"`).join(" or "),[e]);Vi(()=>{if(r===void 0)if(t){let p=`instrument-search-${t.module}-${t.table}`,c=s==null?void 0:s(p);c?o(c):Fi(t).then(m=>{let f=new Op({columns:m.columns.map(h=>h.name),table:m.table});o(f),i==null||i(f,p)})}else throw Error("useInstrumentSearch, if dataSource ismnot provided as prop, Vuu table must be provided")},[r,s,i,t]);let d=Fp(p=>{let{value:c}=p.target,m=u.replaceAll("__VALUE__",c);l({searchText:c,filter:m}),n&&(n.filter={filter:m})},[u,n]);return{dataSource:n,onChange:d,searchState:a}};import{jsx as Vr,jsxs as Qp}from"react/jsx-runtime";var Gn="vuuInstrumentSearch",Up={columns:[{name:"bbg",hidden:!0},{name:"description",width:200,type:{name:"string",renderer:{name:"search-cell"}}}],rowSeparators:!0},Gp=Vr("span",{"data-icon":"search"}),Wp=({TableProps:r,autoFocus:e=!1,className:t,dataSource:n,placeHolder:o,searchColumns:s,table:i,...a})=>{var g;let{dataSource:l,onChange:u,searchState:d}=$i({dataSource:n,searchColumns:s,table:i}),{highlightedIndexRef:p,onHighlight:c,onKeyDown:m,tableRef:f}=$p(-1,(g=l==null?void 0:l.size)!=null?g:0),h=zp(y=>{setTimeout(()=>{var E;(E=y==null?void 0:y.querySelector("input"))==null||E.focus()},100)},[]);return Qp("div",{...a,className:Kp(Gn,t),children:[Vr("div",{className:`${Gn}-inputField`,children:Vr(_p,{inputProps:{onKeyDown:m},endAdornment:Gp,placeholder:o,ref:e?h:null,value:d.searchText,onChange:u})}),l?Vr(Bp,{disableFocus:!0,id:"instrument-search",rowHeight:25,config:Up,highlightedIndex:p.current,renderBufferSize:100,...r,className:`${Gn}-list`,dataSource:l,navigationStyle:"row",onHighlight:c,ref:f,showColumnHeaders:!1}):null]})},_i;(_i=Vp)==null||_i("InstrumentSearch",Wp,"view");import{getMovingValueDirection as jp,isValidNumber as Xp,numericFormatter as Zp}from"@vuu-ui/vuu-utils";import{memo as qp,useMemo as Jp,useRef as Yp}from"react";import ef from"classnames";import{jsx as sf,jsxs as af}from"react/jsx-runtime";var tf="vuuPriceTicker",rf=r=>Zp({type:{name:"number",formatting:{decimals:r,zeroPad:!0}}}),nf=[void 0,void 0],of=qp(({className:r,decimals:e=2,price:t,showArrow:n,...o})=>{let s=Yp(nf),[i,a]=s.current,l=Jp(()=>rf(e),[e]),u=Xp(i)?jp(t,a,i,e):"";return s.current=[t,u],af("div",{...o,className:ef(tf,r,u),children:[l(t),n?sf("span",{"data-icon":"price-arrow"}):null]})});of.displayName="PriceTicker";import{asReactElements as Mf,OverflowContainer as Pf,useId as Lf}from"@vuu-ui/vuu-layout";import{Button as kf}from"@salt-ds/core";import Zn from"classnames";import Rf,{useMemo as Hf,useRef as Nf}from"react";import{dispatchMouseEvent as Tf}from"@vuu-ui/vuu-utils";import{useCallback as Le,useRef as Cf}from"react";var Ki=r=>typeof r=="object"&&r!==null&&"tabIndex"in r&&typeof r.tabIndex=="number",zi=r=>({label:"Close",location:"tab",action:"close-tab",options:r}),Ui=r=>({label:"Rename",location:"tab",action:"rename-tab",options:r});import{getElementDataIndex as lf}from"@vuu-ui/vuu-utils";var Gi=(r,e)=>{if(r){let t=r.querySelector(`[data-index]:has(${e})`);return lf(t)}return-1},Wn=r=>Gi(r,'[aria-selected="true"]'),Wi=r=>Gi(r,".vuuEditableLabel-editing");import{isValidNumber as Qn,MEASURES as uf}from"@vuu-ui/vuu-utils";import{useCallback as jn,useMemo as cf,useRef as Qi}from"react";var ji=(r,e,t="horizontal")=>{let n=Qi(!1),o=jn(()=>{n.current=!0},[]),s=jn(()=>{n.current=!1},[]),i=jn(()=>{var l,u;(l=r.current)==null||l.style.setProperty("--tab-thumb-transition","none"),(u=r.current)==null||u.removeEventListener("transitionend",i)},[r]),a=Qi(-1);return cf(()=>{var d,p;let l=0,u=0;if(a.current!==-1){let c=(d=r.current)==null?void 0:d.querySelector(".vuuTab-selected"),m=(p=r.current)==null?void 0:p.querySelector(`[data-index="${e}"] .vuuTab`),{positionProp:f,sizeProp:h}=uf[t];if(c&&m&&!n.current){let{[f]:g,[h]:y}=c.getBoundingClientRect(),{[f]:E}=m.getBoundingClientRect();if(Qn(g)&&Qn(E)&&Qn(y)){l=g-E,u=y;let b=Math.abs(l/(t==="horizontal"?1100:700));requestAnimationFrame(()=>{var v,S,T,A;(v=r.current)==null||v.style.setProperty("--tab-thumb-offset","0px"),(S=r.current)==null||S.style.setProperty("--tab-thumb-size","100%"),(T=r.current)==null||T.style.setProperty("--tab-thumb-transition",`all ${b}s ease`),(A=r.current)==null||A.addEventListener("transitionend",i)})}}}return a.current=e,n.current?{containerStyle:{"--tab-thumb-offset":"0px","--tab-thumb-size":"100%"},resumeAnimation:s,suspendAnimation:o}:{containerStyle:{"--tab-thumb-offset":`${l}px`,"--tab-thumb-size":u?`${u}px`:void 0},resumeAnimation:s,suspendAnimation:o}},[e,r,t,i,s,o])};import{useControlled as df}from"@salt-ds/core";import{dispatchMouseEvent as pf,getFocusableElement as ff}from"@vuu-ui/vuu-utils";import{useCallback as Ke,useRef as Xn,useState as Xi}from"react";import{ArrowDown as Yi,ArrowUp as mf,ArrowLeft as hf,ArrowRight as gf,Home as Zi,End as qi}from"@vuu-ui/vuu-utils";var ea={horizontal:{[Zi]:"start",[qi]:"end",[hf]:"bwd",[gf]:"fwd"},vertical:{[Zi]:"start",[qi]:"end",[mf]:"bwd",[Yi]:"fwd"}},bf=(r,e="horizontal")=>ea[e][r]!==void 0,xf=r=>r===Yi;function Ji(r,e,t){return e==="start"?0:e==="end"?r-1:e==="bwd"?t>0?t-1:t:t===null?0:t===r-1?t:t+1}var yf=r=>r!==null&&!r.classList.contains("wrapped"),Br=(r,e)=>r?r.querySelector(`[data-index="${e}"]`):null,ta=({containerRef:r,defaultHighlightedIdx:e=-1,highlightedIdx:t,keyBoardActivation:n,orientation:o,selectedIndex:s=0})=>{let i=n==="manual",a=Xn(!1),l=Xn(-1),[u,d]=Xi(!1),[,p]=Xi({}),[c,m]=df({controlled:t,default:e,name:"UseKeyboardNavigation"}),f=Ke(x=>{m(l.current=x)},[m]),h=Xn(!1),g=Ke((x,L=!1,N,k=70)=>{f(x),N===!0&&!h.current&&(h.current=!0);let P=()=>{let R=Br(r.current,x);if(R){let M=ff(R);M==null||M.focus()}};L?P():setTimeout(P,k)},[r,f]),y=x=>{if(l.current===-1&&x.target.tabIndex!==-1){let L=Wi(r.current);L!==-1?requestAnimationFrame(()=>{f(L)}):setTimeout(()=>{l.current===-1&&s!==null&&f(s)},200)}},E=Ke(()=>{var x,L;return(L=(x=r.current)==null?void 0:x.querySelectorAll("[data-index]").length)!=null?L:0},[r]),I=Ke((x="fwd",L)=>{let N=E(),P=Ji(N,x,typeof L=="number"?L:N),R=x==="start"?"fwd":x==="end"?"bwd":x;for(;(R==="fwd"&&P<N||R==="bwd"&&P>0)&&!yf(Br(r.current,P));){let M=Ji(N,R,P);if(M===P)break;P=M}return P},[r,E]),b=Ke((x,L=!1)=>{let N=ea[o][x.key],k=I(N,c);k!==c?i&&g(k,!0):L&&p({})},[c,i,I,g,o]),v=Ke(()=>{let x=Br(r.current,c);return x?x.querySelector(".vuuPopupMenu")!=null:!1},[r,c]),S=Ke(()=>{let x=Br(r.current,c),L=x==null?void 0:x.querySelector(".vuuPopupMenu");return L&&pf(L,"click"),!1},[r,c]),T=Ke(x=>{E()>0&&bf(x.key,o)?(x.preventDefault(),h.current?b(x):(h.current=!0,b(x,!0))):xf(x.key)&&v()&&S()},[S,E,v,b,o]),A=(x,L)=>{f(L)},w=Ke(()=>{u||(d(!0),a.current?a.current=!1:h.current=!0)},[u]),D=Ke(()=>{u||(a.current=!0),h.current=!1},[u]);return{containerProps:{onBlur:x=>{let L=x.target.closest(".vuuTabstrip"),N=x.relatedTarget;L&&!(L!=null&&L.contains(N))&&(f(-1),d(!1))},onMouseDownCapture:D,onFocus:w,onMouseLeave:()=>{h.current=!0,f(-1),a.current=!1}},focusVisible:h.current?c:-1,focusIsWithinComponent:u,highlightedIdx:c,focusTab:g,onClick:A,onFocus:y,onKeyDown:T,setHighlightedIdx:f}};import{useControlled as Sf}from"@salt-ds/core";import{useCallback as $r}from"react";var vf=["Enter"," "],If=r=>r&&r.matches('[class*="vuuTab "]'),ra=({defaultSelected:r,highlightedIdx:e,onSelectionChange:t,selected:n})=>{let[o,s,i]=Sf({controlled:n,default:r!=null?r:0,name:"Tabstrip",state:"value"}),a=$r(p=>vf.includes(p.key),[]),l=$r(p=>{s(p),t==null||t(p)},[t,s]),u=$r(p=>{let c=p.target;a(p)&&e!==o&&If(c)&&(p.stopPropagation(),p.preventDefault(),l(e))},[a,e,o,l]),d=$r((p,c)=>{c!==o&&l(c)},[l,o]);return{activateTab:l,isControlled:i,onClick:d,onKeyDown:u,selected:o}};var wf=new Set(["Enter"," "]),Ef=r=>wf.has(r),Df=(r,e)=>r?r.querySelector(`[data-index="${e}"]`):null,na=({activeTabIndex:r,allowDragDrop:e,animateSelectionThumb:t,containerRef:n,onActiveChange:o,onAddTab:s,onCloseTab:i,onExitEditMode:a,onMoveTab:l,orientation:u,keyBoardActivation:d})=>{let p=Cf(r),{focusTab:c,highlightedIdx:m,onClick:f,onKeyDown:h,setHighlightedIdx:g,...y}=ta({containerRef:n,keyBoardActivation:d,orientation:u,selectedIndex:p.current}),{activateTab:E,onClick:I,onKeyDown:b,selected:v}=ra({highlightedIdx:m,onSelectionChange:o,selected:r});p.current=v;let{containerStyle:S,resumeAnimation:T,suspendAnimation:A}=ji(n,t?v:-1,u),w=Le(($,_)=>{let{current:Y}=p;console.log(`useTabstrip handleDrop ${$} - ${_} ${Y}`),l==null||l($,_);let X=-1;_!==-1&&(Y===$?X=_:$>Y&&_<=Y?X=Y+1:$<Y&&_>=Y&&(X=Y-1),X!==-1&&(A(),E(X),requestAnimationFrame(T)),c(_,!1,!1,350))},[c,l,T,E,A]),{onMouseDown:D,...O}=yr({allowDragDrop:e,containerRef:n,draggableClassName:`tabstrip-${u}`,onDrop:w,orientation:"horizontal",itemQuery:".vuuOverflowContainer-item"}),x=Le(($,_,Y,X)=>{console.log(`handleExitEditMode ${$} ${_} ${Y} ${X}`),a==null||a($,_,Y,X),Y||c(X,!1,!0)},[c,a]),L=Le(($,_)=>{f($,_),I($,_)},[f,I]),N=Le(($=m)=>{let _=Df(n.current,$);if(_)return _.querySelector(".vuuEditableLabel")},[n,m]),k=Le(($=m)=>{let _=N($);return _?_.classList.contains("vuuEditableLabel-editing"):!1},[N,m]),P=Le(($=m)=>{let _=N($);_&&Tf(_,"dblclick")},[N,m]),R=Le($=>{h($),$.defaultPrevented||b($),!$.defaultPrevented&&Ef($.key)&&P()},[P,h,b]),M=Le($=>{let _=Wn(n.current),Y=_>$?_-1:_===$?0:_;return A(),i==null||i($,Y),setTimeout(()=>{T()},200),!0},[n,i,T,A]),V=Le($=>(P($),!0),[P]),C=Le($=>{if(Ki($.options))switch($.menuId){case"close-tab":return M($.options.tabIndex);case"rename-tab":return V($.options.tabIndex);default:console.log(`tab menu action ${$.menuId}`)}return!1},[M,V]),F=Le(()=>{k()?g(m):c(m)},[m,c,g,k]),H=Le($=>{let _=parseInt($.index);isNaN(_)||E(_)},[E]),B={onFocus:y.onFocus,onKeyDown:R},z=Le(()=>{s==null||s(),requestAnimationFrame(()=>{let $=Wn(n.current);$!==-1&&c($)})},[n,c,s]),G={onClick:L,onKeyDown:R,onExitEditMode:x,onMenuAction:C,onMenuClose:F,onMouseDown:D};return{activeTabIndex:v,containerStyle:S,focusVisible:y.focusVisible,containerProps:{...y.containerProps,onSwitchWrappedItemIntoView:H},navigationProps:B,onClickAddTab:z,tabProps:G,...O}};import{Fragment as Ff,jsx as Af,jsxs as Vf}from"react/jsx-runtime";import{createElement as Of}from"react";var qn="vuuTabstrip",xp=({activeTabIndex:r,allowAddTab:e,allowCloseTab:t,allowDragDrop:n=!1,allowRenameTab:o=!1,animateSelectionThumb:s=!1,children:i,className:a,id:l,keyBoardActivation:u="manual",location:d,onActiveChange:p,onAddTab:c,onCloseTab:m,onExitEditMode:f,onMoveTab:h,orientation:g="horizontal",showTabMenuButton:y,style:E,tabClassName:I,...b})=>{let v=Nf(null),{activeTabIndex:S,focusVisible:T,containerStyle:A,draggedItemIndex:w,onClickAddTab:D,tabProps:O,...x}=na({activeTabIndex:r,allowDragDrop:n,animateSelectionThumb:s,containerRef:v,keyBoardActivation:u,onActiveChange:p,onAddTab:c,onCloseTab:m,onExitEditMode:f,onMoveTab:h,orientation:g}),L=Lf(l),N=Zn(qn,`${qn}-${g}`,a),k=E||A?{...E,...A}:void 0,P=Hf(()=>Mf(i).map((R,M)=>{let{id:V=`${L}-tab-${M}`,className:C,closeable:F=t,editable:H=o,location:B,showMenuButton:z=y}=R.props,G=M===S;return Rf.cloneElement(R,{...O,...x.navigationProps,className:Zn(C,I),closeable:F,"data-overflow-priority":G?"1":void 0,dragging:w===M,editable:H,focusVisible:T===M,id:V,index:M,key:M,location:Zn(d,B),selected:G,showMenuButton:z,tabIndex:G?0:-1})}).concat(e?Of(kf,{...x.navigationProps,"aria-label":"Create Tab",className:`${qn}-addTabButton`,"data-icon":"add","data-overflow-priority":"1",key:"addButton",onClick:D,variant:"secondary",tabIndex:-1}):[]),[i,e,x.navigationProps,D,L,t,o,y,S,O,I,w,T,d]);return Vf(Ff,{children:[Af(Pf,{...b,...x.containerProps,className:N,height:29,id:L,orientation:g,overflowIcon:"more-horiz",ref:v,style:k,children:P}),x.draggable]})};import{useForkRef as Uf}from"@salt-ds/core";import Gf from"classnames";import{forwardRef as Wf,useCallback as Qf,useRef as sa}from"react";import{PopupMenu as Bf}from"@vuu-ui/vuu-popups";import{useMemo as $f}from"react";import _f from"classnames";import{jsx as zf}from"react/jsx-runtime";var Kf="vuuTabMenu",oa=({allowClose:r,allowRename:e,controlledComponentId:t,controlledComponentTitle:n,location:o,onMenuAction:s,onMenuClose:i,index:a})=>{let[l,u]=$f(()=>[(d,p)=>{let c=[];return e&&c.push(Ui(p)),r&&c.push(zi(p)),c},{controlledComponentId:t,controlledComponentTitle:n,tabIndex:a}],[r,e,t,a]);return zf(Bf,{className:Kf,menuBuilder:l,menuActionHandler:s,menuLocation:_f("tab",o),menuOptions:u,onMenuClose:i,tabIndex:-1})};import{jsx as _r,jsxs as jf}from"react/jsx-runtime";var at="vuuTab",ia=()=>{},yp=Wf(function({ariaControls:e,children:t,className:n,closeable:o=!1,dragging:s,editable:i=!1,editing:a,focusVisible:l,index:u=-1,label:d,location:p,onClick:c,onClose:m,onEnterEditMode:f=ia,onExitEditMode:h=ia,onFocus:g,onKeyUp:y,onMenuAction:E,onMenuClose:I,orientation:b,selected:v,showMenuButton:S=o||i||!!p,tabIndex:T,...A},w){if(S&&typeof E!="function")throw Error("Tab onMenuAction must be provided if showMenuButton is set");let D=sa(null),O=sa(null),x=Uf(w,D),L=Qf(M=>{a||(M.preventDefault(),c==null||c(M,u))},[a,u,c]),N=(M="",V="",C=!0)=>h(M,V,C,u),k=M=>{switch(M.key){case"Backspace":case"Delete":o&&(M.stopPropagation(),m&&m(u));break;default:y&&y(M,u)}},P=()=>i?_r(di,{editing:a,defaultValue:d,onEnterEditMode:f,onExitEditMode:N,ref:O},d):d,R=M=>{if(O.current){let C=O.current.querySelector(".vuuEditableLabel-input");C==null||C.focus()}g==null||g(M)};return jf("div",{...A,"aria-controls":e,"aria-selected":v,className:Gf(at,n,{[`${at}-closeable`]:o,"vuuDraggable-dragAway":s,[`${at}-editing`]:a,[`${at}-selected`]:v||void 0,[`${at}-vertical`]:b==="vertical",vuuFocusVisible:l}),onClick:L,onFocus:R,onKeyUp:k,ref:x,role:"tab",tabIndex:T,children:[_r("div",{className:`${at}-main`,children:_r("span",{className:`${at}-text`,"data-text":i?void 0:d,children:t!=null?t:P()})}),S?_r(oa,{allowClose:o,allowRename:i,controlledComponentId:e,controlledComponentTitle:d,location:p,onMenuAction:E,onMenuClose:I,index:u}):null]})});import{useForkRef as Cm,useIdMemo as wm}from"@salt-ds/core";import io from"classnames";import{forwardRef as Em,useRef as Dm}from"react";function Xf(r){var e;if(r){let t=r.dataset.idx;if(t)return parseInt(t,10);if(t=(e=r.ariaPosInSet)!=null?e:"-1")return parseInt(t,10)-1}}var Jn=r=>r.closest("[data-idx],[aria-posinset]");var aa=r=>Xf(Jn(r));import{useCallback as Yn,useMemo as Zf}from"react";var qf=new Set(["/","-","."]),Jf=r=>qf.has(r),la=(r,e)=>e.startsWith(r)&&Jf(e[r.length]),ua=(r,e="root",{collapsibleHeaders:t=void 0,defaultExpanded:n=!1,revealSelected:o=!1}={})=>{let s=(c,m,f)=>{if(c.childNodes)return c.childNodes.length;if(c.header){let h=f+1,g=0;for(;h<m.length&&!m[h].header;)g++,h++;return g}else return 0},i=Yn(c=>Array.isArray(o)?o.some(m=>la(c,m)):n,[n,o]),a=Yn((c,m,f=1,h="",g=[],y=[])=>{let E=0;return c.forEach((I,b,v)=>{var N;let S=I.header&&t,T=I.childNodes&&t===!1,A=!I.childNodes||I.childNodes.length===0,w=T||A&&!S,D=h?`${h}.${b}`:`${b}`,O=(N=I.id)!=null?N:`${e}-${D}`,x=w?void 0:i(O),L={...I,childNodes:void 0,id:O,count:!T&&x===void 0?0:s(I,v,b),expanded:x,index:m.index,level:f};if(g.push(L),y.push(c[b]),E+=1,m.index+=1,I.childNodes){let[k,P]=a(I.childNodes,m,f+1,D,[],y);L.childNodes=P,(x===!0||T)&&(E+=k)}}),[E,g,y]},[t,e,i]),[l,u,d]=Zf(()=>a(r,{index:0}),[a,r]),p=Yn((c,m=u)=>{let f=m.find(h=>{var g;return h.id===c||((g=h==null?void 0:h.childNodes)==null?void 0:g.length)&&la(h.id,c)});if((f==null?void 0:f.id)===c)return d[f.index];if(f)return p(c,f.childNodes)},[d,u]);return[l,u,p]};import{useCallback as $t,useRef as Yf}from"react";import{useControlled as em}from"@salt-ds/core";var ca="single",tm="checkbox",rm="multi",nm="extended",om=["Enter"," "],da={},sm=r=>r.expanded!==void 0,pa=r=>r&&r!=="none",fa=({defaultSelected:r,highlightedIdx:e,treeNodes:t,onChange:n,selected:o,selection:s=ca,selectionKeys:i=om})=>{let a=s===ca,l=s===rm||s.startsWith(tm),u=s===nm,d=Yf(-1),p=$t(b=>i.includes(b.key),[i]),[c,m]=em({controlled:o,default:r!=null?r:[],name:"selected"}),f=$t((b,v,S,T,A=!1)=>{let{current:w}=d,D=c==null?void 0:c.includes(S),x=a||u&&!A&&(!T||w===-1),L=l||u&&A&&!T,N=[];if(x&&D)N=[];else if(x)N=[S];else if(L&&D)N=c.filter(k=>k!==S);else if(L)N=c.concat(S);else if(u){let[k,P]=v>w?[w,v]:[v,w];N=c.slice();for(let R=k;R<=P;R++){let{id:M}=t[R];c.includes(M)||N.push(M)}}m(N),n&&n(b,N)},[u,t,l,n,c,m,a]),h=$t(b=>{if(~e&&p(b)){b.preventDefault();let v=t[e];f(b,e,v.id,!1,b.ctrlKey||b.metaKey),u&&(d.current=e)}},[u,e,t,p,f]),g=$t((b,v)=>{if(u&&b.shiftKey){let S=t[v];f(b,v,S.id,!0)}},[u,t,f]),y=s==="none"?da:{onKeyDown:h,onKeyboardNavigation:g},E=$t(b=>{if(e!==-1){let v=t[e];sm(v)||(b.preventDefault(),b.stopPropagation(),f(b,e,v.id,b.shiftKey,b.ctrlKey||b.metaKey),u&&(d.current=e))}},[u,e,t,f]);return{listHandlers:y,listItemHandlers:s==="none"?da:{onClick:E},selected:c,setSelected:m}};import{useCallback as eo,useEffect as ma,useLayoutEffect as im,useRef as Kr}from"react";var am=["height","scrollHeight"],ha=(r,e,t=!1)=>{let n=Kr(0),o=Kr(!1),s=Kr(0),i=Kr(0),a=eo(d=>{let p=d.ariaExpanded?d.firstChild:d,c=t?30:0,m=p.offsetTop,f=p.offsetHeight,h=n.current+c,g=h+s.current-c;(m+f>g||m<h)&&(n.current=m+f>g?n.current+(m+f)-g:m-c,o.current=!0,r.current&&(r.current.scrollTop=n.current),setTimeout(()=>{o.current=!1}))},[r,t]),l=eo(d=>{n.current=d.target.scrollTop},[]);ma(()=>{let{current:d}=r;return d&&d.addEventListener("scroll",l),()=>{d&&d.removeEventListener("scroll",l)}},[r,l]),im(()=>{if(e!==-1&&i.current>s.current&&r.current){let d=r.current.querySelector(`
|
|
6
6
|
[data-idx='${e}'],
|
|
7
7
|
[aria-posinset='${e+1}']
|
|
8
|
-
`);d===null?console.log("[useViewportTracking], is this virtualised ? we're going to have to know rowHeight"):a(d)}},[e,r,a]),ma(()=>{},[t]);let u=eo(({height:d,scrollHeight:p})=>{s.current=d,i.current=p},[]);return ze(r,am,u,!0),o};import{useCallback as Ra,useRef as Im}from"react";import{useCallback as _t,useMemo as Ca,useRef as wa}from"react";var ga=({id:r})=>{let e=r.lastIndexOf("-");if(e!==-1){let n=r.slice(e+1).split(".");return n.length===1?null:(n.pop(),`${r.slice(0,e)}-${n.join(".")}`)}else if((e=r.lastIndexOf("/"))!==-1)return r.slice(0,e)},ba=r=>r.childNodes!==void 0;var to=r=>r.header===!0,lm=new Set([".","/"]),xa=(r,e)=>e.startsWith(r.id)?lm.has(e.charAt(r.id.length)):!1,lt=(r,e)=>{for(let t of r){if(t.id===e)return t;if(xa(t,e))return lt(t.childNodes,e)}},zr=(r,e)=>{let t=typeof e=="string"?e:e.id;for(let n=0;n<r.length;n++)if(r[n].id===t)return n},Ur=(r,e,t)=>{let n;return r.map(s=>s.id===e?{...s,...t}:xa(s,e)?(n=Ur(s.childNodes,e,t),{...s,childNodes:n}):s)};import{useControlled as hm}from"@salt-ds/core";function um(r,...e){let t=new Set(r);for(let n of e)for(let o of n)t.add(o);return t}var ro="ArrowUp",ya="ArrowDown",Ct="ArrowLeft";var Sa="ArrowRight",Gr="Enter";var cm="Delete",dm=new Set([Gr,cm]),pm=new Set(["Tab"]),fm=new Set(["ArrowRight","ArrowLeft"]),va=new Set(["Home","End","ArrowDown","ArrowUp"]),Ia=new Set(["Home","End","ArrowRight","ArrowLeft"]),mm=new Set(["F1","F2","F3","F4","F5","F6","F7","F8","F9","F10","F11","F12"]),cL=um(dm,Ia,va,fm,mm,pm);var Ta=({key:r},e="vertical")=>(e==="vertical"?va:Ia).has(r);function Ea(r,e,t){return e===ro||e===Ct?t>0?t-1:t:t===null?0:t===r-1?t:t+1}var gm=r=>!r.header&&!r.childNodes,bm=r=>gm(r)||r.expanded!==void 0,Da=({defaultHighlightedIdx:r=-1,highlightedIdx:e,treeNodes:t,onHighlight:n,onKeyboardNavigation:o,selected:s=[]})=>{let{bwd:i,fwd:a}=Ca(()=>({bwd:ro,fwd:ya}),[]),[l,u,d]=hm({controlled:e,default:r,name:"highlightedIdx"}),p=_t(b=>{n==null||n(b),u(b)},[n,u]),c=_t((b=a,v=b===a?-1:t.length)=>{let S=Ea(t.length,b,v);for(;S!==-1&&(b===a&&S<t.length||b===i&&S>0)&&!bm(t[S]);)S=Ea(t.length,b,S);return S},[i,a,t]),m=wa(!0),f=wa(!1),h=b=>f.current=b,g=_t(()=>{if(f.current)f.current=!1;else if(s.length>0){let b=lt(t,s[0]);if(b){let v=zr(t,b);p(v)}}else p(c())},[t,c,s,p]),y=_t(b=>{let v=c(b.key,l);v!==l&&(p(v),o==null||o(b,v))},[l,c,o,p]),E=_t(b=>{t.length>0&&Ta(b,"vertical")&&(b.preventDefault(),b.stopPropagation(),m.current=!0,y(b))},[t,y]),I=Ca(()=>({onBlur:()=>{p(-1)},onFocus:g,onKeyDown:E,onMouseDownCapture:()=>{m.current=!1,h(!0)},onMouseMove:()=>{m.current&&(m.current=!1)},onMouseLeave:()=>{m.current=!0,h(!1),p(-1)}}),[g,E,p]);return{focusVisible:m.current?l:-1,controlledHighlighting:d,highlightedIdx:l,hiliteItemAtIndex:p,keyBoardNavigation:m,listProps:I,setIgnoreFocus:h}};import{useRef as no,useState as xm}from"react";var Wr=(r,e=[],t={value:0})=>{let n=!1;for(let o of r)n&&!to(o)||(e[t.value]=o,t.value+=1,n=!1,to(o)&&o.expanded===!1?n=!0:ba(o)&&oo(o)&&Wr(o.childNodes,e,t));return e},Ma=r=>{let e=no(r),t=no(r),n=no(Wr(r)),[,o]=xm({});r!==e.current&&(e.current=r,t.current=r,n.current=Wr(r));let s=i=>{t.current=i,n.current=Wr(i),o({})};return{data:t.current,indexPositions:n.current,setData:s}};import{useCallback as Kt,useRef as Pa}from"react";var ym={},Sm=r=>r&&r.hasAttribute("aria-expanded"),La=({collapsibleHeaders:r,highlightedIdx:e,treeNodes:t,setVisibleData:n,source:o})=>{let s=Pa(o),i=Pa(s.current),a=Kt(f=>{n(i.current=f)},[n]),l=Kt((f,{id:h})=>Ur(f,h,{expanded:!0}),[]),u=Kt((f,{id:h})=>Ur(f,h,{expanded:!1}),[]),d=Kt(f=>{if(f.key===Sa||f.key===Gr){let h=t[e];h&&h.expanded===!1&&(f.preventDefault(),a(l(i.current,h)))}if(f.key===Ct||f.key===Gr){let h=t[e];h&&h.expanded&&(f.preventDefault(),a(u(i.current,h)))}},[u,l,e,t,a]),p=r?{onKeyDown:d}:ym,m={onClick:Kt(f=>{let h=Jn(f.target);if(Sm(h)){f.stopPropagation(),f.preventDefault();let g=lt(o,h.id);(g==null?void 0:g.expanded)===!1?a(l(o,g)):(g==null?void 0:g.expanded)===!0&&a(u(o,g))}},[u,l,a,o])};return{listHandlers:p,listItemHandlers:m}};import{useCallback as vm}from"react";var ka=({highlightedIdx:r,hiliteItemAtIndex:e,indexPositions:t,source:n})=>({listHandlers:{onKeyDown:vm(i=>{if(i.key===Ct){let a=t[r],l=ga(a);if(l){i.preventDefault();let u=lt(n,l);if(u){let d=zr(t,u);d!==void 0&&e(d)}}}},[r,e,t,n])}});var Tm=[],Ha=({defaultSelected:r,sourceWithIds:e,onChange:t,onHighlight:n,selected:o,selection:s})=>{let i=Im(Tm),a=Ma(e),l=(I,b)=>{var v,S;(S=(v=c.listHandlers).onKeyboardNavigation)==null||S.call(v,I,b)},{highlightedIdx:u,...d}=Da({treeNodes:a.indexPositions,onHighlight:n,onKeyboardNavigation:l,selected:i.current}),p=La({collapsibleHeaders:!0,highlightedIdx:u,treeNodes:a.indexPositions,setVisibleData:a.setData,source:a.data}),c=fa({defaultSelected:r,highlightedIdx:u,treeNodes:a.indexPositions,onChange:t,selected:o,selection:s}),m=ka({source:a.data,highlightedIdx:u,hiliteItemAtIndex:d.hiliteItemAtIndex,indexPositions:a.indexPositions}),f=Ra(I=>{var b,v,S;(b=p.listItemHandlers)==null||b.onClick(I),I.defaultPrevented||(S=(v=c.listItemHandlers)==null?void 0:v.onClick)==null||S.call(v,I)},[p,c]),h=Ra(I=>{var b,v,S,T,A,w,D,O;(v=(b=d.listProps).onKeyDown)==null||v.call(b,I),I.defaultPrevented||(T=(S=c.listHandlers).onKeyDown)==null||T.call(S,I),I.defaultPrevented||(w=(A=p.listHandlers).onKeyDown)==null||w.call(A,I),I.defaultPrevented||(O=(D=m.listHandlers).onKeyDown)==null||O.call(D,I)},[p.listHandlers,d.listProps,c.listHandlers,m.listHandlers]),g=()=>{var I;return u===void 0||u===-1||(I=a.indexPositions[u])==null?void 0:I.id};i.current=c.selected;let y={"aria-activedescendant":g(),onBlur:d.listProps.onBlur,onFocus:d.listProps.onFocus,onKeyDown:h,onMouseDownCapture:d.listProps.onMouseDownCapture,onMouseLeave:d.listProps.onMouseLeave,onMouseMove:d.listProps.onMouseMove},E={onClick:f};return{focusVisible:d.focusVisible,highlightedIdx:u,hiliteItemAtIndex:d.hiliteItemAtIndex,listProps:y,listItemHandlers:E,selected:c.selected,visibleData:a.data}};import{jsx as Ye,jsxs as so}from"react/jsx-runtime";import{createElement as Lm}from"react";var Je="vuuTree",oo=r=>r.expanded===!0,Na=({children:r,idx:e,...t})=>Ye("li",{...t,children:r}),Oa=Em(function({allowDragDrop:e,className:t,defaultSelected:n,groupSelection:o="none",id:s,onHighlight:i,onSelectionChange:a,revealSelected:l,selected:u,selection:d="single",source:p,...c},m){var P;let f=wm(s),h=Dm(null),[,g,y]=ua(p,f,{revealSelected:l?(P=u!=null?u:n)!=null?P:!1:void 0}),E=(R,M)=>{if(a){let V=M.map(C=>y(C)).filter(C=>C!==void 0);a(V)}},{focusVisible:I,highlightedIdx:b,hiliteItemAtIndex:v,listProps:S,listItemHandlers:T,selected:A,visibleData:w}=Ha({defaultSelected:n,groupSelection:o,onChange:E,onHighlight:i,selected:u,selection:d,sourceWithIds:g});ha(h,b);let O={...{onMouseEnter:R=>{let M=R.target,V=aa(M);v(V)}},...T,role:"treeitem"},x=pa(o);function L(R,M,V){R.push(so(Na,{...O,...Mm(M,V,b,A,I),children:[M.icon?Ye("span",{className:`${Je}Node-icon`,"data-icon":M.icon}):null,Ye("span",{children:M.label})]})),V.value+=1}function N(R,M,V,C,F){let{value:H}=V;V.value+=1,R.push(Lm(Na,{...T,"aria-expanded":M.expanded,"aria-level":M.level,"aria-selected":A.includes(C)||void 0,className:io(`${Je}Node`,{focusVisible:I===H,[`${Je}Node-toggle`]:!x}),"data-idx":H,"data-highlighted":H===b||void 0,"data-selectable":!0,id:C,key:`header-${H}`},x?so("div",{className:`${Je}Node-label`,children:[Ye("span",{className:`${Je}Node-toggle`}),F]}):so("div",{className:`${Je}Node-label`,children:[M.icon?Ye("span",{className:`${Je}Node-icon`,"data-icon":M.icon}):null,Ye("span",{children:F})]}),Ye("ul",{role:"group",children:oo(M)?k(M.childNodes,V):""})))}function k(R,M={value:0}){if((R==null?void 0:R.length)>0){let V=[];for(let C of R)C.childNodes?N(V,C,M,C.id,C.label):L(V,C,M);return V}}return Ye("ul",{...c,...S,className:io(Je,t),id:`Tree-${f}`,ref:Cm(h,m),role:"tree",tabIndex:0,children:k(w)})}),Mm=(r,e,t,n,o,s)=>({id:r.id,key:r.id,"aria-level":r.level,"aria-selected":n.includes(r.id)||void 0,"data-idx":e.value,"data-highlighted":e.value===t||void 0,className:io("vuuTreeNode",s,{focusVisible:o===e.value})});Oa.displayName="Tree";var Pm=Oa;import{isValidNumber as km}from"@vuu-ui/vuu-utils";import{Input as Rm}from"@salt-ds/core";import Hm from"classnames";import{forwardRef as Nm,useCallback as ao}from"react";import{Tooltip as Om,useTooltip as Am}from"@vuu-ui/vuu-popups";import{useId as Fm}from"@vuu-ui/vuu-layout";import{Fragment as Bm,jsx as uo,jsxs as $m}from"react/jsx-runtime";var lo="vuuInput",Vm={autoComplete:"off"},Mn=Nm(function({className:e,errorMessage:t,id:n,onCommit:o,onKeyDown:s,type:i,...a},l){let u=Fm(n),{anchorProps:d,tooltipProps:p}=Am({id:u,tooltipContent:t}),c=ao((g,y)=>{if(i==="number"){let E=parseFloat(y);if(km(E))o(g,E);else throw Error("Invalid value")}else i==="boolean"?o(g,!!y):o(g,y)},[o,i]),m=ao(g=>{if(g.key==="Enter"){g.preventDefault(),g.stopPropagation();let{value:y}=g.target;c(g,y)}s==null||s(g)},[c,s]),f=ao(g=>{let{value:y}=g.target;c(g,y)},[c]),h=t?uo("span",{...d,className:`${lo}-errorIcon`,"data-icon":"error"}):void 0;return $m(Bm,{children:[uo(Rm,{...a,endAdornment:h,id:u,inputProps:{...Vm,...a.inputProps},className:Hm(lo,e,{[`${lo}-errror`]:t}),onBlur:f,ref:l,onKeyDown:m}),p?uo(Om,{...p,status:"error"}):null]})});export{Lt as ArrowDown,jo as ArrowLeft,Xo as ArrowRight,Pt as ArrowUp,n1 as BWD,ib as CHECKBOX,vd as Checkbox,lr as CheckboxIcon,yo as CollectionContext,Qt as CollectionProvider,nd as ComboBox,Uv as CycleStateButton,m1 as DragDropProvider,FS as Dropdown,ct as DropdownBase,Qo as DropdownButton,di as EditableLabel,rr as End,nn as Enter,Mg as Escape,HI as ExpandoInput,r1 as FWD,lb as GROUP_SELECTION_CASCADE,au as GROUP_SELECTION_NONE,ab as GROUP_SELECTION_SINGLE,Oo as HeightOnly,ms as Highlighter,on as Home,E0 as InstrumentPicker,Wp as InstrumentSearch,un as LIST_FOCUS_VISIBLE,Ot as List,dr as ListItem,vo as ListItemGroup,Io as ListItemHeader,cr as ListItemProxy,Cs as NOT_HIDDEN,br as NOT_OVERFLOWED,nr as PageDown,sn as PageUp,of as PriceTicker,Cd as RadioButton,ei as RadioIcon,Zo as Space,yp as Tab,xp as Tabstrip,Pm as Tree,Na as TreeNode,zy as VirtualizedList,Mn as VuuInput,oI as WarnCommit,Dh as WidthHeight,No as WidthOnly,Ph as allowMultipleSelection,Zv as buildValidationChecker,Mo as childIsGroup,Yr as childItems,ws as cloneElement,Og as closestListItemId,rs as closestListItemIndex,Ms as constrainRect,Eo as countChildItems,Lh as deselectionIsAllowed,Ce as dimensions,R1 as dropTargetsDebugString,Xt as escapeRegExp,Zt as forwardCallbackProps,ja as getChildLabel,Za as getChildNodes,Po as getDefaultFilter,tn as getDefaultFilterRegex,Bo as getFirstSelectedItem,mt as getIndexOfDraggedItem,Wi as getIndexOfEditedItem,Wn as getIndexOfSelectedTab,Es as getItemById,nt as getNextDropTarget,Ps as getScrollableContainer,ub as groupSelectionEnabled,Ue as hasSelection,or as isCharacterKey,Ls as isContainerScrollable,Co as isDisabled,oo as isExpanded,wo as isFocusable,To as isGroupNode,qr as isHeader,ut as isMultiSelection,Jo as isNavigationKey,en as isParentPath,qt as isSelected,Fo as isSingleSelection,Ie as itemToString,Ng as listItemElement,Ql as listItemId,Wl as listItemIndex,ft as measureDropTargets,Fu as measureElementSizeAndPosition,hn as mutateDropTargetsSwitchDropTargetPosition,Ds as removeDraggedItem,jt as replaceCollectionItem,Vo as selectionIsDisallowed,Zr as sourceItemHasProp,Jr as sourceItems,es as useCollapsibleGroups,So as useCollection,je as useCollectionItems,Jt as useControlled,yr as useDragDropNext,Ss as useDragDropProvider,zo as useDropdownBase,sI as useEditableText,sr as useImperativeScrollingAPI,ua as useItemsWithIds,ss as useKeyboardNavigation,Xe as useList,ze as useResizeObserver,is as useSelection,Ah as useStateRef,ls as useTypeahead,fs as useViewportTracking};
|
|
8
|
+
`);d===null?console.log("[useViewportTracking], is this virtualised ? we're going to have to know rowHeight"):a(d)}},[e,r,a]),ma(()=>{},[t]);let u=eo(({height:d,scrollHeight:p})=>{s.current=d,i.current=p},[]);return ze(r,am,u,!0),o};import{useCallback as Ra,useRef as Im}from"react";import{useCallback as _t,useMemo as Ca,useRef as wa}from"react";var ga=({id:r})=>{let e=r.lastIndexOf("-");if(e!==-1){let n=r.slice(e+1).split(".");return n.length===1?null:(n.pop(),`${r.slice(0,e)}-${n.join(".")}`)}else if((e=r.lastIndexOf("/"))!==-1)return r.slice(0,e)},ba=r=>r.childNodes!==void 0;var to=r=>r.header===!0,lm=new Set([".","/"]),xa=(r,e)=>e.startsWith(r.id)?lm.has(e.charAt(r.id.length)):!1,lt=(r,e)=>{for(let t of r){if(t.id===e)return t;if(xa(t,e))return lt(t.childNodes,e)}},zr=(r,e)=>{let t=typeof e=="string"?e:e.id;for(let n=0;n<r.length;n++)if(r[n].id===t)return n},Ur=(r,e,t)=>{let n;return r.map(s=>s.id===e?{...s,...t}:xa(s,e)?(n=Ur(s.childNodes,e,t),{...s,childNodes:n}):s)};import{useControlled as hm}from"@salt-ds/core";function um(r,...e){let t=new Set(r);for(let n of e)for(let o of n)t.add(o);return t}var ro="ArrowUp",ya="ArrowDown",Ct="ArrowLeft";var Sa="ArrowRight",Gr="Enter";var cm="Delete",dm=new Set([Gr,cm]),pm=new Set(["Tab"]),fm=new Set(["ArrowRight","ArrowLeft"]),va=new Set(["Home","End","ArrowDown","ArrowUp"]),Ia=new Set(["Home","End","ArrowRight","ArrowLeft"]),mm=new Set(["F1","F2","F3","F4","F5","F6","F7","F8","F9","F10","F11","F12"]),dL=um(dm,Ia,va,fm,mm,pm);var Ta=({key:r},e="vertical")=>(e==="vertical"?va:Ia).has(r);function Ea(r,e,t){return e===ro||e===Ct?t>0?t-1:t:t===null?0:t===r-1?t:t+1}var gm=r=>!r.header&&!r.childNodes,bm=r=>gm(r)||r.expanded!==void 0,Da=({defaultHighlightedIdx:r=-1,highlightedIdx:e,treeNodes:t,onHighlight:n,onKeyboardNavigation:o,selected:s=[]})=>{let{bwd:i,fwd:a}=Ca(()=>({bwd:ro,fwd:ya}),[]),[l,u,d]=hm({controlled:e,default:r,name:"highlightedIdx"}),p=_t(b=>{n==null||n(b),u(b)},[n,u]),c=_t((b=a,v=b===a?-1:t.length)=>{let S=Ea(t.length,b,v);for(;S!==-1&&(b===a&&S<t.length||b===i&&S>0)&&!bm(t[S]);)S=Ea(t.length,b,S);return S},[i,a,t]),m=wa(!0),f=wa(!1),h=b=>f.current=b,g=_t(()=>{if(f.current)f.current=!1;else if(s.length>0){let b=lt(t,s[0]);if(b){let v=zr(t,b);p(v)}}else p(c())},[t,c,s,p]),y=_t(b=>{let v=c(b.key,l);v!==l&&(p(v),o==null||o(b,v))},[l,c,o,p]),E=_t(b=>{t.length>0&&Ta(b,"vertical")&&(b.preventDefault(),b.stopPropagation(),m.current=!0,y(b))},[t,y]),I=Ca(()=>({onBlur:()=>{p(-1)},onFocus:g,onKeyDown:E,onMouseDownCapture:()=>{m.current=!1,h(!0)},onMouseMove:()=>{m.current&&(m.current=!1)},onMouseLeave:()=>{m.current=!0,h(!1),p(-1)}}),[g,E,p]);return{focusVisible:m.current?l:-1,controlledHighlighting:d,highlightedIdx:l,hiliteItemAtIndex:p,keyBoardNavigation:m,listProps:I,setIgnoreFocus:h}};import{useRef as no,useState as xm}from"react";var Wr=(r,e=[],t={value:0})=>{let n=!1;for(let o of r)n&&!to(o)||(e[t.value]=o,t.value+=1,n=!1,to(o)&&o.expanded===!1?n=!0:ba(o)&&oo(o)&&Wr(o.childNodes,e,t));return e},Ma=r=>{let e=no(r),t=no(r),n=no(Wr(r)),[,o]=xm({});r!==e.current&&(e.current=r,t.current=r,n.current=Wr(r));let s=i=>{t.current=i,n.current=Wr(i),o({})};return{data:t.current,indexPositions:n.current,setData:s}};import{useCallback as Kt,useRef as Pa}from"react";var ym={},Sm=r=>r&&r.hasAttribute("aria-expanded"),La=({collapsibleHeaders:r,highlightedIdx:e,treeNodes:t,setVisibleData:n,source:o})=>{let s=Pa(o),i=Pa(s.current),a=Kt(f=>{n(i.current=f)},[n]),l=Kt((f,{id:h})=>Ur(f,h,{expanded:!0}),[]),u=Kt((f,{id:h})=>Ur(f,h,{expanded:!1}),[]),d=Kt(f=>{if(f.key===Sa||f.key===Gr){let h=t[e];h&&h.expanded===!1&&(f.preventDefault(),a(l(i.current,h)))}if(f.key===Ct||f.key===Gr){let h=t[e];h&&h.expanded&&(f.preventDefault(),a(u(i.current,h)))}},[u,l,e,t,a]),p=r?{onKeyDown:d}:ym,m={onClick:Kt(f=>{let h=Jn(f.target);if(Sm(h)){f.stopPropagation(),f.preventDefault();let g=lt(o,h.id);(g==null?void 0:g.expanded)===!1?a(l(o,g)):(g==null?void 0:g.expanded)===!0&&a(u(o,g))}},[u,l,a,o])};return{listHandlers:p,listItemHandlers:m}};import{useCallback as vm}from"react";var ka=({highlightedIdx:r,hiliteItemAtIndex:e,indexPositions:t,source:n})=>({listHandlers:{onKeyDown:vm(i=>{if(i.key===Ct){let a=t[r],l=ga(a);if(l){i.preventDefault();let u=lt(n,l);if(u){let d=zr(t,u);d!==void 0&&e(d)}}}},[r,e,t,n])}});var Tm=[],Ha=({defaultSelected:r,sourceWithIds:e,onChange:t,onHighlight:n,selected:o,selection:s})=>{let i=Im(Tm),a=Ma(e),l=(I,b)=>{var v,S;(S=(v=c.listHandlers).onKeyboardNavigation)==null||S.call(v,I,b)},{highlightedIdx:u,...d}=Da({treeNodes:a.indexPositions,onHighlight:n,onKeyboardNavigation:l,selected:i.current}),p=La({collapsibleHeaders:!0,highlightedIdx:u,treeNodes:a.indexPositions,setVisibleData:a.setData,source:a.data}),c=fa({defaultSelected:r,highlightedIdx:u,treeNodes:a.indexPositions,onChange:t,selected:o,selection:s}),m=ka({source:a.data,highlightedIdx:u,hiliteItemAtIndex:d.hiliteItemAtIndex,indexPositions:a.indexPositions}),f=Ra(I=>{var b,v,S;(b=p.listItemHandlers)==null||b.onClick(I),I.defaultPrevented||(S=(v=c.listItemHandlers)==null?void 0:v.onClick)==null||S.call(v,I)},[p,c]),h=Ra(I=>{var b,v,S,T,A,w,D,O;(v=(b=d.listProps).onKeyDown)==null||v.call(b,I),I.defaultPrevented||(T=(S=c.listHandlers).onKeyDown)==null||T.call(S,I),I.defaultPrevented||(w=(A=p.listHandlers).onKeyDown)==null||w.call(A,I),I.defaultPrevented||(O=(D=m.listHandlers).onKeyDown)==null||O.call(D,I)},[p.listHandlers,d.listProps,c.listHandlers,m.listHandlers]),g=()=>{var I;return u===void 0||u===-1||(I=a.indexPositions[u])==null?void 0:I.id};i.current=c.selected;let y={"aria-activedescendant":g(),onBlur:d.listProps.onBlur,onFocus:d.listProps.onFocus,onKeyDown:h,onMouseDownCapture:d.listProps.onMouseDownCapture,onMouseLeave:d.listProps.onMouseLeave,onMouseMove:d.listProps.onMouseMove},E={onClick:f};return{focusVisible:d.focusVisible,highlightedIdx:u,hiliteItemAtIndex:d.hiliteItemAtIndex,listProps:y,listItemHandlers:E,selected:c.selected,visibleData:a.data}};import{jsx as Ye,jsxs as so}from"react/jsx-runtime";import{createElement as Lm}from"react";var Je="vuuTree",oo=r=>r.expanded===!0,Na=({children:r,idx:e,...t})=>Ye("li",{...t,children:r}),Oa=Em(function({allowDragDrop:e,className:t,defaultSelected:n,groupSelection:o="none",id:s,onHighlight:i,onSelectionChange:a,revealSelected:l,selected:u,selection:d="single",source:p,...c},m){var P;let f=wm(s),h=Dm(null),[,g,y]=ua(p,f,{revealSelected:l?(P=u!=null?u:n)!=null?P:!1:void 0}),E=(R,M)=>{if(a){let V=M.map(C=>y(C)).filter(C=>C!==void 0);a(V)}},{focusVisible:I,highlightedIdx:b,hiliteItemAtIndex:v,listProps:S,listItemHandlers:T,selected:A,visibleData:w}=Ha({defaultSelected:n,groupSelection:o,onChange:E,onHighlight:i,selected:u,selection:d,sourceWithIds:g});ha(h,b);let O={...{onMouseEnter:R=>{let M=R.target,V=aa(M);v(V)}},...T,role:"treeitem"},x=pa(o);function L(R,M,V){R.push(so(Na,{...O,...Mm(M,V,b,A,I),children:[M.icon?Ye("span",{className:`${Je}Node-icon`,"data-icon":M.icon}):null,Ye("span",{children:M.label})]})),V.value+=1}function N(R,M,V,C,F){let{value:H}=V;V.value+=1,R.push(Lm(Na,{...T,"aria-expanded":M.expanded,"aria-level":M.level,"aria-selected":A.includes(C)||void 0,className:io(`${Je}Node`,{focusVisible:I===H,[`${Je}Node-toggle`]:!x}),"data-idx":H,"data-highlighted":H===b||void 0,"data-selectable":!0,id:C,key:`header-${H}`},x?so("div",{className:`${Je}Node-label`,children:[Ye("span",{className:`${Je}Node-toggle`}),F]}):so("div",{className:`${Je}Node-label`,children:[M.icon?Ye("span",{className:`${Je}Node-icon`,"data-icon":M.icon}):null,Ye("span",{children:F})]}),Ye("ul",{role:"group",children:oo(M)?k(M.childNodes,V):""})))}function k(R,M={value:0}){if((R==null?void 0:R.length)>0){let V=[];for(let C of R)C.childNodes?N(V,C,M,C.id,C.label):L(V,C,M);return V}}return Ye("ul",{...c,...S,className:io(Je,t),id:`Tree-${f}`,ref:Cm(h,m),role:"tree",tabIndex:0,children:k(w)})}),Mm=(r,e,t,n,o,s)=>({id:r.id,key:r.id,"aria-level":r.level,"aria-selected":n.includes(r.id)||void 0,"data-idx":e.value,"data-highlighted":e.value===t||void 0,className:io("vuuTreeNode",s,{focusVisible:o===e.value})});Oa.displayName="Tree";var Pm=Oa;import{isValidNumber as km}from"@vuu-ui/vuu-utils";import{Input as Rm}from"@salt-ds/core";import Hm from"classnames";import{forwardRef as Nm,useCallback as ao}from"react";import{Tooltip as Om,useTooltip as Am}from"@vuu-ui/vuu-popups";import{useId as Fm}from"@vuu-ui/vuu-layout";import{Fragment as Bm,jsx as uo,jsxs as $m}from"react/jsx-runtime";var lo="vuuInput",Vm={autoComplete:"off"},Mn=Nm(function({className:e,errorMessage:t,id:n,onCommit:o,onKeyDown:s,type:i,...a},l){let u=Fm(n),{anchorProps:d,tooltipProps:p}=Am({id:u,tooltipContent:t}),c=ao((g,y)=>{if(i==="number"){let E=parseFloat(y);if(km(E))o(g,E);else throw Error("Invalid value")}else i==="boolean"?o(g,!!y):o(g,y)},[o,i]),m=ao(g=>{if(g.key==="Enter"){g.preventDefault(),g.stopPropagation();let{value:y}=g.target;c(g,y)}s==null||s(g)},[c,s]),f=ao(g=>{let{value:y}=g.target;c(g,y)},[c]),h=t?uo("span",{...d,className:`${lo}-errorIcon`,"data-icon":"error"}):void 0;return $m(Bm,{children:[uo(Rm,{...a,endAdornment:h,id:u,inputProps:{...Vm,...a.inputProps},className:Hm(lo,e,{[`${lo}-errror`]:t}),onBlur:f,ref:l,onKeyDown:m}),p?uo(Om,{...p,status:"error"}):null]})});export{Lt as ArrowDown,jo as ArrowLeft,Xo as ArrowRight,Pt as ArrowUp,o1 as BWD,ib as CHECKBOX,vd as Checkbox,lr as CheckboxIcon,yo as CollectionContext,Qt as CollectionProvider,nd as ComboBox,Gv as CycleStateButton,h1 as DragDropProvider,VS as Dropdown,ct as DropdownBase,Qo as DropdownButton,di as EditableLabel,rr as End,nn as Enter,Mg as Escape,NI as ExpandoInput,n1 as FWD,lb as GROUP_SELECTION_CASCADE,au as GROUP_SELECTION_NONE,ab as GROUP_SELECTION_SINGLE,Oo as HeightOnly,ms as Highlighter,on as Home,D0 as InstrumentPicker,Wp as InstrumentSearch,un as LIST_FOCUS_VISIBLE,Ot as List,dr as ListItem,vo as ListItemGroup,Io as ListItemHeader,cr as ListItemProxy,Cs as NOT_HIDDEN,br as NOT_OVERFLOWED,nr as PageDown,sn as PageUp,of as PriceTicker,Cd as RadioButton,ei as RadioIcon,Zo as Space,yp as Tab,xp as Tabstrip,Pm as Tree,Na as TreeNode,Uy as VirtualizedList,Mn as VuuInput,sI as WarnCommit,Dh as WidthHeight,No as WidthOnly,Ph as allowMultipleSelection,qv as buildValidationChecker,Mo as childIsGroup,Yr as childItems,ws as cloneElement,Og as closestListItemId,rs as closestListItemIndex,Ms as constrainRect,Eo as countChildItems,Lh as deselectionIsAllowed,Ce as dimensions,H1 as dropTargetsDebugString,Xt as escapeRegExp,Zt as forwardCallbackProps,ja as getChildLabel,Za as getChildNodes,Po as getDefaultFilter,tn as getDefaultFilterRegex,Bo as getFirstSelectedItem,mt as getIndexOfDraggedItem,Wi as getIndexOfEditedItem,Wn as getIndexOfSelectedTab,Es as getItemById,nt as getNextDropTarget,Ps as getScrollableContainer,ub as groupSelectionEnabled,Ue as hasSelection,or as isCharacterKey,Ls as isContainerScrollable,Co as isDisabled,oo as isExpanded,wo as isFocusable,To as isGroupNode,qr as isHeader,ut as isMultiSelection,Jo as isNavigationKey,en as isParentPath,qt as isSelected,Fo as isSingleSelection,Ie as itemToString,Ng as listItemElement,Ql as listItemId,Wl as listItemIndex,ft as measureDropTargets,Fu as measureElementSizeAndPosition,hn as mutateDropTargetsSwitchDropTargetPosition,Ds as removeDraggedItem,jt as replaceCollectionItem,Vo as selectionIsDisallowed,Zr as sourceItemHasProp,Jr as sourceItems,es as useCollapsibleGroups,So as useCollection,je as useCollectionItems,Jt as useControlled,yr as useDragDropNext,Ss as useDragDropProvider,zo as useDropdownBase,iI as useEditableText,sr as useImperativeScrollingAPI,ua as useItemsWithIds,ss as useKeyboardNavigation,Xe as useList,ze as useResizeObserver,is as useSelection,Ah as useStateRef,ls as useTypeahead,fs as useViewportTracking};
|
|
9
9
|
//# sourceMappingURL=index.js.map
|