@bazza-ui/react 0.1.0-canary.15 → 0.1.0-canary.16

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.
Files changed (44) hide show
  1. package/dist/chunk-3HMQLMSF.js +2 -0
  2. package/dist/chunk-3HMQLMSF.js.map +1 -0
  3. package/dist/chunk-MPPIEWSL.js +2 -0
  4. package/dist/chunk-MPPIEWSL.js.map +1 -0
  5. package/dist/chunk-PCNHYMD6.cjs +2 -0
  6. package/dist/chunk-PCNHYMD6.cjs.map +1 -0
  7. package/dist/chunk-RTG6U56O.cjs +2 -0
  8. package/dist/chunk-RTG6U56O.cjs.map +1 -0
  9. package/dist/combobox/index.cjs +1 -1
  10. package/dist/combobox/index.cjs.map +1 -1
  11. package/dist/combobox/index.js +1 -1
  12. package/dist/combobox/index.js.map +1 -1
  13. package/dist/command-menu/index.cjs +1 -1
  14. package/dist/command-menu/index.cjs.map +1 -1
  15. package/dist/command-menu/index.js +1 -1
  16. package/dist/command-menu/index.js.map +1 -1
  17. package/dist/context-menu/index.cjs +1 -1
  18. package/dist/context-menu/index.cjs.map +1 -1
  19. package/dist/context-menu/index.js +1 -1
  20. package/dist/context-menu/index.js.map +1 -1
  21. package/dist/dropdown-menu/index.cjs +1 -1
  22. package/dist/dropdown-menu/index.cjs.map +1 -1
  23. package/dist/dropdown-menu/index.js +1 -1
  24. package/dist/dropdown-menu/index.js.map +1 -1
  25. package/dist/internal/popup-menu/index.cjs +1 -1
  26. package/dist/internal/popup-menu/index.cjs.map +1 -1
  27. package/dist/internal/popup-menu/index.js +1 -1
  28. package/dist/kbd/index.cjs +1 -1
  29. package/dist/kbd/index.cjs.map +1 -1
  30. package/dist/kbd/index.js +1 -1
  31. package/dist/kbd/index.js.map +1 -1
  32. package/dist/select/index.cjs +1 -1
  33. package/dist/select/index.cjs.map +1 -1
  34. package/dist/select/index.js +1 -1
  35. package/dist/select/index.js.map +1 -1
  36. package/dist/video-player/index.cjs +2 -2
  37. package/dist/video-player/index.cjs.map +1 -1
  38. package/dist/video-player/index.js +2 -2
  39. package/dist/video-player/index.js.map +1 -1
  40. package/package.json +1 -1
  41. package/dist/chunk-BEWVWSAW.cjs +0 -2
  42. package/dist/chunk-BEWVWSAW.cjs.map +0 -1
  43. package/dist/chunk-EDZTZHQ4.js +0 -2
  44. package/dist/chunk-EDZTZHQ4.js.map +0 -1
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }var _chunk5T5B5SPRcjs = require('../chunk-5T5B5SPR.cjs');var _chunkBEWVWSAWcjs = require('../chunk-BEWVWSAW.cjs');var _chunkXMZZ62VJcjs = require('../chunk-XMZZ62VJ.cjs');var _chunkM4G6J7DPcjs = require('../chunk-M4G6J7DP.cjs');var zo={};_chunkM4G6J7DPcjs.a.call(void 0, zo,{Arrow:()=>_chunkBEWVWSAWcjs.s,Backdrop:()=>_chunkBEWVWSAWcjs.t,Clear:()=>Me,Empty:()=>_chunkBEWVWSAWcjs.V,Group:()=>_chunkBEWVWSAWcjs.ra,GroupLabel:()=>_chunkBEWVWSAWcjs.X,Icon:()=>_chunkBEWVWSAWcjs.U,Input:()=>we,InputWrapper:()=>ke,Item:()=>Te,ItemIndicator:()=>He,ItemLabel:()=>Oe,List:()=>_chunkBEWVWSAWcjs.ca,Popup:()=>_chunkBEWVWSAWcjs.K,Portal:()=>_chunkBEWVWSAWcjs.L,Positioner:()=>De,Root:()=>Ae,ScrollDownArrow:()=>_chunkBEWVWSAWcjs.fa,ScrollUpArrow:()=>_chunkBEWVWSAWcjs.ea,Separator:()=>_chunkBEWVWSAWcjs.ua,Surface:()=>Fe,useComboboxPositionerContext:()=>Ee});var _userender = require('@base-ui/react/use-render');var _react = require('react'); var _ = _interopRequireWildcard(_react); var xe = _interopRequireWildcard(_react); var ne = _interopRequireWildcard(_react); var Ce = _interopRequireWildcard(_react); var se = _interopRequireWildcard(_react); var T = _interopRequireWildcard(_react); var re = _interopRequireWildcard(_react); var E = _interopRequireWildcard(_react); var le = _interopRequireWildcard(_react); var Ie = _interopRequireWildcard(_react); var Y = _interopRequireWildcard(_react); var U = _interopRequireWildcard(_react); var h = _interopRequireWildcard(_react); var Z = _interopRequireWildcard(_react);var ko={slot:"bazzaui-combobox-clear"};var Me=_.forwardRef(function(e,o){let{keepMounted:i=!1,disabled:u,render:s,className:p,style:c,onClick:a,onPointerDown:t,...P}=e,m=_chunkBEWVWSAWcjs.w.call(void 0, ),b=_nullishCoalesce(u, () => (m.disabled)),I=m.multiple?m.values.length>0:m.value!=="",d=_.useCallback(R=>{_optionalChain([a, 'optionalCall', _2 => _2(R)]),!R.defaultPrevented&&(m.multiple?m.onValuesChange([]):m.onValueChange(""),m.onInputValueChange(""))},[a,m]),g=_.useCallback(R=>{R.preventDefault(),_optionalChain([t, 'optionalCall', _3 => _3(R)])},[t]),l=_.useMemo(()=>({hasValue:I,disabled:b}),[I,b]),S=_userender.useRender.call(void 0, {render:s,ref:o,state:l,props:{...P,[ko.slot]:"",type:"button",tabIndex:-1,"aria-label":"Clear selection",disabled:b||!I,className:p,style:c,onClick:d,onPointerDown:g},enabled:i||I,defaultTagName:"button"});return!i&&!I?null:S});var fe=xe.createContext(null);function Ee(){return xe.useContext(fe)}var Le=Ce.createContext(!1);function To(){return Ce.useContext(Le)}var Q={slot:"bazzaui-combobox-input",open:"data-open",closed:"data-closed",disabled:"data-disabled",placeholder:"data-placeholder"};function Ho(x){let{comboboxContext:e,open:o}=x,i=e.multiple?e.values.length>0:!_chunkBEWVWSAWcjs.R.call(void 0, e.value),u=se.useCallback(c=>{let a=_chunkBEWVWSAWcjs.T.call(void 0, c,e.itemToStringValue),t=e.itemTextRegistry.get(a);if(t!==void 0)return t;let P=_chunk5T5B5SPRcjs.f.call(void 0, e.items,a);if(typeof P=="string")return P;let m=_chunkBEWVWSAWcjs.S.call(void 0, c,e.itemToStringLabel);if(m&&m!==a)return m},[e.itemTextRegistry,e.items,e.itemToStringLabel,e.itemToStringValue]),s=se.useMemo(()=>{if(!i)return"";if(e.multiple){let t=e.values.map(P=>{let m=u(P);return m!==void 0?m:_chunkBEWVWSAWcjs.S.call(void 0, P,e.itemToStringLabel)||_chunkBEWVWSAWcjs.T.call(void 0, P,e.itemToStringValue)}).filter(Boolean);return t.length<=2?t.join(", "):`${t.length} selected`}let c=e.value;if(c==null)return"";let a=u(c);return a!==void 0?a:_chunkBEWVWSAWcjs.S.call(void 0, c,e.itemToStringLabel)||_chunkBEWVWSAWcjs.T.call(void 0, c,e.itemToStringValue)},[i,e.multiple,e.value,e.values,e.itemToStringLabel,e.itemToStringValue,u]),p=se.useMemo(()=>o?e.inputValue:s,[o,s,e.inputValue]);return{hasValue:i,displayValue:p,selectedLabel:s,getValueText:u}}function Oo(x){let{comboboxContext:e,store:o,focusOwnerStore:i,open:u,disabled:s,cursorBehavior:p,hasValue:c,getValueText:a,onFocus:t,onBlur:P,onClick:m,onKeyDown:b}=x,I=T.useRef(!1),d=T.useRef(!1),g=T.useRef(!1),l=T.useRef(null),S=T.useRef(null),R=T.useRef(null);T.useEffect(()=>{if(!u)return;let n=f=>{let r=e.inputRef.current,v=e.inputWrapperRef.current,y=document.getElementById(e.listId),O=f.target,W=_optionalChain([r, 'optionalAccess', _4 => _4.contains, 'call', _5 => _5(O)]),z=_optionalChain([v, 'optionalAccess', _6 => _6.contains, 'call', _7 => _7(O)]),ee=_optionalChain([y, 'optionalAccess', _8 => _8.contains, 'call', _9 => _9(O)]);!W&&!z&&!ee&&(R.current=f)};return document.addEventListener("pointerdown",n,!0),()=>{document.removeEventListener("pointerdown",n,!0),R.current=null}},[u,e.inputRef,e.inputWrapperRef,e.listId]),T.useLayoutEffect(()=>{let n=e.inputRef.current;if(n&&u&&S.current){let{start:f,end:r}=S.current,v=n.selectionStart,y=n.value.length;v===y&&f!==y&&n.setSelectionRange(f,r),S.current=null}});let L=T.useRef(u);T.useLayoutEffect(()=>{if(u&&!L.current){if(I.current){I.current=!1,L.current=u;return}if(g.current){g.current=!1,d.current=!1,l.current=null,L.current=u;return}if(d.current&&p==="none"){let f=e.inputRef.current,r=l.current;f&&r!==null&&requestAnimationFrame(()=>{let v=f.value.length,y=Math.min(r,v);f.setSelectionRange(y,y)}),d.current=!1,l.current=null,L.current=u;return}c&&e.multiple&&e.onInputValueChange("");let n=e.inputRef.current;if(n){let f=n.value.length;p==="select-all"&&f>0?requestAnimationFrame(()=>{n.setSelectionRange(0,n.value.length)}):p==="end"&&f>0&&requestAnimationFrame(()=>{n.setSelectionRange(n.value.length,n.value.length)})}}L.current=u},[u,e,c,p]);let w=T.useCallback(n=>{let f=n.target,r=f.value,v=f.selectionStart,y=f.selectionEnd;v!==null&&y!==null&&(S.current={start:v,end:y}),e.onInputValueChange(r),e.setFilterActive(),o.setSearch(r),o.state.open||(I.current=!0,e.openCombobox())},[e,o]),k=T.useCallback(n=>{if(_optionalChain([t, 'optionalCall', _10 => _10(n)]),n.defaultPrevented)return;let f=o.state.open;if(f&&(g.current=!0),e.openOnFocus&&!s&&!f){if(c&&!e.multiple){let r=_nullishCoalesce(a(e.value), () => (_chunkBEWVWSAWcjs.S.call(void 0, e.value,e.itemToStringLabel)));e.onInputValueChange(r)}e.openCombobox()}},[t,e,s,o,c,a]),V=T.useCallback(n=>{_optionalChain([P, 'optionalCall', _11 => _11(n)]),!n.defaultPrevented&&requestAnimationFrame(()=>{let f=document.activeElement,v=_optionalChain([document, 'access', _12 => _12.getElementById, 'call', _13 => _13(e.listId), 'optionalAccess', _14 => _14.contains, 'call', _15 => _15(f)]),y=f===e.inputRef.current;if(!v&&!y){g.current=!1;let O=R.current,W=O?_chunkXMZZ62VJcjs.a.outsidePress:_chunkXMZZ62VJcjs.a.focusOut;R.current=null,e.closeCombobox(W,_nullishCoalesce(O, () => (void 0)))}})},[P,e]),A=T.useCallback(n=>{if(_optionalChain([m, 'optionalCall', _16 => _16(n)]),n.defaultPrevented)return;let f=o.state.open;if(!s&&!f){let r=n.target;if(p==="none"){let v=r.selectionStart;l.current=v,d.current=!0}if(c&&!e.multiple){let v=_nullishCoalesce(a(e.value), () => (_chunkBEWVWSAWcjs.S.call(void 0, e.value,e.itemToStringLabel)));e.onInputValueChange(v)}e.openCombobox()}else f&&(g.current=!0)},[m,e,s,o,p,c,a]),K=T.useCallback(n=>{if(_optionalChain([b, 'optionalCall', _17 => _17(n)]),!n.defaultPrevented){if(u&&n.key==="Escape"){n.preventDefault(),e.closeCombobox(_chunkXMZZ62VJcjs.a.escapeKey);return}if(!u&&(n.key==="ArrowDown"||n.key==="ArrowUp"||n.key==="Enter")){if(n.preventDefault(),c&&!e.multiple){let f=_nullishCoalesce(a(e.value), () => (_chunkBEWVWSAWcjs.S.call(void 0, e.value,e.itemToStringLabel)));e.onInputValueChange(f)}e.openCombobox();return}}},[u,e,b,c,a]),{handleKeyDown:j}=_chunkBEWVWSAWcjs.Q.call(void 0, {store:o,surfaceId:"combobox-input",focusOwnerStore:i,depth:0,submenuContext:null,subpageContext:null,enabled:u,enableTypeToSearch:!1,onKeyDown:K,closeAll:e.closeCombobox,skipFocusOwnerCheck:!0});return{handleChange:w,handleFocus:k,handleBlur:V,handleClick:A,handleKeyDown:j,selectionRef:S}}var we=ne.forwardRef(function(e,o){let{placeholder:i,disabled:u,cursorBehavior:s="none",render:p,className:c,style:a,onFocus:t,onBlur:P,onClick:m,onKeyDown:b,...I}=e,d=_chunkBEWVWSAWcjs.w.call(void 0, ),g=_chunkBEWVWSAWcjs.d.call(void 0, ),l=_chunkBEWVWSAWcjs.a.call(void 0, ),S=To(),R=(_nullishCoalesce(u, () => (d.disabled)))||g.disabled,L=_chunk5T5B5SPRcjs.f.call(void 0, d.items,""),w=_nullishCoalesce(_nullishCoalesce(i, () => ((typeof L=="string"?L:void 0))), () => (d.placeholder)),k=g.store.useState("open"),{hasValue:V,displayValue:A,getValueText:K}=Ho({comboboxContext:d,open:k}),{handleChange:j,handleFocus:n,handleBlur:f,handleClick:r,handleKeyDown:v}=Oo({comboboxContext:d,store:g.store,focusOwnerStore:l,open:k,disabled:R,cursorBehavior:s,hasValue:V,getValueText:K,onFocus:t,onBlur:P,onClick:m,onKeyDown:b}),y={[Q.slot]:""};k?y[Q.open]="":y[Q.closed]="",R&&(y[Q.disabled]=""),V||(y[Q.placeholder]=""),d.layout==="input-embedded"&&(y["data-input-embedded"]="");let O=ne.useCallback(M=>{d.setInputElement(M),typeof o=="function"?o(M):o&&(o.current=M)},[o,d]),W=ne.useMemo(()=>({open:k,disabled:R,placeholder:!V}),[k,R,V]),z=d.layout==="input-embedded"&&!S?{position:"relative",zIndex:1}:void 0;return _userender.useRender.call(void 0, {render:p,ref:O,state:W,props:{...I,...y,type:"text",role:"combobox","aria-autocomplete":"list","aria-expanded":k,"aria-controls":d.listId,"aria-haspopup":"listbox",autoComplete:"off",autoCorrect:"off",spellCheck:!1,disabled:R,placeholder:V?void 0:w,className:c,style:{...z,...a},value:A,onChange:j,onFocus:n,onBlur:f,onClick:r,onKeyDown:v},defaultTagName:"input"})});var ge={slot:"bazzaui-combobox-input-wrapper",open:"data-open"};var _jsxruntime = require('react/jsx-runtime');var Rt={open:x=>x?{[ge.open]:""}:null},ke= exports.ComboboxInputWrapper =re.forwardRef(function(e,o){let{render:i,className:u,style:s,children:p,...c}=e,{store:a}=_chunkBEWVWSAWcjs.d.call(void 0, ),t=_chunkBEWVWSAWcjs.w.call(void 0, ),P=a.useState("open"),m=re.useMemo(()=>({open:P}),[P]),b=t.layout==="input-embedded"?{position:"relative",zIndex:1}:{position:"relative"},I=re.useCallback(g=>{t.setInputWrapperElement(g),typeof o=="function"?o(g):o&&(o.current=g)},[o,t]),d=_userender.useRender.call(void 0, {render:i,ref:I,state:m,stateAttributesMapping:Rt,props:{...c,[ge.slot]:"",className:u,style:{...b,...s},children:p},defaultTagName:"div"});return _jsxruntime.jsx.call(void 0, Le.Provider,{value:!0,children:d})});var q={slot:"bazzaui-combobox-item",highlighted:"data-highlighted",disabled:"data-disabled",selected:"data-selected",first:"data-first",last:"data-last",firstInGroup:"data-first-in-group",lastInGroup:"data-last-in-group"};var he=le.createContext(null);function ue(){let x=le.useContext(he);if(!x)throw new Error("ComboboxItem child components must be used within a Combobox.Item");return x}function yt(){return le.useContext(he)}var Vt={highlighted:x=>x?{[q.highlighted]:""}:null,disabled:x=>x?{[q.disabled]:""}:null,selected:x=>x?{[q.selected]:""}:null,first:x=>x?{[q.first]:""}:null,last:x=>x?{[q.last]:""}:null,firstInGroup:x=>x?{[q.firstInGroup]:""}:null,lastInGroup:x=>x?{[q.lastInGroup]:""}:null};function Mt(x,e){let{value:o,textValue:i,keywords:u,disabled:s=!1,onSelect:p,forceMount:c=!1,render:a,className:t,style:P,onClick:m,onPointerDown:b,onPointerMove:I,children:d,...g}=x,l=_chunkBEWVWSAWcjs.w.call(void 0, ),S=E.useMemo(()=>_chunkBEWVWSAWcjs.T.call(void 0, o,l.itemToStringValue),[o,l.itemToStringValue]),R=E.useId(),L=o===null?`combobox-clear-${R}`:void 0,w=E.useMemo(()=>_chunk5T5B5SPRcjs.e.call(void 0, l.items,S),[l.items,S]),k=_optionalChain([w, 'optionalAccess', _18 => _18.label]),V=E.useMemo(()=>_chunkBEWVWSAWcjs.S.call(void 0, o,l.itemToStringLabel),[o,l.itemToStringLabel]),A=E.useMemo(()=>{if(i!==void 0)return i;if(typeof k=="string")return k;if(V&&V!==S)return V},[i,k,V,S]),K=E.useMemo(()=>_chunk5T5B5SPRcjs.g.call(void 0, u,[typeof k=="string"?k:V&&V!==S?V:void 0,..._nullishCoalesce(_optionalChain([w, 'optionalAccess', _19 => _19.keywords]), () => ([]))]),[u,k,V,S,w]),j=E.useRef(A),n=l.multiple?_chunk5T5B5SPRcjs.c.call(void 0, l.values,o,l.isItemEqualToValue):l.value!==""&&_chunk5T5B5SPRcjs.b.call(void 0, l.value,o,l.isItemEqualToValue),f=l.closeOnSelect,r=_chunkBEWVWSAWcjs.P.call(void 0, {id:L,value:S,keywords:K,disabled:s,forceMount:c,closeOnClick:f,children:d});E.useEffect(()=>{let M=()=>{if(!s){if(l.multiple)if(o==null)l.onValuesChange([]);else{let me=n?_chunk5T5B5SPRcjs.d.call(void 0, l.values,o,l.isItemEqualToValue):[...l.values,o];l.onValuesChange(me)}else l.onValueChange(o);_optionalChain([p, 'optionalCall', _20 => _20()])}};return r.registerSelect(M)},[s,l,o,n,p,r]),E.useEffect(()=>{let M=j.current;if(M)return l.registerItemText(S,M)},[S,l]),E.useEffect(()=>{!A&&typeof d=="string"&&(j.current=d,l.registerItemText(S,d))},[d,A,S,l]);let v=E.useMemo(()=>({highlighted:r.isHighlighted,disabled:s,selected:n,first:r.positional.first,last:r.positional.last,firstInGroup:r.positional.firstInGroup,lastInGroup:r.positional.lastInGroup}),[r.isHighlighted,s,n,r.positional]),y=E.useMemo(()=>({id:r.id,value:o,textValue:A,highlighted:r.isHighlighted,disabled:s,selected:n}),[r.id,o,A,r.isHighlighted,s,n]),O=E.useCallback(M=>{_optionalChain([m, 'optionalCall', _21 => _21(M)]),M.defaultPrevented||r.handlers.onClick(M)},[m,r.handlers]),W=E.useCallback(M=>{r.handlers.onPointerDown(M),_optionalChain([b, 'optionalCall', _22 => _22(M)])},[r.handlers,b]),z=E.useCallback(M=>{_optionalChain([I, 'optionalCall', _23 => _23(M)]),M.defaultPrevented||r.handlers.onPointerMove(M)},[I,r.handlers]),ee=_userender.useRender.call(void 0, {render:a,ref:[r.ref,r.rowRef,e],state:v,stateAttributesMapping:Vt,props:{...g,[q.slot]:"",id:r.id,role:"option",tabIndex:-1,"aria-selected":n,"aria-disabled":s||void 0,className:t,style:P,onClick:O,onPointerMove:z,onPointerDown:W,children:d},enabled:r.isVisible,defaultTagName:"div"});return r.isVisible?_jsxruntime.jsx.call(void 0, he.Provider,{value:y,children:ee}):null}var Te=E.forwardRef(Mt);var Pe={slot:"bazzaui-combobox-item-indicator",selected:"data-selected"};var wt={selected:x=>x?{[Pe.selected]:""}:null},He= exports.ComboboxItemIndicator =Ie.forwardRef(function(e,o){let{keepMounted:i=!1,render:u,className:s,style:p,...c}=e,a=ue(),t=Ie.useMemo(()=>({selected:a.selected}),[a.selected]),P=_userender.useRender.call(void 0, {render:u,ref:o,state:t,stateAttributesMapping:wt,props:{...c,[Pe.slot]:"","aria-hidden":!0,className:s,style:p},enabled:i||a.selected,defaultTagName:"span"});return!i&&!a.selected?null:P});var Do={slot:"bazzaui-combobox-item-label"};var Oe=Y.forwardRef(function(e,o){let{render:i,className:u,style:s,children:p,...c}=e,a=_chunkBEWVWSAWcjs.w.call(void 0, ),t=ue(),P=_chunkBEWVWSAWcjs.T.call(void 0, t.value,a.itemToStringValue),m=Y.useMemo(()=>{if(p!==void 0)return p;let I=_chunk5T5B5SPRcjs.f.call(void 0, a.items,P);return I!==void 0?I:t.textValue!==void 0?t.textValue:P},[p,a.items,P,t.textValue]),b=Y.useMemo(()=>({value:P,selected:t.selected,highlighted:t.highlighted,disabled:t.disabled}),[P,t.selected,t.highlighted,t.disabled]);return Y.useEffect(()=>{if(typeof m=="string")return a.registerItemText(P,m)},[m,a,P]),_userender.useRender.call(void 0, {render:i,ref:o,state:b,props:{...c,[Do.slot]:"",className:u,style:s,children:m},defaultTagName:"span"})});var _popover = require('@base-ui/react/popover');var Re={slot:"bazzaui-combobox-positioner"};function Tt(x,e,o,i){let u=o+i*2;if(x==="top"){let c=-(e+i),a=e+i;return{width:u,marginBottom:c,paddingTop:i,paddingLeft:i,paddingRight:i,paddingBottom:a}}let s=-(e+i),p=e+i;return{width:u,marginTop:s,paddingTop:p,paddingLeft:i,paddingRight:i,paddingBottom:i}}var De=U.forwardRef(function(e,o){let{layout:i,popupPadding:u=8,side:s="bottom",align:p,sideOffset:c=4,anchor:a,className:t,style:P,children:m,...b}=e,I=_chunkBEWVWSAWcjs.w.call(void 0, ),d=_nullishCoalesce(i, () => (I.layout)),g=d==="input-embedded",l=_nullishCoalesce(a, () => (I.inputWrapperRef.current))?I.inputWrapperRef:I.inputRef,S=g?0:c,R=g?"center":_nullishCoalesce(p, () => ("start")),{inputHeight:L,inputWidth:w}=I,k=w+u*2,V={...P,...g?{zIndex:0}:{}};if(g)return _jsxruntime.jsx.call(void 0, _popover.Popover.Positioner,{ref:o,side:s,align:R,sideOffset:S,anchor:l,className:t,style:V,"data-input-embedded":"",[Re.slot]:"",...b,render:(n,f)=>{let r=f.side,v={layout:d,side:r,align:f.align,inputHeight:I.inputHeight},y={"--combobox-input-height":`${L}px`,"--combobox-input-width":`${w}px`,"--combobox-popup-padding":`${u}px`,"--combobox-popup-width":`${k}px`},O=Tt(r,L,w,u),W=U.Children.map(m,z=>U.isValidElement(z)?U.cloneElement(z,{style:{...O,...z.props.style},"data-side":r}):z);return _jsxruntime.jsx.call(void 0, fe.Provider,{value:v,children:_jsxruntime.jsx.call(void 0, "div",{...n,style:{...n.style,...y},"data-side":r,children:W})})}});let A={layout:d,side:s,align:R,inputHeight:I.inputHeight},K={"--combobox-input-height":`${L}px`,"--combobox-input-width":`${w}px`},j={...V,...K};return _jsxruntime.jsx.call(void 0, fe.Provider,{value:A,children:_jsxruntime.jsx.call(void 0, _popover.Popover.Positioner,{ref:o,side:s,align:R,sideOffset:S,anchor:l,className:t,style:j,[Re.slot]:"",...b,children:m})})});function Ae(x){let{open:e,onOpenChange:o,actionsRef:i,defaultOpen:u=!1,value:s,defaultValue:p,onValueChange:c,multiple:a=!1,values:t,defaultValues:P,onValuesChange:m,isItemEqualToValue:b=_chunk5T5B5SPRcjs.a,itemToStringLabel:I,itemToStringValue:d,inputValue:g,defaultInputValue:l="",onInputValueChange:S,name:R,form:L,required:w,disabled:k=!1,placeholder:V="Search...",items:A,modal:K=!1,closeOnSelect:j,openOnFocus:n=!0,virtualized:f=!1,virtualItems:r,onHighlightChange:v,layout:y="floating",onOpenChangeComplete:O,debug:W,children:z,...ee}=x,M=h.useCallback((C,H,G,be)=>_optionalChain([v, 'optionalCall', _24 => _24(C,G,be)]),[v]),me=h.useId(),ce=h.useRef(null),Se=h.useRef(null),[ze,Be]=h.useState(0),[We,je]=h.useState(0),Ge=h.useCallback(C=>{if(ce.current=C,C&&!Se.current){let H=C.getBoundingClientRect();Be(H.height),je(H.width)}},[]),Ne=h.useCallback(C=>{if(Se.current=C,C){let H=C.getBoundingClientRect();Be(H.height),je(H.width)}},[]),{store:B,focusOwnerStore:$o,openChainStore:Jo,registerSurface:Xo,closeAll:_o,virtualization:Qo,handleOpenChange:qe,disabled:$,setDisabled:Ke,menuTreeResolver:Yo}=_chunkBEWVWSAWcjs.q.call(void 0, {onOpenChange:o,defaultOpen:u,virtualized:f,items:r,onHighlightChange:M,disabled:k}),ye=h.useRef(null);h.useImperativeHandle(i,()=>({close:()=>{_optionalChain([ye, 'access', _25 => _25.current, 'optionalAccess', _26 => _26.close, 'call', _27 => _27()])},unmount:()=>{_optionalChain([ye, 'access', _28 => _28.current, 'optionalAccess', _29 => _29.unmount, 'call', _30 => _30()])},setDisabled:Ke}),[Ke]),B.useControlledProp("openProp",e);let Zo=B.useState("open"),Ue=h.useCallback((C,H,G)=>{$&&H!==_chunkXMZZ62VJcjs.a.imperativeAction||!C&&ce.current&&document.activeElement===ce.current||qe(C,H,G)},[qe,$]),et=h.useCallback(C=>{!C&&B.context.clearSearchOnClose==="after-exit"&&(B.clearSearch(),B.setInputActive(!1)),C||B.clearHighlight(),_optionalChain([O, 'optionalCall', _31 => _31(C)])},[B,O]),ot=h.useCallback((C,H)=>{Ue(C,H.reason,H.event)},[Ue]),[tt,nt]=h.useState(p!==void 0?p:null),J=s!==void 0?s:tt,$e=h.useCallback(C=>{s===void 0&&nt(C),_optionalChain([c, 'optionalCall', _32 => _32(C)])},[s,c]),[rt,at]=h.useState(_nullishCoalesce(P, () => ([]))),ae=t!==void 0?t:rt,Je=h.useCallback(C=>{t===void 0&&at(C),_optionalChain([m, 'optionalCall', _33 => _33(C)])},[t,m]),[ve,st]=h.useState(l),Xe=g!==void 0?g:ve,_e=h.useCallback(C=>{g===void 0&&st(C),_optionalChain([S, 'optionalCall', _34 => _34(C)])},[g,S]),Qe=h.useRef(new Map),Ye=h.useCallback((C,H)=>(Qe.current.set(C,H),()=>{}),[]),Ze=_nullishCoalesce(j, () => (!a)),Ve=h.useRef({type:"active"}),[,lt]=h.useState({type:"active"}),X=h.useCallback(C=>{Ve.current=C,lt(C)},[]),eo=Ve.current,oo=h.useCallback(()=>{X({type:"active"})},[X]),to=h.useCallback(()=>{$||(!a&&J!=null?X({type:"showAll"}):X({type:"active"}),B.setOpen(!0))},[$,B,a,J,X]),no=h.useCallback((C,H)=>{let G=Ve.current,be=G.type==="active"?ve:G.type==="showAll"?"":G.search;X({type:"frozen",search:be}),B.setOpen(!1,C,H)},[B,X,ve]),ut=h.useMemo(()=>({multiple:a,value:J,values:ae,onValueChange:$e,onValuesChange:Je,isItemEqualToValue:b,itemToStringLabel:I,itemToStringValue:d,inputValue:Xe,onInputValueChange:_e,name:R,form:L,required:w,disabled:$,placeholder:V,items:A,itemTextRegistry:Qe.current,registerItemText:Ye,listId:me,inputRef:ce,setInputElement:Ge,inputWrapperRef:Se,setInputWrapperElement:Ne,closeOnSelect:Ze,openOnFocus:n,openCombobox:to,closeCombobox:no,filterMode:eo,setFilterActive:oo,inputHeight:ze,inputWidth:We,layout:y}),[a,J,ae,$e,Je,b,I,d,Xe,_e,R,L,w,$,V,A,Ye,me,Ge,Ne,Ze,n,to,no,eo,oo,ze,We,y]),it=h.useMemo(()=>R?a?ae.length>0?ae.map((C,H)=>{let G=_chunkBEWVWSAWcjs.T.call(void 0, C,d);return _jsxruntime.jsx.call(void 0, "input",{type:"hidden",name:R,value:G,form:L,required:w&&H===0},G)}):_jsxruntime.jsx.call(void 0, "input",{type:"hidden",name:R,value:"",form:L,required:w}):_jsxruntime.jsx.call(void 0, "input",{type:"hidden",name:R,value:J!=null?_chunkBEWVWSAWcjs.T.call(void 0, J,d):"",form:L,required:w}):null,[R,L,w,a,J,ae,d]);return _jsxruntime.jsx.call(void 0, _chunkBEWVWSAWcjs.v.Provider,{value:ut,children:_jsxruntime.jsxs.call(void 0, _chunkBEWVWSAWcjs.O,{menuTreeResolver:Yo,store:B,focusOwnerStore:$o,openChainStore:Jo,disabled:$,depth:0,closeAll:_o,registerSurface:Xo,virtualization:Qo,menuType:"dropdown",componentName:"combobox",debug:W,children:[it,_jsxruntime.jsx.call(void 0, _popover.Popover.Root,{...ee,open:Zo,onOpenChange:ot,onOpenChangeComplete:et,modal:K,actionsRef:i?ye:void 0,children:z})]})})}var Fo={slot:"bazzaui-combobox-surface"};var Fe=Z.forwardRef(function(e,o){let{autoHighlightFirst:i,clearSearchOnClose:u=!0,search:s,onSearchChange:p,onPointerMove:c,...a}=e,t=_chunkBEWVWSAWcjs.w.call(void 0, ),P=Z.useCallback(g=>{_optionalChain([c, 'optionalCall', _35 => _35(g)]);let l=t.inputRef.current;l&&document.activeElement!==l&&l.focus()},[c,t.inputRef]),m=Z.useMemo(()=>{let g=_nullishCoalesce(i, () => (!0));if(g==="selected"){let l=t.multiple?t.values[0]:t.value;return l!=null?_chunkBEWVWSAWcjs.T.call(void 0, l,t.itemToStringValue):!0}return g},[i,t.multiple,t.value,t.values,t.itemToStringValue]),{filterMode:b}=t,I=_nullishCoalesce(s, () => ((b.type==="active"?t.inputValue:b.type==="showAll"?"":b.search))),d=Z.useCallback(g=>{t.onInputValueChange(g),_optionalChain([p, 'optionalCall', _36 => _36(g)])},[t,p]);return _jsxruntime.jsx.call(void 0, _chunkBEWVWSAWcjs.ga,{ref:o,autoHighlightFirst:m,clearSearchOnClose:u,search:I,onSearchChange:d,onPointerMove:P,skipAutoFocus:!0,[Fo.slot]:"",...a})});var Bo=(p=>(p.slot="bazzaui-combobox-arrow",p.open="data-open",p.closed="data-closed",p.side="data-side",p.align="data-align",p.uncentered="data-uncentered",p))(Bo||{});var Wo=(s=>(s.slot="bazzaui-combobox-backdrop",s.open="data-open",s.closed="data-closed",s.startingStyle="data-starting-style",s.endingStyle="data-ending-style",s))(Wo||{});var jo=(e=>(e.slot="bazzaui-combobox-empty",e))(jo||{});var Go=(e=>(e.slot="bazzaui-combobox-group",e))(Go||{});var No=(e=>(e.slot="bazzaui-combobox-group-label",e))(No||{});var At={slot:"bazzaui-combobox-icon",open:"data-popup-open"};var qo=(o=>(o.slot="bazzaui-combobox-list",o.list="data-popup-menu-list",o))(qo||{});var Ko=(b=>(b.slot="bazzaui-combobox-popup",b.open="data-open",b.closed="data-closed",b.side="data-side",b.align="data-align",b.startingStyle="data-starting-style",b.endingStyle="data-ending-style",b.instant="data-instant",b.focused="data-focused",b.hasOpenSubmenu="data-has-open-submenu",b.submenu="data-submenu",b.navigating="data-navigating",b))(Ko||{});var Ft={slotUp:"bazzaui-combobox-scroll-up-arrow",slotDown:"bazzaui-combobox-scroll-down-arrow",direction:"data-direction",side:"data-side"};var Uo=(e=>(e.slot="bazzaui-combobox-separator",e))(Uo||{});exports.Combobox = zo; exports.ComboboxArrowDataAttributes = Bo; exports.ComboboxBackdropDataAttributes = Wo; exports.ComboboxClear = Me; exports.ComboboxEmptyDataAttributes = jo; exports.ComboboxGroupDataAttributes = Go; exports.ComboboxGroupLabelDataAttributes = No; exports.ComboboxIconDataAttributes = At; exports.ComboboxInput = we; exports.ComboboxInputDataAttributes = Q; exports.ComboboxInputWrapper = ke; exports.ComboboxInputWrapperDataAttributes = ge; exports.ComboboxItem = Te; exports.ComboboxItemDataAttributes = q; exports.ComboboxItemIndicator = He; exports.ComboboxItemIndicatorDataAttributes = Pe; exports.ComboboxItemLabel = Oe; exports.ComboboxListCssVars = _chunkBEWVWSAWcjs.ba; exports.ComboboxListDataAttributes = qo; exports.ComboboxPopupDataAttributes = Ko; exports.ComboboxPositioner = De; exports.ComboboxPositionerCssVars = _chunkBEWVWSAWcjs.M; exports.ComboboxPositionerDataAttributes = Re; exports.ComboboxRoot = Ae; exports.ComboboxScrollArrowDataAttributes = Ft; exports.ComboboxSeparatorDataAttributes = Uo; exports.ComboboxStore = _chunkXMZZ62VJcjs.y; exports.ComboboxSurface = Fe; exports.commandScore = _chunkXMZZ62VJcjs.w; exports.defaultFilter = _chunkXMZZ62VJcjs.x; exports.useComboboxContext = _chunkBEWVWSAWcjs.w; exports.useComboboxItemContext = ue; exports.useComboboxPositionerContext = Ee; exports.useMaybeComboboxContext = _chunkBEWVWSAWcjs.x; exports.useMaybeComboboxItemContext = yt; exports.useMaybeSurfaceContext = _chunkXMZZ62VJcjs.q; exports.useSurfaceContext = _chunkXMZZ62VJcjs.p;
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }var _chunk5T5B5SPRcjs = require('../chunk-5T5B5SPR.cjs');var _chunkRTG6U56Ocjs = require('../chunk-RTG6U56O.cjs');var _chunkXMZZ62VJcjs = require('../chunk-XMZZ62VJ.cjs');var _chunkPCNHYMD6cjs = require('../chunk-PCNHYMD6.cjs');var _chunkM4G6J7DPcjs = require('../chunk-M4G6J7DP.cjs');var No={};_chunkM4G6J7DPcjs.a.call(void 0, No,{Arrow:()=>_chunkRTG6U56Ocjs.s,Backdrop:()=>_chunkRTG6U56Ocjs.t,Clear:()=>we,Empty:()=>_chunkRTG6U56Ocjs.V,Group:()=>_chunkRTG6U56Ocjs.ra,GroupLabel:()=>_chunkRTG6U56Ocjs.X,Icon:()=>_chunkRTG6U56Ocjs.U,Input:()=>He,InputWrapper:()=>Oe,Item:()=>De,ItemIndicator:()=>Ae,ItemLabel:()=>Fe,List:()=>_chunkRTG6U56Ocjs.ca,Popup:()=>_chunkRTG6U56Ocjs.K,Portal:()=>_chunkRTG6U56Ocjs.L,Positioner:()=>ze,Root:()=>Be,ScrollDownArrow:()=>_chunkRTG6U56Ocjs.fa,ScrollUpArrow:()=>_chunkRTG6U56Ocjs.ea,Separator:()=>_chunkRTG6U56Ocjs.ua,Surface:()=>We,useComboboxPositionerContext:()=>ke});var _userender = require('@base-ui/react/use-render');var _react = require('react'); var Y = _interopRequireWildcard(_react); var Ce = _interopRequireWildcard(_react); var ae = _interopRequireWildcard(_react); var he = _interopRequireWildcard(_react); var ue = _interopRequireWildcard(_react); var T = _interopRequireWildcard(_react); var se = _interopRequireWildcard(_react); var M = _interopRequireWildcard(_react); var ie = _interopRequireWildcard(_react); var ye = _interopRequireWildcard(_react); var ee = _interopRequireWildcard(_react); var J = _interopRequireWildcard(_react); var I = _interopRequireWildcard(_react); var oe = _interopRequireWildcard(_react);var Oo={slot:"bazzaui-combobox-clear"};var we=Y.forwardRef(function(e,t){let{keepMounted:i=!1,disabled:u,render:l,className:m,style:b,onClick:s,onPointerDown:o,...g}=e,p=_chunkRTG6U56Ocjs.w.call(void 0, ),c=_nullishCoalesce(u, () => (p.disabled)),P=p.multiple?p.values.length>0:p.value!=="",d=Y.useCallback(R=>{_optionalChain([s, 'optionalCall', _2 => _2(R)]),!R.defaultPrevented&&(p.multiple?p.onValuesChange([]):p.onValueChange(""),p.onInputValueChange(""))},[s,p]),h=Y.useCallback(R=>{R.preventDefault(),_optionalChain([o, 'optionalCall', _3 => _3(R)])},[o]),r=Y.useMemo(()=>({hasValue:P,disabled:c}),[P,c]),y=_userender.useRender.call(void 0, {render:l,ref:t,state:r,props:{...g,[Oo.slot]:"",type:"button",tabIndex:-1,"aria-label":"Clear selection",disabled:c||!P,className:_chunkPCNHYMD6cjs.a.call(void 0, m,r),style:_chunkPCNHYMD6cjs.b.call(void 0, b,r),onClick:d,onPointerDown:h},enabled:i||P,defaultTagName:"button"});return!i&&!P?null:y});var ge=Ce.createContext(null);function ke(){return Ce.useContext(ge)}var Te=he.createContext(!1);function Do(){return he.useContext(Te)}var Z={slot:"bazzaui-combobox-input",open:"data-open",closed:"data-closed",disabled:"data-disabled",placeholder:"data-placeholder"};function Ao(x){let{comboboxContext:e,open:t}=x,i=e.multiple?e.values.length>0:!_chunkRTG6U56Ocjs.R.call(void 0, e.value),u=ue.useCallback(b=>{let s=_chunkRTG6U56Ocjs.T.call(void 0, b,e.itemToStringValue),o=e.itemTextRegistry.get(s);if(o!==void 0)return o;let g=_chunk5T5B5SPRcjs.f.call(void 0, e.items,s);if(typeof g=="string")return g;let p=_chunkRTG6U56Ocjs.S.call(void 0, b,e.itemToStringLabel);if(p&&p!==s)return p},[e.itemTextRegistry,e.items,e.itemToStringLabel,e.itemToStringValue]),l=ue.useMemo(()=>{if(!i)return"";if(e.multiple){let o=e.values.map(g=>{let p=u(g);return p!==void 0?p:_chunkRTG6U56Ocjs.S.call(void 0, g,e.itemToStringLabel)||_chunkRTG6U56Ocjs.T.call(void 0, g,e.itemToStringValue)}).filter(Boolean);return o.length<=2?o.join(", "):`${o.length} selected`}let b=e.value;if(b==null)return"";let s=u(b);return s!==void 0?s:_chunkRTG6U56Ocjs.S.call(void 0, b,e.itemToStringLabel)||_chunkRTG6U56Ocjs.T.call(void 0, b,e.itemToStringValue)},[i,e.multiple,e.value,e.values,e.itemToStringLabel,e.itemToStringValue,u]),m=ue.useMemo(()=>t?e.inputValue:l,[t,l,e.inputValue]);return{hasValue:i,displayValue:m,selectedLabel:l,getValueText:u}}function Fo(x){let{comboboxContext:e,store:t,focusOwnerStore:i,open:u,disabled:l,cursorBehavior:m,hasValue:b,getValueText:s,onFocus:o,onBlur:g,onClick:p,onKeyDown:c}=x,P=T.useRef(!1),d=T.useRef(!1),h=T.useRef(!1),r=T.useRef(null),y=T.useRef(null),R=T.useRef(null);T.useEffect(()=>{if(!u)return;let n=f=>{let a=e.inputRef.current,v=e.inputWrapperRef.current,S=document.getElementById(e.listId),O=f.target,F=_optionalChain([a, 'optionalAccess', _4 => _4.contains, 'call', _5 => _5(O)]),B=_optionalChain([v, 'optionalAccess', _6 => _6.contains, 'call', _7 => _7(O)]),te=_optionalChain([S, 'optionalAccess', _8 => _8.contains, 'call', _9 => _9(O)]);!F&&!B&&!te&&(R.current=f)};return document.addEventListener("pointerdown",n,!0),()=>{document.removeEventListener("pointerdown",n,!0),R.current=null}},[u,e.inputRef,e.inputWrapperRef,e.listId]),T.useLayoutEffect(()=>{let n=e.inputRef.current;if(n&&u&&y.current){let{start:f,end:a}=y.current,v=n.selectionStart,S=n.value.length;v===S&&f!==S&&n.setSelectionRange(f,a),y.current=null}});let E=T.useRef(u);T.useLayoutEffect(()=>{if(u&&!E.current){if(P.current){P.current=!1,E.current=u;return}if(h.current){h.current=!1,d.current=!1,r.current=null,E.current=u;return}if(d.current&&m==="none"){let f=e.inputRef.current,a=r.current;f&&a!==null&&requestAnimationFrame(()=>{let v=f.value.length,S=Math.min(a,v);f.setSelectionRange(S,S)}),d.current=!1,r.current=null,E.current=u;return}b&&e.multiple&&e.onInputValueChange("");let n=e.inputRef.current;if(n){let f=n.value.length;m==="select-all"&&f>0?requestAnimationFrame(()=>{n.setSelectionRange(0,n.value.length)}):m==="end"&&f>0&&requestAnimationFrame(()=>{n.setSelectionRange(n.value.length,n.value.length)})}}E.current=u},[u,e,b,m]);let w=T.useCallback(n=>{let f=n.target,a=f.value,v=f.selectionStart,S=f.selectionEnd;v!==null&&S!==null&&(y.current={start:v,end:S}),e.onInputValueChange(a),e.setFilterActive(),t.setSearch(a),t.state.open||(P.current=!0,e.openCombobox())},[e,t]),k=T.useCallback(n=>{if(_optionalChain([o, 'optionalCall', _10 => _10(n)]),n.defaultPrevented)return;let f=t.state.open;if(f&&(h.current=!0),e.openOnFocus&&!l&&!f){if(b&&!e.multiple){let a=_nullishCoalesce(s(e.value), () => (_chunkRTG6U56Ocjs.S.call(void 0, e.value,e.itemToStringLabel)));e.onInputValueChange(a)}e.openCombobox()}},[o,e,l,t,b,s]),L=T.useCallback(n=>{_optionalChain([g, 'optionalCall', _11 => _11(n)]),!n.defaultPrevented&&requestAnimationFrame(()=>{let f=document.activeElement,v=_optionalChain([document, 'access', _12 => _12.getElementById, 'call', _13 => _13(e.listId), 'optionalAccess', _14 => _14.contains, 'call', _15 => _15(f)]),S=f===e.inputRef.current;if(!v&&!S){h.current=!1;let O=R.current,F=O?_chunkXMZZ62VJcjs.a.outsidePress:_chunkXMZZ62VJcjs.a.focusOut;R.current=null,e.closeCombobox(F,_nullishCoalesce(O, () => (void 0)))}})},[g,e]),A=T.useCallback(n=>{if(_optionalChain([p, 'optionalCall', _16 => _16(n)]),n.defaultPrevented)return;let f=t.state.open;if(!l&&!f){let a=n.target;if(m==="none"){let v=a.selectionStart;r.current=v,d.current=!0}if(b&&!e.multiple){let v=_nullishCoalesce(s(e.value), () => (_chunkRTG6U56Ocjs.S.call(void 0, e.value,e.itemToStringLabel)));e.onInputValueChange(v)}e.openCombobox()}else f&&(h.current=!0)},[p,e,l,t,m,b,s]),$=T.useCallback(n=>{if(_optionalChain([c, 'optionalCall', _17 => _17(n)]),!n.defaultPrevented){if(u&&n.key==="Escape"){n.preventDefault(),e.closeCombobox(_chunkXMZZ62VJcjs.a.escapeKey);return}if(!u&&(n.key==="ArrowDown"||n.key==="ArrowUp"||n.key==="Enter")){if(n.preventDefault(),b&&!e.multiple){let f=_nullishCoalesce(s(e.value), () => (_chunkRTG6U56Ocjs.S.call(void 0, e.value,e.itemToStringLabel)));e.onInputValueChange(f)}e.openCombobox();return}}},[u,e,c,b,s]),{handleKeyDown:G}=_chunkRTG6U56Ocjs.Q.call(void 0, {store:t,surfaceId:"combobox-input",focusOwnerStore:i,depth:0,submenuContext:null,subpageContext:null,enabled:u,enableTypeToSearch:!1,onKeyDown:$,closeAll:e.closeCombobox,skipFocusOwnerCheck:!0});return{handleChange:w,handleFocus:k,handleBlur:L,handleClick:A,handleKeyDown:G,selectionRef:y}}var He=ae.forwardRef(function(e,t){let{placeholder:i,disabled:u,cursorBehavior:l="none",render:m,className:b,style:s,onFocus:o,onBlur:g,onClick:p,onKeyDown:c,...P}=e,d=_chunkRTG6U56Ocjs.w.call(void 0, ),h=_chunkRTG6U56Ocjs.d.call(void 0, ),r=_chunkRTG6U56Ocjs.a.call(void 0, ),y=Do(),R=(_nullishCoalesce(u, () => (d.disabled)))||h.disabled,E=_chunk5T5B5SPRcjs.f.call(void 0, d.items,""),w=_nullishCoalesce(_nullishCoalesce(i, () => ((typeof E=="string"?E:void 0))), () => (d.placeholder)),k=h.store.useState("open"),{hasValue:L,displayValue:A,getValueText:$}=Ao({comboboxContext:d,open:k}),{handleChange:G,handleFocus:n,handleBlur:f,handleClick:a,handleKeyDown:v}=Fo({comboboxContext:d,store:h.store,focusOwnerStore:r,open:k,disabled:R,cursorBehavior:l,hasValue:L,getValueText:$,onFocus:o,onBlur:g,onClick:p,onKeyDown:c}),S={[Z.slot]:""};k?S[Z.open]="":S[Z.closed]="",R&&(S[Z.disabled]=""),L||(S[Z.placeholder]=""),d.layout==="input-embedded"&&(S["data-input-embedded"]="");let O=ae.useCallback(V=>{d.setInputElement(V),typeof t=="function"?t(V):t&&(t.current=V)},[t,d]),F=ae.useMemo(()=>({open:k,disabled:R,placeholder:!L}),[k,R,L]),B=d.layout==="input-embedded"&&!y?{position:"relative",zIndex:1}:void 0;return _userender.useRender.call(void 0, {render:m,ref:O,state:F,props:{...P,...S,type:"text",role:"combobox","aria-autocomplete":"list","aria-expanded":k,"aria-controls":d.listId,"aria-haspopup":"listbox",autoComplete:"off",autoCorrect:"off",spellCheck:!1,disabled:R,placeholder:L?void 0:w,className:_chunkPCNHYMD6cjs.a.call(void 0, b,F),style:{...B,..._chunkPCNHYMD6cjs.b.call(void 0, s,F)},value:A,onChange:G,onFocus:n,onBlur:f,onClick:a,onKeyDown:v},defaultTagName:"input"})});var Ie={slot:"bazzaui-combobox-input-wrapper",open:"data-open"};var _jsxruntime = require('react/jsx-runtime');var vt={open:x=>x?{[Ie.open]:""}:null},Oe= exports.ComboboxInputWrapper =se.forwardRef(function(e,t){let{render:i,className:u,style:l,children:m,...b}=e,{store:s}=_chunkRTG6U56Ocjs.d.call(void 0, ),o=_chunkRTG6U56Ocjs.w.call(void 0, ),g=s.useState("open"),p=se.useMemo(()=>({open:g}),[g]),c=o.layout==="input-embedded"?{position:"relative",zIndex:1}:{position:"relative"},P=se.useCallback(h=>{o.setInputWrapperElement(h),typeof t=="function"?t(h):t&&(t.current=h)},[t,o]),d=_userender.useRender.call(void 0, {render:i,ref:P,state:p,stateAttributesMapping:vt,props:{...b,[Ie.slot]:"",className:_chunkPCNHYMD6cjs.a.call(void 0, u,p),style:{...c,..._chunkPCNHYMD6cjs.b.call(void 0, l,p)},children:m},defaultTagName:"div"});return _jsxruntime.jsx.call(void 0, Te.Provider,{value:!0,children:d})});var U={slot:"bazzaui-combobox-item",highlighted:"data-highlighted",disabled:"data-disabled",selected:"data-selected",first:"data-first",last:"data-last",firstInGroup:"data-first-in-group",lastInGroup:"data-last-in-group"};var Pe=ie.createContext(null);function pe(){let x=ie.useContext(Pe);if(!x)throw new Error("ComboboxItem child components must be used within a Combobox.Item");return x}function Mt(){return ie.useContext(Pe)}var Lt={highlighted:x=>x?{[U.highlighted]:""}:null,disabled:x=>x?{[U.disabled]:""}:null,selected:x=>x?{[U.selected]:""}:null,first:x=>x?{[U.first]:""}:null,last:x=>x?{[U.last]:""}:null,firstInGroup:x=>x?{[U.firstInGroup]:""}:null,lastInGroup:x=>x?{[U.lastInGroup]:""}:null};function wt(x,e){let{value:t,textValue:i,keywords:u,disabled:l=!1,onSelect:m,forceMount:b=!1,render:s,className:o,style:g,onClick:p,onPointerDown:c,onPointerMove:P,children:d,...h}=x,r=_chunkRTG6U56Ocjs.w.call(void 0, ),y=M.useMemo(()=>_chunkRTG6U56Ocjs.T.call(void 0, t,r.itemToStringValue),[t,r.itemToStringValue]),R=M.useId(),E=t===null?`combobox-clear-${R}`:void 0,w=M.useMemo(()=>_chunk5T5B5SPRcjs.e.call(void 0, r.items,y),[r.items,y]),k=_optionalChain([w, 'optionalAccess', _18 => _18.label]),L=M.useMemo(()=>_chunkRTG6U56Ocjs.S.call(void 0, t,r.itemToStringLabel),[t,r.itemToStringLabel]),A=M.useMemo(()=>{if(i!==void 0)return i;if(typeof k=="string")return k;if(L&&L!==y)return L},[i,k,L,y]),$=M.useMemo(()=>_chunk5T5B5SPRcjs.g.call(void 0, u,[typeof k=="string"?k:L&&L!==y?L:void 0,..._nullishCoalesce(_optionalChain([w, 'optionalAccess', _19 => _19.keywords]), () => ([]))]),[u,k,L,y,w]),G=M.useRef(A),n=r.multiple?_chunk5T5B5SPRcjs.c.call(void 0, r.values,t,r.isItemEqualToValue):r.value!==""&&_chunk5T5B5SPRcjs.b.call(void 0, r.value,t,r.isItemEqualToValue),f=r.closeOnSelect,a=_chunkRTG6U56Ocjs.P.call(void 0, {id:E,value:y,keywords:$,disabled:l,forceMount:b,closeOnClick:f,children:d});M.useEffect(()=>{let V=()=>{if(!l){if(r.multiple)if(t==null)r.onValuesChange([]);else{let be=n?_chunk5T5B5SPRcjs.d.call(void 0, r.values,t,r.isItemEqualToValue):[...r.values,t];r.onValuesChange(be)}else r.onValueChange(t);_optionalChain([m, 'optionalCall', _20 => _20()])}};return a.registerSelect(V)},[l,r,t,n,m,a]),M.useEffect(()=>{let V=G.current;if(V)return r.registerItemText(y,V)},[y,r]),M.useEffect(()=>{!A&&typeof d=="string"&&(G.current=d,r.registerItemText(y,d))},[d,A,y,r]);let v=M.useMemo(()=>({highlighted:a.isHighlighted,disabled:l,selected:n,first:a.positional.first,last:a.positional.last,firstInGroup:a.positional.firstInGroup,lastInGroup:a.positional.lastInGroup}),[a.isHighlighted,l,n,a.positional]),S=M.useMemo(()=>({id:a.id,value:t,textValue:A,highlighted:a.isHighlighted,disabled:l,selected:n}),[a.id,t,A,a.isHighlighted,l,n]),O=M.useCallback(V=>{_optionalChain([p, 'optionalCall', _21 => _21(V)]),V.defaultPrevented||a.handlers.onClick(V)},[p,a.handlers]),F=M.useCallback(V=>{a.handlers.onPointerDown(V),_optionalChain([c, 'optionalCall', _22 => _22(V)])},[a.handlers,c]),B=M.useCallback(V=>{_optionalChain([P, 'optionalCall', _23 => _23(V)]),V.defaultPrevented||a.handlers.onPointerMove(V)},[P,a.handlers]),te=_userender.useRender.call(void 0, {render:s,ref:[a.ref,a.rowRef,e],state:v,stateAttributesMapping:Lt,props:{...h,[U.slot]:"",id:a.id,role:"option",tabIndex:-1,"aria-selected":n,"aria-disabled":l||void 0,className:_chunkPCNHYMD6cjs.a.call(void 0, o,v),style:_chunkPCNHYMD6cjs.b.call(void 0, g,v),onClick:O,onPointerMove:B,onPointerDown:F,children:d},enabled:a.isVisible,defaultTagName:"div"});return a.isVisible?_jsxruntime.jsx.call(void 0, Pe.Provider,{value:S,children:te}):null}var De=M.forwardRef(wt);var Re={slot:"bazzaui-combobox-item-indicator",selected:"data-selected"};var Ht={selected:x=>x?{[Re.selected]:""}:null},Ae= exports.ComboboxItemIndicator =ye.forwardRef(function(e,t){let{keepMounted:i=!1,render:u,className:l,style:m,...b}=e,s=pe(),o=ye.useMemo(()=>({selected:s.selected}),[s.selected]),g=_userender.useRender.call(void 0, {render:u,ref:t,state:o,stateAttributesMapping:Ht,props:{...b,[Re.slot]:"","aria-hidden":!0,className:_chunkPCNHYMD6cjs.a.call(void 0, l,o),style:_chunkPCNHYMD6cjs.b.call(void 0, m,o)},enabled:i||s.selected,defaultTagName:"span"});return!i&&!s.selected?null:g});var zo={slot:"bazzaui-combobox-item-label"};var Fe=ee.forwardRef(function(e,t){let{render:i,className:u,style:l,children:m,...b}=e,s=_chunkRTG6U56Ocjs.w.call(void 0, ),o=pe(),g=_chunkRTG6U56Ocjs.T.call(void 0, o.value,s.itemToStringValue),p=ee.useMemo(()=>{if(m!==void 0)return m;let P=_chunk5T5B5SPRcjs.f.call(void 0, s.items,g);return P!==void 0?P:o.textValue!==void 0?o.textValue:g},[m,s.items,g,o.textValue]),c=ee.useMemo(()=>({value:g,selected:o.selected,highlighted:o.highlighted,disabled:o.disabled}),[g,o.selected,o.highlighted,o.disabled]);return ee.useEffect(()=>{if(typeof p=="string")return s.registerItemText(g,p)},[p,s,g]),_userender.useRender.call(void 0, {render:i,ref:t,state:c,props:{...b,[zo.slot]:"",className:_chunkPCNHYMD6cjs.a.call(void 0, u,c),style:_chunkPCNHYMD6cjs.b.call(void 0, l,c),children:p},defaultTagName:"span"})});var _popover = require('@base-ui/react/popover');var Se={slot:"bazzaui-combobox-positioner"};function Dt(x,e,t,i){let u=t+i*2;if(x==="top"){let b=-(e+i),s=e+i;return{width:u,marginBottom:b,paddingTop:i,paddingLeft:i,paddingRight:i,paddingBottom:s}}let l=-(e+i),m=e+i;return{width:u,marginTop:l,paddingTop:m,paddingLeft:i,paddingRight:i,paddingBottom:i}}var ze=J.forwardRef(function(e,t){let{layout:i,popupPadding:u=8,side:l="bottom",align:m,sideOffset:b=4,anchor:s,className:o,style:g,children:p,...c}=e,P=_chunkRTG6U56Ocjs.w.call(void 0, ),d=_nullishCoalesce(i, () => (P.layout)),h=d==="input-embedded",r=_nullishCoalesce(s, () => (P.inputWrapperRef.current))?P.inputWrapperRef:P.inputRef,y=h?0:b,R=h?"center":_nullishCoalesce(m, () => ("start")),{inputHeight:E,inputWidth:w}=P,k=w+u*2,L=_chunkPCNHYMD6cjs.c.call(void 0, g,n=>({...n,...h?{zIndex:0}:{}}));if(h)return _jsxruntime.jsx.call(void 0, _popover.Popover.Positioner,{ref:t,side:l,align:R,sideOffset:y,anchor:r,className:o,style:L,"data-input-embedded":"",[Se.slot]:"",...c,render:(n,f)=>{let a=f.side,v={layout:d,side:a,align:f.align,inputHeight:P.inputHeight},S={"--combobox-input-height":`${E}px`,"--combobox-input-width":`${w}px`,"--combobox-popup-padding":`${u}px`,"--combobox-popup-width":`${k}px`},O=Dt(a,E,w,u),F=J.Children.map(p,B=>J.isValidElement(B)?J.cloneElement(B,{style:{...O,...B.props.style},"data-side":a}):B);return _jsxruntime.jsx.call(void 0, ge.Provider,{value:v,children:_jsxruntime.jsx.call(void 0, "div",{...n,style:{...n.style,...S},"data-side":a,children:F})})}});let A={layout:d,side:l,align:R,inputHeight:P.inputHeight},$={"--combobox-input-height":`${E}px`,"--combobox-input-width":`${w}px`},G=_chunkPCNHYMD6cjs.c.call(void 0, g,n=>({...n,...$}));return _jsxruntime.jsx.call(void 0, ge.Provider,{value:A,children:_jsxruntime.jsx.call(void 0, _popover.Popover.Positioner,{ref:t,side:l,align:R,sideOffset:y,anchor:r,className:o,style:G,[Se.slot]:"",...c,children:p})})});function Be(x){let{open:e,onOpenChange:t,actionsRef:i,defaultOpen:u=!1,value:l,defaultValue:m,onValueChange:b,multiple:s=!1,values:o,defaultValues:g,onValuesChange:p,isItemEqualToValue:c=_chunk5T5B5SPRcjs.a,itemToStringLabel:P,itemToStringValue:d,inputValue:h,defaultInputValue:r="",onInputValueChange:y,name:R,form:E,required:w,disabled:k=!1,placeholder:L="Search...",items:A,modal:$=!1,closeOnSelect:G,openOnFocus:n=!0,virtualized:f=!1,virtualItems:a,onHighlightChange:v,layout:S="floating",onOpenChangeComplete:O,debug:F,children:B,...te}=x,V=I.useCallback((C,H,q,xe)=>_optionalChain([v, 'optionalCall', _24 => _24(C,q,xe)]),[v]),be=I.useId(),de=I.useRef(null),ve=I.useRef(null),[Ne,je]=I.useState(0),[Ge,qe]=I.useState(0),Ke=I.useCallback(C=>{if(de.current=C,C&&!ve.current){let H=C.getBoundingClientRect();je(H.height),qe(H.width)}},[]),Ue=I.useCallback(C=>{if(ve.current=C,C){let H=C.getBoundingClientRect();je(H.height),qe(H.width)}},[]),{store:W,focusOwnerStore:_o,openChainStore:Qo,registerSurface:Yo,closeAll:Zo,virtualization:et,handleOpenChange:$e,disabled:X,setDisabled:Je,menuTreeResolver:ot}=_chunkRTG6U56Ocjs.q.call(void 0, {onOpenChange:t,defaultOpen:u,virtualized:f,items:a,onHighlightChange:V,disabled:k}),Ve=I.useRef(null);I.useImperativeHandle(i,()=>({close:()=>{_optionalChain([Ve, 'access', _25 => _25.current, 'optionalAccess', _26 => _26.close, 'call', _27 => _27()])},unmount:()=>{_optionalChain([Ve, 'access', _28 => _28.current, 'optionalAccess', _29 => _29.unmount, 'call', _30 => _30()])},setDisabled:Je}),[Je]),W.useControlledProp("openProp",e);let tt=W.useState("open"),Xe=I.useCallback((C,H,q)=>{X&&H!==_chunkXMZZ62VJcjs.a.imperativeAction||!C&&de.current&&document.activeElement===de.current||$e(C,H,q)},[$e,X]),nt=I.useCallback(C=>{!C&&W.context.clearSearchOnClose==="after-exit"&&(W.clearSearch(),W.setInputActive(!1)),C||W.clearHighlight(),_optionalChain([O, 'optionalCall', _31 => _31(C)])},[W,O]),rt=I.useCallback((C,H)=>{Xe(C,H.reason,H.event)},[Xe]),[at,st]=I.useState(m!==void 0?m:null),_=l!==void 0?l:at,_e=I.useCallback(C=>{l===void 0&&st(C),_optionalChain([b, 'optionalCall', _32 => _32(C)])},[l,b]),[lt,ut]=I.useState(_nullishCoalesce(g, () => ([]))),le=o!==void 0?o:lt,Qe=I.useCallback(C=>{o===void 0&&ut(C),_optionalChain([p, 'optionalCall', _33 => _33(C)])},[o,p]),[Me,it]=I.useState(r),Ye=h!==void 0?h:Me,Ze=I.useCallback(C=>{h===void 0&&it(C),_optionalChain([y, 'optionalCall', _34 => _34(C)])},[h,y]),eo=I.useRef(new Map),oo=I.useCallback((C,H)=>(eo.current.set(C,H),()=>{}),[]),to=_nullishCoalesce(G, () => (!s)),Ee=I.useRef({type:"active"}),[,pt]=I.useState({type:"active"}),Q=I.useCallback(C=>{Ee.current=C,pt(C)},[]),no=Ee.current,ro=I.useCallback(()=>{Q({type:"active"})},[Q]),ao=I.useCallback(()=>{X||(!s&&_!=null?Q({type:"showAll"}):Q({type:"active"}),W.setOpen(!0))},[X,W,s,_,Q]),so=I.useCallback((C,H)=>{let q=Ee.current,xe=q.type==="active"?Me:q.type==="showAll"?"":q.search;Q({type:"frozen",search:xe}),W.setOpen(!1,C,H)},[W,Q,Me]),mt=I.useMemo(()=>({multiple:s,value:_,values:le,onValueChange:_e,onValuesChange:Qe,isItemEqualToValue:c,itemToStringLabel:P,itemToStringValue:d,inputValue:Ye,onInputValueChange:Ze,name:R,form:E,required:w,disabled:X,placeholder:L,items:A,itemTextRegistry:eo.current,registerItemText:oo,listId:be,inputRef:de,setInputElement:Ke,inputWrapperRef:ve,setInputWrapperElement:Ue,closeOnSelect:to,openOnFocus:n,openCombobox:ao,closeCombobox:so,filterMode:no,setFilterActive:ro,inputHeight:Ne,inputWidth:Ge,layout:S}),[s,_,le,_e,Qe,c,P,d,Ye,Ze,R,E,w,X,L,A,oo,be,Ke,Ue,to,n,ao,so,no,ro,Ne,Ge,S]),ct=I.useMemo(()=>R?s?le.length>0?le.map((C,H)=>{let q=_chunkRTG6U56Ocjs.T.call(void 0, C,d);return _jsxruntime.jsx.call(void 0, "input",{type:"hidden",name:R,value:q,form:E,required:w&&H===0},q)}):_jsxruntime.jsx.call(void 0, "input",{type:"hidden",name:R,value:"",form:E,required:w}):_jsxruntime.jsx.call(void 0, "input",{type:"hidden",name:R,value:_!=null?_chunkRTG6U56Ocjs.T.call(void 0, _,d):"",form:E,required:w}):null,[R,E,w,s,_,le,d]);return _jsxruntime.jsx.call(void 0, _chunkRTG6U56Ocjs.v.Provider,{value:mt,children:_jsxruntime.jsxs.call(void 0, _chunkRTG6U56Ocjs.O,{menuTreeResolver:ot,store:W,focusOwnerStore:_o,openChainStore:Qo,disabled:X,depth:0,closeAll:Zo,registerSurface:Yo,virtualization:et,menuType:"dropdown",componentName:"combobox",debug:F,children:[ct,_jsxruntime.jsx.call(void 0, _popover.Popover.Root,{...te,open:tt,onOpenChange:rt,onOpenChangeComplete:nt,modal:$,actionsRef:i?Ve:void 0,children:B})]})})}var Wo={slot:"bazzaui-combobox-surface"};var We=oe.forwardRef(function(e,t){let{autoHighlightFirst:i,clearSearchOnClose:u=!0,search:l,onSearchChange:m,onPointerMove:b,...s}=e,o=_chunkRTG6U56Ocjs.w.call(void 0, ),g=oe.useCallback(h=>{_optionalChain([b, 'optionalCall', _35 => _35(h)]);let r=o.inputRef.current;r&&document.activeElement!==r&&r.focus()},[b,o.inputRef]),p=oe.useMemo(()=>{let h=_nullishCoalesce(i, () => (!0));if(h==="selected"){let r=o.multiple?o.values[0]:o.value;return r!=null?_chunkRTG6U56Ocjs.T.call(void 0, r,o.itemToStringValue):!0}return h},[i,o.multiple,o.value,o.values,o.itemToStringValue]),{filterMode:c}=o,P=_nullishCoalesce(l, () => ((c.type==="active"?o.inputValue:c.type==="showAll"?"":c.search))),d=oe.useCallback(h=>{o.onInputValueChange(h),_optionalChain([m, 'optionalCall', _36 => _36(h)])},[o,m]);return _jsxruntime.jsx.call(void 0, _chunkRTG6U56Ocjs.ga,{ref:t,autoHighlightFirst:p,clearSearchOnClose:u,search:P,onSearchChange:d,onPointerMove:g,skipAutoFocus:!0,[Wo.slot]:"",...s})});var jo=(m=>(m.slot="bazzaui-combobox-arrow",m.open="data-open",m.closed="data-closed",m.side="data-side",m.align="data-align",m.uncentered="data-uncentered",m))(jo||{});var Go=(l=>(l.slot="bazzaui-combobox-backdrop",l.open="data-open",l.closed="data-closed",l.startingStyle="data-starting-style",l.endingStyle="data-ending-style",l))(Go||{});var qo=(e=>(e.slot="bazzaui-combobox-empty",e))(qo||{});var Ko=(e=>(e.slot="bazzaui-combobox-group",e))(Ko||{});var Uo=(e=>(e.slot="bazzaui-combobox-group-label",e))(Uo||{});var Bt={slot:"bazzaui-combobox-icon",open:"data-popup-open"};var $o=(t=>(t.slot="bazzaui-combobox-list",t.list="data-popup-menu-list",t))($o||{});var Jo=(c=>(c.slot="bazzaui-combobox-popup",c.open="data-open",c.closed="data-closed",c.side="data-side",c.align="data-align",c.startingStyle="data-starting-style",c.endingStyle="data-ending-style",c.instant="data-instant",c.focused="data-focused",c.hasOpenSubmenu="data-has-open-submenu",c.submenu="data-submenu",c.navigating="data-navigating",c))(Jo||{});var Wt={slotUp:"bazzaui-combobox-scroll-up-arrow",slotDown:"bazzaui-combobox-scroll-down-arrow",direction:"data-direction",side:"data-side"};var Xo=(e=>(e.slot="bazzaui-combobox-separator",e))(Xo||{});exports.Combobox = No; exports.ComboboxArrowDataAttributes = jo; exports.ComboboxBackdropDataAttributes = Go; exports.ComboboxClear = we; exports.ComboboxEmptyDataAttributes = qo; exports.ComboboxGroupDataAttributes = Ko; exports.ComboboxGroupLabelDataAttributes = Uo; exports.ComboboxIconDataAttributes = Bt; exports.ComboboxInput = He; exports.ComboboxInputDataAttributes = Z; exports.ComboboxInputWrapper = Oe; exports.ComboboxInputWrapperDataAttributes = Ie; exports.ComboboxItem = De; exports.ComboboxItemDataAttributes = U; exports.ComboboxItemIndicator = Ae; exports.ComboboxItemIndicatorDataAttributes = Re; exports.ComboboxItemLabel = Fe; exports.ComboboxListCssVars = _chunkRTG6U56Ocjs.ba; exports.ComboboxListDataAttributes = $o; exports.ComboboxPopupDataAttributes = Jo; exports.ComboboxPositioner = ze; exports.ComboboxPositionerCssVars = _chunkRTG6U56Ocjs.M; exports.ComboboxPositionerDataAttributes = Se; exports.ComboboxRoot = Be; exports.ComboboxScrollArrowDataAttributes = Wt; exports.ComboboxSeparatorDataAttributes = Xo; exports.ComboboxStore = _chunkXMZZ62VJcjs.y; exports.ComboboxSurface = We; exports.commandScore = _chunkXMZZ62VJcjs.w; exports.defaultFilter = _chunkXMZZ62VJcjs.x; exports.useComboboxContext = _chunkRTG6U56Ocjs.w; exports.useComboboxItemContext = pe; exports.useComboboxPositionerContext = ke; exports.useMaybeComboboxContext = _chunkRTG6U56Ocjs.x; exports.useMaybeComboboxItemContext = Mt; exports.useMaybeSurfaceContext = _chunkXMZZ62VJcjs.q; exports.useSurfaceContext = _chunkXMZZ62VJcjs.p;
2
2
  //# sourceMappingURL=index.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["/home/runner/work/ui/ui/packages/react/dist/combobox/index.cjs","../../src/combobox/index.parts.ts","../../src/combobox/clear/clear.tsx","../../src/combobox/clear/clear.data-attrs.ts","../../src/combobox/contexts/combobox-positioner-context.ts","../../src/combobox/input/input.tsx","../../src/combobox/input-wrapper/input-wrapper-context.ts","../../src/combobox/input/input.data-attrs.ts","../../src/combobox/input/use-combobox-display-value.ts"],"names":["index_parts_exports","__export","PopupMenuArrow","PopupMenuBackdrop","ComboboxClear","PopupMenuEmpty","PopupMenuGroup","PopupMenuGroupLabel","PopupMenuIcon","ComboboxInput","ComboboxInputWrapper","ComboboxItem","ComboboxItemIndicator","ComboboxItemLabel","PopupMenuList","PopupMenuPopup","PopupMenuPortal","ComboboxPositioner","ComboboxRoot","PopupMenuScrollDownArrow","PopupMenuScrollUpArrow","PopupMenuSeparator","ComboboxSurface","useComboboxPositionerContext","ComboboxClearDataAttributes","props","forwardedRef","keepMounted","disabledProp","render","className","style","onClick","onPointerDown","rest","comboboxContext","useComboboxContext","disabled","hasValue","handleClick","event","handlePointerDown","state","element","useRender","ComboboxPositionerContext","ComboboxInputWrapperContext","useIsInsideInputWrapper","ComboboxInputDataAttributes","useComboboxDisplayValue","params","open","isValueEmpty","getValueText","value","serializedValue","stringifyAsValue","registryText","itemsLabel","resolveLabelFromItems","resolvedLabel","resolveLabel","selectedLabel","texts","v","text"],"mappings":"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","file":"/home/runner/work/ui/ui/packages/react/dist/combobox/index.cjs","sourcesContent":[null,"// ============================================================================\n// Combobox Parts\n// ============================================================================\n// Re-exports shared components from internal/popup-menu with Combobox-specific\n// Root, Input, Item, ItemLabel, and ItemIndicator components.\n\n// Re-export VirtualItem type from internal/listbox\nexport type { VirtualItem } from '../internal/listbox/index.js'\n\n// Re-export shared components from internal/popup-menu\nexport {\n PopupMenuArrow as Arrow,\n PopupMenuBackdrop as Backdrop,\n PopupMenuEmpty as Empty,\n // Structure\n PopupMenuGroup as Group,\n PopupMenuGroupLabel as GroupLabel,\n // Icon\n PopupMenuIcon as Icon,\n PopupMenuList as List,\n PopupMenuPopup as Popup,\n // Positioning & Container\n PopupMenuPortal as Portal,\n // Scroll indicators\n PopupMenuScrollDownArrow as ScrollDownArrow,\n PopupMenuScrollUpArrow as ScrollUpArrow,\n PopupMenuSeparator as Separator,\n} from '../internal/popup-menu/index.js'\nexport { ComboboxClear as Clear } from './clear/clear.js'\nexport { useComboboxPositionerContext } from './contexts/combobox-positioner-context.js'\nexport { ComboboxInput as Input } from './input/input.js'\nexport { ComboboxInputWrapper as InputWrapper } from './input-wrapper/input-wrapper.js'\nexport { ComboboxItem as Item } from './item/item.js'\nexport { ComboboxItemIndicator as ItemIndicator } from './item-indicator/item-indicator.js'\nexport { ComboboxItemLabel as ItemLabel } from './item-label/item-label.js'\nexport { ComboboxPositioner as Positioner } from './positioner/positioner.js'\n// Combobox-specific components\nexport { ComboboxRoot as Root } from './root/root.js'\nexport { ComboboxSurface as Surface } from './surface/surface.js'\n","'use client'\n\nimport { useRender } from '@base-ui/react/use-render'\nimport * as React from 'react'\nimport type { ComponentProps } from '../../utils/types.js'\nimport { useComboboxContext } from '../contexts/combobox-context.js'\nimport { ComboboxClearDataAttributes } from './clear.data-attrs.js'\n\nexport { ComboboxClearDataAttributes }\n\nexport interface ComboboxClearState extends Record<string, unknown> {\n /**\n * Whether the combobox has a value (clear button is actionable).\n */\n hasValue: boolean\n /**\n * Whether the combobox is disabled.\n */\n disabled: boolean\n}\n\nexport interface ComboboxClearProps\n extends ComponentProps<'button', ComboboxClear.State> {\n /**\n * Whether to render the button even when there's no value to clear.\n * @default false\n */\n keepMounted?: boolean\n}\n\n/**\n * A button that clears the selected value(s) when clicked.\n * Renders a `<button>` element.\n */\nexport const ComboboxClear = React.forwardRef<\n HTMLButtonElement,\n ComboboxClear.Props\n>(function ComboboxClear(props, forwardedRef) {\n const {\n keepMounted = false,\n disabled: disabledProp,\n render,\n className,\n style,\n onClick,\n onPointerDown,\n ...rest\n } = props\n\n const comboboxContext = useComboboxContext()\n\n const disabled = disabledProp ?? comboboxContext.disabled\n\n const hasValue = comboboxContext.multiple\n ? comboboxContext.values.length > 0\n : comboboxContext.value !== ''\n\n const handleClick = React.useCallback(\n (event: React.MouseEvent<HTMLButtonElement>) => {\n onClick?.(event)\n if (event.defaultPrevented) return\n\n if (comboboxContext.multiple) {\n comboboxContext.onValuesChange([])\n } else {\n comboboxContext.onValueChange('')\n }\n\n // Also clear the input value\n comboboxContext.onInputValueChange('')\n },\n [onClick, comboboxContext],\n )\n\n // Prevent pointer down from stealing focus from the input\n const handlePointerDown = React.useCallback(\n (event: React.PointerEvent<HTMLButtonElement>) => {\n event.preventDefault()\n onPointerDown?.(event)\n },\n [onPointerDown],\n )\n\n const state: ComboboxClear.State = React.useMemo(\n () => ({\n hasValue,\n disabled,\n }),\n [hasValue, disabled],\n )\n\n const element = useRender({\n render,\n ref: forwardedRef,\n state,\n props: {\n ...rest,\n [ComboboxClearDataAttributes.slot]: '',\n type: 'button',\n tabIndex: -1, // Not tabbable - use keyboard shortcuts instead\n 'aria-label': 'Clear selection',\n disabled: disabled || !hasValue,\n className,\n style,\n onClick: handleClick,\n onPointerDown: handlePointerDown,\n },\n enabled: keepMounted || hasValue,\n defaultTagName: 'button',\n })\n\n // Don't render if no value and not keepMounted\n if (!keepMounted && !hasValue) {\n return null\n }\n\n return element\n})\n\nexport namespace ComboboxClear {\n export type State = ComboboxClearState\n export interface Props extends ComboboxClearProps {}\n}\n","/**\n * Data attributes for ComboboxClear component.\n */\nexport const ComboboxClearDataAttributes = {\n /**\n * Identifies the component part.\n * @type {'bazzaui-combobox-clear'}\n */\n slot: 'bazzaui-combobox-clear',\n} as const\n","'use client'\n\nimport * as React from 'react'\n\n// ============================================================================\n// Types\n// ============================================================================\n\n// Types matching Base UI's positioning types\nexport type Side = 'top' | 'bottom' | 'left' | 'right'\nexport type Align = 'start' | 'center' | 'end'\n\n/**\n * Layout mode for the combobox popup.\n * - `'floating'` - Standard dropdown positioning below/above the input\n * - `'input-embedded'` - Popup wraps around the input (macOS-style)\n */\nexport type ComboboxLayout = 'floating' | 'input-embedded'\n\n/**\n * Context value for Combobox Positioner.\n * Provides alignment state for coordinating positioning behavior.\n */\nexport interface ComboboxPositionerContextValue {\n /**\n * The layout mode being used.\n * - `'floating'` - Standard dropdown positioning\n * - `'input-embedded'` - Popup wraps around the input\n */\n layout: ComboboxLayout\n\n /**\n * The side of the popup relative to the input.\n */\n side: Side\n\n /**\n * The alignment of the popup.\n */\n align: Align\n\n /**\n * Height of the input element in pixels.\n * Use this to add appropriate padding to the popup.\n */\n inputHeight: number\n}\n\n// ============================================================================\n// Context\n// ============================================================================\n\nconst ComboboxPositionerContext =\n React.createContext<ComboboxPositionerContextValue | null>(null)\n\n/**\n * Hook to access the Combobox Positioner context.\n * Returns null if used outside a ComboboxPositioner.\n */\nexport function useComboboxPositionerContext(): ComboboxPositionerContextValue | null {\n return React.useContext(ComboboxPositionerContext)\n}\n\nexport { ComboboxPositionerContext }\n","'use client'\n\nimport { useRender } from '@base-ui/react/use-render'\nimport * as React from 'react'\nimport { useFocusOwner } from '../../internal/popup-menu/contexts/focus-owner-context.js'\nimport { usePopupMenuContext } from '../../internal/popup-menu/contexts/popup-menu-context.js'\nimport { resolveLabelFromItems } from '../../utils/items.js'\nimport type { ComponentProps } from '../../utils/types.js'\nimport { useComboboxContext } from '../contexts/combobox-context.js'\nimport { useIsInsideInputWrapper } from '../input-wrapper/input-wrapper-context.js'\nimport { ComboboxInputDataAttributes } from './input.data-attrs.js'\nimport { useComboboxDisplayValue } from './use-combobox-display-value.js'\nimport { useComboboxInputBehavior } from './use-combobox-input-behavior.js'\n\nexport { ComboboxInputDataAttributes }\n\nexport interface ComboboxInputState extends Record<string, unknown> {\n /**\n * Whether the combobox popup is open.\n */\n open: boolean\n /**\n * Whether the input is disabled.\n */\n disabled: boolean\n /**\n * Whether the input currently shows placeholder (no value selected).\n */\n placeholder: boolean\n}\n\n/**\n * Cursor behavior when the combobox popup opens.\n * - `'none'` - Don't move the cursor (cursor appears where clicked)\n * - `'end'` - Move cursor to the end of the input\n * - `'select-all'` - Move cursor to the end and select all text\n */\nexport type ComboboxInputCursorBehavior = 'none' | 'end' | 'select-all'\n\nexport interface ComboboxInputProps\n extends Omit<\n ComponentProps<'input', ComboboxInput.State>,\n 'value' | 'onChange' | 'type'\n > {\n /**\n * Placeholder text shown when no value is selected and input is empty.\n * Overrides the placeholder set on Combobox.Root.\n */\n placeholder?: string\n\n /**\n * Cursor behavior when the combobox popup opens.\n * - `'none'` - Don't move the cursor (cursor appears where clicked)\n * - `'end'` - Move cursor to the end of the input\n * - `'select-all'` - Move cursor to the end and select all text\n *\n * @default 'none'\n */\n cursorBehavior?: ComboboxInputCursorBehavior\n}\n\n/**\n * An input that acts as both the trigger and search field for the combobox.\n * Renders an `<input>` element with combobox ARIA semantics.\n */\nexport const ComboboxInput = React.forwardRef<\n HTMLInputElement,\n ComboboxInput.Props\n>(function ComboboxInput(props, forwardedRef) {\n const {\n placeholder: placeholderProp,\n disabled: disabledProp,\n cursorBehavior = 'none',\n render,\n className,\n style,\n onFocus,\n onBlur,\n onClick,\n onKeyDown,\n ...rest\n } = props\n\n const comboboxContext = useComboboxContext()\n const popupMenuContext = usePopupMenuContext()\n const focusOwnerStore = useFocusOwner()\n const isInsideInputWrapper = useIsInsideInputWrapper()\n\n const disabled =\n (disabledProp ?? comboboxContext.disabled) || popupMenuContext.disabled\n\n // A `null` item's label (looked up under the empty-string key) acts as the\n // placeholder, taking precedence over the Root placeholder but not an\n // explicit `placeholder` prop on the input.\n const nullItemLabel = resolveLabelFromItems(comboboxContext.items, '')\n const placeholder =\n placeholderProp ??\n (typeof nullItemLabel === 'string' ? nullItemLabel : undefined) ??\n comboboxContext.placeholder\n\n // Get open state\n const open = popupMenuContext.store.useState('open')\n\n // Use display value hook\n const { hasValue, displayValue, getValueText } = useComboboxDisplayValue({\n comboboxContext,\n open,\n })\n\n // Use input behavior hook\n const { handleChange, handleFocus, handleBlur, handleClick, handleKeyDown } =\n useComboboxInputBehavior({\n comboboxContext,\n store: popupMenuContext.store,\n focusOwnerStore,\n open,\n disabled,\n cursorBehavior,\n hasValue,\n getValueText,\n onFocus,\n onBlur,\n onClick,\n onKeyDown,\n })\n\n // Build data attributes\n const dataAttrs: Record<string, string> = {\n [ComboboxInputDataAttributes.slot]: '',\n }\n if (open) {\n dataAttrs[ComboboxInputDataAttributes.open] = ''\n } else {\n dataAttrs[ComboboxInputDataAttributes.closed] = ''\n }\n if (disabled) {\n dataAttrs[ComboboxInputDataAttributes.disabled] = ''\n }\n if (!hasValue) {\n dataAttrs[ComboboxInputDataAttributes.placeholder] = ''\n }\n // Add input-embedded data attribute when layout is input-embedded\n if (comboboxContext.layout === 'input-embedded') {\n dataAttrs['data-input-embedded'] = ''\n }\n\n // Register input element for positioning\n const mergedRef = React.useCallback(\n (node: HTMLInputElement | null) => {\n comboboxContext.setInputElement(node)\n if (typeof forwardedRef === 'function') {\n forwardedRef(node)\n } else if (forwardedRef) {\n forwardedRef.current = node\n }\n },\n [forwardedRef, comboboxContext],\n )\n\n const state: ComboboxInput.State = React.useMemo(\n () => ({\n open,\n disabled,\n placeholder: !hasValue,\n }),\n [open, disabled, hasValue],\n )\n\n // When input-embedded layout, apply styles to position input above the popup\n // Skip z-index if inside an InputWrapper (the wrapper handles z-index)\n const inputEmbeddedStyles: React.CSSProperties | undefined =\n comboboxContext.layout === 'input-embedded' && !isInsideInputWrapper\n ? { position: 'relative', zIndex: 1 }\n : undefined\n\n const element = useRender({\n render,\n ref: mergedRef,\n state,\n props: {\n ...rest,\n ...dataAttrs,\n type: 'text',\n role: 'combobox',\n 'aria-autocomplete': 'list',\n 'aria-expanded': open,\n 'aria-controls': comboboxContext.listId,\n 'aria-haspopup': 'listbox',\n autoComplete: 'off',\n autoCorrect: 'off',\n spellCheck: false,\n disabled,\n placeholder: !hasValue ? placeholder : undefined,\n className,\n style: { ...inputEmbeddedStyles, ...style },\n value: displayValue,\n onChange: handleChange,\n onFocus: handleFocus,\n onBlur: handleBlur,\n onClick: handleClick,\n onKeyDown: handleKeyDown,\n },\n defaultTagName: 'input',\n })\n\n return element\n})\n\nexport namespace ComboboxInput {\n export interface Props extends ComboboxInputProps {}\n export type State = ComboboxInputState\n}\n","import * as React from 'react'\n\n/**\n * Context to indicate that children are inside an InputWrapper.\n * When true, Input should not apply its own z-index styles for input-embedded layout.\n */\nexport const ComboboxInputWrapperContext = React.createContext<boolean>(false)\n\n/**\n * Hook to check if component is inside a ComboboxInputWrapper.\n */\nexport function useIsInsideInputWrapper(): boolean {\n return React.useContext(ComboboxInputWrapperContext)\n}\n","/**\n * Data attributes for ComboboxInput component.\n */\nexport const ComboboxInputDataAttributes = {\n /**\n * Identifies the component part.\n * @type {'bazzaui-combobox-input'}\n */\n slot: 'bazzaui-combobox-input',\n /** Present when the combobox popup is open. */\n open: 'data-open',\n /** Present when the combobox popup is closed. */\n closed: 'data-closed',\n /** Present when the input is disabled. */\n disabled: 'data-disabled',\n /** Present when no value is selected (showing placeholder). */\n placeholder: 'data-placeholder',\n} as const\n","'use client'\n\nimport * as React from 'react'\nimport { resolveLabelFromItems } from '../../utils/items.js'\nimport {\n isValueEmpty,\n resolveLabel,\n stringifyAsValue,\n} from '../../utils/resolve-value-label.js'\nimport type { ComboboxContextValue } from '../contexts/combobox-context.js'\n\nexport interface UseComboboxDisplayValueParams<Value = unknown> {\n comboboxContext: ComboboxContextValue<Value>\n open: boolean\n}\n\nexport interface UseComboboxDisplayValueReturn<Value = unknown> {\n /** Whether a value is selected */\n hasValue: boolean\n /** The value to display in the input */\n displayValue: string\n /** The label of the selected value(s) */\n selectedLabel: string\n /** Get the display text for a value */\n getValueText: (value: Value) => string | undefined\n}\n\n/**\n * Hook to compute the display value for the combobox input.\n *\n * Handles:\n * - Determining if a value is selected (single or multi-select)\n * - Computing the display label for selected values\n * - Switching between selected label (closed) and input value (open)\n */\nexport function useComboboxDisplayValue<Value = unknown>(\n params: UseComboboxDisplayValueParams<Value>,\n): UseComboboxDisplayValueReturn<Value> {\n const { comboboxContext, open } = params\n\n // Determine if showing placeholder (no value selected)\n const hasValue = comboboxContext.multiple\n ? comboboxContext.values.length > 0\n : !isValueEmpty(comboboxContext.value)\n\n // Get the display text for selected value\n const getValueText = React.useCallback(\n (value: Value): string | undefined => {\n // Serialize for registry lookup\n const serializedValue = stringifyAsValue(\n value,\n comboboxContext.itemToStringValue,\n )\n\n // First try the registry (populated when items mount)\n const registryText = comboboxContext.itemTextRegistry.get(serializedValue)\n if (registryText !== undefined) {\n return registryText\n }\n\n // Fall back to the items prop (for initial render before popup opens).\n // The input can only display strings, so ignore non-string labels here.\n const itemsLabel = resolveLabelFromItems(\n comboboxContext.items,\n serializedValue,\n )\n if (typeof itemsLabel === 'string') {\n return itemsLabel\n }\n\n // Fall back to itemToStringLabel for object values\n const resolvedLabel = resolveLabel(\n value,\n comboboxContext.itemToStringLabel,\n )\n // Only return if it's different from the serialized value (meaning we got a real label)\n if (resolvedLabel && resolvedLabel !== serializedValue) {\n return resolvedLabel\n }\n\n return undefined\n },\n [\n comboboxContext.itemTextRegistry,\n comboboxContext.items,\n comboboxContext.itemToStringLabel,\n comboboxContext.itemToStringValue,\n ],\n )\n\n // Get the label for the selected value (used when closed or just opened)\n const selectedLabel = React.useMemo(() => {\n if (!hasValue) {\n return ''\n }\n if (comboboxContext.multiple) {\n // For multi-select, show comma-separated values or count\n const texts = comboboxContext.values\n .map((v) => {\n const text = getValueText(v)\n if (text !== undefined) return text\n // Fall back to resolved label or serialized value\n return (\n resolveLabel(v, comboboxContext.itemToStringLabel) ||\n stringifyAsValue(v, comboboxContext.itemToStringValue)\n )\n })\n .filter(Boolean)\n if (texts.length <= 2) {\n return texts.join(', ')\n }\n return `${texts.length} selected`\n }\n // Single-select: show the value's text.\n // Empty-string values are already handled by the `!hasValue` guard above;\n // this null check also narrows `Value | null` down to `Value`.\n const value = comboboxContext.value\n if (value == null) return ''\n\n const text = getValueText(value)\n if (text !== undefined) return text\n // Fall back to resolved label or serialized value\n return (\n resolveLabel(value, comboboxContext.itemToStringLabel) ||\n stringifyAsValue(value, comboboxContext.itemToStringValue)\n )\n }, [\n hasValue,\n comboboxContext.multiple,\n comboboxContext.value,\n comboboxContext.values,\n comboboxContext.itemToStringLabel,\n comboboxContext.itemToStringValue,\n getValueText,\n ])\n\n // Determine the display value for the input\n // When closed: show selected value's text\n // When open: show the search/filter text (inputValue)\n const displayValue = React.useMemo(() => {\n if (!open) {\n // When closed, show the selected value's label\n return selectedLabel\n }\n // When open, use the input value for filtering\n return comboboxContext.inputValue\n }, [open, selectedLabel, comboboxContext.inputValue])\n\n return {\n hasValue,\n displayValue,\n selectedLabel,\n getValueText,\n }\n}\n"]}
1
+ {"version":3,"sources":["/home/runner/work/ui/ui/packages/react/dist/combobox/index.cjs","../../src/combobox/index.parts.ts","../../src/combobox/clear/clear.tsx","../../src/combobox/clear/clear.data-attrs.ts","../../src/combobox/contexts/combobox-positioner-context.ts","../../src/combobox/input/input.tsx","../../src/combobox/input-wrapper/input-wrapper-context.ts","../../src/combobox/input/input.data-attrs.ts","../../src/combobox/input/use-combobox-display-value.ts"],"names":["index_parts_exports","__export","PopupMenuArrow","PopupMenuBackdrop","ComboboxClear","PopupMenuEmpty","PopupMenuGroup","PopupMenuGroupLabel","PopupMenuIcon","ComboboxInput","ComboboxInputWrapper","ComboboxItem","ComboboxItemIndicator","ComboboxItemLabel","PopupMenuList","PopupMenuPopup","PopupMenuPortal","ComboboxPositioner","ComboboxRoot","PopupMenuScrollDownArrow","PopupMenuScrollUpArrow","PopupMenuSeparator","ComboboxSurface","useComboboxPositionerContext","ComboboxClearDataAttributes","props","forwardedRef","keepMounted","disabledProp","render","className","style","onClick","onPointerDown","rest","comboboxContext","useComboboxContext","disabled","hasValue","handleClick","event","handlePointerDown","state","element","useRender","resolveClassName","resolveStyle","ComboboxPositionerContext","ComboboxInputWrapperContext","useIsInsideInputWrapper","ComboboxInputDataAttributes","useComboboxDisplayValue","params","open","isValueEmpty","getValueText","value","serializedValue","stringifyAsValue","registryText","itemsLabel","resolveLabelFromItems","resolvedLabel","resolveLabel","selectedLabel","texts","v","text"],"mappings":"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","file":"/home/runner/work/ui/ui/packages/react/dist/combobox/index.cjs","sourcesContent":[null,"// ============================================================================\n// Combobox Parts\n// ============================================================================\n// Re-exports shared components from internal/popup-menu with Combobox-specific\n// Root, Input, Item, ItemLabel, and ItemIndicator components.\n\n// Re-export VirtualItem type from internal/listbox\nexport type { VirtualItem } from '../internal/listbox/index.js'\n\n// Re-export shared components from internal/popup-menu\nexport {\n PopupMenuArrow as Arrow,\n PopupMenuBackdrop as Backdrop,\n PopupMenuEmpty as Empty,\n // Structure\n PopupMenuGroup as Group,\n PopupMenuGroupLabel as GroupLabel,\n // Icon\n PopupMenuIcon as Icon,\n PopupMenuList as List,\n PopupMenuPopup as Popup,\n // Positioning & Container\n PopupMenuPortal as Portal,\n // Scroll indicators\n PopupMenuScrollDownArrow as ScrollDownArrow,\n PopupMenuScrollUpArrow as ScrollUpArrow,\n PopupMenuSeparator as Separator,\n} from '../internal/popup-menu/index.js'\nexport { ComboboxClear as Clear } from './clear/clear.js'\nexport { useComboboxPositionerContext } from './contexts/combobox-positioner-context.js'\nexport { ComboboxInput as Input } from './input/input.js'\nexport { ComboboxInputWrapper as InputWrapper } from './input-wrapper/input-wrapper.js'\nexport { ComboboxItem as Item } from './item/item.js'\nexport { ComboboxItemIndicator as ItemIndicator } from './item-indicator/item-indicator.js'\nexport { ComboboxItemLabel as ItemLabel } from './item-label/item-label.js'\nexport { ComboboxPositioner as Positioner } from './positioner/positioner.js'\n// Combobox-specific components\nexport { ComboboxRoot as Root } from './root/root.js'\nexport { ComboboxSurface as Surface } from './surface/surface.js'\n","'use client'\n\nimport { useRender } from '@base-ui/react/use-render'\nimport * as React from 'react'\nimport {\n resolveClassName,\n resolveStyle,\n} from '../../utils/resolve-state-props.js'\nimport type { ComponentProps } from '../../utils/types.js'\nimport { useComboboxContext } from '../contexts/combobox-context.js'\nimport { ComboboxClearDataAttributes } from './clear.data-attrs.js'\n\nexport { ComboboxClearDataAttributes }\n\nexport interface ComboboxClearState extends Record<string, unknown> {\n /**\n * Whether the combobox has a value (clear button is actionable).\n */\n hasValue: boolean\n /**\n * Whether the combobox is disabled.\n */\n disabled: boolean\n}\n\nexport interface ComboboxClearProps\n extends ComponentProps<'button', ComboboxClear.State> {\n /**\n * Whether to render the button even when there's no value to clear.\n * @default false\n */\n keepMounted?: boolean\n}\n\n/**\n * A button that clears the selected value(s) when clicked.\n * Renders a `<button>` element.\n */\nexport const ComboboxClear = React.forwardRef<\n HTMLButtonElement,\n ComboboxClear.Props\n>(function ComboboxClear(props, forwardedRef) {\n const {\n keepMounted = false,\n disabled: disabledProp,\n render,\n className,\n style,\n onClick,\n onPointerDown,\n ...rest\n } = props\n\n const comboboxContext = useComboboxContext()\n\n const disabled = disabledProp ?? comboboxContext.disabled\n\n const hasValue = comboboxContext.multiple\n ? comboboxContext.values.length > 0\n : comboboxContext.value !== ''\n\n const handleClick = React.useCallback(\n (event: React.MouseEvent<HTMLButtonElement>) => {\n onClick?.(event)\n if (event.defaultPrevented) return\n\n if (comboboxContext.multiple) {\n comboboxContext.onValuesChange([])\n } else {\n comboboxContext.onValueChange('')\n }\n\n // Also clear the input value\n comboboxContext.onInputValueChange('')\n },\n [onClick, comboboxContext],\n )\n\n // Prevent pointer down from stealing focus from the input\n const handlePointerDown = React.useCallback(\n (event: React.PointerEvent<HTMLButtonElement>) => {\n event.preventDefault()\n onPointerDown?.(event)\n },\n [onPointerDown],\n )\n\n const state: ComboboxClear.State = React.useMemo(\n () => ({\n hasValue,\n disabled,\n }),\n [hasValue, disabled],\n )\n\n const element = useRender({\n render,\n ref: forwardedRef,\n state,\n props: {\n ...rest,\n [ComboboxClearDataAttributes.slot]: '',\n type: 'button',\n tabIndex: -1, // Not tabbable - use keyboard shortcuts instead\n 'aria-label': 'Clear selection',\n disabled: disabled || !hasValue,\n className: resolveClassName(className, state),\n style: resolveStyle(style, state),\n onClick: handleClick,\n onPointerDown: handlePointerDown,\n },\n enabled: keepMounted || hasValue,\n defaultTagName: 'button',\n })\n\n // Don't render if no value and not keepMounted\n if (!keepMounted && !hasValue) {\n return null\n }\n\n return element\n})\n\nexport namespace ComboboxClear {\n export type State = ComboboxClearState\n export interface Props extends ComboboxClearProps {}\n}\n","/**\n * Data attributes for ComboboxClear component.\n */\nexport const ComboboxClearDataAttributes = {\n /**\n * Identifies the component part.\n * @type {'bazzaui-combobox-clear'}\n */\n slot: 'bazzaui-combobox-clear',\n} as const\n","'use client'\n\nimport * as React from 'react'\n\n// ============================================================================\n// Types\n// ============================================================================\n\n// Types matching Base UI's positioning types\nexport type Side = 'top' | 'bottom' | 'left' | 'right'\nexport type Align = 'start' | 'center' | 'end'\n\n/**\n * Layout mode for the combobox popup.\n * - `'floating'` - Standard dropdown positioning below/above the input\n * - `'input-embedded'` - Popup wraps around the input (macOS-style)\n */\nexport type ComboboxLayout = 'floating' | 'input-embedded'\n\n/**\n * Context value for Combobox Positioner.\n * Provides alignment state for coordinating positioning behavior.\n */\nexport interface ComboboxPositionerContextValue {\n /**\n * The layout mode being used.\n * - `'floating'` - Standard dropdown positioning\n * - `'input-embedded'` - Popup wraps around the input\n */\n layout: ComboboxLayout\n\n /**\n * The side of the popup relative to the input.\n */\n side: Side\n\n /**\n * The alignment of the popup.\n */\n align: Align\n\n /**\n * Height of the input element in pixels.\n * Use this to add appropriate padding to the popup.\n */\n inputHeight: number\n}\n\n// ============================================================================\n// Context\n// ============================================================================\n\nconst ComboboxPositionerContext =\n React.createContext<ComboboxPositionerContextValue | null>(null)\n\n/**\n * Hook to access the Combobox Positioner context.\n * Returns null if used outside a ComboboxPositioner.\n */\nexport function useComboboxPositionerContext(): ComboboxPositionerContextValue | null {\n return React.useContext(ComboboxPositionerContext)\n}\n\nexport { ComboboxPositionerContext }\n","'use client'\n\nimport { useRender } from '@base-ui/react/use-render'\nimport * as React from 'react'\nimport { useFocusOwner } from '../../internal/popup-menu/contexts/focus-owner-context.js'\nimport { usePopupMenuContext } from '../../internal/popup-menu/contexts/popup-menu-context.js'\nimport { resolveLabelFromItems } from '../../utils/items.js'\nimport {\n resolveClassName,\n resolveStyle,\n} from '../../utils/resolve-state-props.js'\nimport type { ComponentProps } from '../../utils/types.js'\nimport { useComboboxContext } from '../contexts/combobox-context.js'\nimport { useIsInsideInputWrapper } from '../input-wrapper/input-wrapper-context.js'\nimport { ComboboxInputDataAttributes } from './input.data-attrs.js'\nimport { useComboboxDisplayValue } from './use-combobox-display-value.js'\nimport { useComboboxInputBehavior } from './use-combobox-input-behavior.js'\n\nexport { ComboboxInputDataAttributes }\n\nexport interface ComboboxInputState extends Record<string, unknown> {\n /**\n * Whether the combobox popup is open.\n */\n open: boolean\n /**\n * Whether the input is disabled.\n */\n disabled: boolean\n /**\n * Whether the input currently shows placeholder (no value selected).\n */\n placeholder: boolean\n}\n\n/**\n * Cursor behavior when the combobox popup opens.\n * - `'none'` - Don't move the cursor (cursor appears where clicked)\n * - `'end'` - Move cursor to the end of the input\n * - `'select-all'` - Move cursor to the end and select all text\n */\nexport type ComboboxInputCursorBehavior = 'none' | 'end' | 'select-all'\n\nexport interface ComboboxInputProps\n extends Omit<\n ComponentProps<'input', ComboboxInput.State>,\n 'value' | 'onChange' | 'type'\n > {\n /**\n * Placeholder text shown when no value is selected and input is empty.\n * Overrides the placeholder set on Combobox.Root.\n */\n placeholder?: string\n\n /**\n * Cursor behavior when the combobox popup opens.\n * - `'none'` - Don't move the cursor (cursor appears where clicked)\n * - `'end'` - Move cursor to the end of the input\n * - `'select-all'` - Move cursor to the end and select all text\n *\n * @default 'none'\n */\n cursorBehavior?: ComboboxInputCursorBehavior\n}\n\n/**\n * An input that acts as both the trigger and search field for the combobox.\n * Renders an `<input>` element with combobox ARIA semantics.\n */\nexport const ComboboxInput = React.forwardRef<\n HTMLInputElement,\n ComboboxInput.Props\n>(function ComboboxInput(props, forwardedRef) {\n const {\n placeholder: placeholderProp,\n disabled: disabledProp,\n cursorBehavior = 'none',\n render,\n className,\n style,\n onFocus,\n onBlur,\n onClick,\n onKeyDown,\n ...rest\n } = props\n\n const comboboxContext = useComboboxContext()\n const popupMenuContext = usePopupMenuContext()\n const focusOwnerStore = useFocusOwner()\n const isInsideInputWrapper = useIsInsideInputWrapper()\n\n const disabled =\n (disabledProp ?? comboboxContext.disabled) || popupMenuContext.disabled\n\n // A `null` item's label (looked up under the empty-string key) acts as the\n // placeholder, taking precedence over the Root placeholder but not an\n // explicit `placeholder` prop on the input.\n const nullItemLabel = resolveLabelFromItems(comboboxContext.items, '')\n const placeholder =\n placeholderProp ??\n (typeof nullItemLabel === 'string' ? nullItemLabel : undefined) ??\n comboboxContext.placeholder\n\n // Get open state\n const open = popupMenuContext.store.useState('open')\n\n // Use display value hook\n const { hasValue, displayValue, getValueText } = useComboboxDisplayValue({\n comboboxContext,\n open,\n })\n\n // Use input behavior hook\n const { handleChange, handleFocus, handleBlur, handleClick, handleKeyDown } =\n useComboboxInputBehavior({\n comboboxContext,\n store: popupMenuContext.store,\n focusOwnerStore,\n open,\n disabled,\n cursorBehavior,\n hasValue,\n getValueText,\n onFocus,\n onBlur,\n onClick,\n onKeyDown,\n })\n\n // Build data attributes\n const dataAttrs: Record<string, string> = {\n [ComboboxInputDataAttributes.slot]: '',\n }\n if (open) {\n dataAttrs[ComboboxInputDataAttributes.open] = ''\n } else {\n dataAttrs[ComboboxInputDataAttributes.closed] = ''\n }\n if (disabled) {\n dataAttrs[ComboboxInputDataAttributes.disabled] = ''\n }\n if (!hasValue) {\n dataAttrs[ComboboxInputDataAttributes.placeholder] = ''\n }\n // Add input-embedded data attribute when layout is input-embedded\n if (comboboxContext.layout === 'input-embedded') {\n dataAttrs['data-input-embedded'] = ''\n }\n\n // Register input element for positioning\n const mergedRef = React.useCallback(\n (node: HTMLInputElement | null) => {\n comboboxContext.setInputElement(node)\n if (typeof forwardedRef === 'function') {\n forwardedRef(node)\n } else if (forwardedRef) {\n forwardedRef.current = node\n }\n },\n [forwardedRef, comboboxContext],\n )\n\n const state: ComboboxInput.State = React.useMemo(\n () => ({\n open,\n disabled,\n placeholder: !hasValue,\n }),\n [open, disabled, hasValue],\n )\n\n // When input-embedded layout, apply styles to position input above the popup\n // Skip z-index if inside an InputWrapper (the wrapper handles z-index)\n const inputEmbeddedStyles: React.CSSProperties | undefined =\n comboboxContext.layout === 'input-embedded' && !isInsideInputWrapper\n ? { position: 'relative', zIndex: 1 }\n : undefined\n\n const element = useRender({\n render,\n ref: mergedRef,\n state,\n props: {\n ...rest,\n ...dataAttrs,\n type: 'text',\n role: 'combobox',\n 'aria-autocomplete': 'list',\n 'aria-expanded': open,\n 'aria-controls': comboboxContext.listId,\n 'aria-haspopup': 'listbox',\n autoComplete: 'off',\n autoCorrect: 'off',\n spellCheck: false,\n disabled,\n placeholder: !hasValue ? placeholder : undefined,\n className: resolveClassName(className, state),\n style: { ...inputEmbeddedStyles, ...resolveStyle(style, state) },\n value: displayValue,\n onChange: handleChange,\n onFocus: handleFocus,\n onBlur: handleBlur,\n onClick: handleClick,\n onKeyDown: handleKeyDown,\n },\n defaultTagName: 'input',\n })\n\n return element\n})\n\nexport namespace ComboboxInput {\n export interface Props extends ComboboxInputProps {}\n export type State = ComboboxInputState\n}\n","import * as React from 'react'\n\n/**\n * Context to indicate that children are inside an InputWrapper.\n * When true, Input should not apply its own z-index styles for input-embedded layout.\n */\nexport const ComboboxInputWrapperContext = React.createContext<boolean>(false)\n\n/**\n * Hook to check if component is inside a ComboboxInputWrapper.\n */\nexport function useIsInsideInputWrapper(): boolean {\n return React.useContext(ComboboxInputWrapperContext)\n}\n","/**\n * Data attributes for ComboboxInput component.\n */\nexport const ComboboxInputDataAttributes = {\n /**\n * Identifies the component part.\n * @type {'bazzaui-combobox-input'}\n */\n slot: 'bazzaui-combobox-input',\n /** Present when the combobox popup is open. */\n open: 'data-open',\n /** Present when the combobox popup is closed. */\n closed: 'data-closed',\n /** Present when the input is disabled. */\n disabled: 'data-disabled',\n /** Present when no value is selected (showing placeholder). */\n placeholder: 'data-placeholder',\n} as const\n","'use client'\n\nimport * as React from 'react'\nimport { resolveLabelFromItems } from '../../utils/items.js'\nimport {\n isValueEmpty,\n resolveLabel,\n stringifyAsValue,\n} from '../../utils/resolve-value-label.js'\nimport type { ComboboxContextValue } from '../contexts/combobox-context.js'\n\nexport interface UseComboboxDisplayValueParams<Value = unknown> {\n comboboxContext: ComboboxContextValue<Value>\n open: boolean\n}\n\nexport interface UseComboboxDisplayValueReturn<Value = unknown> {\n /** Whether a value is selected */\n hasValue: boolean\n /** The value to display in the input */\n displayValue: string\n /** The label of the selected value(s) */\n selectedLabel: string\n /** Get the display text for a value */\n getValueText: (value: Value) => string | undefined\n}\n\n/**\n * Hook to compute the display value for the combobox input.\n *\n * Handles:\n * - Determining if a value is selected (single or multi-select)\n * - Computing the display label for selected values\n * - Switching between selected label (closed) and input value (open)\n */\nexport function useComboboxDisplayValue<Value = unknown>(\n params: UseComboboxDisplayValueParams<Value>,\n): UseComboboxDisplayValueReturn<Value> {\n const { comboboxContext, open } = params\n\n // Determine if showing placeholder (no value selected)\n const hasValue = comboboxContext.multiple\n ? comboboxContext.values.length > 0\n : !isValueEmpty(comboboxContext.value)\n\n // Get the display text for selected value\n const getValueText = React.useCallback(\n (value: Value): string | undefined => {\n // Serialize for registry lookup\n const serializedValue = stringifyAsValue(\n value,\n comboboxContext.itemToStringValue,\n )\n\n // First try the registry (populated when items mount)\n const registryText = comboboxContext.itemTextRegistry.get(serializedValue)\n if (registryText !== undefined) {\n return registryText\n }\n\n // Fall back to the items prop (for initial render before popup opens).\n // The input can only display strings, so ignore non-string labels here.\n const itemsLabel = resolveLabelFromItems(\n comboboxContext.items,\n serializedValue,\n )\n if (typeof itemsLabel === 'string') {\n return itemsLabel\n }\n\n // Fall back to itemToStringLabel for object values\n const resolvedLabel = resolveLabel(\n value,\n comboboxContext.itemToStringLabel,\n )\n // Only return if it's different from the serialized value (meaning we got a real label)\n if (resolvedLabel && resolvedLabel !== serializedValue) {\n return resolvedLabel\n }\n\n return undefined\n },\n [\n comboboxContext.itemTextRegistry,\n comboboxContext.items,\n comboboxContext.itemToStringLabel,\n comboboxContext.itemToStringValue,\n ],\n )\n\n // Get the label for the selected value (used when closed or just opened)\n const selectedLabel = React.useMemo(() => {\n if (!hasValue) {\n return ''\n }\n if (comboboxContext.multiple) {\n // For multi-select, show comma-separated values or count\n const texts = comboboxContext.values\n .map((v) => {\n const text = getValueText(v)\n if (text !== undefined) return text\n // Fall back to resolved label or serialized value\n return (\n resolveLabel(v, comboboxContext.itemToStringLabel) ||\n stringifyAsValue(v, comboboxContext.itemToStringValue)\n )\n })\n .filter(Boolean)\n if (texts.length <= 2) {\n return texts.join(', ')\n }\n return `${texts.length} selected`\n }\n // Single-select: show the value's text.\n // Empty-string values are already handled by the `!hasValue` guard above;\n // this null check also narrows `Value | null` down to `Value`.\n const value = comboboxContext.value\n if (value == null) return ''\n\n const text = getValueText(value)\n if (text !== undefined) return text\n // Fall back to resolved label or serialized value\n return (\n resolveLabel(value, comboboxContext.itemToStringLabel) ||\n stringifyAsValue(value, comboboxContext.itemToStringValue)\n )\n }, [\n hasValue,\n comboboxContext.multiple,\n comboboxContext.value,\n comboboxContext.values,\n comboboxContext.itemToStringLabel,\n comboboxContext.itemToStringValue,\n getValueText,\n ])\n\n // Determine the display value for the input\n // When closed: show selected value's text\n // When open: show the search/filter text (inputValue)\n const displayValue = React.useMemo(() => {\n if (!open) {\n // When closed, show the selected value's label\n return selectedLabel\n }\n // When open, use the input value for filtering\n return comboboxContext.inputValue\n }, [open, selectedLabel, comboboxContext.inputValue])\n\n return {\n hasValue,\n displayValue,\n selectedLabel,\n getValueText,\n }\n}\n"]}
@@ -1,2 +1,2 @@
1
- import{a as vo,b as Vo,c as Mo,d as Eo,e as Lo,f as te,g as wo}from"../chunk-KO3DXT3Y.js";import{K as io,L as po,M as Ct,O as mo,P as co,Q as bo,R as xo,S as N,T as F,U as fo,V as Co,X as go,a as ro,ba as gt,ca as ho,d as de,ea as Po,fa as Io,ga as Ro,q as ao,ra as So,s as so,t as lo,ua as yo,v as uo,w as D,x as ft}from"../chunk-EDZTZHQ4.js";import{a as oe,p as mt,q as ct,w as bt,x as dt,y as xt}from"../chunk-A4Z5BY7H.js";import{a as pt}from"../chunk-4C666HHU.js";var zo={};pt(zo,{Arrow:()=>so,Backdrop:()=>lo,Clear:()=>Me,Empty:()=>Co,Group:()=>So,GroupLabel:()=>go,Icon:()=>fo,Input:()=>we,InputWrapper:()=>ke,Item:()=>Te,ItemIndicator:()=>He,ItemLabel:()=>Oe,List:()=>ho,Popup:()=>io,Portal:()=>po,Positioner:()=>De,Root:()=>Ae,ScrollDownArrow:()=>Io,ScrollUpArrow:()=>Po,Separator:()=>yo,Surface:()=>Fe,useComboboxPositionerContext:()=>Ee});import{useRender as ht}from"@base-ui/react/use-render";import*as _ from"react";var ko={slot:"bazzaui-combobox-clear"};var Me=_.forwardRef(function(e,o){let{keepMounted:i=!1,disabled:u,render:s,className:p,style:c,onClick:a,onPointerDown:t,...P}=e,m=D(),b=u??m.disabled,I=m.multiple?m.values.length>0:m.value!=="",d=_.useCallback(R=>{a?.(R),!R.defaultPrevented&&(m.multiple?m.onValuesChange([]):m.onValueChange(""),m.onInputValueChange(""))},[a,m]),g=_.useCallback(R=>{R.preventDefault(),t?.(R)},[t]),l=_.useMemo(()=>({hasValue:I,disabled:b}),[I,b]),S=ht({render:s,ref:o,state:l,props:{...P,[ko.slot]:"",type:"button",tabIndex:-1,"aria-label":"Clear selection",disabled:b||!I,className:p,style:c,onClick:d,onPointerDown:g},enabled:i||I,defaultTagName:"button"});return!i&&!I?null:S});import*as xe from"react";var fe=xe.createContext(null);function Ee(){return xe.useContext(fe)}import{useRender as Pt}from"@base-ui/react/use-render";import*as ne from"react";import*as Ce from"react";var Le=Ce.createContext(!1);function To(){return Ce.useContext(Le)}var Q={slot:"bazzaui-combobox-input",open:"data-open",closed:"data-closed",disabled:"data-disabled",placeholder:"data-placeholder"};import*as se from"react";function Ho(x){let{comboboxContext:e,open:o}=x,i=e.multiple?e.values.length>0:!xo(e.value),u=se.useCallback(c=>{let a=F(c,e.itemToStringValue),t=e.itemTextRegistry.get(a);if(t!==void 0)return t;let P=te(e.items,a);if(typeof P=="string")return P;let m=N(c,e.itemToStringLabel);if(m&&m!==a)return m},[e.itemTextRegistry,e.items,e.itemToStringLabel,e.itemToStringValue]),s=se.useMemo(()=>{if(!i)return"";if(e.multiple){let t=e.values.map(P=>{let m=u(P);return m!==void 0?m:N(P,e.itemToStringLabel)||F(P,e.itemToStringValue)}).filter(Boolean);return t.length<=2?t.join(", "):`${t.length} selected`}let c=e.value;if(c==null)return"";let a=u(c);return a!==void 0?a:N(c,e.itemToStringLabel)||F(c,e.itemToStringValue)},[i,e.multiple,e.value,e.values,e.itemToStringLabel,e.itemToStringValue,u]),p=se.useMemo(()=>o?e.inputValue:s,[o,s,e.inputValue]);return{hasValue:i,displayValue:p,selectedLabel:s,getValueText:u}}import*as T from"react";function Oo(x){let{comboboxContext:e,store:o,focusOwnerStore:i,open:u,disabled:s,cursorBehavior:p,hasValue:c,getValueText:a,onFocus:t,onBlur:P,onClick:m,onKeyDown:b}=x,I=T.useRef(!1),d=T.useRef(!1),g=T.useRef(!1),l=T.useRef(null),S=T.useRef(null),R=T.useRef(null);T.useEffect(()=>{if(!u)return;let n=f=>{let r=e.inputRef.current,v=e.inputWrapperRef.current,y=document.getElementById(e.listId),O=f.target,W=r?.contains(O),z=v?.contains(O),ee=y?.contains(O);!W&&!z&&!ee&&(R.current=f)};return document.addEventListener("pointerdown",n,!0),()=>{document.removeEventListener("pointerdown",n,!0),R.current=null}},[u,e.inputRef,e.inputWrapperRef,e.listId]),T.useLayoutEffect(()=>{let n=e.inputRef.current;if(n&&u&&S.current){let{start:f,end:r}=S.current,v=n.selectionStart,y=n.value.length;v===y&&f!==y&&n.setSelectionRange(f,r),S.current=null}});let L=T.useRef(u);T.useLayoutEffect(()=>{if(u&&!L.current){if(I.current){I.current=!1,L.current=u;return}if(g.current){g.current=!1,d.current=!1,l.current=null,L.current=u;return}if(d.current&&p==="none"){let f=e.inputRef.current,r=l.current;f&&r!==null&&requestAnimationFrame(()=>{let v=f.value.length,y=Math.min(r,v);f.setSelectionRange(y,y)}),d.current=!1,l.current=null,L.current=u;return}c&&e.multiple&&e.onInputValueChange("");let n=e.inputRef.current;if(n){let f=n.value.length;p==="select-all"&&f>0?requestAnimationFrame(()=>{n.setSelectionRange(0,n.value.length)}):p==="end"&&f>0&&requestAnimationFrame(()=>{n.setSelectionRange(n.value.length,n.value.length)})}}L.current=u},[u,e,c,p]);let w=T.useCallback(n=>{let f=n.target,r=f.value,v=f.selectionStart,y=f.selectionEnd;v!==null&&y!==null&&(S.current={start:v,end:y}),e.onInputValueChange(r),e.setFilterActive(),o.setSearch(r),o.state.open||(I.current=!0,e.openCombobox())},[e,o]),k=T.useCallback(n=>{if(t?.(n),n.defaultPrevented)return;let f=o.state.open;if(f&&(g.current=!0),e.openOnFocus&&!s&&!f){if(c&&!e.multiple){let r=a(e.value)??N(e.value,e.itemToStringLabel);e.onInputValueChange(r)}e.openCombobox()}},[t,e,s,o,c,a]),V=T.useCallback(n=>{P?.(n),!n.defaultPrevented&&requestAnimationFrame(()=>{let f=document.activeElement,v=document.getElementById(e.listId)?.contains(f),y=f===e.inputRef.current;if(!v&&!y){g.current=!1;let O=R.current,W=O?oe.outsidePress:oe.focusOut;R.current=null,e.closeCombobox(W,O??void 0)}})},[P,e]),A=T.useCallback(n=>{if(m?.(n),n.defaultPrevented)return;let f=o.state.open;if(!s&&!f){let r=n.target;if(p==="none"){let v=r.selectionStart;l.current=v,d.current=!0}if(c&&!e.multiple){let v=a(e.value)??N(e.value,e.itemToStringLabel);e.onInputValueChange(v)}e.openCombobox()}else f&&(g.current=!0)},[m,e,s,o,p,c,a]),K=T.useCallback(n=>{if(b?.(n),!n.defaultPrevented){if(u&&n.key==="Escape"){n.preventDefault(),e.closeCombobox(oe.escapeKey);return}if(!u&&(n.key==="ArrowDown"||n.key==="ArrowUp"||n.key==="Enter")){if(n.preventDefault(),c&&!e.multiple){let f=a(e.value)??N(e.value,e.itemToStringLabel);e.onInputValueChange(f)}e.openCombobox();return}}},[u,e,b,c,a]),{handleKeyDown:j}=bo({store:o,surfaceId:"combobox-input",focusOwnerStore:i,depth:0,submenuContext:null,subpageContext:null,enabled:u,enableTypeToSearch:!1,onKeyDown:K,closeAll:e.closeCombobox,skipFocusOwnerCheck:!0});return{handleChange:w,handleFocus:k,handleBlur:V,handleClick:A,handleKeyDown:j,selectionRef:S}}var we=ne.forwardRef(function(e,o){let{placeholder:i,disabled:u,cursorBehavior:s="none",render:p,className:c,style:a,onFocus:t,onBlur:P,onClick:m,onKeyDown:b,...I}=e,d=D(),g=de(),l=ro(),S=To(),R=(u??d.disabled)||g.disabled,L=te(d.items,""),w=i??(typeof L=="string"?L:void 0)??d.placeholder,k=g.store.useState("open"),{hasValue:V,displayValue:A,getValueText:K}=Ho({comboboxContext:d,open:k}),{handleChange:j,handleFocus:n,handleBlur:f,handleClick:r,handleKeyDown:v}=Oo({comboboxContext:d,store:g.store,focusOwnerStore:l,open:k,disabled:R,cursorBehavior:s,hasValue:V,getValueText:K,onFocus:t,onBlur:P,onClick:m,onKeyDown:b}),y={[Q.slot]:""};k?y[Q.open]="":y[Q.closed]="",R&&(y[Q.disabled]=""),V||(y[Q.placeholder]=""),d.layout==="input-embedded"&&(y["data-input-embedded"]="");let O=ne.useCallback(M=>{d.setInputElement(M),typeof o=="function"?o(M):o&&(o.current=M)},[o,d]),W=ne.useMemo(()=>({open:k,disabled:R,placeholder:!V}),[k,R,V]),z=d.layout==="input-embedded"&&!S?{position:"relative",zIndex:1}:void 0;return Pt({render:p,ref:O,state:W,props:{...I,...y,type:"text",role:"combobox","aria-autocomplete":"list","aria-expanded":k,"aria-controls":d.listId,"aria-haspopup":"listbox",autoComplete:"off",autoCorrect:"off",spellCheck:!1,disabled:R,placeholder:V?void 0:w,className:c,style:{...z,...a},value:A,onChange:j,onFocus:n,onBlur:f,onClick:r,onKeyDown:v},defaultTagName:"input"})});import{useRender as It}from"@base-ui/react/use-render";import*as re from"react";var ge={slot:"bazzaui-combobox-input-wrapper",open:"data-open"};import{jsx as St}from"react/jsx-runtime";var Rt={open:x=>x?{[ge.open]:""}:null},ke=re.forwardRef(function(e,o){let{render:i,className:u,style:s,children:p,...c}=e,{store:a}=de(),t=D(),P=a.useState("open"),m=re.useMemo(()=>({open:P}),[P]),b=t.layout==="input-embedded"?{position:"relative",zIndex:1}:{position:"relative"},I=re.useCallback(g=>{t.setInputWrapperElement(g),typeof o=="function"?o(g):o&&(o.current=g)},[o,t]),d=It({render:i,ref:I,state:m,stateAttributesMapping:Rt,props:{...c,[ge.slot]:"",className:u,style:{...b,...s},children:p},defaultTagName:"div"});return St(Le.Provider,{value:!0,children:d})});import{useRender as vt}from"@base-ui/react/use-render";import*as E from"react";var q={slot:"bazzaui-combobox-item",highlighted:"data-highlighted",disabled:"data-disabled",selected:"data-selected",first:"data-first",last:"data-last",firstInGroup:"data-first-in-group",lastInGroup:"data-last-in-group"};import*as le from"react";var he=le.createContext(null);function ue(){let x=le.useContext(he);if(!x)throw new Error("ComboboxItem child components must be used within a Combobox.Item");return x}function yt(){return le.useContext(he)}import{jsx as Et}from"react/jsx-runtime";var Vt={highlighted:x=>x?{[q.highlighted]:""}:null,disabled:x=>x?{[q.disabled]:""}:null,selected:x=>x?{[q.selected]:""}:null,first:x=>x?{[q.first]:""}:null,last:x=>x?{[q.last]:""}:null,firstInGroup:x=>x?{[q.firstInGroup]:""}:null,lastInGroup:x=>x?{[q.lastInGroup]:""}:null};function Mt(x,e){let{value:o,textValue:i,keywords:u,disabled:s=!1,onSelect:p,forceMount:c=!1,render:a,className:t,style:P,onClick:m,onPointerDown:b,onPointerMove:I,children:d,...g}=x,l=D(),S=E.useMemo(()=>F(o,l.itemToStringValue),[o,l.itemToStringValue]),R=E.useId(),L=o===null?`combobox-clear-${R}`:void 0,w=E.useMemo(()=>Lo(l.items,S),[l.items,S]),k=w?.label,V=E.useMemo(()=>N(o,l.itemToStringLabel),[o,l.itemToStringLabel]),A=E.useMemo(()=>{if(i!==void 0)return i;if(typeof k=="string")return k;if(V&&V!==S)return V},[i,k,V,S]),K=E.useMemo(()=>wo(u,[typeof k=="string"?k:V&&V!==S?V:void 0,...w?.keywords??[]]),[u,k,V,S,w]),j=E.useRef(A),n=l.multiple?Mo(l.values,o,l.isItemEqualToValue):l.value!==""&&Vo(l.value,o,l.isItemEqualToValue),f=l.closeOnSelect,r=co({id:L,value:S,keywords:K,disabled:s,forceMount:c,closeOnClick:f,children:d});E.useEffect(()=>{let M=()=>{if(!s){if(l.multiple)if(o==null)l.onValuesChange([]);else{let me=n?Eo(l.values,o,l.isItemEqualToValue):[...l.values,o];l.onValuesChange(me)}else l.onValueChange(o);p?.()}};return r.registerSelect(M)},[s,l,o,n,p,r]),E.useEffect(()=>{let M=j.current;if(M)return l.registerItemText(S,M)},[S,l]),E.useEffect(()=>{!A&&typeof d=="string"&&(j.current=d,l.registerItemText(S,d))},[d,A,S,l]);let v=E.useMemo(()=>({highlighted:r.isHighlighted,disabled:s,selected:n,first:r.positional.first,last:r.positional.last,firstInGroup:r.positional.firstInGroup,lastInGroup:r.positional.lastInGroup}),[r.isHighlighted,s,n,r.positional]),y=E.useMemo(()=>({id:r.id,value:o,textValue:A,highlighted:r.isHighlighted,disabled:s,selected:n}),[r.id,o,A,r.isHighlighted,s,n]),O=E.useCallback(M=>{m?.(M),M.defaultPrevented||r.handlers.onClick(M)},[m,r.handlers]),W=E.useCallback(M=>{r.handlers.onPointerDown(M),b?.(M)},[r.handlers,b]),z=E.useCallback(M=>{I?.(M),M.defaultPrevented||r.handlers.onPointerMove(M)},[I,r.handlers]),ee=vt({render:a,ref:[r.ref,r.rowRef,e],state:v,stateAttributesMapping:Vt,props:{...g,[q.slot]:"",id:r.id,role:"option",tabIndex:-1,"aria-selected":n,"aria-disabled":s||void 0,className:t,style:P,onClick:O,onPointerMove:z,onPointerDown:W,children:d},enabled:r.isVisible,defaultTagName:"div"});return r.isVisible?Et(he.Provider,{value:y,children:ee}):null}var Te=E.forwardRef(Mt);import{useRender as Lt}from"@base-ui/react/use-render";import*as Ie from"react";var Pe={slot:"bazzaui-combobox-item-indicator",selected:"data-selected"};var wt={selected:x=>x?{[Pe.selected]:""}:null},He=Ie.forwardRef(function(e,o){let{keepMounted:i=!1,render:u,className:s,style:p,...c}=e,a=ue(),t=Ie.useMemo(()=>({selected:a.selected}),[a.selected]),P=Lt({render:u,ref:o,state:t,stateAttributesMapping:wt,props:{...c,[Pe.slot]:"","aria-hidden":!0,className:s,style:p},enabled:i||a.selected,defaultTagName:"span"});return!i&&!a.selected?null:P});import{useRender as kt}from"@base-ui/react/use-render";import*as Y from"react";var Do={slot:"bazzaui-combobox-item-label"};var Oe=Y.forwardRef(function(e,o){let{render:i,className:u,style:s,children:p,...c}=e,a=D(),t=ue(),P=F(t.value,a.itemToStringValue),m=Y.useMemo(()=>{if(p!==void 0)return p;let I=te(a.items,P);return I!==void 0?I:t.textValue!==void 0?t.textValue:P},[p,a.items,P,t.textValue]),b=Y.useMemo(()=>({value:P,selected:t.selected,highlighted:t.highlighted,disabled:t.disabled}),[P,t.selected,t.highlighted,t.disabled]);return Y.useEffect(()=>{if(typeof m=="string")return a.registerItemText(P,m)},[m,a,P]),kt({render:i,ref:o,state:b,props:{...c,[Do.slot]:"",className:u,style:s,children:m},defaultTagName:"span"})});import{Popover as Ao}from"@base-ui/react/popover";import*as U from"react";var Re={slot:"bazzaui-combobox-positioner"};import{jsx as ie}from"react/jsx-runtime";function Tt(x,e,o,i){let u=o+i*2;if(x==="top"){let c=-(e+i),a=e+i;return{width:u,marginBottom:c,paddingTop:i,paddingLeft:i,paddingRight:i,paddingBottom:a}}let s=-(e+i),p=e+i;return{width:u,marginTop:s,paddingTop:p,paddingLeft:i,paddingRight:i,paddingBottom:i}}var De=U.forwardRef(function(e,o){let{layout:i,popupPadding:u=8,side:s="bottom",align:p,sideOffset:c=4,anchor:a,className:t,style:P,children:m,...b}=e,I=D(),d=i??I.layout,g=d==="input-embedded",l=a??I.inputWrapperRef.current?I.inputWrapperRef:I.inputRef,S=g?0:c,R=g?"center":p??"start",{inputHeight:L,inputWidth:w}=I,k=w+u*2,V={...P,...g?{zIndex:0}:{}};if(g)return ie(Ao.Positioner,{ref:o,side:s,align:R,sideOffset:S,anchor:l,className:t,style:V,"data-input-embedded":"",[Re.slot]:"",...b,render:(n,f)=>{let r=f.side,v={layout:d,side:r,align:f.align,inputHeight:I.inputHeight},y={"--combobox-input-height":`${L}px`,"--combobox-input-width":`${w}px`,"--combobox-popup-padding":`${u}px`,"--combobox-popup-width":`${k}px`},O=Tt(r,L,w,u),W=U.Children.map(m,z=>U.isValidElement(z)?U.cloneElement(z,{style:{...O,...z.props.style},"data-side":r}):z);return ie(fe.Provider,{value:v,children:ie("div",{...n,style:{...n.style,...y},"data-side":r,children:W})})}});let A={layout:d,side:s,align:R,inputHeight:I.inputHeight},K={"--combobox-input-height":`${L}px`,"--combobox-input-width":`${w}px`},j={...V,...K};return ie(fe.Provider,{value:A,children:ie(Ao.Positioner,{ref:o,side:s,align:R,sideOffset:S,anchor:l,className:t,style:j,[Re.slot]:"",...b,children:m})})});import{Popover as Ht}from"@base-ui/react/popover";import*as h from"react";import{jsx as pe,jsxs as Ot}from"react/jsx-runtime";function Ae(x){let{open:e,onOpenChange:o,actionsRef:i,defaultOpen:u=!1,value:s,defaultValue:p,onValueChange:c,multiple:a=!1,values:t,defaultValues:P,onValuesChange:m,isItemEqualToValue:b=vo,itemToStringLabel:I,itemToStringValue:d,inputValue:g,defaultInputValue:l="",onInputValueChange:S,name:R,form:L,required:w,disabled:k=!1,placeholder:V="Search...",items:A,modal:K=!1,closeOnSelect:j,openOnFocus:n=!0,virtualized:f=!1,virtualItems:r,onHighlightChange:v,layout:y="floating",onOpenChangeComplete:O,debug:W,children:z,...ee}=x,M=h.useCallback((C,H,G,be)=>v?.(C,G,be),[v]),me=h.useId(),ce=h.useRef(null),Se=h.useRef(null),[ze,Be]=h.useState(0),[We,je]=h.useState(0),Ge=h.useCallback(C=>{if(ce.current=C,C&&!Se.current){let H=C.getBoundingClientRect();Be(H.height),je(H.width)}},[]),Ne=h.useCallback(C=>{if(Se.current=C,C){let H=C.getBoundingClientRect();Be(H.height),je(H.width)}},[]),{store:B,focusOwnerStore:$o,openChainStore:Jo,registerSurface:Xo,closeAll:_o,virtualization:Qo,handleOpenChange:qe,disabled:$,setDisabled:Ke,menuTreeResolver:Yo}=ao({onOpenChange:o,defaultOpen:u,virtualized:f,items:r,onHighlightChange:M,disabled:k}),ye=h.useRef(null);h.useImperativeHandle(i,()=>({close:()=>{ye.current?.close()},unmount:()=>{ye.current?.unmount()},setDisabled:Ke}),[Ke]),B.useControlledProp("openProp",e);let Zo=B.useState("open"),Ue=h.useCallback((C,H,G)=>{$&&H!==oe.imperativeAction||!C&&ce.current&&document.activeElement===ce.current||qe(C,H,G)},[qe,$]),et=h.useCallback(C=>{!C&&B.context.clearSearchOnClose==="after-exit"&&(B.clearSearch(),B.setInputActive(!1)),C||B.clearHighlight(),O?.(C)},[B,O]),ot=h.useCallback((C,H)=>{Ue(C,H.reason,H.event)},[Ue]),[tt,nt]=h.useState(p!==void 0?p:null),J=s!==void 0?s:tt,$e=h.useCallback(C=>{s===void 0&&nt(C),c?.(C)},[s,c]),[rt,at]=h.useState(P??[]),ae=t!==void 0?t:rt,Je=h.useCallback(C=>{t===void 0&&at(C),m?.(C)},[t,m]),[ve,st]=h.useState(l),Xe=g!==void 0?g:ve,_e=h.useCallback(C=>{g===void 0&&st(C),S?.(C)},[g,S]),Qe=h.useRef(new Map),Ye=h.useCallback((C,H)=>(Qe.current.set(C,H),()=>{}),[]),Ze=j??!a,Ve=h.useRef({type:"active"}),[,lt]=h.useState({type:"active"}),X=h.useCallback(C=>{Ve.current=C,lt(C)},[]),eo=Ve.current,oo=h.useCallback(()=>{X({type:"active"})},[X]),to=h.useCallback(()=>{$||(!a&&J!=null?X({type:"showAll"}):X({type:"active"}),B.setOpen(!0))},[$,B,a,J,X]),no=h.useCallback((C,H)=>{let G=Ve.current,be=G.type==="active"?ve:G.type==="showAll"?"":G.search;X({type:"frozen",search:be}),B.setOpen(!1,C,H)},[B,X,ve]),ut=h.useMemo(()=>({multiple:a,value:J,values:ae,onValueChange:$e,onValuesChange:Je,isItemEqualToValue:b,itemToStringLabel:I,itemToStringValue:d,inputValue:Xe,onInputValueChange:_e,name:R,form:L,required:w,disabled:$,placeholder:V,items:A,itemTextRegistry:Qe.current,registerItemText:Ye,listId:me,inputRef:ce,setInputElement:Ge,inputWrapperRef:Se,setInputWrapperElement:Ne,closeOnSelect:Ze,openOnFocus:n,openCombobox:to,closeCombobox:no,filterMode:eo,setFilterActive:oo,inputHeight:ze,inputWidth:We,layout:y}),[a,J,ae,$e,Je,b,I,d,Xe,_e,R,L,w,$,V,A,Ye,me,Ge,Ne,Ze,n,to,no,eo,oo,ze,We,y]),it=h.useMemo(()=>R?a?ae.length>0?ae.map((C,H)=>{let G=F(C,d);return pe("input",{type:"hidden",name:R,value:G,form:L,required:w&&H===0},G)}):pe("input",{type:"hidden",name:R,value:"",form:L,required:w}):pe("input",{type:"hidden",name:R,value:J!=null?F(J,d):"",form:L,required:w}):null,[R,L,w,a,J,ae,d]);return pe(uo.Provider,{value:ut,children:Ot(mo,{menuTreeResolver:Yo,store:B,focusOwnerStore:$o,openChainStore:Jo,disabled:$,depth:0,closeAll:_o,registerSurface:Xo,virtualization:Qo,menuType:"dropdown",componentName:"combobox",debug:W,children:[it,pe(Ht.Root,{...ee,open:Zo,onOpenChange:ot,onOpenChangeComplete:et,modal:K,actionsRef:i?ye:void 0,children:z})]})})}import*as Z from"react";var Fo={slot:"bazzaui-combobox-surface"};import{jsx as Dt}from"react/jsx-runtime";var Fe=Z.forwardRef(function(e,o){let{autoHighlightFirst:i,clearSearchOnClose:u=!0,search:s,onSearchChange:p,onPointerMove:c,...a}=e,t=D(),P=Z.useCallback(g=>{c?.(g);let l=t.inputRef.current;l&&document.activeElement!==l&&l.focus()},[c,t.inputRef]),m=Z.useMemo(()=>{let g=i??!0;if(g==="selected"){let l=t.multiple?t.values[0]:t.value;return l!=null?F(l,t.itemToStringValue):!0}return g},[i,t.multiple,t.value,t.values,t.itemToStringValue]),{filterMode:b}=t,I=s??(b.type==="active"?t.inputValue:b.type==="showAll"?"":b.search),d=Z.useCallback(g=>{t.onInputValueChange(g),p?.(g)},[t,p]);return Dt(Ro,{ref:o,autoHighlightFirst:m,clearSearchOnClose:u,search:I,onSearchChange:d,onPointerMove:P,skipAutoFocus:!0,[Fo.slot]:"",...a})});var Bo=(p=>(p.slot="bazzaui-combobox-arrow",p.open="data-open",p.closed="data-closed",p.side="data-side",p.align="data-align",p.uncentered="data-uncentered",p))(Bo||{});var Wo=(s=>(s.slot="bazzaui-combobox-backdrop",s.open="data-open",s.closed="data-closed",s.startingStyle="data-starting-style",s.endingStyle="data-ending-style",s))(Wo||{});var jo=(e=>(e.slot="bazzaui-combobox-empty",e))(jo||{});var Go=(e=>(e.slot="bazzaui-combobox-group",e))(Go||{});var No=(e=>(e.slot="bazzaui-combobox-group-label",e))(No||{});var At={slot:"bazzaui-combobox-icon",open:"data-popup-open"};var qo=(o=>(o.slot="bazzaui-combobox-list",o.list="data-popup-menu-list",o))(qo||{});var Ko=(b=>(b.slot="bazzaui-combobox-popup",b.open="data-open",b.closed="data-closed",b.side="data-side",b.align="data-align",b.startingStyle="data-starting-style",b.endingStyle="data-ending-style",b.instant="data-instant",b.focused="data-focused",b.hasOpenSubmenu="data-has-open-submenu",b.submenu="data-submenu",b.navigating="data-navigating",b))(Ko||{});var Ft={slotUp:"bazzaui-combobox-scroll-up-arrow",slotDown:"bazzaui-combobox-scroll-down-arrow",direction:"data-direction",side:"data-side"};var Uo=(e=>(e.slot="bazzaui-combobox-separator",e))(Uo||{});export{zo as Combobox,Bo as ComboboxArrowDataAttributes,Wo as ComboboxBackdropDataAttributes,Me as ComboboxClear,jo as ComboboxEmptyDataAttributes,Go as ComboboxGroupDataAttributes,No as ComboboxGroupLabelDataAttributes,At as ComboboxIconDataAttributes,we as ComboboxInput,Q as ComboboxInputDataAttributes,ke as ComboboxInputWrapper,ge as ComboboxInputWrapperDataAttributes,Te as ComboboxItem,q as ComboboxItemDataAttributes,He as ComboboxItemIndicator,Pe as ComboboxItemIndicatorDataAttributes,Oe as ComboboxItemLabel,gt as ComboboxListCssVars,qo as ComboboxListDataAttributes,Ko as ComboboxPopupDataAttributes,De as ComboboxPositioner,Ct as ComboboxPositionerCssVars,Re as ComboboxPositionerDataAttributes,Ae as ComboboxRoot,Ft as ComboboxScrollArrowDataAttributes,Uo as ComboboxSeparatorDataAttributes,xt as ComboboxStore,Fe as ComboboxSurface,bt as commandScore,dt as defaultFilter,D as useComboboxContext,ue as useComboboxItemContext,Ee as useComboboxPositionerContext,ft as useMaybeComboboxContext,yt as useMaybeComboboxItemContext,ct as useMaybeSurfaceContext,mt as useSurfaceContext};
1
+ import{a as Eo,b as Lo,c as wo,d as ko,e as To,f as re,g as Ho}from"../chunk-KO3DXT3Y.js";import{K as co,L as bo,M as It,O as xo,P as fo,Q as Co,R as go,S as K,T as z,U as ho,V as Io,X as Po,a as lo,ba as Pt,ca as Ro,d as fe,ea as yo,fa as So,ga as vo,q as uo,ra as Vo,s as io,t as po,ua as Mo,v as mo,w as D,x as ht}from"../chunk-3HMQLMSF.js";import{a as ne,p as dt,q as xt,w as ft,x as Ct,y as gt}from"../chunk-A4Z5BY7H.js";import{a as N,b as j,c as Le}from"../chunk-MPPIEWSL.js";import{a as bt}from"../chunk-4C666HHU.js";var No={};bt(No,{Arrow:()=>io,Backdrop:()=>po,Clear:()=>we,Empty:()=>Io,Group:()=>Vo,GroupLabel:()=>Po,Icon:()=>ho,Input:()=>He,InputWrapper:()=>Oe,Item:()=>De,ItemIndicator:()=>Ae,ItemLabel:()=>Fe,List:()=>Ro,Popup:()=>co,Portal:()=>bo,Positioner:()=>ze,Root:()=>Be,ScrollDownArrow:()=>So,ScrollUpArrow:()=>yo,Separator:()=>Mo,Surface:()=>We,useComboboxPositionerContext:()=>ke});import{useRender as Rt}from"@base-ui/react/use-render";import*as Y from"react";var Oo={slot:"bazzaui-combobox-clear"};var we=Y.forwardRef(function(e,t){let{keepMounted:i=!1,disabled:u,render:l,className:m,style:b,onClick:s,onPointerDown:o,...g}=e,p=D(),c=u??p.disabled,P=p.multiple?p.values.length>0:p.value!=="",d=Y.useCallback(R=>{s?.(R),!R.defaultPrevented&&(p.multiple?p.onValuesChange([]):p.onValueChange(""),p.onInputValueChange(""))},[s,p]),h=Y.useCallback(R=>{R.preventDefault(),o?.(R)},[o]),r=Y.useMemo(()=>({hasValue:P,disabled:c}),[P,c]),y=Rt({render:l,ref:t,state:r,props:{...g,[Oo.slot]:"",type:"button",tabIndex:-1,"aria-label":"Clear selection",disabled:c||!P,className:N(m,r),style:j(b,r),onClick:d,onPointerDown:h},enabled:i||P,defaultTagName:"button"});return!i&&!P?null:y});import*as Ce from"react";var ge=Ce.createContext(null);function ke(){return Ce.useContext(ge)}import{useRender as yt}from"@base-ui/react/use-render";import*as ae from"react";import*as he from"react";var Te=he.createContext(!1);function Do(){return he.useContext(Te)}var Z={slot:"bazzaui-combobox-input",open:"data-open",closed:"data-closed",disabled:"data-disabled",placeholder:"data-placeholder"};import*as ue from"react";function Ao(x){let{comboboxContext:e,open:t}=x,i=e.multiple?e.values.length>0:!go(e.value),u=ue.useCallback(b=>{let s=z(b,e.itemToStringValue),o=e.itemTextRegistry.get(s);if(o!==void 0)return o;let g=re(e.items,s);if(typeof g=="string")return g;let p=K(b,e.itemToStringLabel);if(p&&p!==s)return p},[e.itemTextRegistry,e.items,e.itemToStringLabel,e.itemToStringValue]),l=ue.useMemo(()=>{if(!i)return"";if(e.multiple){let o=e.values.map(g=>{let p=u(g);return p!==void 0?p:K(g,e.itemToStringLabel)||z(g,e.itemToStringValue)}).filter(Boolean);return o.length<=2?o.join(", "):`${o.length} selected`}let b=e.value;if(b==null)return"";let s=u(b);return s!==void 0?s:K(b,e.itemToStringLabel)||z(b,e.itemToStringValue)},[i,e.multiple,e.value,e.values,e.itemToStringLabel,e.itemToStringValue,u]),m=ue.useMemo(()=>t?e.inputValue:l,[t,l,e.inputValue]);return{hasValue:i,displayValue:m,selectedLabel:l,getValueText:u}}import*as T from"react";function Fo(x){let{comboboxContext:e,store:t,focusOwnerStore:i,open:u,disabled:l,cursorBehavior:m,hasValue:b,getValueText:s,onFocus:o,onBlur:g,onClick:p,onKeyDown:c}=x,P=T.useRef(!1),d=T.useRef(!1),h=T.useRef(!1),r=T.useRef(null),y=T.useRef(null),R=T.useRef(null);T.useEffect(()=>{if(!u)return;let n=f=>{let a=e.inputRef.current,v=e.inputWrapperRef.current,S=document.getElementById(e.listId),O=f.target,F=a?.contains(O),B=v?.contains(O),te=S?.contains(O);!F&&!B&&!te&&(R.current=f)};return document.addEventListener("pointerdown",n,!0),()=>{document.removeEventListener("pointerdown",n,!0),R.current=null}},[u,e.inputRef,e.inputWrapperRef,e.listId]),T.useLayoutEffect(()=>{let n=e.inputRef.current;if(n&&u&&y.current){let{start:f,end:a}=y.current,v=n.selectionStart,S=n.value.length;v===S&&f!==S&&n.setSelectionRange(f,a),y.current=null}});let E=T.useRef(u);T.useLayoutEffect(()=>{if(u&&!E.current){if(P.current){P.current=!1,E.current=u;return}if(h.current){h.current=!1,d.current=!1,r.current=null,E.current=u;return}if(d.current&&m==="none"){let f=e.inputRef.current,a=r.current;f&&a!==null&&requestAnimationFrame(()=>{let v=f.value.length,S=Math.min(a,v);f.setSelectionRange(S,S)}),d.current=!1,r.current=null,E.current=u;return}b&&e.multiple&&e.onInputValueChange("");let n=e.inputRef.current;if(n){let f=n.value.length;m==="select-all"&&f>0?requestAnimationFrame(()=>{n.setSelectionRange(0,n.value.length)}):m==="end"&&f>0&&requestAnimationFrame(()=>{n.setSelectionRange(n.value.length,n.value.length)})}}E.current=u},[u,e,b,m]);let w=T.useCallback(n=>{let f=n.target,a=f.value,v=f.selectionStart,S=f.selectionEnd;v!==null&&S!==null&&(y.current={start:v,end:S}),e.onInputValueChange(a),e.setFilterActive(),t.setSearch(a),t.state.open||(P.current=!0,e.openCombobox())},[e,t]),k=T.useCallback(n=>{if(o?.(n),n.defaultPrevented)return;let f=t.state.open;if(f&&(h.current=!0),e.openOnFocus&&!l&&!f){if(b&&!e.multiple){let a=s(e.value)??K(e.value,e.itemToStringLabel);e.onInputValueChange(a)}e.openCombobox()}},[o,e,l,t,b,s]),L=T.useCallback(n=>{g?.(n),!n.defaultPrevented&&requestAnimationFrame(()=>{let f=document.activeElement,v=document.getElementById(e.listId)?.contains(f),S=f===e.inputRef.current;if(!v&&!S){h.current=!1;let O=R.current,F=O?ne.outsidePress:ne.focusOut;R.current=null,e.closeCombobox(F,O??void 0)}})},[g,e]),A=T.useCallback(n=>{if(p?.(n),n.defaultPrevented)return;let f=t.state.open;if(!l&&!f){let a=n.target;if(m==="none"){let v=a.selectionStart;r.current=v,d.current=!0}if(b&&!e.multiple){let v=s(e.value)??K(e.value,e.itemToStringLabel);e.onInputValueChange(v)}e.openCombobox()}else f&&(h.current=!0)},[p,e,l,t,m,b,s]),$=T.useCallback(n=>{if(c?.(n),!n.defaultPrevented){if(u&&n.key==="Escape"){n.preventDefault(),e.closeCombobox(ne.escapeKey);return}if(!u&&(n.key==="ArrowDown"||n.key==="ArrowUp"||n.key==="Enter")){if(n.preventDefault(),b&&!e.multiple){let f=s(e.value)??K(e.value,e.itemToStringLabel);e.onInputValueChange(f)}e.openCombobox();return}}},[u,e,c,b,s]),{handleKeyDown:G}=Co({store:t,surfaceId:"combobox-input",focusOwnerStore:i,depth:0,submenuContext:null,subpageContext:null,enabled:u,enableTypeToSearch:!1,onKeyDown:$,closeAll:e.closeCombobox,skipFocusOwnerCheck:!0});return{handleChange:w,handleFocus:k,handleBlur:L,handleClick:A,handleKeyDown:G,selectionRef:y}}var He=ae.forwardRef(function(e,t){let{placeholder:i,disabled:u,cursorBehavior:l="none",render:m,className:b,style:s,onFocus:o,onBlur:g,onClick:p,onKeyDown:c,...P}=e,d=D(),h=fe(),r=lo(),y=Do(),R=(u??d.disabled)||h.disabled,E=re(d.items,""),w=i??(typeof E=="string"?E:void 0)??d.placeholder,k=h.store.useState("open"),{hasValue:L,displayValue:A,getValueText:$}=Ao({comboboxContext:d,open:k}),{handleChange:G,handleFocus:n,handleBlur:f,handleClick:a,handleKeyDown:v}=Fo({comboboxContext:d,store:h.store,focusOwnerStore:r,open:k,disabled:R,cursorBehavior:l,hasValue:L,getValueText:$,onFocus:o,onBlur:g,onClick:p,onKeyDown:c}),S={[Z.slot]:""};k?S[Z.open]="":S[Z.closed]="",R&&(S[Z.disabled]=""),L||(S[Z.placeholder]=""),d.layout==="input-embedded"&&(S["data-input-embedded"]="");let O=ae.useCallback(V=>{d.setInputElement(V),typeof t=="function"?t(V):t&&(t.current=V)},[t,d]),F=ae.useMemo(()=>({open:k,disabled:R,placeholder:!L}),[k,R,L]),B=d.layout==="input-embedded"&&!y?{position:"relative",zIndex:1}:void 0;return yt({render:m,ref:O,state:F,props:{...P,...S,type:"text",role:"combobox","aria-autocomplete":"list","aria-expanded":k,"aria-controls":d.listId,"aria-haspopup":"listbox",autoComplete:"off",autoCorrect:"off",spellCheck:!1,disabled:R,placeholder:L?void 0:w,className:N(b,F),style:{...B,...j(s,F)},value:A,onChange:G,onFocus:n,onBlur:f,onClick:a,onKeyDown:v},defaultTagName:"input"})});import{useRender as St}from"@base-ui/react/use-render";import*as se from"react";var Ie={slot:"bazzaui-combobox-input-wrapper",open:"data-open"};import{jsx as Vt}from"react/jsx-runtime";var vt={open:x=>x?{[Ie.open]:""}:null},Oe=se.forwardRef(function(e,t){let{render:i,className:u,style:l,children:m,...b}=e,{store:s}=fe(),o=D(),g=s.useState("open"),p=se.useMemo(()=>({open:g}),[g]),c=o.layout==="input-embedded"?{position:"relative",zIndex:1}:{position:"relative"},P=se.useCallback(h=>{o.setInputWrapperElement(h),typeof t=="function"?t(h):t&&(t.current=h)},[t,o]),d=St({render:i,ref:P,state:p,stateAttributesMapping:vt,props:{...b,[Ie.slot]:"",className:N(u,p),style:{...c,...j(l,p)},children:m},defaultTagName:"div"});return Vt(Te.Provider,{value:!0,children:d})});import{useRender as Et}from"@base-ui/react/use-render";import*as M from"react";var U={slot:"bazzaui-combobox-item",highlighted:"data-highlighted",disabled:"data-disabled",selected:"data-selected",first:"data-first",last:"data-last",firstInGroup:"data-first-in-group",lastInGroup:"data-last-in-group"};import*as ie from"react";var Pe=ie.createContext(null);function pe(){let x=ie.useContext(Pe);if(!x)throw new Error("ComboboxItem child components must be used within a Combobox.Item");return x}function Mt(){return ie.useContext(Pe)}import{jsx as kt}from"react/jsx-runtime";var Lt={highlighted:x=>x?{[U.highlighted]:""}:null,disabled:x=>x?{[U.disabled]:""}:null,selected:x=>x?{[U.selected]:""}:null,first:x=>x?{[U.first]:""}:null,last:x=>x?{[U.last]:""}:null,firstInGroup:x=>x?{[U.firstInGroup]:""}:null,lastInGroup:x=>x?{[U.lastInGroup]:""}:null};function wt(x,e){let{value:t,textValue:i,keywords:u,disabled:l=!1,onSelect:m,forceMount:b=!1,render:s,className:o,style:g,onClick:p,onPointerDown:c,onPointerMove:P,children:d,...h}=x,r=D(),y=M.useMemo(()=>z(t,r.itemToStringValue),[t,r.itemToStringValue]),R=M.useId(),E=t===null?`combobox-clear-${R}`:void 0,w=M.useMemo(()=>To(r.items,y),[r.items,y]),k=w?.label,L=M.useMemo(()=>K(t,r.itemToStringLabel),[t,r.itemToStringLabel]),A=M.useMemo(()=>{if(i!==void 0)return i;if(typeof k=="string")return k;if(L&&L!==y)return L},[i,k,L,y]),$=M.useMemo(()=>Ho(u,[typeof k=="string"?k:L&&L!==y?L:void 0,...w?.keywords??[]]),[u,k,L,y,w]),G=M.useRef(A),n=r.multiple?wo(r.values,t,r.isItemEqualToValue):r.value!==""&&Lo(r.value,t,r.isItemEqualToValue),f=r.closeOnSelect,a=fo({id:E,value:y,keywords:$,disabled:l,forceMount:b,closeOnClick:f,children:d});M.useEffect(()=>{let V=()=>{if(!l){if(r.multiple)if(t==null)r.onValuesChange([]);else{let be=n?ko(r.values,t,r.isItemEqualToValue):[...r.values,t];r.onValuesChange(be)}else r.onValueChange(t);m?.()}};return a.registerSelect(V)},[l,r,t,n,m,a]),M.useEffect(()=>{let V=G.current;if(V)return r.registerItemText(y,V)},[y,r]),M.useEffect(()=>{!A&&typeof d=="string"&&(G.current=d,r.registerItemText(y,d))},[d,A,y,r]);let v=M.useMemo(()=>({highlighted:a.isHighlighted,disabled:l,selected:n,first:a.positional.first,last:a.positional.last,firstInGroup:a.positional.firstInGroup,lastInGroup:a.positional.lastInGroup}),[a.isHighlighted,l,n,a.positional]),S=M.useMemo(()=>({id:a.id,value:t,textValue:A,highlighted:a.isHighlighted,disabled:l,selected:n}),[a.id,t,A,a.isHighlighted,l,n]),O=M.useCallback(V=>{p?.(V),V.defaultPrevented||a.handlers.onClick(V)},[p,a.handlers]),F=M.useCallback(V=>{a.handlers.onPointerDown(V),c?.(V)},[a.handlers,c]),B=M.useCallback(V=>{P?.(V),V.defaultPrevented||a.handlers.onPointerMove(V)},[P,a.handlers]),te=Et({render:s,ref:[a.ref,a.rowRef,e],state:v,stateAttributesMapping:Lt,props:{...h,[U.slot]:"",id:a.id,role:"option",tabIndex:-1,"aria-selected":n,"aria-disabled":l||void 0,className:N(o,v),style:j(g,v),onClick:O,onPointerMove:B,onPointerDown:F,children:d},enabled:a.isVisible,defaultTagName:"div"});return a.isVisible?kt(Pe.Provider,{value:S,children:te}):null}var De=M.forwardRef(wt);import{useRender as Tt}from"@base-ui/react/use-render";import*as ye from"react";var Re={slot:"bazzaui-combobox-item-indicator",selected:"data-selected"};var Ht={selected:x=>x?{[Re.selected]:""}:null},Ae=ye.forwardRef(function(e,t){let{keepMounted:i=!1,render:u,className:l,style:m,...b}=e,s=pe(),o=ye.useMemo(()=>({selected:s.selected}),[s.selected]),g=Tt({render:u,ref:t,state:o,stateAttributesMapping:Ht,props:{...b,[Re.slot]:"","aria-hidden":!0,className:N(l,o),style:j(m,o)},enabled:i||s.selected,defaultTagName:"span"});return!i&&!s.selected?null:g});import{useRender as Ot}from"@base-ui/react/use-render";import*as ee from"react";var zo={slot:"bazzaui-combobox-item-label"};var Fe=ee.forwardRef(function(e,t){let{render:i,className:u,style:l,children:m,...b}=e,s=D(),o=pe(),g=z(o.value,s.itemToStringValue),p=ee.useMemo(()=>{if(m!==void 0)return m;let P=re(s.items,g);return P!==void 0?P:o.textValue!==void 0?o.textValue:g},[m,s.items,g,o.textValue]),c=ee.useMemo(()=>({value:g,selected:o.selected,highlighted:o.highlighted,disabled:o.disabled}),[g,o.selected,o.highlighted,o.disabled]);return ee.useEffect(()=>{if(typeof p=="string")return s.registerItemText(g,p)},[p,s,g]),Ot({render:i,ref:t,state:c,props:{...b,[zo.slot]:"",className:N(u,c),style:j(l,c),children:p},defaultTagName:"span"})});import{Popover as Bo}from"@base-ui/react/popover";import*as J from"react";var Se={slot:"bazzaui-combobox-positioner"};import{jsx as me}from"react/jsx-runtime";function Dt(x,e,t,i){let u=t+i*2;if(x==="top"){let b=-(e+i),s=e+i;return{width:u,marginBottom:b,paddingTop:i,paddingLeft:i,paddingRight:i,paddingBottom:s}}let l=-(e+i),m=e+i;return{width:u,marginTop:l,paddingTop:m,paddingLeft:i,paddingRight:i,paddingBottom:i}}var ze=J.forwardRef(function(e,t){let{layout:i,popupPadding:u=8,side:l="bottom",align:m,sideOffset:b=4,anchor:s,className:o,style:g,children:p,...c}=e,P=D(),d=i??P.layout,h=d==="input-embedded",r=s??P.inputWrapperRef.current?P.inputWrapperRef:P.inputRef,y=h?0:b,R=h?"center":m??"start",{inputHeight:E,inputWidth:w}=P,k=w+u*2,L=Le(g,n=>({...n,...h?{zIndex:0}:{}}));if(h)return me(Bo.Positioner,{ref:t,side:l,align:R,sideOffset:y,anchor:r,className:o,style:L,"data-input-embedded":"",[Se.slot]:"",...c,render:(n,f)=>{let a=f.side,v={layout:d,side:a,align:f.align,inputHeight:P.inputHeight},S={"--combobox-input-height":`${E}px`,"--combobox-input-width":`${w}px`,"--combobox-popup-padding":`${u}px`,"--combobox-popup-width":`${k}px`},O=Dt(a,E,w,u),F=J.Children.map(p,B=>J.isValidElement(B)?J.cloneElement(B,{style:{...O,...B.props.style},"data-side":a}):B);return me(ge.Provider,{value:v,children:me("div",{...n,style:{...n.style,...S},"data-side":a,children:F})})}});let A={layout:d,side:l,align:R,inputHeight:P.inputHeight},$={"--combobox-input-height":`${E}px`,"--combobox-input-width":`${w}px`},G=Le(g,n=>({...n,...$}));return me(ge.Provider,{value:A,children:me(Bo.Positioner,{ref:t,side:l,align:R,sideOffset:y,anchor:r,className:o,style:G,[Se.slot]:"",...c,children:p})})});import{Popover as At}from"@base-ui/react/popover";import*as I from"react";import{jsx as ce,jsxs as Ft}from"react/jsx-runtime";function Be(x){let{open:e,onOpenChange:t,actionsRef:i,defaultOpen:u=!1,value:l,defaultValue:m,onValueChange:b,multiple:s=!1,values:o,defaultValues:g,onValuesChange:p,isItemEqualToValue:c=Eo,itemToStringLabel:P,itemToStringValue:d,inputValue:h,defaultInputValue:r="",onInputValueChange:y,name:R,form:E,required:w,disabled:k=!1,placeholder:L="Search...",items:A,modal:$=!1,closeOnSelect:G,openOnFocus:n=!0,virtualized:f=!1,virtualItems:a,onHighlightChange:v,layout:S="floating",onOpenChangeComplete:O,debug:F,children:B,...te}=x,V=I.useCallback((C,H,q,xe)=>v?.(C,q,xe),[v]),be=I.useId(),de=I.useRef(null),ve=I.useRef(null),[Ne,je]=I.useState(0),[Ge,qe]=I.useState(0),Ke=I.useCallback(C=>{if(de.current=C,C&&!ve.current){let H=C.getBoundingClientRect();je(H.height),qe(H.width)}},[]),Ue=I.useCallback(C=>{if(ve.current=C,C){let H=C.getBoundingClientRect();je(H.height),qe(H.width)}},[]),{store:W,focusOwnerStore:_o,openChainStore:Qo,registerSurface:Yo,closeAll:Zo,virtualization:et,handleOpenChange:$e,disabled:X,setDisabled:Je,menuTreeResolver:ot}=uo({onOpenChange:t,defaultOpen:u,virtualized:f,items:a,onHighlightChange:V,disabled:k}),Ve=I.useRef(null);I.useImperativeHandle(i,()=>({close:()=>{Ve.current?.close()},unmount:()=>{Ve.current?.unmount()},setDisabled:Je}),[Je]),W.useControlledProp("openProp",e);let tt=W.useState("open"),Xe=I.useCallback((C,H,q)=>{X&&H!==ne.imperativeAction||!C&&de.current&&document.activeElement===de.current||$e(C,H,q)},[$e,X]),nt=I.useCallback(C=>{!C&&W.context.clearSearchOnClose==="after-exit"&&(W.clearSearch(),W.setInputActive(!1)),C||W.clearHighlight(),O?.(C)},[W,O]),rt=I.useCallback((C,H)=>{Xe(C,H.reason,H.event)},[Xe]),[at,st]=I.useState(m!==void 0?m:null),_=l!==void 0?l:at,_e=I.useCallback(C=>{l===void 0&&st(C),b?.(C)},[l,b]),[lt,ut]=I.useState(g??[]),le=o!==void 0?o:lt,Qe=I.useCallback(C=>{o===void 0&&ut(C),p?.(C)},[o,p]),[Me,it]=I.useState(r),Ye=h!==void 0?h:Me,Ze=I.useCallback(C=>{h===void 0&&it(C),y?.(C)},[h,y]),eo=I.useRef(new Map),oo=I.useCallback((C,H)=>(eo.current.set(C,H),()=>{}),[]),to=G??!s,Ee=I.useRef({type:"active"}),[,pt]=I.useState({type:"active"}),Q=I.useCallback(C=>{Ee.current=C,pt(C)},[]),no=Ee.current,ro=I.useCallback(()=>{Q({type:"active"})},[Q]),ao=I.useCallback(()=>{X||(!s&&_!=null?Q({type:"showAll"}):Q({type:"active"}),W.setOpen(!0))},[X,W,s,_,Q]),so=I.useCallback((C,H)=>{let q=Ee.current,xe=q.type==="active"?Me:q.type==="showAll"?"":q.search;Q({type:"frozen",search:xe}),W.setOpen(!1,C,H)},[W,Q,Me]),mt=I.useMemo(()=>({multiple:s,value:_,values:le,onValueChange:_e,onValuesChange:Qe,isItemEqualToValue:c,itemToStringLabel:P,itemToStringValue:d,inputValue:Ye,onInputValueChange:Ze,name:R,form:E,required:w,disabled:X,placeholder:L,items:A,itemTextRegistry:eo.current,registerItemText:oo,listId:be,inputRef:de,setInputElement:Ke,inputWrapperRef:ve,setInputWrapperElement:Ue,closeOnSelect:to,openOnFocus:n,openCombobox:ao,closeCombobox:so,filterMode:no,setFilterActive:ro,inputHeight:Ne,inputWidth:Ge,layout:S}),[s,_,le,_e,Qe,c,P,d,Ye,Ze,R,E,w,X,L,A,oo,be,Ke,Ue,to,n,ao,so,no,ro,Ne,Ge,S]),ct=I.useMemo(()=>R?s?le.length>0?le.map((C,H)=>{let q=z(C,d);return ce("input",{type:"hidden",name:R,value:q,form:E,required:w&&H===0},q)}):ce("input",{type:"hidden",name:R,value:"",form:E,required:w}):ce("input",{type:"hidden",name:R,value:_!=null?z(_,d):"",form:E,required:w}):null,[R,E,w,s,_,le,d]);return ce(mo.Provider,{value:mt,children:Ft(xo,{menuTreeResolver:ot,store:W,focusOwnerStore:_o,openChainStore:Qo,disabled:X,depth:0,closeAll:Zo,registerSurface:Yo,virtualization:et,menuType:"dropdown",componentName:"combobox",debug:F,children:[ct,ce(At.Root,{...te,open:tt,onOpenChange:rt,onOpenChangeComplete:nt,modal:$,actionsRef:i?Ve:void 0,children:B})]})})}import*as oe from"react";var Wo={slot:"bazzaui-combobox-surface"};import{jsx as zt}from"react/jsx-runtime";var We=oe.forwardRef(function(e,t){let{autoHighlightFirst:i,clearSearchOnClose:u=!0,search:l,onSearchChange:m,onPointerMove:b,...s}=e,o=D(),g=oe.useCallback(h=>{b?.(h);let r=o.inputRef.current;r&&document.activeElement!==r&&r.focus()},[b,o.inputRef]),p=oe.useMemo(()=>{let h=i??!0;if(h==="selected"){let r=o.multiple?o.values[0]:o.value;return r!=null?z(r,o.itemToStringValue):!0}return h},[i,o.multiple,o.value,o.values,o.itemToStringValue]),{filterMode:c}=o,P=l??(c.type==="active"?o.inputValue:c.type==="showAll"?"":c.search),d=oe.useCallback(h=>{o.onInputValueChange(h),m?.(h)},[o,m]);return zt(vo,{ref:t,autoHighlightFirst:p,clearSearchOnClose:u,search:P,onSearchChange:d,onPointerMove:g,skipAutoFocus:!0,[Wo.slot]:"",...s})});var jo=(m=>(m.slot="bazzaui-combobox-arrow",m.open="data-open",m.closed="data-closed",m.side="data-side",m.align="data-align",m.uncentered="data-uncentered",m))(jo||{});var Go=(l=>(l.slot="bazzaui-combobox-backdrop",l.open="data-open",l.closed="data-closed",l.startingStyle="data-starting-style",l.endingStyle="data-ending-style",l))(Go||{});var qo=(e=>(e.slot="bazzaui-combobox-empty",e))(qo||{});var Ko=(e=>(e.slot="bazzaui-combobox-group",e))(Ko||{});var Uo=(e=>(e.slot="bazzaui-combobox-group-label",e))(Uo||{});var Bt={slot:"bazzaui-combobox-icon",open:"data-popup-open"};var $o=(t=>(t.slot="bazzaui-combobox-list",t.list="data-popup-menu-list",t))($o||{});var Jo=(c=>(c.slot="bazzaui-combobox-popup",c.open="data-open",c.closed="data-closed",c.side="data-side",c.align="data-align",c.startingStyle="data-starting-style",c.endingStyle="data-ending-style",c.instant="data-instant",c.focused="data-focused",c.hasOpenSubmenu="data-has-open-submenu",c.submenu="data-submenu",c.navigating="data-navigating",c))(Jo||{});var Wt={slotUp:"bazzaui-combobox-scroll-up-arrow",slotDown:"bazzaui-combobox-scroll-down-arrow",direction:"data-direction",side:"data-side"};var Xo=(e=>(e.slot="bazzaui-combobox-separator",e))(Xo||{});export{No as Combobox,jo as ComboboxArrowDataAttributes,Go as ComboboxBackdropDataAttributes,we as ComboboxClear,qo as ComboboxEmptyDataAttributes,Ko as ComboboxGroupDataAttributes,Uo as ComboboxGroupLabelDataAttributes,Bt as ComboboxIconDataAttributes,He as ComboboxInput,Z as ComboboxInputDataAttributes,Oe as ComboboxInputWrapper,Ie as ComboboxInputWrapperDataAttributes,De as ComboboxItem,U as ComboboxItemDataAttributes,Ae as ComboboxItemIndicator,Re as ComboboxItemIndicatorDataAttributes,Fe as ComboboxItemLabel,Pt as ComboboxListCssVars,$o as ComboboxListDataAttributes,Jo as ComboboxPopupDataAttributes,ze as ComboboxPositioner,It as ComboboxPositionerCssVars,Se as ComboboxPositionerDataAttributes,Be as ComboboxRoot,Wt as ComboboxScrollArrowDataAttributes,Xo as ComboboxSeparatorDataAttributes,gt as ComboboxStore,We as ComboboxSurface,ft as commandScore,Ct as defaultFilter,D as useComboboxContext,pe as useComboboxItemContext,ke as useComboboxPositionerContext,ht as useMaybeComboboxContext,Mt as useMaybeComboboxItemContext,xt as useMaybeSurfaceContext,dt as useSurfaceContext};
2
2
  //# sourceMappingURL=index.js.map