1try{let e=typeof window<`u`?window:typeof global<`u`?global:typeof globalThis<`u`?globalThis:typeof self<`u`?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]=`630d4635-6138-4604-bbd5-f3ac17cf4e30`,e._sentryDebugIdIdentifier=`sentry-dbid-630d4635-6138-4604-bbd5-f3ac17cf4e30`)}catch{}import{o as e}from"./_sentry-release-injection-file-BIr0W1zm.js";import{n as t,t as n}from"./jsx-runtime-zj0ecbIi.js";import{A as r,C as i,L as a,N as o,l as s,t as c}from"./icon-0N4IT-9A-C9RTZSFF.js";import{t as l}from"./clsx-BOYpCVEp.js";import{t as u}from"./spinner-BYUvV30h-BZM10UIm.js";import{t as d}from"./text-field-VL8P-7Zp-BpXWdHf_.js";import{t as f}from"./vanilla-extract-dynamic.esm-BAuagCvO.js";import{D as p,T as m,n as h,s as g,y as _}from"./portal-kQkfG3hE-D3Mki3Dc.js";import{$ as v,B as y,C as b,F as x,G as S,H as C,I as w,J as T,K as E,L as D,N as O,Q as k,R as A,S as j,T as M,U as N,V as P,W as F,X as I,Y as L,Z as ee,_t as R,at as te,bt as z,ct as B,dt as V,f as ne,ft as re,gt as ie,h as ae,i as oe,it as se,lt as H,mt as U,n as ce,nt as le,ot as ue,pt as de,q as W,rt as fe,s as pe,st as me,t as he,tt as ge,ut as G,vt as _e,w as ve,xt as ye,yt as be,z as xe}from"./select.utils-Cn6KAhjA-CoH70XCY.js";import{n as Se,r as Ce,t as K}from"./tooltip-BU69zysg-C32z2eE-.js";import{a as q,n as we,r as Te}from"./overlays-23B-WmXX-EMk_dnhZ.js";import{t as Ee}from"./paragraph-BixpUru3-CXFr9Pcp.js";import{t as De}from"./close-button-Dif_IaKr-BL1VpPJT.js";import{t as Oe}from"./plain-button-Bt69GO9T-DsnqpxNp.js";import{t as ke}from"./icon-slot-hDA8RF3F-Ccj8mry9.js";import{t as Ae}from"./esm-D77lSaHy.js";var J=e(t()),Y=n(),X=(0,J.createContext)({});function je(e){let t=(0,J.useRef)(e);return(0,J.useEffect)(()=>{t.current=e}),t}var Me={allowedPlacements:[`top-start`,`top-end`,`bottom-start`,`bottom-end`],padding:we.padding};function Ne(e={}){return{autoPlacement:q(e.autoPlacement,Me),offset:q(e.offset,Te),shift:q(e.shift,we),hide:e.hide??void 0,size:q(e.size,we)}}function Pe(e){return Array.isArray(e.categories)}function Z(e){return e.id??e.label}var Fe=new Set([`icon`,`iconSrc`,`iconColor`,`iconSize`,`label`,`count`,`isActive`,`isDisabled`,`tooltip`,`tooltipPlacement`]),Ie=new Set([`placeholder`,`ariaLabel`,`value`,`size`,`ariaControls`]),Le=new Set(`options.selectedValue.activeValue.isSearchable.searchPlaceholder.searchAriaLabel.searchValue.size.parentId.title.headerMetaComponent.withCloseButton.onClose.categories.activeCategoryId.defaultActiveCategoryId.onCategoryChange.beforeHeaderComponent.headerComponent.beforeBodyComponent.categoriesComponent.detailComponent.detailContext.footerComponent.resultCount.animationTransitionDuration.onLoadMore.isLoadingMore.shouldLoadMore`.split(`.`));function Re(e=[]){let t=0;for(let n of e){let e=n.options;t+=e==null?1:Re(e)}return t}function ze(e){return e.isSearchable===!0||e.title!=null||e.headerMetaComponent!=null||e.withCloseButton===!0||e.headerComponent!=null}function Be(e){return(e.categories?.length??0)>0||e.categoriesComponent!=null}function Ve(e){return Be(e)||e.detailComponent!=null}var He=J.forwardRef(function(e,t){let{className:n,children:i,...a}=e,{restProps:s,sprinkleProps:c}=o(a);return(0,Y.jsx)(r,{className:l(D,n),ref:t,...s,...c,children:i})});He.displayName=`PlumaSelectMenuHeader`;var Q=J.forwardRef(function(e,t){let{name:n,isSelected:i,color:a,size:s,src:c,className:u,...d}=e,{restProps:f,sprinkleProps:p}=o(d,ve),m=a??(i?void 0:`subtle`);return(0,Y.jsx)(r,{className:l(E,u),ref:t,...f,...p,children:(0,Y.jsx)(ke,{name:n,src:c,color:m,size:s})})});Q.displayName=`PlumaSelectMenuOptionIcon`;var Ue=J.forwardRef(function(e,t){return(0,Y.jsx)(Q,{...e,name:`check`,color:`bold`,ref:t})});Ue.displayName=`PlumaSelectMenuOptionSelectedIcon`;var $=J.forwardRef(function(e,t){let{option:{label:n,icon:a,description:s},isSelected:c=!1,optionIconSize:u,className:d,shouldShowDescription:f=!0,labelRef:p,...m}=e,{restProps:h,sprinkleProps:g}=o(m,b),_=(0,J.useContext)(X),v=f&&!i(s),y=_?.props?.iconComponent??Q,{elementBefore:x,elementAfter:w}=e.option,{iconSrc:T,iconColor:E,iconSize:D}=e.option,O=c?(0,Y.jsx)(Ue,{}):null;return(0,Y.jsxs)(r,{className:l(C,d),ref:t,...h,...g,children:[(0,Y.jsxs)(r,{display:`flex`,alignItems:`center`,gap:`050`,overflow:`hidden`,children:[i(T)?a==null?null:(0,Y.jsx)(y,{name:a,color:E,isSelected:c,size:D??u??`md`}):(0,Y.jsx)(Q,{src:T,isSelected:c,size:D??u??`md`}),x==null?null:(0,Y.jsx)(r,{className:S,children:x}),(0,Y.jsxs)(r,{overflow:`hidden`,children:[(0,Y.jsx)(r,{ref:p,truncate:!0,"data-test-pluma-id":`option-label`,children:n}),v?(0,Y.jsx)(Ee,{variant:`secondary`,sizeVariant:`xs`,"data-test-pluma-id":`option-description`,children:s}):null]})]}),w==null?O:(0,Y.jsxs)(r,{className:F,children:[w,O]})]})});$.displayName=`PlumaSelectMenuOptionContent`;var We=(0,J.memo)($),Ge=J.forwardRef(function(e,t){let{option:n,isActive:r,isSelected:i,isDisabled:s,index:c,optionComponent:u=We,labelRef:d,textVariant:f=`product-p`,className:p,onPointerEnter:m,onPointerLeave:h,onFocus:g,...v}=e,{restProps:y,sprinkleProps:b}=o(v,j),x=_(),S=(0,J.useContext)(Ce),C=(0,J.useRef)(!1),w=(0,J.useRef)(!1);function T(e){S!=null&&(C.current=!0),m?.(e)}function E(e){S!=null&&(C.current=!1),h?.(e)}function D(e){C.current===!0&&S!=null&&(S.preventOpenRef.current=`focus`),g?.(e)}return(0,J.useEffect)(()=>
1{if(S==null)return;function t(t){if(t.id===e?.id){if(!w.current){if(C.current===!0)return;S?.floatingContext?.onOpenChange(!0,void 0,`focus`),w.current=!0}}else S?.floatingContext?.onOpenChange(!1,void 0,`focus`),w.current=!1}return x?.events?.on(`virtualfocus`,t),()=>{x?.events?.off(`virtualfocus`,t)}},[x,S,e?.id]),(0,Y.jsx)(Oe,{ref:t,className:l(P,a[f],p),isDisabled:s,onPointerEnter:T,onPointerLeave:E,onFocus:D,...y,...b,children:(0,Y.jsx)(u,{option:n,isSelected:i,isActive:r,labelRef:d})})});Ge.displayName=`PlumaSelectMenuOptionButton`;var Ke=(0,J.memo)($),qe=J.forwardRef(function(e,t){let{tooltip:n,tooltipPlacement:r=`right`,withTruncatedTooltip:i,option:a,isSelected:o,isActive:s,...c}=e,l=(0,J.useRef)(null),[u,d]=(0,J.useState)(!1);function f(e){if(!e){d(!1);return}if(i===!0){if(l.current==null){d(!1);return}d(l.current.scrollWidth>l.current.clientWidth)}else d(!0)}return(0,Y.jsx)(K,{isOpen:u,onOpenChange:f,content:n??a.label,isCustom:!0,placement:r,children:e=>(0,Y.jsx)(Y.Fragment,{children:(0,Y.jsx)(Ge,{labelRef:l,option:a,isSelected:o,isActive:s,ref:m([e.reference.setReference,t]),...e.reference.getReferenceProps(c)})})})}),Je=J.forwardRef(function(e,t){let{option:n,className:r,index:i,level:a,selectedValue:s,activeValue:c,parentsCollapsibleStates:u=[],...d}=e,{restProps:p,sprinkleProps:m}=o(d,M),{value:h,isDisabled:g=!1}=n,_=(0,J.useContext)(X),v=(0,J.useMemo)(()=>_?.state?.activeValue??c??null,[_?.state?.activeValue,c]),b=(0,J.useMemo)(()=>_?.state?.selectedValue??s??null,[_?.state?.selectedValue,s]),x=(0,J.useRef)(null);(0,J.useImperativeHandle)(t,()=>x.current);let S=(0,J.useMemo)(()=>v===h,[v,h]),C=(0,J.useMemo)(()=>Array.isArray(b)?b.includes(h):b===h,[b,h]),w=(0,J.useMemo)(()=>_?.listItem?.getItemProps({onClick:()=>{g||_?.state?.handleSelect(h)},onKeyDown:e=>{g||e.key===`Enter`&&(e.preventDefault(),_?.state?.handleSelect(h))},active:S,selected:C})??{},[_?.listItem?.getItemProps,_?.state?.handleSelect,S,C,g]),T=(0,J.useMemo)(()=>n.value===oe.value,[n.value]),E=(0,J.useMemo)(()=>_?.props?.optionComponent??Ke,[_?.props?.optionComponent]),D=(0,J.useMemo)(()=>_?.props?.optionItemComponent,[_?.props?.optionItemComponent]),{collapsibleParentsCount:O,nonCollapsibleParentsCount:k}=ce(u),j=a+1,P=(0,J.useMemo)(()=>({...w,role:`option`,"aria-selected":C,"aria-current":S,"aria-level":j,tabIndex:S?0:-1,id:`${_?.floatingContext?.floatingId}_option_${h}`}),[w,C,S,j,_?.floatingContext?.floatingId,h]),F=(0,J.useMemo)(()=>f({[xe]:`${j}`,[A]:`${O}`,[y]:`${k}`}),[j,O,k]),I=e=>{x.current=e,_?.list?.elementsRef?.current!=null&&(_.list.elementsRef.current[i]=e)};if(D!=null&&!T)return(0,Y.jsx)(D,{ref:I,option:n,isActive:S,isSelected:C,isDisabled:g,index:i,level:j,collapsibleParentsCount:O,nonCollapsibleParentsCount:k,optionComponent:E,style:F,...P,...p,...m});let L=n.withTruncatedTooltip??_?.props?.withTruncatedTooltip??!1;return(n.tooltip!=null||L===!0)&&!T?(0,Y.jsx)(qe,{ref:I,option:n,tooltip:n.tooltip,tooltipPlacement:n.tooltipPlacement,withTruncatedTooltip:L,isActive:S,isSelected:C,isDisabled:g,optionComponent:E,level:j,collapsibleParentsCount:O,nonCollapsibleParentsCount:k,className:l(r),style:F,...P,...p,...m}):(0,Y.jsx)(Ge,{ref:I,option:n,isActive:S,isSelected:C,isDisabled:g,optionComponent:T?$:E,level:j,collapsibleParentsCount:O,nonCollapsibleParentsCount:k,className:l(T?N:null,r),textVariant:T?`product-h4`:void 0,style:F,...P,...p,...m})});Je.displayName=`PlumaSelectMenuOption`;var Ye=(0,J.memo)(function(e){let{group:t,isActive:n,isSelected:a,isCollapsed:o,optionRef:l,elementsRef:u,index:d,level:p,parentsCollapsibleStates:m,style:h,labelRef:g,..._}=e,{isCollapsible:v}=t,{collapsibleParentsCount:b,nonCollapsibleParentsCount:x}=ce(m);return(0,Y.jsxs)(s,{as:v?`button`:`div`,"data-value":t.value,"aria-selected":v?a:void 0,"aria-current":v?n:void 0,"aria-level":p+1,"aria-expanded":v?!o:void 0,tabIndex:v?n?0:-1:void 0,color:`subtle`,ref:e=>{l.current=e,v&&u?.current!=null&&(u.current[d]=e)},style:{...h,...f({[xe]:`${p+1}`,[A]:`${b}`,[y]:`${x}`})},..._,children:[t.isCollapsible===!0?(0,Y.jsx)(r,{className:E,children:(0,Y.jsx)(c,{name:o?`chevron-right`:`chevron-down`,size:`sm`})}
1):null,t.icon!=null||!i(t.iconSrc)?(0,Y.jsx)(r,{className:E,children:(0,Y.jsx)(ke,{name:t.icon,src:t.iconSrc,color:t.iconColor,size:t.iconSize??`sm`})}):null,(0,Y.jsx)(r,{ref:g,truncate:!0,children:t.label})]})});function Xe(e){let{tooltip:t,tooltipPlacement:n=`right`,withTruncatedTooltip:r,group:i,optionRef:a,...o}=e,s=(0,J.useRef)(null),[c,l]=(0,J.useState)(!1);function u(e){if(!e){l(!1);return}if(r===!0){if(s.current==null){l(!1);return}l(s.current.scrollWidth>s.current.clientWidth)}else l(!0)}let d=t??i.label;return(0,Y.jsx)(K,{isOpen:c,onOpenChange:u,isCustom:!0,placement:n,children:e=>(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(Se,{children:d}),(0,Y.jsx)(Ye,{labelRef:s,optionRef:{get current(){return a.current},set current(t){a.current=t,e.reference.setReference(t)}},group:i,...o,...e.reference.getReferenceProps()})]})})}var Ze=J.forwardRef(function(e,t){let{className:n,group:r,index:i,level:a,selectedValue:o,activeValue:s,parentsCollapsibleStates:c,...u}=e,{isDisabled:d,value:f}=r,p=(0,J.useContext)(X),m=(0,J.useMemo)(()=>p?.state?.activeValue??null,[p?.state?.activeValue]),h=(0,J.useMemo)(()=>p?.state?.selectedValue??null,[p?.state?.selectedValue]),g=(0,J.useRef)(null);(0,J.useImperativeHandle)(t,()=>g.current);let _=p?.state?.groupCollapseState.get(f)??r.defaultIsCollapsed??!1,v=(0,J.useRef)(_);(0,J.useEffect)(()=>{v.current=_},[_]);let y=(0,J.useMemo)(()=>m===f,[m,f]),b=(0,J.useMemo)(()=>Array.isArray(h)?h.includes(f):h===f,[h,f]),S=()=>{p?.state?.toggleGroupCollapseState(f)},C=(0,J.useMemo)(()=>r.isCollapsible?p?.listItem?.getItemProps({onClick:()=>{d||S()},onKeyDown:e=>{d||(e.key===`Enter`&&(e.preventDefault(),S()),e.key===`ArrowRight`&&v.current&&(e.preventDefault(),S()),e.key===`ArrowLeft`&&!v.current&&(e.preventDefault(),S()))},active:y,selected:b})??{}:{},[r.isCollapsible,p?.listItem?.getItemProps,p?.state?.setGroupCollapseState,y,b,d]),T={className:l(x,r.isCollapsible?w:void 0,n),...C,optionRef:g,index:i,level:a,elementsRef:p?.list?.elementsRef,id:f,"aria-disabled":r.
1isCollapsible===!0&&d===!0?!0:void 0,group:r,isActive:y,isSelected:b,isCollapsed:_,parentsCollapsibleStates:c,...u},E=r.withTruncatedTooltip??p?.props?.withTruncatedTooltip??!1;return r.tooltip!=null||E===!0?(0,Y.jsx)(Xe,{tooltip:r.tooltip,tooltipPlacement:r.tooltipPlacement,withTruncatedTooltip:E,...T}):(0,Y.jsx)(Ye,{...T})});Ze.displayName=`PlumaSelectMenuGroupHeader`;var Qe=(0,J.memo)(Je),$e=e=>f({[T]:`${e.size}`,[L]:`${e.start}`}),et=(0,J.memo)(J.forwardRef(function(e,t){let{className:n,renderItems:i={items:[],itemsMap:{}},parentId:a,selectedValue:o,activeValue:s,withVirtualizer:c,virtualizerOptions:d,filteredOptionMeta:p,elementsRef:m,isPositioned:h,onLoadMore:g,isLoadingMore:_=!1,shouldLoadMore:y=!1,...b}=e,x=(0,J.useRef)(null);(0,J.useImperativeHandle)(t,()=>x.current);let S=Ae({estimateSize:()=>36,overscan:5,...d,count:_?i.items.length+1:i.items.length,getScrollElement:()=>x.current,enabled:c}),C=f({[v]:`${S.getTotalSize()??0}`});(0,J.useLayoutEffect)(()=>{if(c&&h&&o!=null){let e=ne(o);if(e!=null){let t=i.itemsMap[e];t!=null&&S.scrollToIndex(t.displayIndex)}}},[h,c]),(0,J.useEffect)(()=>{if(c&&s!=null){let e=i.itemsMap[s];e!=null&&((m?.current??[])[e.index]??S.scrollToIndex(e.displayIndex))}},[c,S,s,i.itemsMap]);let w=(0,J.useRef)(_),T=(0,J.useCallback)(()=>{y&&x.current!=null&&!w.current&&g!=null&&x.current.scrollHeight-x.current.scrollTop-x.current.clientHeight<x.current.clientHeight*1&&(w.current=!0,g())},[y,g,x]),E=(0,J.useRef)(i.items);return(0,J.useLayoutEffect)(()=>{i.items!==E.current&&(w.current=_),h&&x?.current!=null&&!w.current&&y&&g!=null&&x.current.clientHeight===x.current.scrollHeight&&(w.current=!0,g?.()),E.current=i.items},[h,g,_,y,x,i.items]),(0,J.useEffect)(()=>{if(x.current==null||y===!1)return;let e=x.current;return e.addEventListener(`scroll`,T),()=>{e.removeEventListener(`scroll`,T)}},[T,x,y]),(0,Y.jsx)(r,{className:l(I,c?ee:null,n),ref:x,id:`${a}_options`,...b,children:c?(0,Y.jsx)(r,{className:k,style:C,children:S.getVirtualItems().map(e=>{if(e.index>i.items.length-1)return(0,Y.jsx)(r,{display:`flex`,alignItems:`center`,justifyContent:`center`,py:`125`,px:`100`,className:W,style:$e(e),"data-index":e.index,ref:S.measureElement,children:(0,Y.jsx)(u,{"aria-label":`Loading moreâ¦`})},`__virtual_loader`);let t=i.items[e.index];return t.type===`group`?(0,Y.jsx)(Ze,{className:W,style:$e(e),"data-index":e.index,ref:S.measureElement,group:t.option,index:t.index,level:t.level??0,parentsCollapsibleStates:t.parentsCollapsibleStates,selectedValue:o,activeValue:s},t.option.value):(0,Y.jsx)(Qe,{className:W,style:$e(e),"data-index":e.index,ref:S.measureElement,option:t.option,index:t.index,level:t.level??0,parentsCollapsibleStates:t.parentsCollapsibleStates,selectedValue:o,activeValue:s,"aria-setsize":p?.optionCount,"aria-posinset":t.optionIndex+1},t.option.value)})}):(0,Y.jsxs)(Y.Fragment,{children:[i.items.map(e=>e.type===`group`?(0,Y.jsx)(Ze,{group:e.option,index:e.index,level:e.level??0,parentsCollapsibleStates:e.parentsCollapsibleStates,selectedValue:o,activeValue:s},e.option.value):(0,Y.jsx)(Qe,{option:e.option,index:e.index,level:e.level??0,parentsCollapsibleStates:e.parentsCollapsibleStates,selectedValue:o,activeValue:s},e.option.value)),_?(0,Y.jsx)(r,{display:`flex`,alignItems:`center`,justifyContent:`center`,py:`125`,px:`100`,children:(0,Y.jsx)(u,{"aria-label":`Loading moreâ¦`})}):null]})})})),tt=J.forwardRef(function(e,t){let{className:n,options:r,parentId:i,selectedValue:a,activeValue:s,isLoadingMore:c,onLoadMore:l,shouldLoadMore:u,...d}=e,{restProps:f,sprinkleProps:p}=o(d),m=(0,J.useContext)(X),h=(0,J.useMemo)(()=>m?.state?.options??(r==null?[]:he(r)),[m?.state?.options,r]),g=m?.floatingContext?.floatingId??i??``,_=m?.state?.optionMeta,v=m?.state?.filteredOptionMeta,y=m?.state?.groupCollapseState??pe(h,a??null),b=(0,J.useMemo)(()=>ae(h,_,y),[h,_,y]),x=m?.props?.withVirtualizer??!1,S=m?.props?.virtualizerOptions,C;return typeof S==`function`?C=S():S!=null&&(C=S),(0,Y.jsx)(et,{className:n,ref:t,parentId:g,selectedValue:a??m?.state?.selectedValue,activeValue:s??m?.state?.activeValue,renderItems:b,withVirtualizer:x,virtualizerOptions:C,filteredOptionMeta:v,elementsRef:m?.list?.elementsRef,isPositioned:m?.floatingContext?.isPositioned,onLoadMore:l,isLoadingMore:c,shouldLoadMore:u,...f,...p})});tt.displayName=`PlumaSelectMenuOptions`;var nt=J.forwardRef(function(e,t){let{className:n,children:i,...a}=e,{restProps:s,sprinkleProps:c}=o(a);return(0,Y.jsx)(r,{className:l(le,n),ref:t,...s,...c,children:i})});nt.displayName=`PlumaSelectPaletteCategories`;function rt(...e){return t=>{for(let n of e)typeof n==`function`?n(t):n!=null&&(n.current=t)}}var it=J.forwardRef(function(e,t){let{icon:n,iconSrc:r,iconColor:a,iconSize:s,label:c,count:u,isActive:d=!1,isDisabled:f=!1,tooltip:p,tooltipPlacement:m=`right`,className:h,children:g,..._}=e,{restProps:v,sprinkleProps:y}=o(_,Fe),b=e=>{let{ref:i,...o}=e??{};return(0,Y.jsxs)(Oe,{className:l(fe,h),ref:rt(t,i),isDisabled:f,"aria-current":d?`true`:void 0,...v,...y,...o,children:[(0,Y.jsx)(ke,{name:n,src:r,color:a,size:s}),g??(0,Y.jsx)(`span`,{className:H,children:c}),u==null?null:(0,Y.jsx)(`span`,{className:se,children:u.toLocaleStr
1ing()})]})};return i(p)?b():(0,Y.jsx)(K,{isCustom:!0,placement:m,children:e=>(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(Se,{children:p}),b({ref:e.reference.setReference,...e.reference.getReferenceProps()})]})})});it.displayName=`PlumaSelectPaletteCategory`;var at=new Set([`label`,`isCollapsible`,`isCollapsed`,`onToggle`]),ot=J.forwardRef(function(e,t){let{label:n,isCollapsible:i=!1,isCollapsed:a=!1,onToggle:s,className:u,children:d,...f}=e,{restProps:p,sprinkleProps:m}=o(f,at);return(0,Y.jsxs)(r,{className:l(te,u),ref:t,...p,...m,children:[(0,Y.jsxs)(r,{as:i?`button`:`div`,type:i?`button`:void 0,className:l(ue,i?me:null),"aria-expanded":i?!a:void 0,onClick:i?s:void 0,children:[i?(0,Y.jsx)(c,{name:a?`chevron-right`:`chevron-down`,size:`sm`}):null,(0,Y.jsx)(`span`,{className:B,children:n})]}),a?null:d]})});ot.displayName=`PlumaSelectPaletteCategoryGroup`;var st=J.forwardRef(function(e,t){let{className:n,children:i,...a}=e,{restProps:s,sprinkleProps:c}=o(a);return(0,Y.jsx)(r,{className:l(G,n),ref:t,...s,...c,children:i})});st.displayName=`PlumaSelectPaletteDetail`;var ct=J.forwardRef(function(e,t){let{placeholder:n,ariaLabel:r,value:i,size:a,ariaControls:s,...c}=e,{restProps:l}=o(c,Ie);return(0,Y.jsx)(d,{ref:t,ariaLabel:r??`Search`,placeholder:n??`Search`,icon:`search`,value:i,size:a,"aria-controls":s,role:`combobox`,"aria-expanded":`true`,"aria-autocomplete":`list`,"aria-haspopup":`listbox`,...l})});ct.displayName=`PlumaSelectPaletteHeaderSearch`;var lt=J.forwardRef(function(e,t){let{className:n,children:i,as:a=`div`,...s}=e,{restProps:c,sprinkleProps:u}=o(s);return(0,Y.jsx)(r,{as:a,className:l(R,n),ref:t,...c,...u,children:i})});lt.displayName=`PlumaSelectPaletteHeaderTitle`;var ut=new Set([...Le,`searchInputProps`]),dt=J.memo(tt),ft=(0,J.createContext)(null);function pt(){let e=(0,J.useContext)(ft);return e==null?null:(0,Y.jsx)(ct,{...e})}pt.displayName=`PlumaSelectPaletteHeaderSearchSlot`;function mt(e){return e.withSideRegions?e.withContentAboveBody&&e.withFooter?V:e.withContentAboveBody?l(V,de):e.withFooter?l(V,U):l(V,re):null}var ht=J.forwardRef(function(e,t){let{options:n=[],selectedValue:i,activeValue:a,isSearchable:s=!1,searchPlaceholder:c=`Search`,searchAriaLabel:u=`Search`,searchValue:d,searchInputProps:f={},size:p,parentId:m=``,title:h=null,headerMetaComponent:g,withCloseButton:_=!1,onClose:v,categories:y,activeCategoryId:b,defaultActiveCategoryId:x=null,onCategoryChange:S,beforeHeaderComponent:C,headerComponent:w,beforeBodyComponent:T,categoriesComponent:E,detailComponent:D,detailContext:k,footerComponent:A,resultCount:j,onLoadMore:M,isLoadingMore:N,shouldLoadMore:P,className:F,...I}=e,{restProps:L,sprinkleProps:ee}=o(I,ut),R=g,te=w,z=C,B=T,V=E,ne=D,re=A,ae=(0,J.useRef)(b!==void 0),[oe,se]=(0,J.useState)(x),H=(0,J.useCallback)(e=>{ae.current||se(e),S?.(e)},[S,se]),U=ae.current?b??null:oe,[ce,le]=(0,J.useState)(()=>{let e=new Set;for(let t of y??[])Pe(t)&&t.isCollapsible===!0&&t.defaultIsCollapsed===!0&&e.add(Z(t));return e}),ue=(0,J.useCallback)(e=>{le(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},[]),de=(0,J.useCallback)(e=>(0,Y.jsx)(it,{icon:e.icon,iconSrc:e.iconSrc,iconColor:e.iconColor,iconSize:e.iconSize,label:e.label,count:e.count,isActive:e.id===U,isDisabled:e.isDisabled,tooltip:e.tooltip,tooltipPlacement:e.tooltipPlacement,onClick:()=>H(e.id)},e.id),[U,H]),W=n.length>0,fe=W?`${m}_options`:`${m}_no_results`,pe=ze({isSearchable:s,title:h,headerMetaComponent:g,withCloseButton:_,headerComponent:w}),me=Be({categories:y,categoriesComponent:E}),he=Ve({categories:y,categoriesComponent:E,detailComponent:D}),G=(0,J.useCallback)(()=>{v?.()},[v]),ve=(0,J.useMemo)(()=>({ariaLabel:u??`Search`,placeholder:c??`Search`,value:d,size:p,ariaControls:fe,...f}),[u,c,d,p,fe,f]),ye=(0,J.useMemo)(()=>({title:h,isSearchable:s,searchValue:d??``,size:p,onClose:G,searchComponent:pt}),[h,s,d,p,G]),xe=(0,J.useMemo)(()=>({categories:y??[],activeCategoryId:U,onCategoryChange:H}),[y,U,H]),Se=(0,J.useMemo)(()=>({activeOption:k?.activeOption??null,activeIndex:k?.activeIndex??null,isSelected:k?.isSelected??!1,activeCategoryId:U,searchValue:k?.searchValue??d??``}),[k,U,d]),Ce=(0,J.useMemo)(()=>({resultCount:j??Re(n),activeCategoryId:U,searchValue:d??``}),[j,n,U,d]),K=W?(0,Y.jsx)(dt,{options:n,selectedValue:i,activeValue:a,onLoadMore:M,isLoadingMore:N,shouldLoadMore:P}):(0,Y.jsx)(Ee,{id:`${m}_no_results`,role:`region`,"aria-atomic":`true`,"aria-live":`assertive`,p:`100`,children:`No results found.`});return(0,Y.jsxs)(r,{className:l(O,mt({withSideRegions:he,withContentAboveBody:pe||z!=null||B!=null,withFooter:re!=null}),F),ref:t,...L,...ee,children:[z==null?null:(0,Y.jsx)(z,{}),pe?(0,Y.jsx)(He,{children:(0,Y.jsx)(ft.Provider,{value:ve,children:te==null?(0,Y.jsxs)(Y.Fragment,{children:[h!=null||R!=null||_?(0,Y.jsxs)(`div`,{className:_e,children:[h==null?null:(0,Y.jsx)(lt,{children:h}),R==null?null:(0,Y.jsx)(`span`,{className:ie,children:(0,Y.jsx)(R,{})}),_?(0,Y.jsx)(De,{size:`md`,onClick:G}):null]}
1):null,s?(0,Y.jsx)(pt,{}):null]}):(0,Y.jsx)(te,{...ye})})}):null,B==null?null:(0,Y.jsx)(B,{}),he?(0,Y.jsxs)(`div`,{className:ge,children:[me?(0,Y.jsx)(nt,{children:V==null?(y??[]).map(e=>Pe(e)?(0,Y.jsx)(ot,{label:e.label,isCollapsible:e.isCollapsible,isCollapsed:ce.has(Z(e)),onToggle:()=>ue(Z(e)),children:e.categories.map(de)},Z(e)):de(e)):(0,Y.jsx)(V,{...xe})}):null,(0,Y.jsx)(`div`,{className:be,children:K}),ne==null?null:(0,Y.jsx)(st,{children:(0,Y.jsx)(ne,{...Se})})]}):K,re==null?null:(0,Y.jsx)(re,{...Ce})]})});ht.displayName=`PlumaSelectPalette`;var gt=(0,J.createContext)(null);function _t(){let e=(0,J.useContext)(gt),t=e?.headerComponent;return t==null?null:(0,Y.jsx)(t,{selectContext:e.selectContext})}_t.displayName=`PlumaSelectMenuLegacyHeaderSlot`;function vt(){let e=(0,J.useContext)(gt),t=e?.beforeOptionsComponent;return t==null?null:(0,Y.jsx)(t,{selectContext:e.selectContext})}vt.displayName=`PlumaSelectMenuLegacyBeforeOptionsSlot`;function yt(){let e=(0,J.useContext)(gt),t=e?.footerComponent;return t==null?null:(0,Y.jsx)(t,{selectContext:e.selectContext})}yt.displayName=`PlumaSelectMenuLegacyFooterSlot`;var bt=J.forwardRef(function(e,t){let{options:n=[],searchValue:r}=e,i=J.useContext(X),a=i?.props,o=i?.state?.activeValue??e.activeValue,s=i?.state?.selectedValue??e.selectedValue,c=(0,J.useCallback)(()=>{let e=a?.onPaletteClose;if(e!=null){e();return}i?.floatingContext?.onOpenChange(!1)},[a?.onPaletteClose,i?.floatingContext]),l=a?.paletteDetailComponent,u=(0,J.useMemo)(()=>{if(l==null)return;let e=o==null?void 0:i?.state?.optionMeta?.meta?.get(o);return{activeOption:e?.type===`option`?e.option:null,activeIndex:e?.index??null,isSelected:o!=null&&(Array.isArray(s)?s.includes(o):s===o),activeCategoryId:null,searchValue:r??``}},[l,o,i?.state?.optionMeta,s,r]),d=(0,J.useMemo)(()=>(i?.state?.filteredOptionMeta??i?.state?.optionMeta)?.optionCount??n.length,[i?.state?.filteredOptionMeta,i?.state?.optionMeta,n.length]),f=(0,J.useMemo)(()=>({selectContext:i,headerComponent:a?.headerComponent,beforeOptionsComponent:a?.beforeOptionsComponent,footerComponent:a?.footerComponent}),[i,a?.headerComponent,a?.beforeOptionsComponent,a?.footerComponent]),p=a?.paletteFooterComponent??(a?.footerComponent==null?void 0:yt);return(0,Y.jsx)(gt.Provider,{value:f,children:(0,Y.jsx)(ht,{ref:t,...e,options:n,activeValue:o,beforeHeaderComponent:a?.headerComponent==null?void 0:_t,beforeBodyComponent:a?.beforeOptionsComponent==null?void 0:vt,footerComponent:p,title:a?.paletteTitle,headerMetaComponent:a?.paletteHeaderMetaComponent,withCloseButton:a?.withPaletteCloseButton,onClose:c,headerComponent:a?.paletteHeaderComponent,categories:a?.paletteCategories,activeCategoryId:a?.activePaletteCategoryId,defaultActiveCategoryId:a?.defaultActivePaletteCategoryId,onCategoryChange:a?.onPaletteCategoryChange,categoriesComponent:a?.paletteCategoriesComponent,detailComponent:l,detailContext:u,resultCount:d})})});bt.displayName=`PlumaSelectMenu`;var xt=J.forwardRef(function(e,t){let{className:n,floatingFocusManagerModal:r=!1,floatingFocusManagerInitialFocus:i,floatingFocusManagerReturnFocus:a,onLoadMore:s,isLoadingMore:c,shouldLoadMore:u,onOpen:d,onCloseComplete:m,..._}=e,{restProps:v,sprinkleProps:y}=o(_),{floatingContext:b,floating:x,searchInput:S,state:C,props:w}=(0,J.useContext)(X),{unsafe_popoverClassName:T,unsafe_popoverStyle:E,menuAnimationTransitionDuration:D}=w,{isMounted:O,status:k}=p(b,{duration:D}),A=(0,J.useRef)(null);(0,J.useImperativeHandle)(t,()=>A.current);let j=(0,J.useCallback)(e=>{e.key===`Enter`&&C.activeValue!=null&&(e.preventDefault(),C.handleSelect(C.activeValue))},[C.handleSelect,C.activeValue]),M=(0,J.useCallback)(e=>{S.onSearchInput(e)},[S.onSearchInput]),N=(0,J.useRef)(null),P=(0,J.useMemo)(()=>{let{ref:e,...t}=S.getInputProps({onKeyDown:j,onInput:M});return{...t,ref:rt(e,N)}},[S.getInputProps,j,M]),F=(0,J.useRef)(k);return(0,J.useEffect)(()=>{k===`open`&&F.current===`initial`&&d?.(),k===`unmounted`&&F.current===`close`&&m?.(),F.current=k},[d,m,k]),O?(0,Y.jsx)(h,{shouldUseFloatingPortal:!0,children:(0,Y.jsx)(g,{context:b,modal:r,initialFocus:i??(w.isSearchable===!0?N:void 0),returnFocus:a,children:(0,Y.jsx)(`div`,{ref:e=>{x.setFloating(e),A.current=e},style:{...x.styles,...E??{}},...y,...x.getFloatingProps(v),className:l(z,n,T),children:(0,Y.jsx)(bt,{options:C.options,animationTransitionDuration:D,parentId:b.floatingId,isSearchable:w.isSearchable,searchPlaceholder:w.searchPlaceholder,searchAriaLabel:w.searchAriaLabel,searchValue:S.searchValue,searchInputProps:P,size:w.size,onLoadMore:s,isLoadingMore:c,shouldLoadMore:u,"data-status":k,"data-placement":b.placement,style:f({[ye]:`${D}ms`})})})})}):null});xt.displayName=`PlumaSelectPopover`;export{xt as a,je as c,Ue as i,He as n,Ve as o,$ as r,Ne as s,X as t}; 2//# sourceMappingURL=popover-CjxSO-UI-N6rVOJsj.js.map
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.