1import{s as y,f as ge,aV as lt,M as Q,aW as ze,aX as nt,aj as Te,A as K,L as B,Z as at,aY as j,ab as Ee,a1 as ie,I as ue,F as Ae,ak as fe,a8 as ke,al as N,H as ot,O as it,x as Be,aZ as ut,z as ne,a_ as st,_ as Le,J as Fe,B as $e,C as xe,an as rt,aw as dt,E as ct,G as de,a$ as vt,b0 as pt,ac as ft,ap as bt,o as F,h as Z,l as oe,e as W,p as D,g as J,i as ce,X as _,m as ee,Y as Ce,n as me,t as ve,aq as mt,r as ht,a2 as gt,U as Pe}from"./y8b2zAfg.js";import{u as yt}from"./C3GubO4z.js";import{d as je,e as Ne}from"./DL9ShZqJ.js";import{o as Me,w as He,i as Ot,O as qe,t as Ve,n as St,a as It,h as xt,u as Ct}from"./DG_uGOUS.js";import{u as H,o as R,f as We,E as Ue,b as Ke,A as Y,T as ye,I as ae,s as Ge,N as se,a as z,l as Rt}from"./C43f6Ruk.js";import{c as k,f as we,i as Mt,u as Qe,p as wt}from"./BvGQn0Xf.js";import{t as Je,i as te,l as Ye}from"./BwcIW-YV.js";import{u as Tt}from"./DPHCmOrY.js";function pe(e,c,n){let o=n.initialDeps??[],l;return()=>{var i,t,a,d;let m;n.key&&((i=n.debug)!=null&&i.call(n))&&(m=Date.now());const p=e();if(!(p.length!==o.length||p.some((M,I)=>o[I]!==M)))return l;o=p;let v;if(n.key&&((t=n.debug)!=null&&t.call(n))&&(v=Date.now()),l=c(...p),n.key&&((a=n.debug)!=null&&a.call(n))){const M=Math.round((Date.now()-m)*100)/100,I=Math.round((Date.now()-v)*100)/100,E=I/16,V=(w,S)=>{for(w=String(w);w.length<S;)w=" "+w;return w};console.info(`%câ± ${V(I,5)} /${V(M,5)} ms`,` 2 font-size: .6rem; 3 font-weight: bold; 4 color: hsl(${Math.max(0,Math.min(120-120*E,120))}deg 100% 31%);`,n==null?void 0:n.key)}return(d=n==null?void 0:n.onChange)==null||d.call(n,l),l}}function Re(e,c){if(e===void 0)throw new Error("Unexpected undefined");return e}const Et=(e,c)=>Math.abs(e-c)<1,At=(e,c,n)=>{let o;return function(...l){e.clearTimeout(o),o=e.setTimeout(()=>c.apply(this,l),n)}},kt=e=>e,zt=e=>{const c=Math.max(e.startIndex-e.overscan,0),n=Math.min(e.endIndex+e.overscan,e.count-1),o=[];for(let l=c;l<=n;l++)o.push(l);return o},$t=(e,c)=>{const n=e.scrollElement;if(!n)return;const o=e.targetWindow;if(!o)return;const l=t=>{const{width:a,height:d}=t;c({width:Math.round(a),height:Math.round(d)})};if(l(n.getBoundingClientRect()),!o.ResizeObserver)return()=>{};const i=new o.ResizeObserver(t=>{const a=t[0];if(a!=null&&a.borderBoxSize){const d=a.borderBoxSize[0];if(d){l({width:d.inlineSize,height:d.blockSize});return}}l(n.getBoundingClientRect())});return i.observe(n,{box:"border-box"}),()=>{i.unobserve(n)}},De={passive:!0},Pt=typeof window>"u"?!0:"onscrollend"in window,Vt=(e,c)=>{const n=e.scrollElement;if(!n)return;const o=e.targetWindow;if(!o)return;let l=0;const i=Pt?()=>{}:At(o,()=>{c(l,!1)},e.options.isScrollingResetDelay),t=m=>()=>{l=n[e.options.horizontal?"scrollLeft":"scrollTop"],i(),c(l,m)},a=t(!0),d=t(!1);return d(),n.addEventListener("scroll",a,De),n.addEventListener("scrollend",d,De),()=>{n.removeEventListener("scroll",a),n.removeEventListener("scrollend",d)}},Dt=(e,c,n)=>{if(c!=null&&c.borderBoxSize){const o=c.borderBoxSize[0];if(o)return Math.round(o[n.options.horizontal?"inlineSize":"blockSize"])}return Math.round(e.getBoundingClientRect()[n.options.horizontal?"width":"height"])},Bt=(e,{adjustments:c=0,behavior:n},o)=>{var l,i;const t=e+c;(i=(l=o.scrollElement)==null?void 0:l.scrollTo)==null||i.call(l,{[o.options.horizontal?"left":"top"]:t,behavior:n})};class Lt{constructor(c){this.unsubs=[],this.scrollElement=null,this.targetWindow=null,this.isScrolling=!1,this.scrollToIndexTimeoutId=null,this.measurementsCache=[],this.itemSizeCache=new Map,this.pendingMeasuredCacheIndexes=[],this.scrollRect=null,this.scrollOffset=null,this.scrollDirection=null,this.scrollAdjustments=0,this.elementsCache=new Map,this.observer=(()=>{let n=null;const o=()=>n||(!this.targetWindow||!this.targetWindow.ResizeObserver?null:n=new this.targetWindow.ResizeObserver(l=>{l.forEach(i=>{this._measureElement(i.target,i)})}));return{disconnect:()=>{var l;return(l=o())==null?void 0:l.disconnect()},observe:l=>{var i;return(i=o())==null?void 0:i.observe(l,{box:"border-box"})},unobserve:l=>{var i;return(i=o())==null?void 0:i.unobserve(l)}}})(),this.range=null,this.setOptions=n=>
4{Object.entries(n).forEach(([o,l])=>{typeof l>"u"&&delete n[o]}),this.options={debug:!1,initialOffset:0,overscan:1,paddingStart:0,paddingEnd:0,scrollPaddingStart:0,scrollPaddingEnd:0,horizontal:!1,getItemKey:kt,rangeExtractor:zt,onChange:()=>{},measureElement:Dt,initialRect:{width:0,height:0},scrollMargin:0,gap:0,indexAttribute:"data-index",initialMeasurementsCache:[],lanes:1,isScrollingResetDelay:150,enabled:!0,...n}},this.notify=(n,o)=>{var l,i;const{startIndex:t,endIndex:a}=this.range??{startIndex:void 0,endIndex:void 0},d=this.calculateRange();(n||t!==(d==null?void 0:d.startIndex)||a!==(d==null?void 0:d.endIndex))&&((i=(l=this.options).onChange)==null||i.call(l,this,o))},this.cleanup=()=>{this.unsubs.filter(Boolean).forEach(n=>n()),this.unsubs=[],this.scrollElement=null,this.targetWindow=null,this.observer.disconnect(),this.elementsCache.clear()},this._didMount=()=>()=>{this.cleanup()},this._willUpdate=()=>{var n;const o=this.options.enabled?this.options.getScrollElement():null;if(this.scrollElement!==o){if(this.cleanup(),!o){this.notify(!1,!1);return}this.scrollElement=o,this.scrollElement&&"ownerDocument"in this.scrollElement?this.targetWindow=this.scrollElement.ownerDocument.defaultView:this.targetWindow=((n=this.scrollElement)==null?void 0:n.window)??null,this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0}),this.unsubs.push(this.options.observeElementRect(this,l=>{this.scrollRect=l,this.notify(!1,!1)})),this.unsubs.push(this.options.observeElementOffset(this,(l,i)=>{this.scrollAdjustments=0,this.scrollDirection=i?this.getScrollOffset()<l?"forward":"backward":null,this.scrollOffset=l;const t=this.isScrolling;this.isScrolling=i,this.notify(t!==i,i)}))}}
vendor: 1,775 bytes, line 4
4,this.getSize=()=>this.options.enabled?(this.scrollRect=this.scrollRect??this.options.initialRect,this.scrollRect[this.options.horizontal?"width":"height"]):(this.scrollRect=null,0),this.getScrollOffset=()=>this.options.enabled?(this.scrollOffset=this.scrollOffset??(typeof this.options.initialOffset=="function"?this.options.initialOffset():this.options.initialOffset),this.scrollOffset):(this.scrollOffset=null,0),this.getFurthestMeasurement=(n,o)=>{const l=new Map,i=new Map;for(let t=o-1;t>=0;t--){const a=n[t];if(l.has(a.lane))continue;const d=i.get(a.lane);if(d==null||a.end>d.end?i.set(a.lane,a):a.end<d.end&&l.set(a.lane,!0),l.size===this.options.lanes)break}return i.size===this.options.lanes?Array.from(i.values()).sort((t,a)=>t.end===a.end?t.index-a.index:t.end-a.end)[0]:void 0},this.getMeasurementOptions=pe(()=>[this.options.count,this.options.paddingStart,this.options.scrollMargin,this.options.getItemKey,this.options.enabled],(n,o,l,i,t)=>(this.pendingMeasuredCacheIndexes=[],{count:n,paddingStart:o,scrollMargin:l,getItemKey:i,enabled:t}),{key:!1}),this.getMeasurements=pe(()=>[this.getMeasurementOptions(),this.itemSizeCache],({count:n,paddingStart:o,scrollMargin:l,getItemKey:i,enabled:t},a)=>{var d;if(!t)return this.measurementsCache=[],this.itemSizeCache.clear(),[];this.measurementsCache.length===0&&(this.measurementsCache=this.options.initialMeasurementsCache,this.measurementsCache.forEach(u=>{this.itemSizeCache.set(u.key,u.size)}));const m=this.pendingMeasuredCacheIndexes.length>0?Math.min(...this.pendingMeasuredCacheIndexes):0;this.pendingMeasuredCacheIndexes=[];const p=this.measurementsCache.slice(0,m);for(let u=m;u<n;u++){let v=(d=this.measurementsCache[u])==null?void 0:d.measureElement;v||(v=h=>{const r=i(u),g=this.elementsCache.get(r);
4if(!h){g&&(this.observer.unobserve(g),this.elementsCache.delete(r));return}g!==h&&(g&&this.observer.unobserve(g),this.observer.observe(h),this.elementsCache.set(r,h)),h.isConnected&&this.resizeItem(u,this.options.measureElement(h,void 0,this))});const M=i(u),I=this.options.lanes===1?p[u-1]:this.getFurthestMeasurement(p,u),E=I?I.end+this.options.gap:o+l,V=a.get(M),w=typeof V=="number"?V:this.options.estimateSize(u),S=E+w,s=I?I.lane:u%this.options.lanes;p[u]={index:u,start:E,size:w,end:S,key:M,lane:s,measureElement:v}}return this.measurementsCache=p,p},{key:!1,debug:()=>this.options.debug}),this.calculateRange=pe(()=>[this.getMeasurements(),this.getSize(),this.getScrollOffset()],(n,o,l)=>this.range=n.length>0&&o>0?Ft({measurements:n,outerSize:o,scrollOffset:l}):null,{key:!1,debug:()=>this.options.debug}),this.getIndexes=pe(()=>[this.options.rangeExtractor,this.calculateRange(),this.options.overscan,this.options.count],(n,o,l,i)=>o===null?[]:n({startIndex:o.startIndex,endIndex:o.endIndex,overscan:l,count:i}),{key:!1,debug:()=>this.options.debug}),this.indexFromElement=n=>{const o=this.options.indexAttribute,l=n.getAttribute(o);return l?parseInt(l,10):(console.warn(`Missing attribute name '${o}={index}' on measured element.`),-1)},this._measureElement=(n,o)=>{const l=this.indexFromElement(n),i=this.getMeasurements()[l];if(!i||!n.isConnected){this.elementsCache.forEach((a,d)=>{a===n&&(this.observer.unobserve(n),this.elementsCache.delete(d))});return}const t=this.elementsCache.get(i.key);t!==n&&(t&&this.observer.unobserve(t),this.observer.observe(n),this.elementsCache.set(i.key,n)),this.resizeItem(l,this.options.measureElement(n,o,this))},this.resizeItem=(n,o)=>{const l=this.getMeasurements()[n];if(!l)return;const i=this.itemSizeCache.get(l.key)??l.size,t=o-i;t!==0&&((this.shouldAdjustScrollPositionOnItemSizeChange!==void 0?this.shouldAdjustScrollPositionOnItemSizeChange(l,t,this):l.start<this.getScrollOffset()+this.scrollAdjustments)&&this._scrollToOffset(this.getScrollOffset(),{adjustments:this.scrollAdjustments+=t,behavior:void 0}),this.pendingMeasuredCacheIndexes.push(l.index),this.itemSizeCache=new Map(this.itemSizeCache.set(l.key,o)),this.notify(!0,!1))},this.measureElement=n=>{n&&this._measureElement(n,void 0)},this.getVirtualItems=pe(()=>[this.getIndexes(),this.getMeasurements()],(n,o)=>{const l=[];for(let i=0,t=n.length;i<t;i++){const a=n[i],d=o[a];l.push(d)}return l},{key:!1,debug:()=>this.options.debug}),this.getVirtualItemForOffset=n=>{const o=this.getMeasurements();if(o.length!==0)return Re(o[Xe(0,o.length-1,l=>Re(o[l]).start,n)])},this.getOffsetForAlignment=(n,o)=>{const l=this.getSize(),i=this.getScrollOffset();o==="auto"&&(n<=i?o="start":n>=i+l?o="end":o="start"),o==="start"?n=n:o==="end"?n=n-l:o==="center"&&(n=n-l/2);const t=this.options.horizontal?"scrollWidth":"scrollHeight",d=(this.scrollElement?"document"in this.scrollElement?this.scrollElement.document.documentElement[t]:this.scrollElement[t]:0)-l;return Math.max(Math.min(d,n),0)},this.getOffsetForIndex=(n,o="auto")=>{n=Math.max(0,Math.min(n,this.options.count-1));const l=this.getMeasurements()[n];if(!l)return;const i=this.getSize(),t=this.getScrollOffset();if(o==="auto")if(l.end>=t+i-this.options.scrollPaddingEnd)o="end";else if(l.start<=t+this.options.scrollPaddingStart)o="start";else return[t,o];const a=o==="end"?l.end+this.options.scrollPaddingEnd:l.start-this.options.scrollPaddingStart;return[this.getOffsetForAlignment(a,o),o]},this.isDynamicMode=()=>this.elementsCache.size>0,this.cancelScrollToIndex=()=>{this.scrollToIndexTimeoutId!==null&&this.targetWindow&&(this.targetWindow.clearTimeout(this.scrollToIndexTimeoutId),this.scrollToIndexTimeoutId=null)},this.scrollToOffset=(n,{align:o="start",behavior:l}={})=>{this.cancelScrollToIndex(),l==="smooth"&&this.isDynamicMode()&&console.warn("The `smooth` scroll behavior is not fully supported with dynamic size."),this._scrollToOffset(this.getOffsetForAlignment(n,o),{adjustments:void 0,behavior:l})},this.scrollToIndex=(n,{align:o="auto",behavior:l}={})=>{n=Math.max(0,Math.min(n,this.options.count-1)),this.cancelScrollToIndex(),l==="smooth"&&this.isDynamicMode()&&console.warn("The `smooth` scroll behavior is not fully supported with dynamic size.");const i=this.getOffsetForIndex(n,o);if(!i)return;const[t,a]=i;this._scrollToOffset(t,{adjustments:void 0,behavior:l}),l!=="smooth"&&this.isDynamicMode()&&this.targetWindow&&(this.scrollToIndexTimeoutId=this.targetWindow.setTimeout(()=>{if(this.scrollToIndexTimeoutId=null,this.elementsCache.has(this.options.getItemKey(n))){const[m]=Re(this.getOffsetForIndex(n,a));
4Et(m,this.getScrollOffset())||this.scrollToIndex(n,{align:a,behavior:l})}else this.scrollToIndex(n,{align:a,behavior:l})}))},this.scrollBy=(n,{behavior:o}={})=>{this.cancelScrollToIndex(),o==="smooth"&&this.isDynamicMode()&&console.warn("The `smooth` scroll behavior is not fully supported with dynamic size."),this._scrollToOffset(this.getScrollOffset()+n,{adjustments:void 0,behavior:o})},this.getTotalSize=()=>{var n;const o=this.getMeasurements();let l;return o.length===0?l=this.options.paddingStart:l=this.options.lanes===1?((n=o[o.length-1])==null?void 0:n.end)??0:Math.max(...o.slice(-this.options.lanes).map(i=>i.end)),l-this.options.scrollMargin+this.options.paddingEnd},this._scrollToOffset=(n,{adjustments:o,behavior:l})=>{this.options.scrollToFn(n,{behavior:l,adjustments:o},this)},this.measure=()=>{var n,o;this.itemSizeCache=new Map,(o=(n=this.options).onChange)==null||o.call(n,this,!1)},this.setOptions(c)}}const Xe=(e,c,n,o)=>{for(;e<=c;){const l=(e+c)/2|0,i=n(l);if(i<o)e=l+1;else if(i>o)c=l-1;else return l}return e>0?e-1:0};function Ft({measurements:e,outerSize:c,scrollOffset:n}){const o=e.length-1,i=Xe(0,o,a=>e[a].start,n);let t=i;for(;t<o&&e[t].end<n+c;)t++;return{startIndex:i,endIndex:t}}function jt(e){const c=new Lt(ge(e)),n=lt(c),o=c._didMount();return Q(()=>ge(e).getScrollElement(),l=>{l&&c._willUpdate()},{immediate:!0}),Q(()=>ge(e),l=>{c.setOptions({...l,onChange:(i,t)=>{var a;ze(n),(a=l.onChange)==null||a.call(l,i,t)}}),c._willUpdate(),ze(n)},{immediate:!0}),nt(o),n}function Nt(e){return jt(y(()=>({observeElementRect:$t,observeElementOffset:Vt,scrollToFn:Bt,...ge(e)})))}function Ht(){let e=Me();return Te(()=>e.dispose()),e}function qt(){let e=Ht();return c=>{e.dispose(),e.nextFrame(c)}}var Ze=(e=>(e[e.Left=0]="Left",e[e.Right=2]="Right",e))(Ze||{}),Wt={};function Ut(e,c){return e===c}var Kt=(e=>(e[e.Open=0]="Open",e[e.Closed=1]="Closed",e))(Kt||{}),Gt=(e=>(e[e.Single=0]="Single",e[e.Multi=1]="Multi",e))(Gt||{}),Qt=(e=>(e[e.Pointer=0]="Pointer",e[e.Focus=1]="Focus",e[e.Other=2]="Other",e))(Qt||{});let _e=Symbol("ComboboxContext");function re(e){let c=ke(_e,null);if(c===null){let n=new Error(`<${e} /> is missing a parent <Combobox /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,re),n}return c}let et=Symbol("VirtualContext"),Jt=K({name:"VirtualProvider",setup(e,{slots:c}){let n=re("VirtualProvider"),o=y(()=>{let a=R(n.optionsRef);if(!a)return{start:0,end:0};let d=window.getComputedStyle(a);return{start:parseFloat(d.paddingBlockStart||d.paddingTop),end:parseFloat(d.paddingBlockEnd||d.paddingBottom)}}),l=Nt(y(()=>({scrollPaddingStart:o.value.start,scrollPaddingEnd:o.value.end,count:n.virtual.value.options.length,estimateSize(){return 40},getScrollElement(){return R(n.optionsRef)},overscan:12}))),i=y(()=>{var a;return(a=n.virtual.value)==null?void 0:a.options}),t=B(0);return Q([i],()=>{t.value+=1}),Ee(et,n.virtual.value?l:null),()=>[ue("div",{style:{position:"relative",width:"100%",height:`${l.value.getTotalSize()}px`},ref:a=>{if(a){if(typeof process<"u"&&Wt.JEST_WORKER_ID!==void 0||n.activationTrigger.value===0)return;n.activeOptionIndex.value!==null&&n.virtual.value.options.length>n.activeOptionIndex.value&&l.value.scrollToIndex(n.activeOptionIndex.value)}}},l.value.getVirtualItems().map(a=>ot(c.default({option:n.virtual.value.options[a.index],open:n.comboboxState.value===0})[0],{key:`${t.value}-${a.index}`,"data-index":a.index,"aria-setsize":n.virtual.value.options.length,"aria-posinset":a.index+1,style:{position:"absolute",top:0,left:0,transform:`translateY(${a.start}px)`,overflowAnchor:"none"}})))]}}),Yt=K({name:"Combobox",emits:{"update:modelValue":e=>!0},props:{as:{type:[Object,String],default:"template"},disabled:{type:[Boolean],default:!1},by:{type:[String,Function],nullable:!0,default:null},modelValue:{type:[Object,String,Number,Boolean],default:void 0},defaultValue:{type:[Object,String,Number,Boolean],default:void 0},form:{type:String,optional:!0},name:{type:String,optional:!0},nullable:{type:Boolean,default:!1},multiple:{type:[Boolean],default:!1},immediate:{type:[Boolean],default:!1},virtual:{type:Object,default:null}},inheritAttrs:!1,setup(e,{slots:c,attrs:n,emit:o}){let l=B(1),i=B(null),t=B(null),a=B(null),d=B(null),m=B({static:!1,hold:!1}),p=B([]),u=B(null),v=B(2),M=B(!1);function I(b=O=>O){let O=u.value!==null?p.value[u.value]:null,C=b(p.value.slice()),T=C.length>0&&C[0].dataRef.order.value!==null?C.sort((P,q)=>P.dataRef.order.value-q.dataRef.order.value):qe(C,P=>R(P.dataRef.domRef)),$=O?T.indexOf(O):null;return $===-1&&($=null),{options:T,activeOptionIndex:$}}let E=y(()=>e.multiple?1:0),V=y(()=>e.nullable),[w,S]=je(y(()=>e.modelValue),b=>o("update:modelValue",b),y(()=>e.defaultValue)),s=y(()=>w.value===void 0?H(E.value,{1:[],0:void 0}):w.value),h=null,r=null;function g(b){return H(E.value,{0(){return S==null?void 0:S(b)},1:()=>{let O=j(f.value.value).slice(),C=j(b),T=O.findIndex($=>f.compare(C,j($)));return T===-1?O.push(C):O.splice(T,1),S==null?void 0:S(O)}
4})}let x=y(()=>{});Q([x],([b],[O])=>{if(f.virtual.value&&b&&O&&u.value!==null){let C=b.indexOf(O[u.value]);C!==-1?u.value=C:u.value=null}});let f={comboboxState:l,value:s,mode:E,compare(b,O){if(typeof e.by=="string"){let C=e.by;return(b==null?void 0:b[C])===(O==null?void 0:O[C])}return e.by===null?Ut(b,O):e.by(b,O)},calculateIndex(b){return f.virtual.value?e.by===null?f.virtual.value.options.indexOf(b):f.virtual.value.options.findIndex(O=>f.compare(O,b)):p.value.findIndex(O=>f.compare(O.dataRef.value,b))},defaultValue:y(()=>e.defaultValue),nullable:V,immediate:y(()=>!1),virtual:y(()=>null),inputRef:t,labelRef:i,buttonRef:a,optionsRef:d,disabled:y(()=>e.disabled),options:p,change(b){S(b)},activeOptionIndex:y(()=>{if(M.value&&u.value===null&&(f.virtual.value?f.virtual.value.options.length>0:p.value.length>0)){if(f.virtual.value){let O=f.virtual.value.options.findIndex(C=>{var T;return!((T=f.virtual.value)!=null&&T.disabled(C))});if(O!==-1)return O}let b=p.value.findIndex(O=>!O.dataRef.disabled);if(b!==-1)return b}return u.value}),activationTrigger:v,optionsPropsRef:m,closeCombobox(){M.value=!1,!e.disabled&&l.value!==1&&(l.value=1,u.value=null)},openCombobox(){if(M.value=!0,!e.disabled&&l.value!==0){if(f.value.value){let b=f.calculateIndex(f.value.value);b!==-1&&(u.value=b)}l.value=0}},setActivationTrigger(b){v.value=b},goToOption(b,O,C){M.value=!1,h!==null&&cancelAnimationFrame(h),h=requestAnimationFrame(()=>{if(e.disabled||d.value&&!m.value.static&&l.value===1)return;if(f.virtual.value){u.value=b===k.Specific?O:we({focus:b},{resolveItems:()=>f.virtual.value.options,resolveActiveIndex:()=>{var P,q;return(q=(P=f.activeOptionIndex.value)!=null?P:f.virtual.value.options.findIndex(X=>{var le;return!((le=f.virtual.value)!=null&&le.disabled(X))}))!=null?q:null},resolveDisabled:P=>f.virtual.value.disabled(P),resolveId(){throw new Error("Function not implemented.")}}),v.value=C??2;return}let T=I();if(T.activeOptionIndex===null){let P=T.options.findIndex(q=>!q.dataRef.disabled);P!==-1&&(T.activeOptionIndex=P)}let $=b===k.Specific?O:we({focus:b},{resolveItems:()=>T.options,resolveActiveIndex:()=>T.activeOptionIndex,resolveId:P=>P.id,resolveDisabled:P=>P.dataRef.disabled});u.value=$,v.value=C??2,p.value=T.options})},selectOption(b){let O=p.value.find(T=>T.id===b);if(!O)return;let{dataRef:C}=O;g(C.value)},selectActiveOption(){if(f.activeOptionIndex.value!==null){if(f.virtual.value)g(f.virtual.value.options[f.activeOptionIndex.value]);else{let{dataRef:b}=p.value[f.activeOptionIndex.value];g(b.value)}f.goToOption(k.Specific,f.activeOptionIndex.value)}},registerOption(b,O){let C=at({id:b,dataRef:O});if(f.virtual.value){p.value.push(C);return}r&&cancelAnimationFrame(r);let T=I($=>($.push(C),$));u.value===null&&f.isSelected(O.value.value)&&(T.activeOptionIndex=T.options.indexOf(C)),p.value=T.options,u.value=T.activeOptionIndex,v.value=2,T.options.some($=>!R($.dataRef.domRef))&&(r=requestAnimationFrame(()=>{let $=I();p.value=$.options,u.value=$.activeOptionIndex}))},unregisterOption(b,O){if(h!==null&&cancelAnimationFrame(h),O&&(M.value=!0),f.virtual.value){p.value=p.value.filter(T=>T.id!==b);return}let C=I(T=>{let $=T.findIndex(P=>P.id===b);return $!==-1&&T.splice($,1),T});p.value=C.options,u.value=C.activeOptionIndex,v.value=2},isSelected(b){return H(E.value,{0:()=>f.compare(j(f.value.value),j(b)),1:()=>j(f.value.value).some(O=>f.compare(j(O),j(b)))})},isActive(b){return u.value===f.calculateIndex(b)}};He([t,a,d],()=>f.closeCombobox(),y(()=>l.value===0)),Ee(_e,f),Je(y(()=>H(l.value,{0:te.Open,1:te.Closed})));let A=y(()=>{var b;return(b=R(t))==null?void 0:b.closest("form")});return ie(()=>{Q([A],()=>{if(!A.value||e.defaultValue===void 0)return;function b(){f.change(e.defaultValue)}return A.value.addEventListener("reset",b),()=>{var O;(O=A.value)==null||O.removeEventListener("reset",b)}},{immediate:!0})}),()=>{var b,O,C;let{name:T,disabled:$,form:P,...q}=e,X={open:l.value===0,disabled:$,activeIndex:f.activeOptionIndex.value,activeOption:f.activeOptionIndex.value===null?null:f.virtual.value?f.virtual.value.options[(b=f.activeOptionIndex.value)!=null?b:0]:(C=(O=f.options.value[f.activeOptionIndex.value])==null?void 0:O.dataRef.value)!=null?C:null,value:s.value};return ue(Ae,[...T!=null&&s.value!=null?Ne({[T]:s.value}).map(([le,Se])=>ue(We,Ue({features:Ke.Hidden,key:le,as:"input",type:"hidden",hidden:!0,readOnly:!0,form:P,disabled:$,name:le,value:Se}))):[],Y({theirProps:{...n,...ye(q,["by","defaultValue","immediate","modelValue","multiple","nullable","onUpdate:modelValue","virtual"])},ourProps:{},slot:X,slots:c,attrs:n,name:"Combobox"})])}}}),Xt=K({name:"ComboboxButton",props:{as:{type:[Object,String],default:"button"},id:{type:String,default:null}},setup(e,{attrs:c,slots:n,expose:o}){var l;let i=(l=e.id)!=null?l:`headlessui-combobox-button-${ae()}`,t=re("ComboboxButton");o({el:t.buttonRef,$el:t.buttonRef});function a(p){t.disabled.value||(t.comboboxState.value===0?t.closeCombobox():(p.preventDefault(),t.openCombobox()),N(()=>{var u;return(u=R(t.inputRef))==null?void 0:u.focus({preventScroll:!0})}
4))}function d(p){switch(p.key){case z.ArrowDown:p.preventDefault(),p.stopPropagation(),t.comboboxState.value===1&&t.openCombobox(),N(()=>{var u;return(u=t.inputRef.value)==null?void 0:u.focus({preventScroll:!0})});return;case z.ArrowUp:p.preventDefault(),p.stopPropagation(),t.comboboxState.value===1&&(t.openCombobox(),N(()=>{t.value.value||t.goToOption(k.Last)})),N(()=>{var u;return(u=t.inputRef.value)==null?void 0:u.focus({preventScroll:!0})});return;case z.Escape:if(t.comboboxState.value!==0)return;p.preventDefault(),t.optionsRef.value&&!t.optionsPropsRef.value.static&&p.stopPropagation(),t.closeCombobox(),N(()=>{var u;return(u=t.inputRef.value)==null?void 0:u.focus({preventScroll:!0})});return}}let m=Ge(y(()=>({as:e.as,type:c.type})),t.buttonRef);return()=>{var p,u;let v={open:t.comboboxState.value===0,disabled:t.disabled.value,value:t.value.value},{...M}=e,I={ref:t.buttonRef,id:i,type:m.value,tabindex:"-1","aria-haspopup":"listbox","aria-controls":(p=R(t.optionsRef))==null?void 0:p.id,"aria-expanded":t.comboboxState.value===0,"aria-labelledby":t.labelRef.value?[(u=R(t.labelRef))==null?void 0:u.id,i].join(" "):void 0,disabled:t.disabled.value===!0?!0:void 0,onKeydown:d,onClick:a};return Y({ourProps:I,theirProps:M,slot:v,attrs:c,slots:n,name:"ComboboxButton"})}}}),Zt=K({name:"ComboboxInput",props:{as:{type:[Object,String],default:"input"},static:{type:Boolean,default:!1},unmount:{type:Boolean,default:!0},displayValue:{type:Function},defaultValue:{type:String,default:void 0},id:{type:String,default:null}},emits:{change:e=>!0},setup(e,{emit:c,attrs:n,slots:o,expose:l}){var i;let t=(i=e.id)!=null?i:`headlessui-combobox-input-${ae()}`,a=re("ComboboxInput"),d=y(()=>Ot(R(a.inputRef))),m={value:!1};l({el:a.inputRef,$el:a.inputRef});function p(){a.change(null);let r=R(a.optionsRef);r&&(r.scrollTop=0),a.goToOption(k.Nothing)}let u=y(()=>{var r;let g=a.value.value;return R(a.inputRef)?typeof e.displayValue<"u"&&g!==void 0?(r=e.displayValue(g))!=null?r:"":typeof g=="string"?g:"":""});ie(()=>{Q([u,a.comboboxState,d],([r,g],[x,f])=>{if(m.value)return;let A=R(a.inputRef);A&&((f===0&&g===1||r!==x)&&(A.value=r),requestAnimationFrame(()=>{var b;if(m.value||!A||((b=d.value)==null?void 0:b.activeElement)!==A)return;let{selectionStart:O,selectionEnd:C}=A;Math.abs((C??0)-(O??0))===0&&O===0&&A.setSelectionRange(A.value.length,A.value.length)}))},{immediate:!0}),Q([a.comboboxState],([r],[g])=>{if(r===0&&g===1){if(m.value)return;let x=R(a.inputRef);if(!x)return;let f=x.value,{selectionStart:A,selectionEnd:b,selectionDirection:O}=x;x.value="",x.value=f,O!==null?x.setSelectionRange(A,b,O):x.setSelectionRange(A,b)}})});let v=B(!1);function M(){v.value=!0}function I(){Me().nextFrame(()=>{v.value=!1})}let E=qt();function V(r){switch(m.value=!0,E(()=>{m.value=!1}),r.key){case z.Enter:if(m.value=!1,a.comboboxState.value!==0||v.value)return;if(r.preventDefault(),r.stopPropagation(),a.activeOptionIndex.value===null){a.closeCombobox();return}a.selectActiveOption(),a.mode.value===0&&a.closeCombobox();break;case z.ArrowDown:return m.value=!1,r.preventDefault(),r.stopPropagation(),H(a.comboboxState.value,{0:()=>a.goToOption(k.Next),1:()=>a.openCombobox()});case z.ArrowUp:return m.value=!1,r.preventDefault(),r.stopPropagation(),H(a.comboboxState.value,{0:()=>a.goToOption(k.Previous),1:()=>{a.openCombobox(),N(()=>{a.value.value||a.goToOption(k.Last)})}});case z.Home:if(r.shiftKey)break;return m.value=!1,r.preventDefault(),r.stopPropagation(),a.goToOption(k.First);case z.PageUp:return m.value=!1,r.preventDefault(),r.stopPropagation(),a.goToOption(k.First);case z.End:if(r.shiftKey)break;return m.value=!1,r.preventDefault(),r.stopPropagation(),a.goToOption(k.Last);case z.PageDown:return m.value=!1,r.preventDefault(),r.stopPropagation(),a.goToOption(k.Last);case z.Escape:if(m.value=!1,a.comboboxState.value!==0)return;r.preventDefault(),a.optionsRef.value&&!a.optionsPropsRef.value.static&&r.stopPropagation(),a.nullable.value&&a.mode.value===0&&a.value.value===null&&p(),a.closeCombobox();break;case z.Tab:if(m.value=!1,a.comboboxState.value!==0)return;a.mode.value===0&&a.activationTrigger.value!==1&&a.selectActiveOption(),a.closeCombobox();break}}function w(r){c("change",r),a.nullable.value&&a.mode.value===0&&r.target.value===""&&p(),a.openCombobox()}function S(r){var g,x,f;let A=(g=r.relatedTarget)!=null?g:Ve.find(b=>b!==r.currentTarget);if(m.value=!1,!((x=R(a.optionsRef))!=null&&x.contains(A))&&!((f=R(a.buttonRef))!=null&&f.contains(A))&&a.comboboxState.value===0)return r.preventDefault(),a.mode.value===0&&(a.nullable.value&&a.value.value===null?p():a.activationTrigger.value!==1&&a.selectActiveOption()),a.closeCombobox()}function s(r){var g,x,f;let A=(g=r.relatedTarget)!=null?g:Ve.find(b=>b!==r.currentTarget);(x=R(a.buttonRef))!=null&&x.contains(A)||(f=R(a.optionsRef))!=null&&f.contains(A)||a.disabled.value||a.immediate.value&&a.comboboxState.value!==0&&(a.openCombobox(),Me().nextFrame(()=>{a.setActivationTrigger(1)}))}let h=y(()=>{var r,g,x,f;return(f=(x=(g=e.defaultValue)!=null?g:a.defaultValue.value!==void 0?(r=e.displayValue)==null?void 0:r.call(e,a.defaultValue.value):null)!=null?x:a.defaultValue.value)!=null?f:""});return()=>{var r,g,x,f,A,b,O;
4let C={open:a.comboboxState.value===0},{displayValue:T,onChange:$,...P}=e,q={"aria-controls":(r=a.optionsRef.value)==null?void 0:r.id,"aria-expanded":a.comboboxState.value===0,"aria-activedescendant":a.activeOptionIndex.value===null?void 0:a.virtual.value?(g=a.options.value.find(X=>!a.virtual.value.disabled(X.dataRef.value)&&a.compare(X.dataRef.value,a.virtual.value.options[a.activeOptionIndex.value])))==null?void 0:g.id:(x=a.options.value[a.activeOptionIndex.value])==null?void 0:x.id,"aria-labelledby":(b=(f=R(a.labelRef))==null?void 0:f.id)!=null?b:(A=R(a.buttonRef))==null?void 0:A.id,"aria-autocomplete":"list",id:t,onCompositionstart:M,onCompositionend:I,onKeydown:V,onInput:w,onFocus:s,onBlur:S,role:"combobox",type:(O=n.type)!=null?O:"text",tabIndex:0,ref:a.inputRef,defaultValue:h.value,disabled:a.disabled.value===!0?!0:void 0};return Y({ourProps:q,theirProps:P,slot:C,attrs:n,slots:o,features:se.RenderStrategy|se.Static,name:"ComboboxInput"})}}}),_t=K({name:"ComboboxOptions",props:{as:{type:[Object,String],default:"ul"},static:{type:Boolean,default:!1},unmount:{type:Boolean,default:!0},hold:{type:[Boolean],default:!1}},setup(e,{attrs:c,slots:n,expose:o}){let l=re("ComboboxOptions"),i=`headlessui-combobox-options-${ae()}`;o({el:l.optionsRef,$el:l.optionsRef}),fe(()=>{l.optionsPropsRef.value.static=e.static}),fe(()=>{l.optionsPropsRef.value.hold=e.hold});let t=Ye(),a=y(()=>t!==null?(t.value&te.Open)===te.Open:l.comboboxState.value===0);Mt({container:y(()=>R(l.optionsRef)),enabled:y(()=>l.comboboxState.value===0),accept(m){return m.getAttribute("role")==="option"?NodeFilter.FILTER_REJECT:m.hasAttribute("role")?NodeFilter.FILTER_SKIP:NodeFilter.FILTER_ACCEPT},walk(m){m.setAttribute("role","none")}});function d(m){m.preventDefault()}return()=>{var m,p,u;let v={open:l.comboboxState.value===0},M={"aria-labelledby":(u=(m=R(l.labelRef))==null?void 0:m.id)!=null?u:(p=R(l.buttonRef))==null?void 0:p.id,id:i,ref:l.optionsRef,role:"listbox","aria-multiselectable":l.mode.value===1?!0:void 0,onMousedown:d},I=ye(e,["hold"]);return Y({ourProps:M,theirProps:I,slot:v,attrs:c,slots:l.virtual.value&&l.comboboxState.value===0?{...n,default:()=>[ue(Jt,{},n.default)]}:n,features:se.RenderStrategy|se.Static,visible:a.value,name:"ComboboxOptions"})}}}),el=K({name:"ComboboxOption",props:{as:{type:[Object,String],default:"li"},value:{type:[Object,String,Number,Boolean]},disabled:{type:Boolean,default:!1},order:{type:[Number],default:null}},setup(e,{slots:c,attrs:n,expose:o}){let l=re("ComboboxOption"),i=`headlessui-combobox-option-${ae()}`,t=B(null),a=y(()=>e.disabled);o({el:t,$el:t});let d=y(()=>{var S;return l.virtual.value?l.activeOptionIndex.value===l.calculateIndex(e.value):l.activeOptionIndex.value===null?!1:((S=l.options.value[l.activeOptionIndex.value])==null?void 0:S.id)===i}),m=y(()=>l.isSelected(e.value)),p=ke(et,null),u=y(()=>({disabled:e.disabled,value:e.value,domRef:t,order:y(()=>e.order)}));ie(()=>l.registerOption(i,u)),Te(()=>l.unregisterOption(i,d.value)),fe(()=>{let S=R(t);S&&(p==null||p.value.measureElement(S))}),fe(()=>{l.comboboxState.value===0&&d.value&&(l.virtual.value||l.activationTrigger.value!==0&&N(()=>{var S,s;return(s=(S=R(t))==null?void 0:S.scrollIntoView)==null?void 0:s.call(S,{block:"nearest"})}))});function v(S){S.preventDefault(),S.button===Ze.Left&&(a.value||(l.selectOption(i),St()||requestAnimationFrame(()=>{var s;return(s=R(l.inputRef))==null?void 0:s.focus({preventScroll:!0})}),l.mode.value===0&&l.closeCombobox()))}function M(){var S;if(e.disabled||(S=l.virtual.value)!=null&&S.disabled(e.value))return l.goToOption(k.Nothing);let s=l.calculateIndex(e.value);l.goToOption(k.Specific,s)}let I=Qe();function E(S){I.update(S)}function V(S){var s;if(!I.wasMoved(S)||e.disabled||(s=l.virtual.value)!=null&&s.disabled(e.value)||d.value)return;let h=l.calculateIndex(e.value);l.goToOption(k.Specific,h,0)}function w(S){var s;I.wasMoved(S)&&(e.disabled||(s=l.virtual.value)!=null&&s.disabled(e.value)||d.value&&(l.optionsPropsRef.value.hold||l.goToOption(k.Nothing)))}return()=>{let{disabled:S}=e,s={active:d.value,selected:m.value,disabled:S},h={id:i,ref:t,role:"option",tabIndex:S===!0?void 0:-1,"aria-disabled":S===!0?!0:void 0,"aria-selected":m.value,disabled:void 0,onMousedown:v,onFocus:M,onPointerenter:E,onMouseenter:E,onPointermove:V,onMousemove:V,onPointerleave:w,onMouseleave:w},r=ye(e,["order","value"]);return Y({ourProps:h,theirProps:r,slot:s,attrs:n,slots:c,name:"ComboboxOption"})}}});function tl(e,c){return e===c}var ll=(e=>(e[e.Open=0]="Open",e[e.Closed=1]="Closed",e))(ll||{}),nl=(e=>(e[e.Single=0]="Single",e[e.Multi=1]="Multi",e))(nl||{}),al=(e=>(e[e.Pointer=0]="Pointer",e[e.Other=1]="Other",e))(al||{});function ol(e){requestAnimationFrame(()=>requestAnimationFrame(e))}let tt=Symbol("ListboxContext");function Oe(e){let c=ke(tt,null);if(c===null){let n=new Error(`<${e} /> is missing a parent <Listbox /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,Oe),n}return c}let il=K({name:"Listbox",emits:{"update:modelValue":e=>!0},props:{as:{type:[Object,String],default:"template"},disabled:{type:[Boolean],default:!1},by:{type:[String,Function],default:()=>tl},horizontal:{type:[Boolean],default:!1},modelValue:{type:[Object,String,Number,Boolean],default:void 0},defaultValue:{type:[Object,String,Number,Boolean],default:void 0},form:{type:String,optional:!0},name:{type:String,optional:!0},multiple:{type:[Boolean],default:!1}},inheritAttrs:!1,setup(e,{slots:c,attrs:n,emit:o}
4){let l=B(1),i=B(null),t=B(null),a=B(null),d=B([]),m=B(""),p=B(null),u=B(1);function v(s=h=>h){let h=p.value!==null?d.value[p.value]:null,r=qe(s(d.value.slice()),x=>R(x.dataRef.domRef)),g=h?r.indexOf(h):null;return g===-1&&(g=null),{options:r,activeOptionIndex:g}}let M=y(()=>e.multiple?1:0),[I,E]=je(y(()=>e.modelValue),s=>o("update:modelValue",s),y(()=>e.defaultValue)),V=y(()=>I.value===void 0?H(M.value,{1:[],0:void 0}):I.value),w={listboxState:l,value:V,mode:M,compare(s,h){if(typeof e.by=="string"){let r=e.by;return(s==null?void 0:s[r])===(h==null?void 0:h[r])}return e.by(s,h)},orientation:y(()=>e.horizontal?"horizontal":"vertical"),labelRef:i,buttonRef:t,optionsRef:a,disabled:y(()=>e.disabled),options:d,searchQuery:m,activeOptionIndex:p,activationTrigger:u,closeListbox(){e.disabled||l.value!==1&&(l.value=1,p.value=null)},openListbox(){e.disabled||l.value!==0&&(l.value=0)},goToOption(s,h,r){if(e.disabled||l.value===1)return;let g=v(),x=we(s===k.Specific?{focus:k.Specific,id:h}:{focus:s},{resolveItems:()=>g.options,resolveActiveIndex:()=>g.activeOptionIndex,resolveId:f=>f.id,resolveDisabled:f=>f.dataRef.disabled});m.value="",p.value=x,u.value=r??1,d.value=g.options},search(s){if(e.disabled||l.value===1)return;let h=m.value!==""?0:1;m.value+=s.toLowerCase();let r=(p.value!==null?d.value.slice(p.value+h).concat(d.value.slice(0,p.value+h)):d.value).find(x=>x.dataRef.textValue.startsWith(m.value)&&!x.dataRef.disabled),g=r?d.value.indexOf(r):-1;g===-1||g===p.value||(p.value=g,u.value=1)},clearSearch(){e.disabled||l.value!==1&&m.value!==""&&(m.value="")},registerOption(s,h){let r=v(g=>[...g,{id:s,dataRef:h}]);d.value=r.options,p.value=r.activeOptionIndex},unregisterOption(s){let h=v(r=>{let g=r.findIndex(x=>x.id===s);return g!==-1&&r.splice(g,1),r});d.value=h.options,p.value=h.activeOptionIndex,u.value=1},theirOnChange(s){e.disabled||E(s)},select(s){e.disabled||E(H(M.value,{0:()=>s,1:()=>{let h=j(w.value.value).slice(),r=j(s),g=h.findIndex(x=>w.compare(r,j(x)));return g===-1?h.push(r):h.splice(g,1),h}}))}};He([t,a],(s,h)=>{var r;w.closeListbox(),It(h,xt.Loose)||(s.preventDefault(),(r=R(t))==null||r.focus())},y(()=>l.value===0)),Ee(tt,w),Je(y(()=>H(l.value,{0:te.Open,1:te.Closed})));let S=y(()=>{var s;return(s=R(t))==null?void 0:s.closest("form")});return ie(()=>{Q([S],()=>{if(!S.value||e.defaultValue===void 0)return;function s(){w.theirOnChange(e.defaultValue)}return S.value.addEventListener("reset",s),()=>{var h;(h=S.value)==null||h.removeEventListener("reset",s)}},{immediate:!0})}),()=>{let{name:s,modelValue:h,disabled:r,form:g,...x}=e,f={open:l.value===0,disabled:r,value:V.value};return ue(Ae,[...s!=null&&V.value!=null?Ne({[s]:V.value}).map(([A,b])=>ue(We,Ue({features:Ke.Hidden,key:A,as:"input",type:"hidden",hidden:!0,readOnly:!0,form:g,disabled:r,name:A,value:b}))):[],Y({ourProps:{},theirProps:{...n,...ye(x,["defaultValue","onUpdate:modelValue","horizontal","multiple","by"])},slot:f,slots:c,attrs:n,name:"Listbox"})])}}}),ul=K({name:"ListboxButton",props:{as:{type:[Object,String],default:"button"},id:{type:String,default:null}},setup(e,{attrs:c,slots:n,expose:o}){var l;let i=(l=e.id)!=null?l:`headlessui-listbox-button-${ae()}`,t=Oe("ListboxButton");o({el:t.buttonRef,$el:t.buttonRef});function a(u){switch(u.key){case z.Space:case z.Enter:case z.ArrowDown:u.preventDefault(),t.openListbox(),N(()=>{var v;(v=R(t.optionsRef))==null||v.focus({preventScroll:!0}),t.value.value||t.goToOption(k.First)});break;case z.ArrowUp:u.preventDefault(),t.openListbox(),N(()=>{var v;(v=R(t.optionsRef))==null||v.focus({preventScroll:!0}),t.value.value||t.goToOption(k.Last)});break}}function d(u){switch(u.key){case z.Space:u.preventDefault();break}}function m(u){t.disabled.value||(t.listboxState.value===0?(t.closeListbox(),N(()=>{var v;return(v=R(t.buttonRef))==null?void 0:v.focus({preventScroll:!0})}
4)):(u.preventDefault(),t.openListbox(),ol(()=>{var v;return(v=R(t.optionsRef))==null?void 0:v.focus({preventScroll:!0})})))}let p=Ge(y(()=>({as:e.as,type:c.type})),t.buttonRef);return()=>{var u,v;let M={open:t.listboxState.value===0,disabled:t.disabled.value,value:t.value.value},{...I}=e,E={ref:t.buttonRef,id:i,type:p.value,"aria-haspopup":"listbox","aria-controls":(u=R(t.optionsRef))==null?void 0:u.id,"aria-expanded":t.listboxState.value===0,"aria-labelledby":t.labelRef.value?[(v=R(t.labelRef))==null?void 0:v.id,i].join(" "):void 0,disabled:t.disabled.value===!0?!0:void 0,onKeydown:a,onKeyup:d,onClick:m};return Y({ourProps:E,theirProps:I,slot:M,attrs:c,slots:n,name:"ListboxButton"})}}}),sl=K({name:"ListboxOptions",props:{as:{type:[Object,String],default:"ul"},static:{type:Boolean,default:!1},unmount:{type:Boolean,default:!0},id:{type:String,default:null}},setup(e,{attrs:c,slots:n,expose:o}){var l;let i=(l=e.id)!=null?l:`headlessui-listbox-options-${ae()}`,t=Oe("ListboxOptions"),a=B(null);o({el:t.optionsRef,$el:t.optionsRef});function d(u){switch(a.value&&clearTimeout(a.value),u.key){case z.Space:if(t.searchQuery.value!=="")return u.preventDefault(),u.stopPropagation(),t.search(u.key);case z.Enter:if(u.preventDefault(),u.stopPropagation(),t.activeOptionIndex.value!==null){let v=t.options.value[t.activeOptionIndex.value];t.select(v.dataRef.value)}t.mode.value===0&&(t.closeListbox(),N(()=>{var v;return(v=R(t.buttonRef))==null?void 0:v.focus({preventScroll:!0})}
4));break;case H(t.orientation.value,{vertical:z.ArrowDown,horizontal:z.ArrowRight}):return u.preventDefault(),u.stopPropagation(),t.goToOption(k.Next);case H(t.orientation.value,{vertical:z.ArrowUp,horizontal:z.ArrowLeft}):return u.preventDefault(),u.stopPropagation(),t.goToOption(k.Previous);case z.Home:case z.PageUp:return u.preventDefault(),u.stopPropagation(),t.goToOption(k.First);case z.End:case z.PageDown:return u.preventDefault(),u.stopPropagation(),t.goToOption(k.Last);case z.Escape:u.preventDefault(),u.stopPropagation(),t.closeListbox(),N(()=>{var v;return(v=R(t.buttonRef))==null?void 0:v.focus({preventScroll:!0})});break;case z.Tab:u.preventDefault(),u.stopPropagation();break;default:u.key.length===1&&(t.search(u.key),a.value=setTimeout(()=>t.clearSearch(),350));break}}let m=Ye(),p=y(()=>m!==null?(m.value&te.Open)===te.Open:t.listboxState.value===0);return()=>{var u,v;let M={open:t.listboxState.value===0},{...I}=e,E={"aria-activedescendant":t.activeOptionIndex.value===null||(u=t.options.value[t.activeOptionIndex.value])==null?void 0:u.id,"aria-multiselectable":t.mode.value===1?!0:void 0,"aria-labelledby":(v=R(t.buttonRef))==null?void 0:v.id,"aria-orientation":t.orientation.value,id:i,onKeydown:d,role:"listbox",tabIndex:0,ref:t.optionsRef};return Y({ourProps:E,theirProps:I,slot:M,attrs:c,slots:n,features:se.RenderStrategy|se.Static,visible:p.value,name:"ListboxOptions"})}}}),rl=K({name:"ListboxOption",props:{as:{type:[Object,String],default:"li"},value:{type:[Object,String,Number,Boolean]},disabled:{type:Boolean,default:!1},id:{type:String,default:null}},setup(e,{slots:c,attrs:n,expose:o}){var l;let i=(l=e.id)!=null?l:`headlessui-listbox-option-${ae()}`,t=Oe("ListboxOption"),a=B(null);o({el:a,$el:a});let d=y(()=>t.activeOptionIndex.value!==null?t.options.value[t.activeOptionIndex.value].id===i:!1),m=y(()=>H(t.mode.value,{0:()=>t.compare(j(t.value.value),j(e.value)),1:()=>j(t.value.value).some(s=>t.compare(j(s),j(e.value)))})),p=y(()=>H(t.mode.value,{1:()=>{var s;let h=j(t.value.value);return((s=t.options.value.find(r=>h.some(g=>t.compare(j(g),j(r.dataRef.value)))))==null?void 0:s.id)===i},0:()=>m.value})),u=wt(a),v=y(()=>({disabled:e.disabled,value:e.value,get textValue(){return u()},domRef:a}));ie(()=>t.registerOption(i,v)),Te(()=>t.unregisterOption(i)),ie(()=>{Q([t.listboxState,m],()=>{t.listboxState.value===0&&m.value&&H(t.mode.value,{1:()=>{p.value&&t.goToOption(k.Specific,i)},0:()=>{t.goToOption(k.Specific,i)}})},{immediate:!0})}),fe(()=>{t.listboxState.value===0&&d.value&&t.activationTrigger.value!==0&&N(()=>{var s,h;return(h=(s=R(a))==null?void 0:s.scrollIntoView)==null?void 0:h.call(s,{block:"nearest"})})});function M(s){if(e.disabled)return s.preventDefault();t.select(e.value),t.mode.value===0&&(t.closeListbox(),N(()=>{var h;return(h=R(t.buttonRef))==null?void 0:h.focus({preventScroll:!0})}
4))}function I(){if(e.disabled)return t.goToOption(k.Nothing);t.goToOption(k.Specific,i)}let E=Qe();function V(s){E.update(s)}function w(s){E.wasMoved(s)&&(e.disabled||d.value||t.goToOption(k.Specific,i,0))}function S(s){E.wasMoved(s)&&(e.disabled||d.value&&t.goToOption(k.Nothing))}return()=>{let{disabled:s}=e,h={active:d.value,selected:m.value,disabled:s},{value:r,disabled:g,...x}=e,f={id:i,ref:a,role:"option",tabIndex:s===!0?void 0:-1,"aria-disabled":s===!0?!0:void 0,"aria-selected":m.value,disabled:void 0,onClick:M,onFocus:I,onPointerenter:V,onMouseenter:V,onPointermove:w,onMousemove:w,onPointerleave:S,onMouseleave:S};return Y({ourProps:f,theirProps:x,slot:h,attrs:n,slots:c,name:"ListboxOption"})}}});const G=Be(ne.ui.strategy,ne.ui.select,ut),he=Be(ne.ui.strategy,ne.ui.selectMenu,st),dl=K({components:{HCombobox:Yt,HComboboxButton:Xt,HComboboxOptions:_t,HComboboxOption:el,HComboboxInput:Zt,HListbox:il,HListboxButton:ul,HListboxOptions:sl,HListboxOption:rl,UIcon:Le,UAvatar:Fe},inheritAttrs:!1,props:{modelValue:{type:[String,Number,Object,Array,Boolean],default:""},query:{type:String,default:null},by:{type:String,default:void 0},options:{type:Array,default:()=>[]},id:{type:String,default:null},name:{type:String,default:null},required:{type:Boolean,default:!1},icon:{type:String,default:null},loadingIcon:{type:String,default:()=>G.default.loadingIcon},leadingIcon:{type:String,default:null},trailingIcon:{type:String,default:()=>G.default.trailingIcon},trailing:{type:Boolean,default:!1},leading:{type:Boolean,default:!1},loading:{type:Boolean,default:!1},selectedIcon:{type:String,default:()=>he.default.selectedIcon},disabled:{type:Boolean,default:!1},multiple:{type:Boolean,default:!1},searchable:{type:[Boolean,Function],default:!1},searchablePlaceholder:{type:String,default:"Search..."},searchableLazy:{type:Boolean,default:!1},clearSearchOnClose:{type:Boolean,default:()=>he.default.clearSearchOnClose},debounce:{type:Number,default:200},creatable:{type:Boolean,default:!1},showCreateOptionWhen:{type:String,default:()=>he.default.showCreateOptionWhen},placeholder:{type:String,default:null},padded:{type:Boolean,default:!0},size:{type:String,default:null,validator(e){return Object.keys(G.size).includes(e)}},color:{type:String,default:()=>G.default.color,validator(e){return[...ne.ui.colors,...Object.keys(G.color)].includes(e)}},variant:{type:String,default:()=>G.default.variant,validator(e){return[...Object.keys(G.variant),...Object.values(G.color).flatMap(c=>Object.keys(c))].includes(e)}},optionAttribute:{type:String,default:"label"},valueAttribute:{type:String,default:null},searchAttributes:{type:Array,default:null},popper:{type:Object,default:()=>({})},selectClass:{type:String,default:null},class:{type:[String,Object,Array],default:()=>""},ui:{type:Object,default:()=>({})},uiMenu:{type:Object,default:()=>({})}},emits:["update:modelValue","update:query","open","close","change"],setup(e,{emit:c,slots:n}){const{ui:o,attrs:l}=$e("select",xe(e,"ui"),G,xe(e,"class")),{ui:i}=$e("selectMenu",xe(e,"uiMenu"),he),t=y(()=>rt({},e.popper,i.value.popper)),[a,d]=Ct(t.value),{size:m,rounded:p}=dt({ui:o,props:e}),{emitFormBlur:u,emitFormChange:v,inputId:M,color:I,size:E,name:V}=Tt(e,G),w=y(()=>m.value||E.value),S=B(""),s=y({get(){return e.query??S.value},set(L){S.value=L,c("update:query",L)}}),h=y(()=>{if(e.multiple)return Array.isArray(e.modelValue)&&e.modelValue.length?`${e.modelValue.length} selected`:null;if(e.modelValue!==void 0&&e.modelValue!==null)if(e.valueAttribute){const L=e.options.find(U=>U[e.valueAttribute]===e.modelValue);return L?L[e.optionAttribute]:null}else return["string","number"].includes(typeof e.modelValue)?e.modelValue:e.modelValue[e.optionAttribute];return null}),r=y(()=>{var U,be;const L=((be=(U=o.value.color)==null?void 0:U[I.value])==null?void 0:be[e.variant])||o.value.variant[e.variant];return ct(de(o.value.base,i.value.select,p.value,o.value.size[w.value],o.value.gap[w.value],e.padded?o.value.padding[w.value]:"p-0",L==null?void 0:L.replaceAll("{color}",I.value),(g.value||n.leading)&&o.value.leading.padding[w.value],(x.value||n.trailing)&&o.value.trailing.padding[w.value]),e.placeholder&&!e.modelValue&&o.value.placeholder,e.selectClass)}),g=y(()=>e.icon&&e.leading||e.icon&&!e.trailing||e.loading&&!e.trailing||e.leadingIcon),x=y(()=>e.icon&&e.trailing||e.loading&&e.trailing||e.trailingIcon),f=y(()=>e.loading?e.loadingIcon:e.leadingIcon||e.icon),A=y(()=>e.loading&&!g.value?e.loadingIcon:e.trailingIcon||e.icon),b=y(()=>de(o.value.icon.leading.wrapper,o.value.icon.leading.pointer,o.value.icon.leading.padding[w.value])),O=y(()=>de(o.value.icon.base,I.value&&ne.ui.colors.includes(I.value)&&o.value.icon.color.replaceAll("{color}",I.value),o.value.icon.size[w.value],e.loading&&o.value.icon.loading)),C=y(()=>de(o.value.icon.trailing.wrapper,o.value.icon.trailing.pointer,o.value.icon.trailing.padding[w.value])),T=y(()=>de(o.value.icon.base,I.value&&ne.ui.colors.includes(I.value)&&o.value.icon.color.replaceAll("{color}",I.value),o.value.icon.size[w.value],e.loading&&!g.value&&o.value.icon.loading)),$=typeof e.searchable=="function"?vt(e.searchable,e.debounce):void 0,P=pt(async()=>e.searchable&&$?await $(s.value):s.value===""?e.options:e.options.filter(L=>{var U;return((U=e.searchAttributes)!=null&&U.length?e.searchAttributes:[e.optionAttribute]).some(be=>{if(["string","number"].includes(typeof L))return String(L).search(new RegExp(s.value,"i"))!==-1;const Ie=ft(L,be);return Ie!=null&&String(Ie).search(new RegExp(s.value,"i"))!==-1})}),[],{lazy:e.searchableLazy}),q=y(()=>s.value===""||e.showCreateOptionWhen==="empty"&&P.value.length||e.showCreateOptionWhen==="always"&&P.value.find(U=>["string","number"].includes(typeof U)?U===s.value:U[e.optionAttribute]===s.value)?null:["string","number"].includes(typeof e.modelValue)?s.value:{[e.optionAttribute]:s.value});function X(){e.clearSearchOnClose&&(s.value="")}Q(d,L=>{L?c("open"):(X(),c("close"),u())});function le(L){c("update:modelValue",L),c("change",L),v()}function Se(L){s.value=L.target.value}return Rt(()=>yt("$YMH7mn4R4k")),{ui:o,uiMenu:i,attrs:l,name:V,inputId:M,popper:t,trigger:a,container:d,label:h,isLeading:g,isTrailing:x,selectClass:r,leadingIconName:f,leadingIconClass:O,leadingWrapperIconClass:b,trailingIconName:A,trailingIconClass:T,trailingWrapperIconClass:C,filteredOptions:P,createOption:q,query:s,onUpdate:le,onQueryChange:Se}}}),cl=["value","required"],vl=["id","disabled"],pl={class:"truncate"};function fl(e,c,n,o,l,i){const t=Le,a=bt("HComboboxInput"),d=Fe;return F(),Z(ce(e.searchable?"HCombobox":"HListbox"),{by:e.by,name:e.name,"model-value":e.modelValue,multiple:e.multiple,disabled:e.disabled,as:"div",class:D(e.ui.wrapper),"onUpdate:modelValue":e.onUpdate},{default:oe(({open:m})=>[e.required?(F(),W("input",{key:0,value:e.modelValue,required:e.required,
4class:D(e.uiMenu.required),tabindex:"-1","aria-hidden":"true"},null,10,cl)):J("",!0),(F(),Z(ce(e.searchable?"HComboboxButton":"HListboxButton"),{ref:"trigger",as:"div",role:"button",class:D(e.uiMenu.trigger)},{default:oe(()=>[_(e.$slots,"default",{open:m,disabled:e.disabled,loading:e.loading},()=>[ee("button",Ce({id:e.inputId,class:e.selectClass,disabled:e.disabled,type:"button"},e.attrs),[e.isLeading&&e.leadingIconName||e.$slots.leading?(F(),W("span",{key:0,class:D(e.leadingWrapperIconClass)},[_(e.$slots,"leading",{disabled:e.disabled,loading:e.loading},()=>[me(t,{name:e.leadingIconName,class:D(e.leadingIconClass)},null,8,["name","class"])])],2)):J("",!0),_(e.$slots,"label",{},()=>[e.label?(F(),W("span",{key:0,class:D(e.uiMenu.label)},ve(e.label),3)):(F(),W("span",{key:1,class:D(e.uiMenu.label)},ve(e.placeholder||"Â "),3))]),e.isTrailing&&e.trailingIconName||e.$slots.trailing?(F(),W("span",{key:1,class:D(e.trailingWrapperIconClass)},[_(e.$slots,"trailing",{disabled:e.disabled,loading:e.loading},()=>[me(t,{name:e.trailingIconName,class:D(e.trailingIconClass),"aria-hidden":"true"},null,8,["name","class"])])],2)):J("",!0)],16,vl)])]),_:2},1032,["class"])),m?(F(),W("div",{key:1,ref:"container",class:D([e.uiMenu.container,e.uiMenu.width])},[me(mt,Ce({appear:""},e.uiMenu.transition),{default:oe(()=>[ee("div",null,[e.popper.arrow?(F(),W("div",{key:0,"data-popper-arrow":"",class:D(Object.values(e.uiMenu.arrow))},null,2)):J("",!0),(F(),Z(ce(e.searchable?"HComboboxOptions":"HListboxOptions"),{static:"",class:D([e.uiMenu.base,e.uiMenu.ring,e.uiMenu.rounded,e.uiMenu.shadow,e.uiMenu.background,e.uiMenu.padding,e.uiMenu.height])},{default:oe(()=>{var p,u;return[e.searchable?(F(),Z(a,{key:0,"display-value":()=>e.query,name:"q",placeholder:e.searchablePlaceholder,autofocus:"",autocomplete:"off",class:D(e.uiMenu.input),onChange:e.onQueryChange},null,8,["display-value","placeholder","class","onChange"])):J("",!0),(F(!0),W(Ae,null,ht(e.filteredOptions,(v,M)=>(F(),Z(ce(e.searchable?"HComboboxOption":"HListboxOption"),{key:M,as:"template",value:e.valueAttribute?v[e.valueAttribute]:v,disabled:v.disabled},{default:oe(({active:I,selected:E,disabled:V})=>[ee("li",{class:D([e.uiMenu.option.base,e.uiMenu.option.rounded,e.uiMenu.option.padding,e.uiMenu.option.size,e.uiMenu.option.color,I?e.uiMenu.option.active:e.uiMenu.option.inactive,E&&e.uiMenu.option.selected,V&&e.uiMenu.option.disabled])},[ee("div",{class:D(e.uiMenu.option.container)},[_(e.$slots,"option",{option:v,active:I,selected:E},()=>[v.icon?(F(),Z(t,{key:0,name:v.icon,class:D([e.uiMenu.option.icon.base,I?e.uiMenu.option.icon.active:e.uiMenu.option.icon.inactive,v.iconClass]),"aria-hidden":"true"},null,8,["name","class"])):v.avatar?(F(),Z(d,Ce({key:1,ref_for:!0},{size:e.uiMenu.option.avatar.size,...v.avatar},{class:e.uiMenu.option.avatar.base,"aria-hidden":"true"}),null,16,["class"])):v.chip?(F(),W("span",{key:2,class:D(e.uiMenu.option.chip.base),style:gt({background:`#${v.chip}`})},null,6)):J("",!0),ee("span",pl,ve(["string","number"].includes(typeof v)?v:v[e.optionAttribute]),1)])],2),E?(F(),W("span",{key:0,class:D([e.uiMenu.option.selectedIcon.wrapper,e.uiMenu.option.selectedIcon.padding])},[me(t,{name:e.selectedIcon,class:D(e.uiMenu.option.selectedIcon.base),"aria-hidden":"true"},null,8,["name","class"])],2)):J("",!0)],2)]),_:2},1032,["value","disabled"]))),128)),e.creatable&&e.createOption?(F(),Z(ce(e.searchable?"HComboboxOption":"HListboxOption"),{key:1,value:e.createOption,as:"template"},{default:oe(({active:v,selected:M})=>[ee("li",{class:D([e.uiMenu.option.base,e.uiMenu.option.rounded,e.uiMenu.option.padding,e.uiMenu.option.size,e.uiMenu.option.color,v?e.uiMenu.option.active:e.uiMenu.option.inactive])},[ee("div",{class:D(e.uiMenu.option.container)},[_(e.$slots,"option-create",{option:e.createOption,active:v,selected:M},()=>[ee("span",{class:D(e.uiMenu.option.create)},'Create "'+ve(e.createOption[e.optionAttribute])+'"',3)])],2)],2)]),_:3},8,["value"])):e.searchable&&e.query&&!((p=e.filteredOptions)!=null&&p.length)?(F(),W("p",{key:2,class:D(e.uiMenu.option.empty)},[_(e.$slots,"option-empty",{query:e.query},()=>[Pe(' No results for "'+ve(e.query)+'". ',1)])],2)):(u=e.filteredOptions)!=null&&u.length?J("",!0):(F(),W("p",{key:3,class:D(e.uiMenu.empty)},[_(e.$slots,"empty",{query:e.query},()=>[Pe(" No options. ")])],2))]}),_:3},8,["class"]))])]),_:3},16)],2)):J("",!0)]),_:3},8,["by","name","model-value","multiple","disabled","class","onUpdate:modelValue"])}const xl=it(dl,[["render",fl]]);export{xl as _};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.