caplink-saas-ui-shared-component-library 0.3.8 → 0.3.9

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/dist/index.umd.js CHANGED
@@ -161,5 +161,5 @@ Linha N° ${N+1} até N° ${S+1}`:`Você irá excluir a linha N° ${N+1}, deseja
161
161
  prefix: `+o+`
162
162
  allowNegative: `+a+`
163
163
  `),a=!1),Object.assign(Object.assign({},e),{allowNegative:a})}function Sf(e){e=Ef(e),e.decimalSeparator,e.allowedDecimalSeparators,e.thousandsGroupStyle;var t=e.suffix,n=e.allowNegative,r=e.allowLeadingZeros,o=e.onKeyDown;o===void 0&&(o=at);var a=e.onBlur;a===void 0&&(a=at);var s=e.thousandSeparator,c=e.decimalScale,l=e.fixedDecimalScale,d=e.prefix;d===void 0&&(d="");var f=e.defaultValue,u=e.value,m=e.valueIsNumericString,h=e.onValueChange,p=za(e,["decimalSeparator","allowedDecimalSeparators","thousandsGroupStyle","suffix","allowNegative","allowLeadingZeros","onKeyDown","onBlur","thousandSeparator","decimalScale","fixedDecimalScale","prefix","defaultValue","value","valueIsNumericString","onValueChange"]),v=Pn(e),y=v.decimalSeparator,g=v.allowedDecimalSeparators,w=function(I){return Za(I,e)},$=function(I,O){return $f(I,O,e)},C=Mt(u)?f:u,E=m??yf(C,d,t);Mt(u)?Mt(f)||(E=E||typeof f=="number"):E=E||typeof u=="number";var M=function(I){return Wa(I)?I:(typeof I=="number"&&(I=Ka(I)),E&&typeof c=="number"?Ga(I,c,!!l):I)},T=qa(M(u),M(f),!!E,w,$,h),_=T[0],B=_.numAsString,K=_.formattedValue,A=T[1],P=function(I){var O=I.target,N=I.key,S=O.selectionStart,F=O.selectionEnd,W=O.value;if(W===void 0&&(W=""),S!==F){o(I);return}N==="Backspace"&&W[0]==="-"&&S===d.length+1&&n&&ft(O,1),c&&l&&(N==="Backspace"&&W[S-1]===y?(ft(O,S-1),I.preventDefault()):N==="Delete"&&W[S]===y&&I.preventDefault()),g?.includes(N)&&W[S]===y&&ft(O,S+1);var X=s===!0?",":s;N==="Backspace"&&W[S-1]===X&&ft(O,S-1),N==="Delete"&&W[S]===X&&ft(O,S+1),o(I)},G=function(I){var O=B;if(O.match(/\d/g)||(O=""),r||(O=lf(O)),l&&c&&(O=Ga(O,c,l)),O!==B){var N=Za(O,e);A({formattedValue:N,value:O,floatValue:parseFloat(O)},{event:I,source:Gt.event})}a(I)},z=function(I){return I===y?!0:Yt(I)},R=function(I){var O=I.currentValue,N=I.lastValue,S=I.formattedValue,F=I.currentValueIndex,W=I.formattedValueIndex,X=O[F],ae=S[W],be=Ya(N,O),ge=be.to;return F>=ge.start&&F<ge.end&&g&&g.includes(X)&&ae===y?!0:X===ae};return Object.assign(Object.assign({},p),{value:K,valueIsNumericString:!1,isValidInputCharacter:z,isCharacterSame:R,onValueChange:A,format:w,removeFormatting:$,getCaretBoundary:function(I){return Cf(I,e)},onKeyDown:P,onBlur:G})}function _f(e){var t=Sf(e);return i.createElement(bf,Object.assign({},t))}function kf(e,t){const{className:n,dataEditorType:r,onFocus:o,onBlur:a,onChange:s,onClick:c,onPaste:l,settings:d,testid:f,value:u,disabled:m,dataCypress:h,tabIndex:p,...v}=e,y=".",g=",",w=Pf({dataEditorType:r,decimalScale:d?.numeric?.decimalScale}),$=d?.numeric?.allowNegative,C=d?.numeric?.min,E=d?.numeric?.max,M=r==="Currency"?"R$ ":"",T=r==="Percentage"?"%":"",[_,B]=i.useState(u),K=i.useCallback(({value:A})=>{const P=Ln({value:A,min:C,max:E});s?.(P),B(P)},[s,C,E]);return i.useEffect(()=>{const A=Ln({value:u,min:C,max:E});B(A)},[u,C,E]),x.jsx(_f,{...v,getInputRef:t,tabIndex:p,value:_,onPaste:l,prefix:M,suffix:T,fixedDecimalScale:!0,onBlur:a,"data-testid":f,valueIsNumericString:!0,onFocus:o,onClick:c,decimalScale:w,onValueChange:K,allowNegative:$,decimalSeparator:g,thousandSeparator:y,className:Q("h-full w-full rounded-none bg-transparent pl-1 text-xs outline-none",n),disabled:m,"data-cypress":h,autoFocus:!0})}const Tf=2;function Pf(e){const{dataEditorType:t,decimalScale:n}=e;let r=n;return t==="Percentage"&&(n?r=n>2?n-Tf:0:r=0),n||(t==="Decimal"&&(r=2),t==="Float"&&(r=2),t==="Integer"&&(r=0),t==="Currency"&&(r=2)),r}const Ja=i.forwardRef(kf);function Nf(e){const{mode:t,value:n,onBlur:r,onChange:o,onPaste:a,setMode:s,column:c,coordinates:l}=e,d=i.useRef(null),f=i.useCallback(m=>{m.preventDefault(),a?.()},[a]),u=i.useCallback(()=>{r?.(),s?.("view")},[r,s]);return Sr(d),x.jsx(Ja,{ref:d,dataEditorType:c.dataEditorType,value:n,onPaste:f,onBlur:u,onChange:m=>o?.({data:m}),settings:c.settings,dataCypress:`table-cell-numeric-${c.id}-${l.row}`,"aria-readonly":t==="readonly"})}function Of(e){const{mode:t,value:n,column:r,coordinates:o}=e;return x.jsx(Ja,{dataEditorType:r.dataEditorType,value:n,settings:r.settings,disabled:!0,className:"pointer-events-none",dataCypress:`table-cell-numeric-${r.id}-${o.row}`,"aria-readonly":t==="readonly"})}function If(e){const{mode:t,value:n,onChange:r,onPaste:o,items:a,setMode:s,coordinates:c,column:l}=e,[d,f]=co(!0),u=i.useCallback(p=>{p.preventDefault(),o?.()},[o]),m=i.useCallback(()=>{d||(s?.("view"),f(!1))},[s,f,d]),h=i.useCallback(p=>{r?.({data:p}),m()},[r,m]);return x.jsxs(La,{value:n,open:d,onOpenChange:f,onValueChange:h,children:[x.jsx(Cr,{onBlur:m,onPaste:u,className:Q("h-full w-full rounded-none border-none pl-1 text-xs outline-none focus:ring-0"),"data-cypress":`table-cell-select-${l.id}-${c.row}`,"aria-readonly":t==="readonly",children:x.jsx(Fa,{placeholder:"Selecionar"})}),x.jsx(Er,{onBlur:m,children:a.map(({value:p,text:v})=>x.jsx(Tn,{"data-cypress":`table-cell-select-${l.id}-${c.row}-${p}`,className:"min-h-[24px] text-xs",value:p,children:v},p))})]})}function Mf(e){const{mode:t,value:n,items:r,coordinates:o,column:a}=e,s=i.useMemo(()=>r.find(l=>l.value===n),[r,n]),c=i.useMemo(()=>s?s.text:"Selecionar",[s]);return x.jsxs("div",{className:"flex h-full w-full items-center justify-between pr-px pl-1","data-cypress":`table-cell-select-${a.id}-${o.row}`,"aria-readonly":t==="readonly",children:[x.jsx("p",{className:"line-clamp-1 text-xs",children:c}),x.jsx(Wn,{className:"h-4 w-4 opacity-50"})]})}function Af(e){e.selectionStart=e.selectionEnd=e.value.length}const Df="text/plain";function jf(e){return window.clipboardData?.getData?window.clipboardData.getData("Text"):e.clipboardData?.getData?e.clipboardData.getData(Df):""}function Lf(e){return[" ",`
164
- `,"\r"].every(t=>!e.includes(t))}function Qa(e,t){return no(e)>t-4}const ei=200;function Ff(e){const{mode:t,width:n,value:r,onBlur:o,onChange:a,onPaste:s,setMode:c,column:l,selected:d,coordinates:f}=e,u=r,m=i.useRef(null),h=i.useRef(null),[p,v]=i.useState(0),y=i.useMemo(()=>Qa(u,n),[u,n]),g=i.useCallback(()=>{const E=h.current;if(!E)return;const M=E.scrollHeight;E.style.height=`${M}px`,v(M)},[]),w=i.useCallback(E=>{const M=jf(E);Lf(M)||(E.preventDefault(),s?.()),g()},[s,g]),$=i.useCallback(()=>{o?.(),c?.("view")},[o,c]),C=i.useCallback(E=>{a?.({data:E.target.value}),g()},[g,a]);return i.useEffect(()=>{g()},[g]),Sr(m),Sr(h),y?x.jsx("div",{style:{height:p||"fit-content"},className:Q("-left-0.5 -top-0.5 absolute z-40 h-fit w-fit border bg-white shadow-lg outline outline-2 outline-blue-500",d?"bg-blue-50":"bg-white"),children:x.jsx("div",{style:{height:p-1},className:"h-full w-full outline outline-[3px] outline-sky-200 outline-offset-2",children:x.jsx("textarea",{ref:h,onBlur:$,onPaste:w,value:u,onChange:C,className:Q("h-fit resize-none break-all rounded-none bg-transparent py-1.5 pr-3 pl-1 text-xs outline-none"),onFocus:E=>Af(E.target),maxLength:ei,style:{width:n},"data-cypress":`table-cell-string-${l.id}-${f.row}`,"aria-readonly":t==="readonly",autoFocus:!0})})}):x.jsx("input",{ref:m,onBlur:o,onPaste:w,value:u,maxLength:ei,onChange:C,className:Q("h-full w-full bg-transparent pl-1 text-xs outline-none"),"data-cypress":`table-cell-string-${l.id}-${f.row}`,"aria-readonly":t==="readonly",autoFocus:!0})}function Vf(e){const{mode:t,value:n,column:r,width:o,selected:a,coordinates:s}=e,c=n;return i.useMemo(()=>Qa(c,o),[c,o])?x.jsx(pn,{delayDuration:0,children:x.jsxs(mn,{children:[x.jsx(hn,{className:"w-full",children:x.jsx("div",{className:"flex h-full w-full items-center overflow-hidden","aria-readonly":t==="readonly","data-cypress":`table-cell-string-${r.id}-${s.row}`,children:x.jsx("p",{className:"line-clamp-1 break-all pl-1 text-left text-xs",children:c})})}),x.jsx(Kt,{align:"start",side:"bottom",alignOffset:-2,sideOffset:-Bt,className:Q("h-fit w-full break-all rounded-none border bg-white pl-1 text-black shadow-lg","data-[state=closed]:transform-none data-[side=bottom]:animate-none data-[state=closed]:animate-none data-[state=closed]:transition-none",a?"bg-blue-50":"bg-white"),style:{width:o},children:x.jsx("p",{"data-cypress":`table-cell-string-tooltip-${r.id}-${s.row}`,children:c})})]})}):x.jsx("div",{className:"flex h-full w-full items-center overflow-hidden","data-cypress":`table-cell-string-${r.id}-${s.row}`,"aria-readonly":t==="readonly",children:x.jsx("p",{className:"line-clamp-1 break-all pl-1 text-left text-xs",title:c,children:c})})}const Ue={Date:ef,Text:Ff,Boolean:Ju,Numeric:Nf,Select:If},Ke={Date:tf,Text:Vf,Boolean:Qu,Numeric:Of,Select:Mf},Bf=["Boolean","Select"];function zf(e){const{value:t,width:n,coordinates:r}=e,{columns:o,isCellSelected:a,onChange:s,onPaste:c,onSelectCell:l}=je(),{dataEditorType:d,state:f,settings:u}=o[r.column],{readonly:m,visible:h}=f,[p,v]=i.useState(m?"readonly":"view"),y=i.useRef(null),g=i.useMemo(()=>o[r.column],[o,r.column]),w=i.useMemo(()=>a(r),[r,a]),$=i.useMemo(()=>u?.select?.items||[],[u?.select?.items]),C=i.useMemo(()=>({dataEditor:{coordinates:r,value:t,column:g,setMode:v,selected:w,mode:p,width:n,onPaste:()=>c(r),onChange:({data:K})=>s({data:K,point:r})},dataViewer:{coordinates:r,value:t,column:g,width:n,selected:w,mode:p}}),[r,n,p,t,g,w,c,s,r]),E=i.useMemo(()=>({Date:x.jsx(Ue.Date,{...C.dataEditor}),String:x.jsx(Ue.Text,{...C.dataEditor}),Currency:x.jsx(Ue.Numeric,{...C.dataEditor}),Decimal:x.jsx(Ue.Numeric,{...C.dataEditor}),Float:x.jsx(Ue.Numeric,{...C.dataEditor}),Integer:x.jsx(Ue.Numeric,{...C.dataEditor}),Percentage:x.jsx(Ue.Numeric,{...C.dataEditor}),Boolean:x.jsx(Ue.Boolean,{...C.dataEditor}),Select:x.jsx(Ue.Select,{...C.dataEditor,items:$})}),[C.dataEditor,$]),M=i.useMemo(()=>({Date:x.jsx(Ke.Date,{...C.dataViewer}),String:x.jsx(Ke.Text,{...C.dataViewer}),Currency:x.jsx(Ke.Numeric,{...C.dataViewer}),Decimal:x.jsx(Ke.Numeric,{...C.dataViewer}),Float:x.jsx(Ke.Numeric,{...C.dataViewer}),Integer:x.jsx(Ke.Numeric,{...C.dataViewer}),Percentage:x.jsx(Ke.Numeric,{...C.dataViewer}),Boolean:x.jsx(Ke.Boolean,{...C.dataViewer}),Select:x.jsx(Ke.Select,{...C.dataViewer,items:$})}),[C.dataViewer,$]),T=i.useMemo(()=>d?E[d]:null,[d,E]),_=i.useMemo(()=>d?M[d]:null,[d,M]),B=i.useCallback(()=>{Bf.includes(d)||v("view")},[d]);return i.useEffect(()=>{const K=A=>{const P=A.code==="Enter";P&&w&&p==="view"&&v("edit"),P&&w&&p==="edit"&&v("view")};return window.addEventListener("keydown",K),()=>window.removeEventListener("keydown",K)},[w,p]),lo(y,B),i.useEffect(()=>{v(m?"readonly":"view")},[m]),h?p==="readonly"?x.jsx("div",{onClick:()=>l(r),className:Q("flex h-7 shrink-0 cursor-default select-none border border-t-transparent border-l-transparent bg-[#F6F6F9]",w&&"bg-[#EAF5FF]"),style:{width:n,height:Bt},children:_}):p==="view"?x.jsx("div",{onClick:()=>l(r),onDoubleClick:()=>v("edit"),className:Q("relative flex h-7 shrink-0 cursor-default select-none border border-t-transparent border-l-transparent",w&&"bg-[#EAF5FF]"),style:{width:n,height:Bt},children:_}):x.jsx("div",{ref:y,"data-testid":"cell__testid",className:"relative h-7 w-32 shrink-0 border border-t-transparent border-l-transparent bg-[#EAF5FF] shadow-lg outline outline-2 outline-blue-500",style:{width:n,height:Bt,top:r.row===0?"4px":"0px"},children:x.jsx("div",{className:"h-full w-full outline outline-[3px] outline-sky-200 outline-offset-2",children:T})}):x.jsx(i.Fragment,{})}function Wf({row:e}){const{onSelectRow:t,pointRange:n,matrix:r}=je(),o=i.useMemo(()=>n&&e>=n.start.row&&e<=n.end.row,[n,e]),a=i.useMemo(()=>!!(n&&js({matrix:r,pointRange:n,row:e})),[r,n,e]);return x.jsx("div",{className:Q("flex h-7 w-12 shrink-0 cursor-default select-none items-center justify-center border-r border-b text-[#8E8EA9] text-xs",o&&"bg-blue-100 font-bold text-blue-700",a&&"bg-[#0085FF] font-bold text-white"),onClick:s=>t(e,s),style:{height:Bt},children:e+1})}function Rf(){const e=i.useId(),{highlightLastRow:t,matrix:n,columns:r}=je();return x.jsx("div",{className:"relative",children:n.map((o,a)=>x.jsxs("div",{className:Q("flex items-center transition-all ease-linear",a===n.length-1&&t&&"bg-blue-50"),children:[x.jsx(Wf,{row:a}),o.map((s,c)=>x.jsx(zf,{value:s,coordinates:{column:c,row:a},width:r[c].state.width},`spreadsheet__cell__key__${e}__${a}__${c}`))]},`spreadsheet__row__key__${e}__${a}}`))})}function Hf({className:e}){const{staticRows:t,emptySize:n,onInsertNewRow:r}=je();return t?null:x.jsx("div",{className:Q("pointer-events-none mt-[calc(28px+36px)] flex h-[calc(100%-28px-28px)] w-full items-center justify-center",n&&"pointer-events-auto bg-white/25 backdrop-blur-sm",e),children:n&&x.jsxs("p",{className:"text-neutral-500",children:[x.jsx("span",{children:"Clique "}),x.jsx("button",{type:"button",onClick:r,className:"font-bold",children:"AQUI"}),x.jsx("span",{children:" para começar a preencher a tabela."})]})})}function ti(e){var t,n,r="";if(typeof e=="string"||typeof e=="number")r+=e;else if(typeof e=="object")if(Array.isArray(e))for(t=0;t<e.length;t++)e[t]&&(n=ti(e[t]))&&(r&&(r+=" "),r+=n);else for(t in e)e[t]&&(r&&(r+=" "),r+=t);return r}function Uf(){for(var e,t,n=0,r="";n<arguments.length;)(e=arguments[n++])&&(t=ti(e))&&(r&&(r+=" "),r+=t);return r}const ni=e=>typeof e=="boolean"?"".concat(e):e===0?"0":e,ri=Uf,Kf=((e,t)=>n=>{var r;if(t?.variants==null)return ri(e,n?.class,n?.className);const{variants:o,defaultVariants:a}=t,s=Object.keys(o).map(d=>{const f=n?.[d],u=a?.[d];if(f===null)return null;const m=ni(f)||ni(u);return o[d][m]}),c=n&&Object.entries(n).reduce((d,f)=>{let[u,m]=f;return m===void 0||(d[u]=m),d},{}),l=t==null||(r=t.compoundVariants)===null||r===void 0?void 0:r.reduce((d,f)=>{let{class:u,className:m,...h}=f;return Object.entries(h).every(p=>{let[v,y]=p;return Array.isArray(y)?y.includes({...a,...c}[v]):{...a,...c}[v]===y})?[...d,u,m]:d},[]);return ri(e,s,l,n?.class,n?.className)})("inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50",{variants:{variant:{default:"bg-primary text-primary-foreground shadow hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90",outline:"border border-input bg-background shadow-sm hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground shadow-sm hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2",sm:"h-8 rounded-md px-3 text-xs",lg:"h-10 rounded-md px-8",icon:"h-9 w-9"}},defaultVariants:{variant:"default",size:"default"}}),Nn=j.forwardRef(({className:e,variant:t,size:n,asChild:r=!1,...o},a)=>{const s=r?ct:"button";return x.jsx(s,{className:Q(Kf({variant:t,size:n,className:e})),ref:a,...o})});Nn.displayName="Button";const Tr="rovingFocusGroup.onEntryFocus",Gf={bubbles:!1,cancelable:!0},Pr="RovingFocusGroup",[Nr,oi,Yf]=lr(Pr),[Xf,ai]=st(Pr,[Yf]),[qf,Zf]=Xf(Pr),Jf=i.forwardRef((e,t)=>i.createElement(Nr.Provider,{scope:e.__scopeRovingFocusGroup},i.createElement(Nr.Slot,{scope:e.__scopeRovingFocusGroup},i.createElement(Qf,L({},e,{ref:t}))))),Qf=i.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,orientation:r,loop:o=!1,dir:a,currentTabStopId:s,defaultCurrentTabStopId:c,onCurrentTabStopIdChange:l,onEntryFocus:d,...f}=e,u=i.useRef(null),m=ve(t,u),h=dr(a),[p=null,v]=Ht({prop:s,defaultProp:c,onChange:l}),[y,g]=i.useState(!1),w=Me(d),$=oi(n),C=i.useRef(!1),[E,M]=i.useState(0);return i.useEffect(()=>{const T=u.current;if(T)return T.addEventListener(Tr,w),()=>T.removeEventListener(Tr,w)},[w]),i.createElement(qf,{scope:n,orientation:r,dir:h,loop:o,currentTabStopId:p,onItemFocus:i.useCallback(T=>v(T),[v]),onItemShiftTab:i.useCallback(()=>g(!0),[]),onFocusableItemAdd:i.useCallback(()=>M(T=>T+1),[]),onFocusableItemRemove:i.useCallback(()=>M(T=>T-1),[])},i.createElement(fe.div,L({tabIndex:y||E===0?-1:0,"data-orientation":r},f,{ref:m,style:{outline:"none",...e.style},onMouseDown:Y(e.onMouseDown,()=>{C.current=!0}),onFocus:Y(e.onFocus,T=>{const _=!C.current;if(T.target===T.currentTarget&&_&&!y){const B=new CustomEvent(Tr,Gf);if(T.currentTarget.dispatchEvent(B),!B.defaultPrevented){const K=$().filter(R=>R.focusable),A=K.find(R=>R.active),P=K.find(R=>R.id===p),z=[A,P,...K].filter(Boolean).map(R=>R.ref.current);ii(z)}}C.current=!1}),onBlur:Y(e.onBlur,()=>g(!1))})))}),ep="RovingFocusGroupItem",tp=i.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,focusable:r=!0,active:o=!1,tabStopId:a,...s}=e,c=wt(),l=a||c,d=Zf(ep,n),f=d.currentTabStopId===l,u=oi(n),{onFocusableItemAdd:m,onFocusableItemRemove:h}=d;return i.useEffect(()=>{if(r)return m(),()=>h()},[r,m,h]),i.createElement(Nr.ItemSlot,{scope:n,id:l,focusable:r,active:o},i.createElement(fe.span,L({tabIndex:f?0:-1,"data-orientation":d.orientation},s,{ref:t,onMouseDown:Y(e.onMouseDown,p=>{r?d.onItemFocus(l):p.preventDefault()}),onFocus:Y(e.onFocus,()=>d.onItemFocus(l)),onKeyDown:Y(e.onKeyDown,p=>{if(p.key==="Tab"&&p.shiftKey){d.onItemShiftTab();return}if(p.target!==p.currentTarget)return;const v=op(p,d.orientation,d.dir);if(v!==void 0){p.preventDefault();let g=u().filter(w=>w.focusable).map(w=>w.ref.current);if(v==="last")g.reverse();else if(v==="prev"||v==="next"){v==="prev"&&g.reverse();const w=g.indexOf(p.currentTarget);g=d.loop?ap(g,w+1):g.slice(w+1)}setTimeout(()=>ii(g))}})})))}),np={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function rp(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function op(e,t,n){const r=rp(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return np[r]}function ii(e){const t=document.activeElement;for(const n of e)if(n===t||(n.focus(),document.activeElement!==t))return}function ap(e,t){return e.map((n,r)=>e[(t+r)%e.length])}const ip=Jf,sp=tp,Or=["Enter"," "],cp=["ArrowDown","PageUp","Home"],si=["ArrowUp","PageDown","End"],lp=[...cp,...si],dp={ltr:[...Or,"ArrowRight"],rtl:[...Or,"ArrowLeft"]},up={ltr:["ArrowLeft"],rtl:["ArrowRight"]},On="Menu",[Xt,fp,pp]=lr(On),[pt,ci]=st(On,[pp,St,ai]),Ir=St(),li=ai(),[mp,mt]=pt(On),[hp,qt]=pt(On),vp=e=>{const{__scopeMenu:t,open:n=!1,children:r,dir:o,onOpenChange:a,modal:s=!0}=e,c=Ir(t),[l,d]=i.useState(null),f=i.useRef(!1),u=Me(a),m=dr(o);return i.useEffect(()=>{const h=()=>{f.current=!0,document.addEventListener("pointerdown",p,{capture:!0,once:!0}),document.addEventListener("pointermove",p,{capture:!0,once:!0})},p=()=>f.current=!1;return document.addEventListener("keydown",h,{capture:!0}),()=>{document.removeEventListener("keydown",h,{capture:!0}),document.removeEventListener("pointerdown",p,{capture:!0}),document.removeEventListener("pointermove",p,{capture:!0})}},[]),i.createElement(nr,c,i.createElement(mp,{scope:t,open:n,onOpenChange:u,content:l,onContentChange:d},i.createElement(hp,{scope:t,onClose:i.useCallback(()=>u(!1),[u]),isUsingKeyboardRef:f,dir:m,modal:s},r)))},di=i.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e,o=Ir(n);return i.createElement(rr,L({},o,r,{ref:t}))}),ui="MenuPortal",[gp,fi]=pt(ui,{forceMount:void 0}),bp=e=>{const{__scopeMenu:t,forceMount:n,children:r,container:o}=e,a=mt(ui,t);return i.createElement(gp,{scope:t,forceMount:n},i.createElement(_t,{present:n||a.open},i.createElement(Ko,{asChild:!0,container:o},r)))},De="MenuContent",[wp,Mr]=pt(De),xp=i.forwardRef((e,t)=>{const n=fi(De,e.__scopeMenu),{forceMount:r=n.forceMount,...o}=e,a=mt(De,e.__scopeMenu),s=qt(De,e.__scopeMenu);return i.createElement(Xt.Provider,{scope:e.__scopeMenu},i.createElement(_t,{present:r||a.open},i.createElement(Xt.Slot,{scope:e.__scopeMenu},s.modal?i.createElement(yp,L({},o,{ref:t})):i.createElement($p,L({},o,{ref:t})))))}),yp=i.forwardRef((e,t)=>{const n=mt(De,e.__scopeMenu),r=i.useRef(null),o=ve(t,r);return i.useEffect(()=>{const a=r.current;if(a)return sa(a)},[]),i.createElement(Ar,L({},e,{ref:o,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:Y(e.onFocusOutside,a=>a.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)}))}),$p=i.forwardRef((e,t)=>{const n=mt(De,e.__scopeMenu);return i.createElement(Ar,L({},e,{ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)}))}),Ar=i.forwardRef((e,t)=>{const{__scopeMenu:n,loop:r=!1,trapFocus:o,onOpenAutoFocus:a,onCloseAutoFocus:s,disableOutsidePointerEvents:c,onEntryFocus:l,onEscapeKeyDown:d,onPointerDownOutside:f,onFocusOutside:u,onInteractOutside:m,onDismiss:h,disableOutsideScroll:p,...v}=e,y=mt(De,n),g=qt(De,n),w=Ir(n),$=li(n),C=fp(n),[E,M]=i.useState(null),T=i.useRef(null),_=ve(t,T,y.onContentChange),B=i.useRef(0),K=i.useRef(""),A=i.useRef(0),P=i.useRef(null),G=i.useRef("right"),z=i.useRef(0),R=p?wr:i.Fragment,I=p?{as:ct,allowPinchZoom:!0}:void 0,O=S=>{var F,W;const X=K.current+S,ae=C().filter(te=>!te.disabled),be=document.activeElement,ge=(F=ae.find(te=>te.ref.current===be))===null||F===void 0?void 0:F.textValue,pe=ae.map(te=>te.textValue),U=Fp(pe,X,ge),ee=(W=ae.find(te=>te.textValue===U))===null||W===void 0?void 0:W.ref.current;(function te(ne){K.current=ne,window.clearTimeout(B.current),ne!==""&&(B.current=window.setTimeout(()=>te(""),1e3))})(X),ee&&setTimeout(()=>ee.focus())};i.useEffect(()=>()=>window.clearTimeout(B.current),[]),Jo();const N=i.useCallback(S=>{var F,W;return G.current===((F=P.current)===null||F===void 0?void 0:F.side)&&Bp(S,(W=P.current)===null||W===void 0?void 0:W.area)},[]);return i.createElement(wp,{scope:n,searchRef:K,onItemEnter:i.useCallback(S=>{N(S)&&S.preventDefault()},[N]),onItemLeave:i.useCallback(S=>{var F;N(S)||((F=T.current)===null||F===void 0||F.focus(),M(null))},[N]),onTriggerLeave:i.useCallback(S=>{N(S)&&S.preventDefault()},[N]),pointerGraceTimerRef:A,onPointerGraceIntentChange:i.useCallback(S=>{P.current=S},[])},i.createElement(R,I,i.createElement(ta,{asChild:!0,trapped:o,onMountAutoFocus:Y(a,S=>{var F;S.preventDefault(),(F=T.current)===null||F===void 0||F.focus()}),onUnmountAutoFocus:s},i.createElement(Un,{asChild:!0,disableOutsidePointerEvents:c,onEscapeKeyDown:d,onPointerDownOutside:f,onFocusOutside:u,onInteractOutside:m,onDismiss:h},i.createElement(ip,L({asChild:!0},$,{dir:g.dir,orientation:"vertical",loop:r,currentTabStopId:E,onCurrentTabStopIdChange:M,onEntryFocus:Y(l,S=>{g.isUsingKeyboardRef.current||S.preventDefault()})}),i.createElement(or,L({role:"menu","aria-orientation":"vertical","data-state":bi(y.open),"data-radix-menu-content":"",dir:g.dir},w,v,{ref:_,style:{outline:"none",...v.style},onKeyDown:Y(v.onKeyDown,S=>{const W=S.target.closest("[data-radix-menu-content]")===S.currentTarget,X=S.ctrlKey||S.altKey||S.metaKey,ae=S.key.length===1;W&&(S.key==="Tab"&&S.preventDefault(),!X&&ae&&O(S.key));const be=T.current;if(S.target!==be||!lp.includes(S.key))return;S.preventDefault();const pe=C().filter(U=>!U.disabled).map(U=>U.ref.current);si.includes(S.key)&&pe.reverse(),jp(pe)}),onBlur:Y(e.onBlur,S=>{S.currentTarget.contains(S.target)||(window.clearTimeout(B.current),K.current="")}),onPointerMove:Y(e.onPointerMove,Zt(S=>{const F=S.target,W=z.current!==S.clientX;if(S.currentTarget.contains(F)&&W){const X=S.clientX>z.current?"right":"left";G.current=X,z.current=S.clientX}}))})))))))}),Cp=i.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return i.createElement(fe.div,L({},r,{ref:t}))}),Dr="MenuItem",pi="menu.itemSelect",jr=i.forwardRef((e,t)=>{const{disabled:n=!1,onSelect:r,...o}=e,a=i.useRef(null),s=qt(Dr,e.__scopeMenu),c=Mr(Dr,e.__scopeMenu),l=ve(t,a),d=i.useRef(!1),f=()=>{const u=a.current;if(!n&&u){const m=new CustomEvent(pi,{bubbles:!0,cancelable:!0});u.addEventListener(pi,h=>r?.(h),{once:!0}),bo(u,m),m.defaultPrevented?d.current=!1:s.onClose()}};return i.createElement(mi,L({},o,{ref:l,disabled:n,onClick:Y(e.onClick,f),onPointerDown:u=>{var m;(m=e.onPointerDown)===null||m===void 0||m.call(e,u),d.current=!0},onPointerUp:Y(e.onPointerUp,u=>{var m;d.current||(m=u.currentTarget)===null||m===void 0||m.click()}),onKeyDown:Y(e.onKeyDown,u=>{const m=c.searchRef.current!=="";n||m&&u.key===" "||Or.includes(u.key)&&(u.currentTarget.click(),u.preventDefault())})}))}),mi=i.forwardRef((e,t)=>{const{__scopeMenu:n,disabled:r=!1,textValue:o,...a}=e,s=Mr(Dr,n),c=li(n),l=i.useRef(null),d=ve(t,l),[f,u]=i.useState(!1),[m,h]=i.useState("");return i.useEffect(()=>{const p=l.current;if(p){var v;h(((v=p.textContent)!==null&&v!==void 0?v:"").trim())}},[a.children]),i.createElement(Xt.ItemSlot,{scope:n,disabled:r,textValue:o??m},i.createElement(sp,L({asChild:!0},c,{focusable:!r}),i.createElement(fe.div,L({role:"menuitem","data-highlighted":f?"":void 0,"aria-disabled":r||void 0,"data-disabled":r?"":void 0},a,{ref:d,onPointerMove:Y(e.onPointerMove,Zt(p=>{r?s.onItemLeave(p):(s.onItemEnter(p),p.defaultPrevented||p.currentTarget.focus())})),onPointerLeave:Y(e.onPointerLeave,Zt(p=>s.onItemLeave(p))),onFocus:Y(e.onFocus,()=>u(!0)),onBlur:Y(e.onBlur,()=>u(!1))}))))}),Ep=i.forwardRef((e,t)=>{const{checked:n=!1,onCheckedChange:r,...o}=e;return i.createElement(vi,{scope:e.__scopeMenu,checked:n},i.createElement(jr,L({role:"menuitemcheckbox","aria-checked":Mn(n)?"mixed":n},o,{ref:t,"data-state":Lr(n),onSelect:Y(o.onSelect,()=>r?.(Mn(n)?!0:!n),{checkForDefaultPrevented:!1})})))}),Sp="MenuRadioGroup",[oh,_p]=pt(Sp,{value:void 0,onValueChange:()=>{}}),kp="MenuRadioItem",Tp=i.forwardRef((e,t)=>{const{value:n,...r}=e,o=_p(kp,e.__scopeMenu),a=n===o.value;return i.createElement(vi,{scope:e.__scopeMenu,checked:a},i.createElement(jr,L({role:"menuitemradio","aria-checked":a},r,{ref:t,"data-state":Lr(a),onSelect:Y(r.onSelect,()=>{var s;return(s=o.onValueChange)===null||s===void 0?void 0:s.call(o,n)},{checkForDefaultPrevented:!1})})))}),hi="MenuItemIndicator",[vi,Pp]=pt(hi,{checked:!1}),Np=i.forwardRef((e,t)=>{const{__scopeMenu:n,forceMount:r,...o}=e,a=Pp(hi,n);return i.createElement(_t,{present:r||Mn(a.checked)||a.checked===!0},i.createElement(fe.span,L({},o,{ref:t,"data-state":Lr(a.checked)})))}),Op=i.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return i.createElement(fe.div,L({role:"separator","aria-orientation":"horizontal"},r,{ref:t}))}),Ip="MenuSub",[ah,gi]=pt(Ip),In="MenuSubTrigger",Mp=i.forwardRef((e,t)=>{const n=mt(In,e.__scopeMenu),r=qt(In,e.__scopeMenu),o=gi(In,e.__scopeMenu),a=Mr(In,e.__scopeMenu),s=i.useRef(null),{pointerGraceTimerRef:c,onPointerGraceIntentChange:l}=a,d={__scopeMenu:e.__scopeMenu},f=i.useCallback(()=>{s.current&&window.clearTimeout(s.current),s.current=null},[]);return i.useEffect(()=>f,[f]),i.useEffect(()=>{const u=c.current;return()=>{window.clearTimeout(u),l(null)}},[c,l]),i.createElement(di,L({asChild:!0},d),i.createElement(mi,L({id:o.triggerId,"aria-haspopup":"menu","aria-expanded":n.open,"aria-controls":o.contentId,"data-state":bi(n.open)},e,{ref:tn(t,o.onTriggerChange),onClick:u=>{var m;(m=e.onClick)===null||m===void 0||m.call(e,u),!(e.disabled||u.defaultPrevented)&&(u.currentTarget.focus(),n.open||n.onOpenChange(!0))},onPointerMove:Y(e.onPointerMove,Zt(u=>{a.onItemEnter(u),!u.defaultPrevented&&!e.disabled&&!n.open&&!s.current&&(a.onPointerGraceIntentChange(null),s.current=window.setTimeout(()=>{n.onOpenChange(!0),f()},100))})),onPointerLeave:Y(e.onPointerLeave,Zt(u=>{var m;f();const h=(m=n.content)===null||m===void 0?void 0:m.getBoundingClientRect();if(h){var p;const v=(p=n.content)===null||p===void 0?void 0:p.dataset.side,y=v==="right",g=y?-5:5,w=h[y?"left":"right"],$=h[y?"right":"left"];a.onPointerGraceIntentChange({area:[{x:u.clientX+g,y:u.clientY},{x:w,y:h.top},{x:$,y:h.top},{x:$,y:h.bottom},{x:w,y:h.bottom}],side:v}),window.clearTimeout(c.current),c.current=window.setTimeout(()=>a.onPointerGraceIntentChange(null),300)}else{if(a.onTriggerLeave(u),u.defaultPrevented)return;a.onPointerGraceIntentChange(null)}})),onKeyDown:Y(e.onKeyDown,u=>{const m=a.searchRef.current!=="";if(!(e.disabled||m&&u.key===" ")&&dp[r.dir].includes(u.key)){var h;n.onOpenChange(!0),(h=n.content)===null||h===void 0||h.focus(),u.preventDefault()}})})))}),Ap="MenuSubContent",Dp=i.forwardRef((e,t)=>{const n=fi(De,e.__scopeMenu),{forceMount:r=n.forceMount,...o}=e,a=mt(De,e.__scopeMenu),s=qt(De,e.__scopeMenu),c=gi(Ap,e.__scopeMenu),l=i.useRef(null),d=ve(t,l);return i.createElement(Xt.Provider,{scope:e.__scopeMenu},i.createElement(_t,{present:r||a.open},i.createElement(Xt.Slot,{scope:e.__scopeMenu},i.createElement(Ar,L({id:c.contentId,"aria-labelledby":c.triggerId},o,{ref:d,align:"start",side:s.dir==="rtl"?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:f=>{var u;s.isUsingKeyboardRef.current&&((u=l.current)===null||u===void 0||u.focus()),f.preventDefault()},onCloseAutoFocus:f=>f.preventDefault(),onFocusOutside:Y(e.onFocusOutside,f=>{f.target!==c.trigger&&a.onOpenChange(!1)}),onEscapeKeyDown:Y(e.onEscapeKeyDown,f=>{s.onClose(),f.preventDefault()}),onKeyDown:Y(e.onKeyDown,f=>{const u=f.currentTarget.contains(f.target),m=up[s.dir].includes(f.key);if(u&&m){var h;a.onOpenChange(!1),(h=c.trigger)===null||h===void 0||h.focus(),f.preventDefault()}})})))))});function bi(e){return e?"open":"closed"}function Mn(e){return e==="indeterminate"}function Lr(e){return Mn(e)?"indeterminate":e?"checked":"unchecked"}function jp(e){const t=document.activeElement;for(const n of e)if(n===t||(n.focus(),document.activeElement!==t))return}function Lp(e,t){return e.map((n,r)=>e[(t+r)%e.length])}function Fp(e,t,n){const o=t.length>1&&Array.from(t).every(d=>d===t[0])?t[0]:t,a=n?e.indexOf(n):-1;let s=Lp(e,Math.max(a,0));o.length===1&&(s=s.filter(d=>d!==n));const l=s.find(d=>d.toLowerCase().startsWith(o.toLowerCase()));return l!==n?l:void 0}function Vp(e,t){const{x:n,y:r}=e;let o=!1;for(let a=0,s=t.length-1;a<t.length;s=a++){const c=t[a].x,l=t[a].y,d=t[s].x,f=t[s].y;l>r!=f>r&&n<(d-c)*(r-l)/(f-l)+c&&(o=!o)}return o}function Bp(e,t){if(!t)return!1;const n={x:e.clientX,y:e.clientY};return Vp(n,t)}function Zt(e){return t=>t.pointerType==="mouse"?e(t):void 0}const zp=vp,Wp=di,Rp=bp,Hp=xp,Up=Cp,Kp=jr,Gp=Ep,Yp=Tp,Xp=Np,qp=Op,Zp=Mp,Jp=Dp,wi="DropdownMenu",[Qp,ih]=st(wi,[ci]),Oe=ci(),[em,xi]=Qp(wi),tm=e=>{const{__scopeDropdownMenu:t,children:n,dir:r,open:o,defaultOpen:a,onOpenChange:s,modal:c=!0}=e,l=Oe(t),d=i.useRef(null),[f=!1,u]=Ht({prop:o,defaultProp:a,onChange:s});return i.createElement(em,{scope:t,triggerId:wt(),triggerRef:d,contentId:wt(),open:f,onOpenChange:u,onOpenToggle:i.useCallback(()=>u(m=>!m),[u]),modal:c},i.createElement(zp,L({},l,{open:f,onOpenChange:u,dir:r,modal:c}),n))},nm="DropdownMenuTrigger",rm=i.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,disabled:r=!1,...o}=e,a=xi(nm,n),s=Oe(n);return i.createElement(Wp,L({asChild:!0},s),i.createElement(fe.button,L({type:"button",id:a.triggerId,"aria-haspopup":"menu","aria-expanded":a.open,"aria-controls":a.open?a.contentId:void 0,"data-state":a.open?"open":"closed","data-disabled":r?"":void 0,disabled:r},o,{ref:tn(t,a.triggerRef),onPointerDown:Y(e.onPointerDown,c=>{!r&&c.button===0&&c.ctrlKey===!1&&(a.onOpenToggle(),a.open||c.preventDefault())}),onKeyDown:Y(e.onKeyDown,c=>{r||(["Enter"," "].includes(c.key)&&a.onOpenToggle(),c.key==="ArrowDown"&&a.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(c.key)&&c.preventDefault())})})))}),om=e=>{const{__scopeDropdownMenu:t,...n}=e,r=Oe(t);return i.createElement(Rp,L({},r,n))},am="DropdownMenuContent",im=i.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=xi(am,n),a=Oe(n),s=i.useRef(!1);return i.createElement(Hp,L({id:o.contentId,"aria-labelledby":o.triggerId},a,r,{ref:t,onCloseAutoFocus:Y(e.onCloseAutoFocus,c=>{var l;s.current||(l=o.triggerRef.current)===null||l===void 0||l.focus(),s.current=!1,c.preventDefault()}),onInteractOutside:Y(e.onInteractOutside,c=>{const l=c.detail.originalEvent,d=l.button===0&&l.ctrlKey===!0,f=l.button===2||d;(!o.modal||f)&&(s.current=!0)}),style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}}))}),sm=i.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=Oe(n);return i.createElement(Up,L({},o,r,{ref:t}))}),cm=i.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=Oe(n);return i.createElement(Kp,L({},o,r,{ref:t}))}),lm=i.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=Oe(n);return i.createElement(Gp,L({},o,r,{ref:t}))}),dm=i.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=Oe(n);return i.createElement(Yp,L({},o,r,{ref:t}))}),um=i.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=Oe(n);return i.createElement(Xp,L({},o,r,{ref:t}))}),fm=i.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=Oe(n);return i.createElement(qp,L({},o,r,{ref:t}))}),pm=i.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=Oe(n);return i.createElement(Zp,L({},o,r,{ref:t}))}),mm=i.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=Oe(n);return i.createElement(Jp,L({},o,r,{ref:t,style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}}))}),hm=tm,vm=rm,gm=om,yi=im,$i=sm,Ci=cm,Ei=lm,Si=dm,_i=um,ki=fm,Ti=pm,Pi=mm,bm=hm,wm=vm,xm=j.forwardRef(({className:e,inset:t,children:n,...r},o)=>x.jsxs(Ti,{ref:o,className:Q("flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none data-[state=open]:bg-accent focus:bg-accent",t&&"pl-8",e),...r,children:[n,x.jsx(Qs,{className:"ml-auto h-4 w-4"})]}));xm.displayName=Ti.displayName;const ym=j.forwardRef(({className:e,...t},n)=>x.jsx(Pi,{ref:n,className:Q("data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg data-[state=closed]:animate-out data-[state=open]:animate-in",e),...t}));ym.displayName=Pi.displayName;const Ni=j.forwardRef(({className:e,sideOffset:t=4,...n},r)=>x.jsx(gm,{children:x.jsx(yi,{ref:r,sideOffset:t,className:Q("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md","data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-[state=closed]:animate-out data-[state=open]:animate-in",e),...n})}));Ni.displayName=yi.displayName;const Oi=j.forwardRef(({className:e,inset:t,...n},r)=>x.jsx(Ci,{ref:r,className:Q("relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none transition-colors data-[disabled]:pointer-events-none focus:bg-accent focus:text-accent-foreground data-[disabled]:opacity-50",t&&"pl-8",e),...n}));Oi.displayName=Ci.displayName;const Ii=j.forwardRef(({className:e,children:t,checked:n,...r},o)=>x.jsxs(Ei,{ref:o,className:Q("relative flex cursor-default select-none items-center rounded-sm py-1.5 pr-2 pl-8 text-sm outline-none transition-colors data-[disabled]:pointer-events-none focus:bg-accent focus:text-accent-foreground data-[disabled]:opacity-50",e),checked:n,...r,children:[x.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:x.jsx(_i,{children:x.jsx(fo,{className:"h-4 w-4"})})}),t]}));Ii.displayName=Ei.displayName;const $m=j.forwardRef(({className:e,children:t,...n},r)=>x.jsxs(Si,{ref:r,className:Q("relative flex cursor-default select-none items-center rounded-sm py-1.5 pr-2 pl-8 text-sm outline-none transition-colors data-[disabled]:pointer-events-none focus:bg-accent focus:text-accent-foreground data-[disabled]:opacity-50",e),...n,children:[x.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:x.jsx(_i,{children:x.jsx(rc,{className:"h-4 w-4 fill-current"})})}),t]}));$m.displayName=Si.displayName;const Cm=j.forwardRef(({className:e,inset:t,...n},r)=>x.jsx($i,{ref:r,className:Q("px-2 py-1.5 font-semibold text-sm",t&&"pl-8",e),...n}));Cm.displayName=$i.displayName;const Em=j.forwardRef(({className:e,...t},n)=>x.jsx(ki,{ref:n,className:Q("-mx-1 my-1 h-px bg-muted",e),...t}));Em.displayName=ki.displayName;function Sm(e){return x.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",fill:"none",viewBox:"0 0 20 20",...e,children:[x.jsx("title",{children:"Add Row"}),x.jsx("path",{stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.5",d:"M10 6.667v6.666M6.667 10h6.666M6.5 17.5h7c1.4 0 2.1 0 2.635-.273a2.5 2.5 0 001.092-1.092c.273-.535.273-1.235.273-2.635v-7c0-1.4 0-2.1-.273-2.635a2.5 2.5 0 00-1.092-1.093C15.6 2.5 14.9 2.5 13.5 2.5h-7c-1.4 0-2.1 0-2.635.272a2.5 2.5 0 00-1.093 1.093C2.5 4.4 2.5 5.1 2.5 6.5v7c0 1.4 0 2.1.272 2.635a2.5 2.5 0 001.093 1.092C4.4 17.5 5.1 17.5 6.5 17.5z"})]})}function _m(e){return x.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",fill:"none",viewBox:"0 0 20 20",...e,children:[x.jsx("title",{children:"Remove Row"}),x.jsx("path",{stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.5",d:"M13.333 5v-.667c0-.933 0-1.4-.181-1.756a1.667 1.667 0 00-.729-.729c-.356-.181-.823-.181-1.756-.181H9.333c-.933 0-1.4 0-1.756.181-.314.16-.569.415-.729.729-.181.356-.181.823-.181 1.756V5m1.666 4.583v4.167m3.334-4.167v4.167M2.5 5h15m-1.667 0v9.333c0 1.4 0 2.1-.272 2.635a2.5 2.5 0 01-1.093 1.093c-.534.272-1.235.272-2.635.272H8.167c-1.4 0-2.1 0-2.635-.272a2.5 2.5 0 01-1.093-1.093c-.272-.535-.272-1.235-.272-2.635V5"})]})}function km(){const{hasSomeEntireRow:e,emptySize:t,staticRows:n,columns:r,onInsertNewRow:o,onRemoveRow:a,onColumnVisibilityChange:s,onRestoreColumnsVisibility:c}=je(),l=i.useMemo(()=>r.filter(({state:h})=>h.visible),[r]),d=i.useMemo(()=>r.length===l.length,[r.length,l.length]),f="Exibindo todas as colunas",u=`Exibindo ${l.length} de ${r.length} colunas`,m=d?f:u;return x.jsxs("div",{className:"sticky top-0 z-50 flex w-full items-center justify-between rounded-t-md border bg-[#EAF5FF] px-4 py-2.5",children:[x.jsxs("div",{className:"flex items-center gap-6",children:[x.jsx(pn,{delayDuration:25,children:x.jsxs(mn,{children:[x.jsx(hn,{asChild:!0,children:x.jsx(Nn,{disabled:n,size:"icon",variant:"ghost",onClick:o,className:"text-[#4A4A6A] transition-none active:bg-[#0085FF] hover:bg-[#8FD6FF] active:text-white","data-cypress":"table-add-new-row",children:x.jsx(Sm,{})})}),x.jsx(Kt,{children:x.jsx("p",{children:"Inserir linha"})})]})}),x.jsx(pn,{delayDuration:25,children:x.jsxs(mn,{children:[x.jsx(hn,{asChild:!0,children:x.jsx(Nn,{disabled:n||t||!e,size:"icon",variant:"ghost",onClick:a,className:"text-[#4A4A6A] transition-none active:bg-[#0085FF] hover:bg-[#8FD6FF] active:text-white","data-cypress":"table-delete-selected-row",children:x.jsx(_m,{})})}),x.jsx(Kt,{children:x.jsx("p",{children:"Excluir linha(s)"})})]})})]}),x.jsx("div",{className:"flex items-center gap-4",children:x.jsxs(bm,{children:[x.jsx(wm,{"data-cypress":"table-hide-columns-button",asChild:!0,className:"w-56 bg-white",children:x.jsxs(Nn,{variant:"outline",className:"justify-between px-2",children:[x.jsx("span",{className:"text-xs",children:m}),x.jsx(fc,{className:"h-4 w-4"})]})}),x.jsxs(Ni,{className:"w-56",children:[x.jsx(Oi,{onClick:c,className:"justify-between text-xs","data-cypress":"table-restore-columns",children:x.jsx("span",{children:"Reexibir todas as colunas"})}),r.map(({name:h,id:p,alphabetLetter:v,position:y,state:g})=>x.jsxs(Ii,{checked:g.visible,onCheckedChange:w=>s({columnId:p,visible:w}),onSelect:w=>w.preventDefault(),className:"justify-between text-xs","data-cypress":`table-hide-column-${p}`,children:[x.jsx("span",{children:h}),x.jsx("span",{className:"text-[10px] text-neutral-500",children:v})]},`spreadsheet__column__dropdown_checkbox__key__${p}__${y}`))]})]})})]})}function Tm(e){const{className:t,...n}=e;return x.jsx(Vs,{...n,children:x.jsxs(uo.Root,{className:Q(t,"h-full"),children:[x.jsx(km,{}),x.jsxs(uo.Matrix,{className:"scrollbar-thin overflow-y-clip overflow-x-scroll",children:[x.jsx(Hf,{className:"absolute z-50"}),x.jsx(gd,{}),x.jsx(Rf,{})]})]})})}function Pm(e){const{fileName:t="Declaração de viabilidade - Esgoto.pdf",fileSizeInMb:n="8.15MB • Versão 1",onDownload:r,onClick:o,state:a,...s}=e,c=d=>{(a==="Idle"||a==="Finished")&&r(),o?.(d)},l=a==="Disabled";return x.jsxs("button",{className:Q("flex h-[34px] items-center gap-4 rounded-md border border-[#E5E5F4] px-4 text-[#474772] transition-all ease-linear hover:shadow-md","disabled:border-[#E5E5F4] disabled:bg-[#E5E5F4] disabled:text-[#9292BA] disabled:shadow-none"),type:"button",onClick:c,disabled:l,"aria-disabled":l,...s,children:[x.jsxs("div",{className:"flex items-center gap-2",children:[x.jsx(vc,{className:"h-4 w-4 shrink-0"}),x.jsx("p",{className:"whitespace-nowrap font-bold text-[14px]",children:t}),x.jsx("p",{className:"whitespace-nowrap text-[10px]",children:n})]}),a==="Finished"&&x.jsx("div",{className:"flex w-[110px] items-center justify-end",children:x.jsx(pc,{className:"h-4 w-4 text-[#199652]"})}),a==="Loading"&&x.jsx("div",{className:"flex w-[110px] items-center justify-end",children:x.jsx(bc,{className:"h-4 w-4 shrink-0 animate-spin text-[#199652]"})}),x.jsx(Nm,{state:a})]})}function Nm({state:e}){return e==="Disabled"?x.jsxs("div",{className:"flex w-[110px] items-center text-[#9292BA]",children:[x.jsx(ho,{className:"mr-1 h-4 w-4 shrink-0 text-current"}),x.jsx("p",{className:"mr-2 whitespace-nowrap font-bold text-[10px] text-current",children:"Novo Arquivo"}),x.jsx(mo,{className:"h-4 w-4 text-[#9292BA]"})]}):e==="Idle"?x.jsxs("div",{className:"flex w-[110px] items-center text-[#4657E1]",children:[x.jsx(ho,{className:"mr-1 h-4 w-4 shrink-0 text-current"}),x.jsx("p",{className:"mr-2 whitespace-nowrap font-bold text-[10px] text-current",children:"Novo Arquivo"}),x.jsx(mo,{className:"h-4 w-4 text-[#474772]"})]}):null}const Om={Spreadsheet:Tm,FileUploader:Pm};Ge.CapLink=Om,Object.defineProperty(Ge,Symbol.toStringTag,{value:"Module"})});
164
+ `,"\r"].every(t=>!e.includes(t))}function Qa(e,t){return no(e)>t-4}const ei=200;function Ff(e){const{mode:t,width:n,value:r,onBlur:o,onChange:a,onPaste:s,setMode:c,column:l,selected:d,coordinates:f}=e,u=r,m=i.useRef(null),h=i.useRef(null),[p,v]=i.useState(0),y=i.useMemo(()=>Qa(u,n),[u,n]),g=i.useCallback(()=>{const E=h.current;if(!E)return;const M=E.scrollHeight;E.style.height=`${M}px`,v(M)},[]),w=i.useCallback(E=>{const M=jf(E);Lf(M)||(E.preventDefault(),s?.()),g()},[s,g]),$=i.useCallback(()=>{o?.(),c?.("view")},[o,c]),C=i.useCallback(E=>{a?.({data:E.target.value}),g()},[g,a]);return i.useEffect(()=>{g()},[g]),Sr(m),Sr(h),y?x.jsx("div",{style:{height:p||"fit-content"},className:Q("-left-0.5 -top-0.5 absolute z-40 h-fit w-fit border bg-white shadow-lg outline outline-2 outline-blue-500",d?"bg-blue-50":"bg-white"),children:x.jsx("div",{style:{height:p-1},className:"h-full w-full outline outline-[3px] outline-sky-200 outline-offset-2",children:x.jsx("textarea",{ref:h,onBlur:$,onPaste:w,value:u,onChange:C,className:Q("h-fit resize-none break-all rounded-none bg-transparent py-1.5 pr-3 pl-1 text-xs outline-none"),onFocus:E=>Af(E.target),maxLength:ei,style:{width:n},"data-cypress":`table-cell-string-${l.id}-${f.row}`,"aria-readonly":t==="readonly",autoFocus:!0})})}):x.jsx("input",{ref:m,onBlur:o,onPaste:w,value:u,maxLength:ei,onChange:C,className:Q("h-full w-full bg-transparent pl-1 text-xs outline-none"),"data-cypress":`table-cell-string-${l.id}-${f.row}`,"aria-readonly":t==="readonly",autoFocus:!0})}function Vf(e){const{mode:t,value:n,column:r,width:o,selected:a,coordinates:s}=e,c=n;return i.useMemo(()=>Qa(c,o),[c,o])?x.jsx(pn,{delayDuration:0,children:x.jsxs(mn,{children:[x.jsx(hn,{className:"w-full",children:x.jsx("div",{className:"flex h-full w-full items-center overflow-hidden","aria-readonly":t==="readonly","data-cypress":`table-cell-string-${r.id}-${s.row}`,children:x.jsx("p",{className:"line-clamp-1 break-all pl-1 text-left text-xs",children:c})})}),x.jsx(Kt,{align:"start",side:"bottom",alignOffset:-2,sideOffset:-Bt,className:Q("h-fit w-full break-all rounded-none border bg-white pl-1 text-black shadow-lg","data-[state=closed]:transform-none data-[side=bottom]:animate-none data-[state=closed]:animate-none data-[state=closed]:transition-none",a?"bg-blue-50":"bg-white"),style:{width:o},children:x.jsx("p",{"data-cypress":`table-cell-string-tooltip-${r.id}-${s.row}`,children:c})})]})}):x.jsx("div",{className:"flex h-full w-full items-center overflow-hidden","data-cypress":`table-cell-string-${r.id}-${s.row}`,"aria-readonly":t==="readonly",children:x.jsx("p",{className:"line-clamp-1 break-all pl-1 text-left text-xs",title:c,children:c})})}const Ue={Date:ef,Text:Ff,Boolean:Ju,Numeric:Nf,Select:If},Ke={Date:tf,Text:Vf,Boolean:Qu,Numeric:Of,Select:Mf},Bf=["Boolean","Select"];function zf(e){const{value:t,width:n,coordinates:r}=e,{columns:o,isCellSelected:a,onChange:s,onPaste:c,onSelectCell:l}=je(),{dataEditorType:d,state:f,settings:u}=o[r.column],{readonly:m,visible:h}=f,[p,v]=i.useState(m?"readonly":"view"),y=i.useRef(null),g=i.useMemo(()=>o[r.column],[o,r.column]),w=i.useMemo(()=>a(r),[r,a]),$=i.useMemo(()=>u?.select?.items||[],[u?.select?.items]),C=i.useMemo(()=>({dataEditor:{coordinates:r,value:t,column:g,setMode:v,selected:w,mode:p,width:n,onPaste:()=>c(r),onChange:({data:K})=>s({data:K,point:r})},dataViewer:{coordinates:r,value:t,column:g,width:n,selected:w,mode:p}}),[r,n,p,t,g,w,c,s,r]),E=i.useMemo(()=>({Date:x.jsx(Ue.Date,{...C.dataEditor}),String:x.jsx(Ue.Text,{...C.dataEditor}),Currency:x.jsx(Ue.Numeric,{...C.dataEditor}),Decimal:x.jsx(Ue.Numeric,{...C.dataEditor}),Float:x.jsx(Ue.Numeric,{...C.dataEditor}),Integer:x.jsx(Ue.Numeric,{...C.dataEditor}),Percentage:x.jsx(Ue.Numeric,{...C.dataEditor}),Boolean:x.jsx(Ue.Boolean,{...C.dataEditor}),Select:x.jsx(Ue.Select,{...C.dataEditor,items:$})}),[C.dataEditor,$]),M=i.useMemo(()=>({Date:x.jsx(Ke.Date,{...C.dataViewer}),String:x.jsx(Ke.Text,{...C.dataViewer}),Currency:x.jsx(Ke.Numeric,{...C.dataViewer}),Decimal:x.jsx(Ke.Numeric,{...C.dataViewer}),Float:x.jsx(Ke.Numeric,{...C.dataViewer}),Integer:x.jsx(Ke.Numeric,{...C.dataViewer}),Percentage:x.jsx(Ke.Numeric,{...C.dataViewer}),Boolean:x.jsx(Ke.Boolean,{...C.dataViewer}),Select:x.jsx(Ke.Select,{...C.dataViewer,items:$})}),[C.dataViewer,$]),T=i.useMemo(()=>d?E[d]:null,[d,E]),_=i.useMemo(()=>d?M[d]:null,[d,M]),B=i.useCallback(()=>{Bf.includes(d)||v("view")},[d]);return i.useEffect(()=>{const K=A=>{const P=A.code==="Enter";P&&w&&p==="view"&&v("edit"),P&&w&&p==="edit"&&v("view")};return window.addEventListener("keydown",K),()=>window.removeEventListener("keydown",K)},[w,p]),lo(y,B),i.useEffect(()=>{v(m?"readonly":"view")},[m]),h?p==="readonly"?x.jsx("div",{onClick:()=>l(r),className:Q("flex h-7 shrink-0 cursor-default select-none border border-t-transparent border-l-transparent bg-[#F6F6F9]",w&&"bg-[#EAF5FF]"),style:{width:n,height:Bt},children:_}):p==="view"?x.jsx("div",{onClick:()=>l(r),onDoubleClick:()=>v("edit"),className:Q("relative flex h-7 shrink-0 cursor-default select-none border border-t-transparent border-l-transparent",w&&"bg-[#EAF5FF]"),style:{width:n,height:Bt},children:_}):x.jsx("div",{ref:y,"data-testid":"cell__testid",className:"relative h-7 w-32 shrink-0 border border-t-transparent border-l-transparent bg-[#EAF5FF] shadow-lg outline outline-2 outline-blue-500",style:{width:n,height:Bt,top:r.row===0?"4px":"0px"},children:x.jsx("div",{className:"h-full w-full outline outline-[3px] outline-sky-200 outline-offset-2",children:T})}):x.jsx(i.Fragment,{})}function Wf({row:e}){const{onSelectRow:t,pointRange:n,matrix:r}=je(),o=i.useMemo(()=>n&&e>=n.start.row&&e<=n.end.row,[n,e]),a=i.useMemo(()=>!!(n&&js({matrix:r,pointRange:n,row:e})),[r,n,e]);return x.jsx("div",{className:Q("flex h-7 w-12 shrink-0 cursor-default select-none items-center justify-center border-r border-b text-[#8E8EA9] text-xs",o&&"bg-blue-100 font-bold text-blue-700",a&&"bg-[#0085FF] font-bold text-white"),onClick:s=>t(e,s),style:{height:Bt},children:e+1})}function Rf(){const e=i.useId(),{highlightLastRow:t,matrix:n,columns:r}=je();return x.jsx("div",{className:"relative",children:n.map((o,a)=>x.jsxs("div",{className:Q("flex items-center transition-all ease-linear",a===n.length-1&&t&&"bg-blue-50"),children:[x.jsx(Wf,{row:a}),o.map((s,c)=>x.jsx(zf,{value:s,coordinates:{column:c,row:a},width:r[c].state.width},`spreadsheet__cell__key__${e}__${a}__${c}`))]},`spreadsheet__row__key__${e}__${a}}`))})}function Hf({className:e}){const{staticRows:t,emptySize:n,onInsertNewRow:r}=je();return t?null:x.jsx("div",{className:Q("pointer-events-none mt-[calc(28px+36px)] flex h-[calc(100%-28px-28px)] w-full items-center justify-center",n&&"pointer-events-auto bg-white/25 backdrop-blur-sm",e),children:n&&x.jsxs("p",{className:"text-neutral-500",children:[x.jsx("span",{children:"Clique "}),x.jsx("button",{type:"button",onClick:r,className:"font-bold",children:"AQUI"}),x.jsx("span",{children:" para começar a preencher a tabela."})]})})}function ti(e){var t,n,r="";if(typeof e=="string"||typeof e=="number")r+=e;else if(typeof e=="object")if(Array.isArray(e))for(t=0;t<e.length;t++)e[t]&&(n=ti(e[t]))&&(r&&(r+=" "),r+=n);else for(t in e)e[t]&&(r&&(r+=" "),r+=t);return r}function Uf(){for(var e,t,n=0,r="";n<arguments.length;)(e=arguments[n++])&&(t=ti(e))&&(r&&(r+=" "),r+=t);return r}const ni=e=>typeof e=="boolean"?"".concat(e):e===0?"0":e,ri=Uf,Kf=((e,t)=>n=>{var r;if(t?.variants==null)return ri(e,n?.class,n?.className);const{variants:o,defaultVariants:a}=t,s=Object.keys(o).map(d=>{const f=n?.[d],u=a?.[d];if(f===null)return null;const m=ni(f)||ni(u);return o[d][m]}),c=n&&Object.entries(n).reduce((d,f)=>{let[u,m]=f;return m===void 0||(d[u]=m),d},{}),l=t==null||(r=t.compoundVariants)===null||r===void 0?void 0:r.reduce((d,f)=>{let{class:u,className:m,...h}=f;return Object.entries(h).every(p=>{let[v,y]=p;return Array.isArray(y)?y.includes({...a,...c}[v]):{...a,...c}[v]===y})?[...d,u,m]:d},[]);return ri(e,s,l,n?.class,n?.className)})("inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50",{variants:{variant:{default:"bg-primary text-primary-foreground shadow hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90",outline:"border border-input bg-background shadow-sm hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground shadow-sm hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2",sm:"h-8 rounded-md px-3 text-xs",lg:"h-10 rounded-md px-8",icon:"h-9 w-9"}},defaultVariants:{variant:"default",size:"default"}}),Nn=j.forwardRef(({className:e,variant:t,size:n,asChild:r=!1,...o},a)=>{const s=r?ct:"button";return x.jsx(s,{className:Q(Kf({variant:t,size:n,className:e})),ref:a,...o})});Nn.displayName="Button";const Tr="rovingFocusGroup.onEntryFocus",Gf={bubbles:!1,cancelable:!0},Pr="RovingFocusGroup",[Nr,oi,Yf]=lr(Pr),[Xf,ai]=st(Pr,[Yf]),[qf,Zf]=Xf(Pr),Jf=i.forwardRef((e,t)=>i.createElement(Nr.Provider,{scope:e.__scopeRovingFocusGroup},i.createElement(Nr.Slot,{scope:e.__scopeRovingFocusGroup},i.createElement(Qf,L({},e,{ref:t}))))),Qf=i.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,orientation:r,loop:o=!1,dir:a,currentTabStopId:s,defaultCurrentTabStopId:c,onCurrentTabStopIdChange:l,onEntryFocus:d,...f}=e,u=i.useRef(null),m=ve(t,u),h=dr(a),[p=null,v]=Ht({prop:s,defaultProp:c,onChange:l}),[y,g]=i.useState(!1),w=Me(d),$=oi(n),C=i.useRef(!1),[E,M]=i.useState(0);return i.useEffect(()=>{const T=u.current;if(T)return T.addEventListener(Tr,w),()=>T.removeEventListener(Tr,w)},[w]),i.createElement(qf,{scope:n,orientation:r,dir:h,loop:o,currentTabStopId:p,onItemFocus:i.useCallback(T=>v(T),[v]),onItemShiftTab:i.useCallback(()=>g(!0),[]),onFocusableItemAdd:i.useCallback(()=>M(T=>T+1),[]),onFocusableItemRemove:i.useCallback(()=>M(T=>T-1),[])},i.createElement(fe.div,L({tabIndex:y||E===0?-1:0,"data-orientation":r},f,{ref:m,style:{outline:"none",...e.style},onMouseDown:Y(e.onMouseDown,()=>{C.current=!0}),onFocus:Y(e.onFocus,T=>{const _=!C.current;if(T.target===T.currentTarget&&_&&!y){const B=new CustomEvent(Tr,Gf);if(T.currentTarget.dispatchEvent(B),!B.defaultPrevented){const K=$().filter(R=>R.focusable),A=K.find(R=>R.active),P=K.find(R=>R.id===p),z=[A,P,...K].filter(Boolean).map(R=>R.ref.current);ii(z)}}C.current=!1}),onBlur:Y(e.onBlur,()=>g(!1))})))}),ep="RovingFocusGroupItem",tp=i.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,focusable:r=!0,active:o=!1,tabStopId:a,...s}=e,c=wt(),l=a||c,d=Zf(ep,n),f=d.currentTabStopId===l,u=oi(n),{onFocusableItemAdd:m,onFocusableItemRemove:h}=d;return i.useEffect(()=>{if(r)return m(),()=>h()},[r,m,h]),i.createElement(Nr.ItemSlot,{scope:n,id:l,focusable:r,active:o},i.createElement(fe.span,L({tabIndex:f?0:-1,"data-orientation":d.orientation},s,{ref:t,onMouseDown:Y(e.onMouseDown,p=>{r?d.onItemFocus(l):p.preventDefault()}),onFocus:Y(e.onFocus,()=>d.onItemFocus(l)),onKeyDown:Y(e.onKeyDown,p=>{if(p.key==="Tab"&&p.shiftKey){d.onItemShiftTab();return}if(p.target!==p.currentTarget)return;const v=op(p,d.orientation,d.dir);if(v!==void 0){p.preventDefault();let g=u().filter(w=>w.focusable).map(w=>w.ref.current);if(v==="last")g.reverse();else if(v==="prev"||v==="next"){v==="prev"&&g.reverse();const w=g.indexOf(p.currentTarget);g=d.loop?ap(g,w+1):g.slice(w+1)}setTimeout(()=>ii(g))}})})))}),np={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function rp(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function op(e,t,n){const r=rp(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return np[r]}function ii(e){const t=document.activeElement;for(const n of e)if(n===t||(n.focus(),document.activeElement!==t))return}function ap(e,t){return e.map((n,r)=>e[(t+r)%e.length])}const ip=Jf,sp=tp,Or=["Enter"," "],cp=["ArrowDown","PageUp","Home"],si=["ArrowUp","PageDown","End"],lp=[...cp,...si],dp={ltr:[...Or,"ArrowRight"],rtl:[...Or,"ArrowLeft"]},up={ltr:["ArrowLeft"],rtl:["ArrowRight"]},On="Menu",[Xt,fp,pp]=lr(On),[pt,ci]=st(On,[pp,St,ai]),Ir=St(),li=ai(),[mp,mt]=pt(On),[hp,qt]=pt(On),vp=e=>{const{__scopeMenu:t,open:n=!1,children:r,dir:o,onOpenChange:a,modal:s=!0}=e,c=Ir(t),[l,d]=i.useState(null),f=i.useRef(!1),u=Me(a),m=dr(o);return i.useEffect(()=>{const h=()=>{f.current=!0,document.addEventListener("pointerdown",p,{capture:!0,once:!0}),document.addEventListener("pointermove",p,{capture:!0,once:!0})},p=()=>f.current=!1;return document.addEventListener("keydown",h,{capture:!0}),()=>{document.removeEventListener("keydown",h,{capture:!0}),document.removeEventListener("pointerdown",p,{capture:!0}),document.removeEventListener("pointermove",p,{capture:!0})}},[]),i.createElement(nr,c,i.createElement(mp,{scope:t,open:n,onOpenChange:u,content:l,onContentChange:d},i.createElement(hp,{scope:t,onClose:i.useCallback(()=>u(!1),[u]),isUsingKeyboardRef:f,dir:m,modal:s},r)))},di=i.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e,o=Ir(n);return i.createElement(rr,L({},o,r,{ref:t}))}),ui="MenuPortal",[gp,fi]=pt(ui,{forceMount:void 0}),bp=e=>{const{__scopeMenu:t,forceMount:n,children:r,container:o}=e,a=mt(ui,t);return i.createElement(gp,{scope:t,forceMount:n},i.createElement(_t,{present:n||a.open},i.createElement(Ko,{asChild:!0,container:o},r)))},De="MenuContent",[wp,Mr]=pt(De),xp=i.forwardRef((e,t)=>{const n=fi(De,e.__scopeMenu),{forceMount:r=n.forceMount,...o}=e,a=mt(De,e.__scopeMenu),s=qt(De,e.__scopeMenu);return i.createElement(Xt.Provider,{scope:e.__scopeMenu},i.createElement(_t,{present:r||a.open},i.createElement(Xt.Slot,{scope:e.__scopeMenu},s.modal?i.createElement(yp,L({},o,{ref:t})):i.createElement($p,L({},o,{ref:t})))))}),yp=i.forwardRef((e,t)=>{const n=mt(De,e.__scopeMenu),r=i.useRef(null),o=ve(t,r);return i.useEffect(()=>{const a=r.current;if(a)return sa(a)},[]),i.createElement(Ar,L({},e,{ref:o,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:Y(e.onFocusOutside,a=>a.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)}))}),$p=i.forwardRef((e,t)=>{const n=mt(De,e.__scopeMenu);return i.createElement(Ar,L({},e,{ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)}))}),Ar=i.forwardRef((e,t)=>{const{__scopeMenu:n,loop:r=!1,trapFocus:o,onOpenAutoFocus:a,onCloseAutoFocus:s,disableOutsidePointerEvents:c,onEntryFocus:l,onEscapeKeyDown:d,onPointerDownOutside:f,onFocusOutside:u,onInteractOutside:m,onDismiss:h,disableOutsideScroll:p,...v}=e,y=mt(De,n),g=qt(De,n),w=Ir(n),$=li(n),C=fp(n),[E,M]=i.useState(null),T=i.useRef(null),_=ve(t,T,y.onContentChange),B=i.useRef(0),K=i.useRef(""),A=i.useRef(0),P=i.useRef(null),G=i.useRef("right"),z=i.useRef(0),R=p?wr:i.Fragment,I=p?{as:ct,allowPinchZoom:!0}:void 0,O=S=>{var F,W;const X=K.current+S,ae=C().filter(te=>!te.disabled),be=document.activeElement,ge=(F=ae.find(te=>te.ref.current===be))===null||F===void 0?void 0:F.textValue,pe=ae.map(te=>te.textValue),U=Fp(pe,X,ge),ee=(W=ae.find(te=>te.textValue===U))===null||W===void 0?void 0:W.ref.current;(function te(ne){K.current=ne,window.clearTimeout(B.current),ne!==""&&(B.current=window.setTimeout(()=>te(""),1e3))})(X),ee&&setTimeout(()=>ee.focus())};i.useEffect(()=>()=>window.clearTimeout(B.current),[]),Jo();const N=i.useCallback(S=>{var F,W;return G.current===((F=P.current)===null||F===void 0?void 0:F.side)&&Bp(S,(W=P.current)===null||W===void 0?void 0:W.area)},[]);return i.createElement(wp,{scope:n,searchRef:K,onItemEnter:i.useCallback(S=>{N(S)&&S.preventDefault()},[N]),onItemLeave:i.useCallback(S=>{var F;N(S)||((F=T.current)===null||F===void 0||F.focus(),M(null))},[N]),onTriggerLeave:i.useCallback(S=>{N(S)&&S.preventDefault()},[N]),pointerGraceTimerRef:A,onPointerGraceIntentChange:i.useCallback(S=>{P.current=S},[])},i.createElement(R,I,i.createElement(ta,{asChild:!0,trapped:o,onMountAutoFocus:Y(a,S=>{var F;S.preventDefault(),(F=T.current)===null||F===void 0||F.focus()}),onUnmountAutoFocus:s},i.createElement(Un,{asChild:!0,disableOutsidePointerEvents:c,onEscapeKeyDown:d,onPointerDownOutside:f,onFocusOutside:u,onInteractOutside:m,onDismiss:h},i.createElement(ip,L({asChild:!0},$,{dir:g.dir,orientation:"vertical",loop:r,currentTabStopId:E,onCurrentTabStopIdChange:M,onEntryFocus:Y(l,S=>{g.isUsingKeyboardRef.current||S.preventDefault()})}),i.createElement(or,L({role:"menu","aria-orientation":"vertical","data-state":bi(y.open),"data-radix-menu-content":"",dir:g.dir},w,v,{ref:_,style:{outline:"none",...v.style},onKeyDown:Y(v.onKeyDown,S=>{const W=S.target.closest("[data-radix-menu-content]")===S.currentTarget,X=S.ctrlKey||S.altKey||S.metaKey,ae=S.key.length===1;W&&(S.key==="Tab"&&S.preventDefault(),!X&&ae&&O(S.key));const be=T.current;if(S.target!==be||!lp.includes(S.key))return;S.preventDefault();const pe=C().filter(U=>!U.disabled).map(U=>U.ref.current);si.includes(S.key)&&pe.reverse(),jp(pe)}),onBlur:Y(e.onBlur,S=>{S.currentTarget.contains(S.target)||(window.clearTimeout(B.current),K.current="")}),onPointerMove:Y(e.onPointerMove,Zt(S=>{const F=S.target,W=z.current!==S.clientX;if(S.currentTarget.contains(F)&&W){const X=S.clientX>z.current?"right":"left";G.current=X,z.current=S.clientX}}))})))))))}),Cp=i.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return i.createElement(fe.div,L({},r,{ref:t}))}),Dr="MenuItem",pi="menu.itemSelect",jr=i.forwardRef((e,t)=>{const{disabled:n=!1,onSelect:r,...o}=e,a=i.useRef(null),s=qt(Dr,e.__scopeMenu),c=Mr(Dr,e.__scopeMenu),l=ve(t,a),d=i.useRef(!1),f=()=>{const u=a.current;if(!n&&u){const m=new CustomEvent(pi,{bubbles:!0,cancelable:!0});u.addEventListener(pi,h=>r?.(h),{once:!0}),bo(u,m),m.defaultPrevented?d.current=!1:s.onClose()}};return i.createElement(mi,L({},o,{ref:l,disabled:n,onClick:Y(e.onClick,f),onPointerDown:u=>{var m;(m=e.onPointerDown)===null||m===void 0||m.call(e,u),d.current=!0},onPointerUp:Y(e.onPointerUp,u=>{var m;d.current||(m=u.currentTarget)===null||m===void 0||m.click()}),onKeyDown:Y(e.onKeyDown,u=>{const m=c.searchRef.current!=="";n||m&&u.key===" "||Or.includes(u.key)&&(u.currentTarget.click(),u.preventDefault())})}))}),mi=i.forwardRef((e,t)=>{const{__scopeMenu:n,disabled:r=!1,textValue:o,...a}=e,s=Mr(Dr,n),c=li(n),l=i.useRef(null),d=ve(t,l),[f,u]=i.useState(!1),[m,h]=i.useState("");return i.useEffect(()=>{const p=l.current;if(p){var v;h(((v=p.textContent)!==null&&v!==void 0?v:"").trim())}},[a.children]),i.createElement(Xt.ItemSlot,{scope:n,disabled:r,textValue:o??m},i.createElement(sp,L({asChild:!0},c,{focusable:!r}),i.createElement(fe.div,L({role:"menuitem","data-highlighted":f?"":void 0,"aria-disabled":r||void 0,"data-disabled":r?"":void 0},a,{ref:d,onPointerMove:Y(e.onPointerMove,Zt(p=>{r?s.onItemLeave(p):(s.onItemEnter(p),p.defaultPrevented||p.currentTarget.focus())})),onPointerLeave:Y(e.onPointerLeave,Zt(p=>s.onItemLeave(p))),onFocus:Y(e.onFocus,()=>u(!0)),onBlur:Y(e.onBlur,()=>u(!1))}))))}),Ep=i.forwardRef((e,t)=>{const{checked:n=!1,onCheckedChange:r,...o}=e;return i.createElement(vi,{scope:e.__scopeMenu,checked:n},i.createElement(jr,L({role:"menuitemcheckbox","aria-checked":Mn(n)?"mixed":n},o,{ref:t,"data-state":Lr(n),onSelect:Y(o.onSelect,()=>r?.(Mn(n)?!0:!n),{checkForDefaultPrevented:!1})})))}),Sp="MenuRadioGroup",[oh,_p]=pt(Sp,{value:void 0,onValueChange:()=>{}}),kp="MenuRadioItem",Tp=i.forwardRef((e,t)=>{const{value:n,...r}=e,o=_p(kp,e.__scopeMenu),a=n===o.value;return i.createElement(vi,{scope:e.__scopeMenu,checked:a},i.createElement(jr,L({role:"menuitemradio","aria-checked":a},r,{ref:t,"data-state":Lr(a),onSelect:Y(r.onSelect,()=>{var s;return(s=o.onValueChange)===null||s===void 0?void 0:s.call(o,n)},{checkForDefaultPrevented:!1})})))}),hi="MenuItemIndicator",[vi,Pp]=pt(hi,{checked:!1}),Np=i.forwardRef((e,t)=>{const{__scopeMenu:n,forceMount:r,...o}=e,a=Pp(hi,n);return i.createElement(_t,{present:r||Mn(a.checked)||a.checked===!0},i.createElement(fe.span,L({},o,{ref:t,"data-state":Lr(a.checked)})))}),Op=i.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return i.createElement(fe.div,L({role:"separator","aria-orientation":"horizontal"},r,{ref:t}))}),Ip="MenuSub",[ah,gi]=pt(Ip),In="MenuSubTrigger",Mp=i.forwardRef((e,t)=>{const n=mt(In,e.__scopeMenu),r=qt(In,e.__scopeMenu),o=gi(In,e.__scopeMenu),a=Mr(In,e.__scopeMenu),s=i.useRef(null),{pointerGraceTimerRef:c,onPointerGraceIntentChange:l}=a,d={__scopeMenu:e.__scopeMenu},f=i.useCallback(()=>{s.current&&window.clearTimeout(s.current),s.current=null},[]);return i.useEffect(()=>f,[f]),i.useEffect(()=>{const u=c.current;return()=>{window.clearTimeout(u),l(null)}},[c,l]),i.createElement(di,L({asChild:!0},d),i.createElement(mi,L({id:o.triggerId,"aria-haspopup":"menu","aria-expanded":n.open,"aria-controls":o.contentId,"data-state":bi(n.open)},e,{ref:tn(t,o.onTriggerChange),onClick:u=>{var m;(m=e.onClick)===null||m===void 0||m.call(e,u),!(e.disabled||u.defaultPrevented)&&(u.currentTarget.focus(),n.open||n.onOpenChange(!0))},onPointerMove:Y(e.onPointerMove,Zt(u=>{a.onItemEnter(u),!u.defaultPrevented&&!e.disabled&&!n.open&&!s.current&&(a.onPointerGraceIntentChange(null),s.current=window.setTimeout(()=>{n.onOpenChange(!0),f()},100))})),onPointerLeave:Y(e.onPointerLeave,Zt(u=>{var m;f();const h=(m=n.content)===null||m===void 0?void 0:m.getBoundingClientRect();if(h){var p;const v=(p=n.content)===null||p===void 0?void 0:p.dataset.side,y=v==="right",g=y?-5:5,w=h[y?"left":"right"],$=h[y?"right":"left"];a.onPointerGraceIntentChange({area:[{x:u.clientX+g,y:u.clientY},{x:w,y:h.top},{x:$,y:h.top},{x:$,y:h.bottom},{x:w,y:h.bottom}],side:v}),window.clearTimeout(c.current),c.current=window.setTimeout(()=>a.onPointerGraceIntentChange(null),300)}else{if(a.onTriggerLeave(u),u.defaultPrevented)return;a.onPointerGraceIntentChange(null)}})),onKeyDown:Y(e.onKeyDown,u=>{const m=a.searchRef.current!=="";if(!(e.disabled||m&&u.key===" ")&&dp[r.dir].includes(u.key)){var h;n.onOpenChange(!0),(h=n.content)===null||h===void 0||h.focus(),u.preventDefault()}})})))}),Ap="MenuSubContent",Dp=i.forwardRef((e,t)=>{const n=fi(De,e.__scopeMenu),{forceMount:r=n.forceMount,...o}=e,a=mt(De,e.__scopeMenu),s=qt(De,e.__scopeMenu),c=gi(Ap,e.__scopeMenu),l=i.useRef(null),d=ve(t,l);return i.createElement(Xt.Provider,{scope:e.__scopeMenu},i.createElement(_t,{present:r||a.open},i.createElement(Xt.Slot,{scope:e.__scopeMenu},i.createElement(Ar,L({id:c.contentId,"aria-labelledby":c.triggerId},o,{ref:d,align:"start",side:s.dir==="rtl"?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:f=>{var u;s.isUsingKeyboardRef.current&&((u=l.current)===null||u===void 0||u.focus()),f.preventDefault()},onCloseAutoFocus:f=>f.preventDefault(),onFocusOutside:Y(e.onFocusOutside,f=>{f.target!==c.trigger&&a.onOpenChange(!1)}),onEscapeKeyDown:Y(e.onEscapeKeyDown,f=>{s.onClose(),f.preventDefault()}),onKeyDown:Y(e.onKeyDown,f=>{const u=f.currentTarget.contains(f.target),m=up[s.dir].includes(f.key);if(u&&m){var h;a.onOpenChange(!1),(h=c.trigger)===null||h===void 0||h.focus(),f.preventDefault()}})})))))});function bi(e){return e?"open":"closed"}function Mn(e){return e==="indeterminate"}function Lr(e){return Mn(e)?"indeterminate":e?"checked":"unchecked"}function jp(e){const t=document.activeElement;for(const n of e)if(n===t||(n.focus(),document.activeElement!==t))return}function Lp(e,t){return e.map((n,r)=>e[(t+r)%e.length])}function Fp(e,t,n){const o=t.length>1&&Array.from(t).every(d=>d===t[0])?t[0]:t,a=n?e.indexOf(n):-1;let s=Lp(e,Math.max(a,0));o.length===1&&(s=s.filter(d=>d!==n));const l=s.find(d=>d.toLowerCase().startsWith(o.toLowerCase()));return l!==n?l:void 0}function Vp(e,t){const{x:n,y:r}=e;let o=!1;for(let a=0,s=t.length-1;a<t.length;s=a++){const c=t[a].x,l=t[a].y,d=t[s].x,f=t[s].y;l>r!=f>r&&n<(d-c)*(r-l)/(f-l)+c&&(o=!o)}return o}function Bp(e,t){if(!t)return!1;const n={x:e.clientX,y:e.clientY};return Vp(n,t)}function Zt(e){return t=>t.pointerType==="mouse"?e(t):void 0}const zp=vp,Wp=di,Rp=bp,Hp=xp,Up=Cp,Kp=jr,Gp=Ep,Yp=Tp,Xp=Np,qp=Op,Zp=Mp,Jp=Dp,wi="DropdownMenu",[Qp,ih]=st(wi,[ci]),Oe=ci(),[em,xi]=Qp(wi),tm=e=>{const{__scopeDropdownMenu:t,children:n,dir:r,open:o,defaultOpen:a,onOpenChange:s,modal:c=!0}=e,l=Oe(t),d=i.useRef(null),[f=!1,u]=Ht({prop:o,defaultProp:a,onChange:s});return i.createElement(em,{scope:t,triggerId:wt(),triggerRef:d,contentId:wt(),open:f,onOpenChange:u,onOpenToggle:i.useCallback(()=>u(m=>!m),[u]),modal:c},i.createElement(zp,L({},l,{open:f,onOpenChange:u,dir:r,modal:c}),n))},nm="DropdownMenuTrigger",rm=i.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,disabled:r=!1,...o}=e,a=xi(nm,n),s=Oe(n);return i.createElement(Wp,L({asChild:!0},s),i.createElement(fe.button,L({type:"button",id:a.triggerId,"aria-haspopup":"menu","aria-expanded":a.open,"aria-controls":a.open?a.contentId:void 0,"data-state":a.open?"open":"closed","data-disabled":r?"":void 0,disabled:r},o,{ref:tn(t,a.triggerRef),onPointerDown:Y(e.onPointerDown,c=>{!r&&c.button===0&&c.ctrlKey===!1&&(a.onOpenToggle(),a.open||c.preventDefault())}),onKeyDown:Y(e.onKeyDown,c=>{r||(["Enter"," "].includes(c.key)&&a.onOpenToggle(),c.key==="ArrowDown"&&a.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(c.key)&&c.preventDefault())})})))}),om=e=>{const{__scopeDropdownMenu:t,...n}=e,r=Oe(t);return i.createElement(Rp,L({},r,n))},am="DropdownMenuContent",im=i.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=xi(am,n),a=Oe(n),s=i.useRef(!1);return i.createElement(Hp,L({id:o.contentId,"aria-labelledby":o.triggerId},a,r,{ref:t,onCloseAutoFocus:Y(e.onCloseAutoFocus,c=>{var l;s.current||(l=o.triggerRef.current)===null||l===void 0||l.focus(),s.current=!1,c.preventDefault()}),onInteractOutside:Y(e.onInteractOutside,c=>{const l=c.detail.originalEvent,d=l.button===0&&l.ctrlKey===!0,f=l.button===2||d;(!o.modal||f)&&(s.current=!0)}),style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}}))}),sm=i.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=Oe(n);return i.createElement(Up,L({},o,r,{ref:t}))}),cm=i.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=Oe(n);return i.createElement(Kp,L({},o,r,{ref:t}))}),lm=i.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=Oe(n);return i.createElement(Gp,L({},o,r,{ref:t}))}),dm=i.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=Oe(n);return i.createElement(Yp,L({},o,r,{ref:t}))}),um=i.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=Oe(n);return i.createElement(Xp,L({},o,r,{ref:t}))}),fm=i.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=Oe(n);return i.createElement(qp,L({},o,r,{ref:t}))}),pm=i.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=Oe(n);return i.createElement(Zp,L({},o,r,{ref:t}))}),mm=i.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=Oe(n);return i.createElement(Jp,L({},o,r,{ref:t,style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}}))}),hm=tm,vm=rm,gm=om,yi=im,$i=sm,Ci=cm,Ei=lm,Si=dm,_i=um,ki=fm,Ti=pm,Pi=mm,bm=hm,wm=vm,xm=j.forwardRef(({className:e,inset:t,children:n,...r},o)=>x.jsxs(Ti,{ref:o,className:Q("flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none data-[state=open]:bg-accent focus:bg-accent",t&&"pl-8",e),...r,children:[n,x.jsx(Qs,{className:"ml-auto h-4 w-4"})]}));xm.displayName=Ti.displayName;const ym=j.forwardRef(({className:e,...t},n)=>x.jsx(Pi,{ref:n,className:Q("data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg data-[state=closed]:animate-out data-[state=open]:animate-in",e),...t}));ym.displayName=Pi.displayName;const Ni=j.forwardRef(({className:e,sideOffset:t=4,...n},r)=>x.jsx(gm,{children:x.jsx(yi,{ref:r,sideOffset:t,className:Q("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md","data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-[state=closed]:animate-out data-[state=open]:animate-in",e),...n})}));Ni.displayName=yi.displayName;const Oi=j.forwardRef(({className:e,inset:t,...n},r)=>x.jsx(Ci,{ref:r,className:Q("relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none transition-colors data-[disabled]:pointer-events-none focus:bg-accent focus:text-accent-foreground data-[disabled]:opacity-50",t&&"pl-8",e),...n}));Oi.displayName=Ci.displayName;const Ii=j.forwardRef(({className:e,children:t,checked:n,...r},o)=>x.jsxs(Ei,{ref:o,className:Q("relative flex cursor-default select-none items-center rounded-sm py-1.5 pr-2 pl-8 text-sm outline-none transition-colors data-[disabled]:pointer-events-none focus:bg-accent focus:text-accent-foreground data-[disabled]:opacity-50",e),checked:n,...r,children:[x.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:x.jsx(_i,{children:x.jsx(fo,{className:"h-4 w-4"})})}),t]}));Ii.displayName=Ei.displayName;const $m=j.forwardRef(({className:e,children:t,...n},r)=>x.jsxs(Si,{ref:r,className:Q("relative flex cursor-default select-none items-center rounded-sm py-1.5 pr-2 pl-8 text-sm outline-none transition-colors data-[disabled]:pointer-events-none focus:bg-accent focus:text-accent-foreground data-[disabled]:opacity-50",e),...n,children:[x.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:x.jsx(_i,{children:x.jsx(rc,{className:"h-4 w-4 fill-current"})})}),t]}));$m.displayName=Si.displayName;const Cm=j.forwardRef(({className:e,inset:t,...n},r)=>x.jsx($i,{ref:r,className:Q("px-2 py-1.5 font-semibold text-sm",t&&"pl-8",e),...n}));Cm.displayName=$i.displayName;const Em=j.forwardRef(({className:e,...t},n)=>x.jsx(ki,{ref:n,className:Q("-mx-1 my-1 h-px bg-muted",e),...t}));Em.displayName=ki.displayName;function Sm(e){return x.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",fill:"none",viewBox:"0 0 20 20",...e,children:[x.jsx("title",{children:"Add Row"}),x.jsx("path",{stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.5",d:"M10 6.667v6.666M6.667 10h6.666M6.5 17.5h7c1.4 0 2.1 0 2.635-.273a2.5 2.5 0 001.092-1.092c.273-.535.273-1.235.273-2.635v-7c0-1.4 0-2.1-.273-2.635a2.5 2.5 0 00-1.092-1.093C15.6 2.5 14.9 2.5 13.5 2.5h-7c-1.4 0-2.1 0-2.635.272a2.5 2.5 0 00-1.093 1.093C2.5 4.4 2.5 5.1 2.5 6.5v7c0 1.4 0 2.1.272 2.635a2.5 2.5 0 001.093 1.092C4.4 17.5 5.1 17.5 6.5 17.5z"})]})}function _m(e){return x.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",fill:"none",viewBox:"0 0 20 20",...e,children:[x.jsx("title",{children:"Remove Row"}),x.jsx("path",{stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.5",d:"M13.333 5v-.667c0-.933 0-1.4-.181-1.756a1.667 1.667 0 00-.729-.729c-.356-.181-.823-.181-1.756-.181H9.333c-.933 0-1.4 0-1.756.181-.314.16-.569.415-.729.729-.181.356-.181.823-.181 1.756V5m1.666 4.583v4.167m3.334-4.167v4.167M2.5 5h15m-1.667 0v9.333c0 1.4 0 2.1-.272 2.635a2.5 2.5 0 01-1.093 1.093c-.534.272-1.235.272-2.635.272H8.167c-1.4 0-2.1 0-2.635-.272a2.5 2.5 0 01-1.093-1.093c-.272-.535-.272-1.235-.272-2.635V5"})]})}function km(){const{hasSomeEntireRow:e,emptySize:t,staticRows:n,columns:r,onInsertNewRow:o,onRemoveRow:a,onColumnVisibilityChange:s,onRestoreColumnsVisibility:c}=je(),l=i.useMemo(()=>r.filter(({state:h})=>h.visible),[r]),d=i.useMemo(()=>r.length===l.length,[r.length,l.length]),f="Exibindo todas as colunas",u=`Exibindo ${l.length} de ${r.length} colunas`,m=d?f:u;return x.jsxs("div",{className:"sticky top-0 z-50 flex w-full items-center justify-between rounded-t-md border bg-[#EAF5FF] px-4 py-2.5",children:[x.jsxs("div",{className:"flex items-center gap-6",children:[x.jsx(pn,{delayDuration:25,children:x.jsxs(mn,{children:[x.jsx(hn,{asChild:!0,children:x.jsx(Nn,{disabled:n,size:"icon",variant:"ghost",onClick:o,className:"text-[#4A4A6A] transition-none active:bg-[#0085FF] hover:bg-[#8FD6FF] active:text-white","data-cypress":"table-add-new-row",children:x.jsx(Sm,{})})}),x.jsx(Kt,{children:x.jsx("p",{children:"Inserir linha"})})]})}),x.jsx(pn,{delayDuration:25,children:x.jsxs(mn,{children:[x.jsx(hn,{asChild:!0,children:x.jsx(Nn,{disabled:n||t||!e,size:"icon",variant:"ghost",onClick:a,className:"text-[#4A4A6A] transition-none active:bg-[#0085FF] hover:bg-[#8FD6FF] active:text-white","data-cypress":"table-delete-selected-row",children:x.jsx(_m,{})})}),x.jsx(Kt,{children:x.jsx("p",{children:"Excluir linha(s)"})})]})})]}),x.jsx("div",{className:"flex items-center gap-4",children:x.jsxs(bm,{children:[x.jsx(wm,{"data-cypress":"table-hide-columns-button",asChild:!0,className:"w-56 bg-white",children:x.jsxs(Nn,{variant:"outline",className:"justify-between px-2",children:[x.jsx("span",{className:"text-xs",children:m}),x.jsx(fc,{className:"h-4 w-4"})]})}),x.jsxs(Ni,{className:"w-56",children:[x.jsx(Oi,{disabled:d,onClick:c,className:"justify-between text-xs","data-cypress":"table-restore-columns",children:x.jsx("span",{children:"Reexibir todas as colunas"})}),r.map(({name:h,id:p,alphabetLetter:v,position:y,state:g})=>x.jsxs(Ii,{checked:g.visible,onCheckedChange:w=>s({columnId:p,visible:w}),onSelect:w=>w.preventDefault(),className:"justify-between text-xs","data-cypress":`table-hide-column-${p}`,children:[x.jsx("span",{children:h}),x.jsx("span",{className:"text-[10px] text-neutral-500",children:v})]},`spreadsheet__column__dropdown_checkbox__key__${p}__${y}`))]})]})})]})}function Tm(e){const{className:t,...n}=e;return x.jsx(Vs,{...n,children:x.jsxs(uo.Root,{className:Q(t,"h-full"),children:[x.jsx(km,{}),x.jsxs(uo.Matrix,{className:"scrollbar-thin overflow-y-clip overflow-x-scroll",children:[x.jsx(Hf,{className:"absolute z-50"}),x.jsx(gd,{}),x.jsx(Rf,{})]})]})})}function Pm(e){const{fileName:t="Declaração de viabilidade - Esgoto.pdf",fileSizeInMb:n="8.15MB • Versão 1",onDownload:r,onClick:o,state:a,...s}=e,c=d=>{(a==="Idle"||a==="Finished")&&r(),o?.(d)},l=a==="Disabled";return x.jsxs("button",{className:Q("flex h-[34px] items-center gap-4 rounded-md border border-[#E5E5F4] px-4 text-[#474772] transition-all ease-linear hover:shadow-md","disabled:border-[#E5E5F4] disabled:bg-[#E5E5F4] disabled:text-[#9292BA] disabled:shadow-none"),type:"button",onClick:c,disabled:l,"aria-disabled":l,...s,children:[x.jsxs("div",{className:"flex items-center gap-2",children:[x.jsx(vc,{className:"h-4 w-4 shrink-0"}),x.jsx("p",{className:"whitespace-nowrap font-bold text-[14px]",children:t}),x.jsx("p",{className:"whitespace-nowrap text-[10px]",children:n})]}),a==="Finished"&&x.jsx("div",{className:"flex w-[110px] items-center justify-end",children:x.jsx(pc,{className:"h-4 w-4 text-[#199652]"})}),a==="Loading"&&x.jsx("div",{className:"flex w-[110px] items-center justify-end",children:x.jsx(bc,{className:"h-4 w-4 shrink-0 animate-spin text-[#199652]"})}),x.jsx(Nm,{state:a})]})}function Nm({state:e}){return e==="Disabled"?x.jsxs("div",{className:"flex w-[110px] items-center text-[#9292BA]",children:[x.jsx(ho,{className:"mr-1 h-4 w-4 shrink-0 text-current"}),x.jsx("p",{className:"mr-2 whitespace-nowrap font-bold text-[10px] text-current",children:"Novo Arquivo"}),x.jsx(mo,{className:"h-4 w-4 text-[#9292BA]"})]}):e==="Idle"?x.jsxs("div",{className:"flex w-[110px] items-center text-[#4657E1]",children:[x.jsx(ho,{className:"mr-1 h-4 w-4 shrink-0 text-current"}),x.jsx("p",{className:"mr-2 whitespace-nowrap font-bold text-[10px] text-current",children:"Novo Arquivo"}),x.jsx(mo,{className:"h-4 w-4 text-[#474772]"})]}):null}const Om={Spreadsheet:Tm,FileUploader:Pm};Ge.CapLink=Om,Object.defineProperty(Ge,Symbol.toStringTag,{value:"Module"})});
165
165
  //# sourceMappingURL=index.umd.js.map