1import Ce from"./Icon.DUfj3xau.js";import{x,l as A,K as Te,B as L,W as de,X as Re,f as H,j as _,D as we,T as N,A as ge,z as ue,N as ee,F as se,H as te,I as xe,S as Ee,E as q,Y as Me,o as B,g as ce,w as Z,a as K,c as U,k as ve,t as fe,b as j,i as Q,n as pe}from"./entry.BxrKbY13.js";import{d as ke,e as ze}from"./form.DAPi4ld9.js";import{u as J,o as T,E as Pe,A as G,T as re,I as ne,i as Ve,c as le,O as _e,a as F}from"./keyboard.BbDlWrfD.js";import{w as De,t as Fe,i as oe,l as $e,n as Ae}from"./open-closed.D-hF2tcx.js";import{s as Be}from"./use-resolve-button-type.DHHK_P_j.js";import{c as V,f as me,u as Ne}from"./calculate-active-index.DxsiUdlR.js";import{i as je}from"./use-tree-walker.DAaU1n5K.js";import{f as Le,s as Ke}from"./hidden.C7J68tB-.js";import{o as he,t as be}from"./disposables.BLHQCCpx.js";import{S as Ue}from"./transition.3Gu9Y5gM.js";function W(o,c,e){let n=e.initialDeps??[],t;return()=>{var a,i,l,p;let m;e.key&&((a=e.debug)!=null&&a.call(e))&&(m=Date.now());const v=o();if(!(v.length!==n.length||v.some((S,w)=>n[w]!==S)))return t;n=v;let y;if(e.key&&((i=e.debug)!=null&&i.call(e))&&(y=Date.now()),t=c(...v),e.key&&((l=e.debug)!=null&&l.call(e))){const S=Math.round((Date.now()-m)*100)/100,w=Math.round((Date.now()-y)*100)/100,O=w/16,k=(h,I)=>{for(h=String(h);h.length<I;)h=" "+h;return h};console.info(`%câ± ${k(w,5)} /${k(S,5)} ms`,` 2 font-size: .6rem; 3 font-weight: bold; 4 color: hsl(${Math.max(0,Math.min(120-120*O,120))}deg 100% 31%);`,e==null?void 0:e.key)}return(p=e==null?void 0:e.onChange)==null||p.call(e,t),t}}function ae(o,c){if(o===void 0)throw new Error(`Unexpected undefined${c?`: ${c}`:""}`);return o}const qe=(o,c)=>Math.abs(o-c)<1,He=o=>o,We=o=>{const c=Math.max(o.startIndex-o.overscan,0),e=Math.min(o.endIndex+o.overscan,o.count-1),n=[];for(let t=c;t<=e;t++)n.push(t);return n},Je=(o,c)=>{const e=o.scrollElement;if(!e)return;const n=a=>{const{width:i,height:l}=a;c({width:Math.round(i),height:Math.round(l)})};if(n(e.getBoundingClientRect()),typeof ResizeObserver>"u")return()=>{};const t=new ResizeObserver(a=>{const i=a[0];if(i!=null&&i.borderBoxSize){const l=i.borderBoxSize[0];if(l){n({width:l.inlineSize,height:l.blockSize});return}}n(e.getBoundingClientRect())});return t.observe(e,{box:"border-box"}),()=>{t.unobserve(e)}},Ye=(o,c)=>{const e=o.scrollElement;if(!e)return;const n=()=>{c(e[o.options.horizontal?"scrollLeft":"scrollTop"])};return n(),e.addEventListener("scroll",n,{passive:!0}),()=>{e.removeEventListener("scroll",n)}},Xe=(o,c,e)=>{if(c!=null&&c.borderBoxSize){const n=c.borderBoxSize[0];if(n)return Math.round(n[e.options.horizontal?"inlineSize":"blockSize"])}return Math.round(o.getBoundingClientRect()[e.options.horizontal?"width":"height"])},Ze=(o,{adjustments:c=0,behavior:e},n)=>{var t,a;const i=o+c;(a=(t=n.scrollElement)==null?void 0:t.scrollTo)==null||a.call(t,{[n.options.horizontal?"left":"top"]:i,behavior:e})};class Ge{constructor(c){this.unsubs=[],this.scrollElement=null,this.isScrolling=!1,this.isScrollingTimeoutId=null,this.scrollToIndexTimeoutId=null,this.measurementsCache=[],this.itemSizeCache=new Map,this.pendingMeasuredCacheIndexes=[],this.scrollDirection=null,this.scrollAdjustments=0,this.measureElementCache=new Map,this.observer=(()=>{let e=null;const n=()=>e||(typeof ResizeObserver<"u"?e=new ResizeObserver(t=>{t.forEach(a=>{this._measureElement(a.target,a)})}):null);return{disconnect:()=>{var t;return(t=n())==null?void 0:t.disconnect()},observe:t=>{var a;return(a=n())==null?void 0:a.observe(t,{box:"border-box"})},unobserve:t=>{var a;return(a=n())==null?void 0:a.unobserve(t)}}})(),this.range=null,this.setOptions=e=>{Object.entries(e).forEach(([n,t])=>{typeof t>"u"&&delete e[n]}),this.options={debug:!1,initialOffset:0,overscan:1,paddingStart:0,paddingEnd:0,scrollPaddingStart:0,scrollPaddingEnd:0,horizontal:!1,getItemKey:He,rangeExtractor:We,onChange:()=>{},measureElement:Xe,initialRect:{width:0,height:0},scrollMargin:0,scrollingDelay:150,indexAttribute:"data-index",initialMeasurementsCache:[],lanes:1,...e}},this.notify=e=>{var n,t;(t=(n=this.options).onChange)==null||t.call(n,this,e)},this.maybeNotify=W(()=>(this.calculateRange(),[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]),e=>{this.notify(e)},{key:!1,debug:()=>this.options.debug,initialDeps:[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]}),this.cleanup=()=>
4{this.unsubs.filter(Boolean).forEach(e=>e()),this.unsubs=[],this.scrollElement=null},this._didMount=()=>(this.measureElementCache.forEach(this.observer.observe),()=>{this.observer.disconnect(),this.cleanup()}),this._willUpdate=()=>{const e=this.options.getScrollElement();this.scrollElement!==e&&(this.cleanup(),this.scrollElement=e,this._scrollToOffset(this.scrollOffset,{adjustments:void 0,behavior:void 0}),this.unsubs.push(this.options.observeElementRect(this,n=>{this.scrollRect=n,this.maybeNotify()})),this.unsubs.push(this.options.observeElementOffset(this,n=>{this.scrollAdjustments=0,this.scrollOffset!==n&&(this.isScrollingTimeoutId!==null&&(clearTimeout(this.isScrollingTimeoutId),this.isScrollingTimeoutId=null),this.isScrolling=!0,this.scrollDirection=this.scrollOffset<n?"forward":"backward",this.scrollOffset=n,this.maybeNotify(),this.isScrollingTimeoutId=setTimeout(()=>{this.isScrollingTimeoutId=null,this.isScrolling=!1,this.scrollDirection=null,this.maybeNotify()},this.options.scrollingDelay))})))},this.getSize=()=>this.scrollRect[this.options.horizontal?"width":"height"],this.memoOptions=W(()=>[this.options.count,this.options.paddingStart,this.options.scrollMargin,this.options.getItemKey],(e,n,t,a)=>(this.pendingMeasuredCacheIndexes=[],{count:e,paddingStart:n,scrollMargin:t,getItemKey:a}),{key:!1}),this.getFurthestMeasurement=(e,n)=>{const t=new Map,a=new Map;for(let i=n-1;i>=0;i--){const l=e[i];if(t.has(l.lane))continue;const p=a.get(l.lane);if(p==null||l.end>p.end?a.set(l.lane,l):l.end<p.end&&t.set(l.lane,!0),t.size===this.options.lanes)break}return a.size===this.options.lanes?Array.from(a.values()).sort((i,l)=>i.end===l.end?i.index-l.index:i.end-l.end)[0]:void 0},this.getMeasurements=W(()=>[this.memoOptions(),this.itemSizeCache],({count:e,paddingStart:n,scrollMargin:t,getItemKey:a},i)=>{const l=this.pendingMeasuredCacheIndexes.length>0?Math.min(...this.pendingMeasuredCacheIndexes):0;this.pendingMeasuredCacheIndexes=[];const p=this.measurementsCache.slice(0,l);for(let m=l;m<e;m++){const v=a(m),r=this.options.lanes===1?p[m-1]:this.getFurthestMeasurement(p,m),y=r?r.end:n+t,S=i.get(v),w=typeof S=="number"?S:this.options.estimateSize(m),O=y+w,k=r?r.lane:m%this.options.lanes;p[m]={index:m,start:y,size:w,end:O,key:v,lane:k}}return this.measurementsCache=p,p},{key:!1,debug:()=>this.options.debug}),this.calculateRange=W(()=>[this.getMeasurements(),this.getSize(),this.scrollOffset],(e,n,t)=>this.range=e.length>0&&n>0?Qe({measurements:e,outerSize:n,scrollOffset:t}):null,{key:!1,debug:()=>this.options.debug}),this.getIndexes=W(()=>[this.options.rangeExtractor,this.calculateRange(),this.options.overscan,this.options.count],(e,n,t,a)=>n===null?[]:e({...n,overscan:t,count:a}),{key:!1,debug:()=>this.options.debug}),this.indexFromElement=e=>{const n=this.options.indexAttribute,t=e.getAttribute(n);return t?parseInt(t,10):(console.warn(`Missing attribute name '${n}={index}' on measured element.`),-1)},this._measureElement=(e,n)=>{const t=this.measurementsCache[this.indexFromElement(e)];if(!t||!e.isConnected){this.measureElementCache.forEach((l,p)=>{l===e&&(this.observer.unobserve(e),this.measureElementCache.delete(p))});return}const a=this.measureElementCache.get(t.key);a!==e&&(a&&this.observer.unobserve(a),this.observer.observe(e),this.measureElementCache.set(t.key,e));const i=this.options.measureElement(e,n,this);this.resizeItem(t,i)},this.resizeItem=(e,n)=>{const t=this.itemSizeCache.get(e.key)??e.size,a=n-t;a!==0&&(e.start<this.scrollOffset+this.scrollAdjustments&&this._scrollToOffset(this.scrollOffset,{adjustments:this.scrollAdjustments+=a,behavior:void 0}),this.pendingMeasuredCacheIndexes.push(e.index),this.itemSizeCache=new Map(this.itemSizeCache.set(e.key,n)),this.notify(!1))},this.measureElement=e=>{e&&this._measureElement(e,void 0)},this.getVirtualItems=W(()=>[this.getIndexes(),this.getMeasurements()],(e,n)=>{const t=[];for(let a=0,i=e.length;a<i;a++){const l=e[a],p=n[l];t.push(p)}return t},{key:!1,debug:()=>this.options.debug}),this.getVirtualItemForOffset=e=>{const n=this.getMeasurements();return ae(n[ye(0,n.length-1,t=>ae(n[t]).start,e)])},this.getOffsetForAlignment=(e,n)=>{const t=this.getSize();n==="auto"&&(e<=this.scrollOffset?n="start":e>=this.scrollOffset+t?n="end":n="start"),n==="start"?e=e:n==="end"?e=e-t:n==="center"&&(e=e-t/2);const a=this.options.horizontal?"scrollWidth":"scrollHeight",l=(this.scrollElement?"document"in this.scrollElement?this.scrollElement.document.documentElement[a]:this.scrollElement[a]:0)-this.getSize();return Math.max(Math.min(l,e),0)},this.getOffsetForIndex=(e,n="auto")=>{e=Math.max(0,Math.min(e,this.options.count-1));const t=ae(this.getMeasurements()[e]);if(n==="auto")if(t.end>=this.scrollOffset+this.getSize()-this.options.scrollPaddingEnd)n="end";else if(t.start<=this.scrollOffset+this.options.scrollPaddingStart)n="start";else return[this.scrollOffset,n];const a=n==="end"?t.end+this.options.scrollPaddingEnd:t.start-this.options.scrollPaddingStart;return[this.getOffsetForAlignment(a,n),n]},this.isDynamicMode=()=>this.measureElementCache.size>0,this.cancelScrollToIndex=()=>{this.scrollToIndexTimeoutId!==null&&(clearTimeout(this.scrollToIndexTimeoutId),this.scrollToIndexTimeoutId=null)},this.scrollToOffset=(e,{align:n="start",behavior:t}={})=>{this.cancelScrollToIndex(),t==="smooth"&&this.isDynamicMode()&&console.warn("The `smooth` scroll behavior is not fully supported with dynamic size."),this._scrollToOffset(this.getOffsetForAlignment(e,n),{adjustments:void 0,behavior:t})},this.scrollToIndex=(e,{align:n="auto",behavior:t}={})=>{e=Math.max(0,Math.min(e,this.options.count-1)),this.cancelScrollToIndex(),t==="smooth"&&this.isDynamicMode()&&console.warn("The `smooth` scroll behavior is not fully supported with dynamic size.");const[a,i]=this.getOffsetForIndex(e,n);this._scrollToOffset(a,{adjustments:void 0,behavior:t}),t!=="smooth"&&this.isDynamicMode()&&(this.scrollToIndexTimeoutId=setTimeout(()=>{if(this.scrollToIndexTimeoutId=null,this.measureElementCache.has(this.options.getItemKey(e))){const[p]=this.getOffsetForIndex(e,i);qe(p,this.scrollOffset)||this.scrollToIndex(e,{align:i,behavior:t})}else this.scrollToIndex(e,{align:i,behavior:t})}))},this.scrollBy=(e,{behavior:n}={})=>{this.cancelScrollToIndex(),n==="smooth"&&this.isDynamicMode()&&console.warn("The `smooth` scroll behavior is not fully supported with dynamic size."),this._scrollToOffset(this.scrollOffset+e,{adjustments:void 0,behavior:n})},this.getTotalSize=()=>{var e;const n=this.getMeasurements();let t;return n.length===0?t=this.options.paddingStart:t=this.options.lanes===1?((e=n[n.length-1])==null?void 0:e.end)??0:Math.max(...n.slice(-this.options.lanes).map(a=>a.end)),t-this.options.scrollMargin+this.options.paddingEnd}
4,this._scrollToOffset=(e,{adjustments:n,behavior:t})=>{this.options.scrollToFn(e,{behavior:t,adjustments:n},this)},this.measure=()=>{this.itemSizeCache=new Map,this.notify(!1)},this.setOptions(c),this.scrollRect=this.options.initialRect,this.scrollOffset=this.options.initialOffset,this.measurementsCache=this.options.initialMeasurementsCache,this.measurementsCache.forEach(e=>{this.itemSizeCache.set(e.key,e.size)}),this.maybeNotify()}}const ye=(o,c,e,n)=>{for(;o<=c;){const t=(o+c)/2|0,a=e(t);if(a<n)o=t+1;else if(a>n)c=t-1;else return t}return o>0?o-1:0};function Qe({measurements:o,outerSize:c,scrollOffset:e}){const n=o.length-1,a=ye(0,n,l=>o[l].start,e);let i=a;for(;i<n&&o[i].end<e+c;)i++;return{startIndex:a,endIndex:i}}function et(o){const c=new Ge(A(o)),e=Te(c),n=c._didMount();return L(()=>A(o).getScrollElement(),t=>{t&&c._willUpdate()},{immediate:!0}),L(()=>A(o),t=>{c.setOptions({...t,onChange:(a,i)=>{var l;de(e),(l=t.onChange)==null||l.call(t,a,i)}}),c._willUpdate(),de(e)},{immediate:!0}),Re(n),e}function tt(o){return et(x(()=>({observeElementRect:Je,observeElementOffset:Ye,scrollToFn:Ze,...A(o)})))}var lt={};function ot(o,c){return o===c}var nt=(o=>(o[o.Open=0]="Open",o[o.Closed=1]="Closed",o))(nt||{}),it=(o=>(o[o.Single=0]="Single",o[o.Multi=1]="Multi",o))(it||{}),at=(o=>(o[o.Pointer=0]="Pointer",o[o.Focus=1]="Focus",o[o.Other=2]="Other",o))(at||{});let Se=Symbol("ComboboxContext");function Y(o){let c=xe(Se,null);if(c===null){let e=new Error(`<${o} /> is missing a parent <Combobox /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(e,Y),e}return c}let Oe=Symbol("VirtualContext"),st=H({name:"VirtualProvider",setup(o,{slots:c}){let e=Y("VirtualProvider"),n=x(()=>{let l=T(e.optionsRef);if(!l)return{start:0,end:0};let p=window.getComputedStyle(l);return{start:parseFloat(p.paddingBlockStart||p.paddingTop),end:parseFloat(p.paddingBlockEnd||p.paddingBottom)}}),t=tt(x(()=>({scrollPaddingStart:n.value.start,scrollPaddingEnd:n.value.end,count:e.virtual.value.options.length,estimateSize(){return 40},getScrollElement(){return T(e.optionsRef)},overscan:12}))),a=x(()=>{var l;return(l=e.virtual.value)==null?void 0:l.options}),i=_(0);return L([a],()=>{i.value+=1}),ge(Oe,e.virtual.value?t:null),()=>[ee("div",{style:{position:"relative",width:"100%",height:`${t.value.getTotalSize()}px`},ref:l=>{if(l){if(typeof process<"u"&<.JEST_WORKER_ID!==void 0||e.activationTrigger.value===0)return;e.activeOptionIndex.value!==null&&e.virtual.value.options.length>e.activeOptionIndex.value&&t.value.scrollToIndex(e.activeOptionIndex.value)}}},t.value.getVirtualItems().map(l=>Me(c.default({option:e.virtual.value.options[l.index],open:e.comboboxState.value===0})[0],{key:`${i.value}-${l.index}`,"data-index":l.index,"aria-setsize":e.virtual.value.options.length,"aria-posinset":l.index+1,style:{position:"absolute",top:0,left:0,transform:`translateY(${l.start}px)`,overflowAnchor:"none"}})))]}}),ut=H({name:"Combobox",emits:{"update:modelValue":o=>!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(o,{slots:c,attrs:e,emit:n}){let t=_(1),a=_(null),i=_(null),l=_(null),p=_(null),m=_({static:!1,hold:!1}),v=_([]),r=_(null),y=_(2),S=_(!1);function w(u=f=>f){let f=r.value!==null?v.value[r.value]:null,b=u(v.value.slice()),g=b.length>0&&b[0].dataRef.order.value!==null?b.sort((M,$)=>M.dataRef.order.value-$.dataRef.order.value):_e(b,M=>T(M.dataRef.domRef)),E=f?g.indexOf(f):null;return E===-1&&(E=null),{options:g,activeOptionIndex:E}}let O=x(()=>o.multiple?1:0),k=x(()=>o.nullable),[h,I]=ke(x(()=>o.modelValue),u=>n("update:modelValue",u),x(()=>o.defaultValue)),D=x(()=>h.value===void 0?J(O.value,{1:[],0:void 0}):h.value),d=null,R=null;function C(u){return J(O.value,{0(){return I==null?void 0:I(u)},1:()=>{let f=N(s.value.value).slice(),b=N(u),g=f.findIndex(E=>s.compare(b,N(E)));return g===-1?f.push(b):f.splice(g,1),I==null?void 0:I(f)}})}let z=x(()=>{});L([z],([u],[f])=>
4{if(s.virtual.value&&u&&f&&r.value!==null){let b=u.indexOf(f[r.value]);b!==-1?r.value=b:r.value=null}});let s={comboboxState:t,value:D,mode:O,compare(u,f){if(typeof o.by=="string"){let b=o.by;return(u==null?void 0:u[b])===(f==null?void 0:f[b])}return o.by===null?ot(u,f):o.by(u,f)},calculateIndex(u){return s.virtual.value?o.by===null?s.virtual.value.options.indexOf(u):s.virtual.value.options.findIndex(f=>s.compare(f,u)):v.value.findIndex(f=>s.compare(f.dataRef.value,u))},defaultValue:x(()=>o.defaultValue),nullable:k,immediate:x(()=>!1),virtual:x(()=>null),inputRef:i,labelRef:a,buttonRef:l,optionsRef:p,disabled:x(()=>o.disabled),options:v,change(u){I(u)},activeOptionIndex:x(()=>{if(S.value&&r.value===null&&(s.virtual.value?s.virtual.value.options.length>0:v.value.length>0)){if(s.virtual.value){let f=s.virtual.value.options.findIndex(b=>{var g;return!((g=s.virtual.value)!=null&&g.disabled(b))});if(f!==-1)return f}let u=v.value.findIndex(f=>!f.dataRef.disabled);if(u!==-1)return u}return r.value}),activationTrigger:y,optionsPropsRef:m,closeCombobox(){S.value=!1,!o.disabled&&t.value!==1&&(t.value=1,r.value=null)},openCombobox(){if(S.value=!0,!o.disabled&&t.value!==0){if(s.value.value){let u=s.calculateIndex(s.value.value);u!==-1&&(r.value=u)}t.value=0}},setActivationTrigger(u){y.value=u},goToOption(u,f,b){S.value=!1,d!==null&&cancelAnimationFrame(d),d=requestAnimationFrame(()=>{if(o.disabled||p.value&&!m.value.static&&t.value===1)return;if(s.virtual.value){r.value=u===V.Specific?f:me({focus:u},{resolveItems:()=>s.virtual.value.options,resolveActiveIndex:()=>{var M,$;return($=(M=s.activeOptionIndex.value)!=null?M:s.virtual.value.options.findIndex(ie=>{var X;return!((X=s.virtual.value)!=null&&X.disabled(ie))}))!=null?$:null},resolveDisabled:M=>s.virtual.value.disabled(M),resolveId(){throw new Error("Function not implemented.")}}),y.value=b??2;return}let g=w();if(g.activeOptionIndex===null){let M=g.options.findIndex($=>!$.dataRef.disabled);M!==-1&&(g.activeOptionIndex=M)}let E=u===V.Specific?f:me({focus:u},{resolveItems:()=>g.options,resolveActiveIndex:()=>g.activeOptionIndex,resolveId:M=>M.id,resolveDisabled:M=>M.dataRef.disabled});r.value=E,y.value=b??2,v.value=g.options})},selectOption(u){let f=v.value.find(g=>g.id===u);if(!f)return;let{dataRef:b}=f;C(b.value)},selectActiveOption(){if(s.activeOptionIndex.value!==null){if(s.virtual.value)C(s.virtual.value.options[s.activeOptionIndex.value]);else{let{dataRef:u}=v.value[s.activeOptionIndex.value];C(u.value)}s.goToOption(V.Specific,s.activeOptionIndex.value)}},registerOption(u,f){let b=we({id:u,dataRef:f});if(s.virtual.value){v.value.push(b);return}R&&cancelAnimationFrame(R);let g=w(E=>(E.push(b),E));r.value===null&&s.isSelected(f.value.value)&&(g.activeOptionIndex=g.options.indexOf(b)),v.value=g.options,r.value=g.activeOptionIndex,y.value=2,g.options.some(E=>!T(E.dataRef.domRef))&&(R=requestAnimationFrame(()=>{let E=w();v.value=E.options,r.value=E.activeOptionIndex}))},unregisterOption(u,f){if(d!==null&&cancelAnimationFrame(d),f&&(S.value=!0),s.virtual.value){v.value=v.value.filter(g=>g.id!==u);return}let b=w(g=>{let E=g.findIndex(M=>M.id===u);return E!==-1&&g.splice(E,1),g});v.value=b.options,r.value=b.activeOptionIndex,y.value=2},isSelected(u){return J(O.value,{0:()=>s.compare(N(s.value.value),N(u)),1:()=>N(s.value.value).some(f=>s.compare(N(f),N(u)))})},isActive(u){return r.value===s.calculateIndex(u)}};De([i,l,p],()=>s.closeCombobox(),x(()=>t.value===0)),ge(Se,s),Fe(x(()=>J(t.value,{0:oe.Open,1:oe.Closed})));let P=x(()=>{var u;return(u=T(i))==null?void 0:u.closest("form")});return ue(()=>{L([P],()=>{if(!P.value||o.defaultValue===void 0)return;function u(){s.change(o.defaultValue)}return P.value.addEventListener("reset",u),()=>{var f;(f=P.value)==null||f.removeEventListener("reset",u)}},{immediate:!0})}),()=>{var u,f,b;let{name:g,disabled:E,form:M,...$}=o,ie={open:t.value===0,disabled:E,activeIndex:s.activeOptionIndex.value,activeOption:s.activeOptionIndex.value===null?null:s.virtual.value?s.virtual.value.options[(u=s.activeOptionIndex.value)!=null?u:0]:(b=(f=s.options.value[s.activeOptionIndex.value])==null?void 0:f.dataRef.value)!=null?b:null,value:D.value};return ee(se,[...g!=null&&D.value!=null?ze({[g]:D.value}).map(([X,Ie])=>ee(Le,Pe({features:Ke.Hidden,key:X,as:"input",type:"hidden",hidden:!0,readOnly:!0,form:M,name:X,value:
4Ie}))):[],G({theirProps:{...e,...re($,["by","defaultValue","immediate","modelValue","multiple","nullable","onUpdate:modelValue","virtual"])},ourProps:{},slot:ie,slots:c,attrs:e,name:"Combobox"})])}}}),rt=H({name:"ComboboxButton",props:{as:{type:[Object,String],default:"button"},id:{type:String,default:null}},setup(o,{attrs:c,slots:e,expose:n}){var t;let a=(t=o.id)!=null?t:`headlessui-combobox-button-${ne()}`,i=Y("ComboboxButton");n({el:i.buttonRef,$el:i.buttonRef});function l(v){i.disabled.value||(i.comboboxState.value===0?i.closeCombobox():(v.preventDefault(),i.openCombobox()),q(()=>{var r;return(r=T(i.inputRef))==null?void 0:r.focus({preventScroll:!0})}))}function p(v){switch(v.key){case F.ArrowDown:v.preventDefault(),v.stopPropagation(),i.comboboxState.value===1&&i.openCombobox(),q(()=>{var r;return(r=i.inputRef.value)==null?void 0:r.focus({preventScroll:!0})});return;case F.ArrowUp:v.preventDefault(),v.stopPropagation(),i.comboboxState.value===1&&(i.openCombobox(),q(()=>{i.value.value||i.goToOption(V.Last)})),q(()=>{var r;return(r=i.inputRef.value)==null?void 0:r.focus({preventScroll:!0})});return;case F.Escape:if(i.comboboxState.value!==0)return;v.preventDefault(),i.optionsRef.value&&!i.optionsPropsRef.value.static&&v.stopPropagation(),i.closeCombobox(),q(()=>{var r;return(r=i.inputRef.value)==null?void 0:r.focus({preventScroll:!0})});return}}let m=Be(x(()=>({as:o.as,type:c.type})),i.buttonRef);return()=>{var v,r;let y={open:i.comboboxState.value===0,disabled:i.disabled.value,value:i.value.value},{...S}=o,w={ref:i.buttonRef,id:a,type:m.value,tabindex:"-1","aria-haspopup":"listbox","aria-controls":(v=T(i.optionsRef))==null?void 0:v.id,"aria-expanded":i.comboboxState.value===0,"aria-labelledby":i.labelRef.value?[(r=T(i.labelRef))==null?void 0:r.id,a].join(" "):void 0,disabled:i.disabled.value===!0?!0:void 0,onKeydown:p,onClick:l};return G({ourProps:w,theirProps:S,slot:y,attrs:c,slots:e,name:"ComboboxButton"})}}}),dt=H({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:o=>!0},setup(o,{emit:c,attrs:e,slots:n,expose:t}){var a;let i=(a=o.id)!=null?a:`headlessui-combobox-input-${ne()}`,l=Y("ComboboxInput"),p=x(()=>Ve(T(l.inputRef))),m={value:!1};t({el:l.inputRef,$el:l.inputRef});function v(){l.change(null);let d=T(l.optionsRef);d&&(d.scrollTop=0),l.goToOption(V.Nothing)}let r=x(()=>{var d;let R=l.value.value;return T(l.inputRef)?typeof o.displayValue<"u"&&R!==void 0?(d=o.displayValue(R))!=null?d:"":typeof R=="string"?R:"":""});ue(()=>{L([r,l.comboboxState,p],([d,R],[C,z])=>{if(m.value)return;let s=T(l.inputRef);s&&((z===0&&R===1||d!==C)&&(s.value=d),requestAnimationFrame(()=>{var P;if(m.value||!s||((P=p.value)==null?void 0:P.activeElement)!==s)return;let{selectionStart:u,selectionEnd:f}=s;Math.abs((f??0)-(u??0))===0&&u===0&&s.setSelectionRange(s.value.length,s.value.length)}))},{immediate:!0}),L([l.comboboxState],([d],[R])=>{if(d===0&&R===1){if(m.value)return;let C=T(l.inputRef);if(!C)return;let z=C.value,{selectionStart:s,selectionEnd:P,selectionDirection:u}=C;C.value="",C.value=z,u!==null?C.setSelectionRange(s,P,u):C.setSelectionRange(s,P)}})});let y=_(!1);function S(){y.value=!0}function w(){he().nextFrame(()=>{y.value=!1})}function O(d){switch(m.value=!0,d.key){case F.Enter:if(m.value=!1,l.comboboxState.value!==0||y.value)return;if(d.preventDefault(),d.stopPropagation(),l.activeOptionIndex.value===null){l.closeCombobox();return}l.selectActiveOption(),l.mode.value===0&&l.closeCombobox();break;case F.ArrowDown:return m.value=!1,d.preventDefault(),d.stopPropagation(),J(l.comboboxState.value,{0:()=>l.goToOption(V.Next),1:()=>l.openCombobox()});case F.ArrowUp:return m.value=!1,d.preventDefault(),d.stopPropagation(),J(l.comboboxState.value,{0:()=>l.goToOption(V.Previous),1:()=>{l.openCombobox(),q(()=>{l.value.value||l.goToOption(V.Last)})}});case F.Home:if(d.shiftKey)break;return m.value=!1,d.preventDefault(),d.stopPropagation(),l.goToOption(V.First);case F.PageUp:return m.value=!1,d.preventDefault(),d.stopPropagation(),l.goToOption(V.First);
4case F.End:if(d.shiftKey)break;return m.value=!1,d.preventDefault(),d.stopPropagation(),l.goToOption(V.Last);case F.PageDown:return m.value=!1,d.preventDefault(),d.stopPropagation(),l.goToOption(V.Last);case F.Escape:if(m.value=!1,l.comboboxState.value!==0)return;d.preventDefault(),l.optionsRef.value&&!l.optionsPropsRef.value.static&&d.stopPropagation(),l.nullable.value&&l.mode.value===0&&l.value.value===null&&v(),l.closeCombobox();break;case F.Tab:if(m.value=!1,l.comboboxState.value!==0)return;l.mode.value===0&&l.activationTrigger.value!==1&&l.selectActiveOption(),l.closeCombobox();break}}function k(d){c("change",d),l.nullable.value&&l.mode.value===0&&d.target.value===""&&v(),l.openCombobox()}function h(d){var R,C,z;let s=(R=d.relatedTarget)!=null?R:be.find(P=>P!==d.currentTarget);if(m.value=!1,!((C=T(l.optionsRef))!=null&&C.contains(s))&&!((z=T(l.buttonRef))!=null&&z.contains(s))&&l.comboboxState.value===0)return d.preventDefault(),l.mode.value===0&&(l.nullable.value&&l.value.value===null?v():l.activationTrigger.value!==1&&l.selectActiveOption()),l.closeCombobox()}function I(d){var R,C,z;let s=(R=d.relatedTarget)!=null?R:be.find(P=>P!==d.currentTarget);(C=T(l.buttonRef))!=null&&C.contains(s)||(z=T(l.optionsRef))!=null&&z.contains(s)||l.disabled.value||l.immediate.value&&l.comboboxState.value!==0&&(l.openCombobox(),he().nextFrame(()=>{l.setActivationTrigger(1)}))}let D=x(()=>{var d,R,C,z;return(z=(C=(R=o.defaultValue)!=null?R:l.defaultValue.value!==void 0?(d=o.displayValue)==null?void 0:d.call(o,l.defaultValue.value):null)!=null?C:l.defaultValue.value)!=null?z:""});return()=>{var d,R,C,z,s,P,u;let f={open:l.comboboxState.value===0},{displayValue:b,onChange:g,...E}=o,M={"aria-controls":(d=l.optionsRef.value)==null?void 0:d.id,"aria-expanded":l.comboboxState.value===0,"aria-activedescendant":l.activeOptionIndex.value===null?void 0:l.virtual.value?(R=l.options.value.find($=>!l.virtual.value.disabled($.dataRef.value)&&l.compare($.dataRef.value,l.virtual.value.options[l.activeOptionIndex.value])))==null?void 0:R.id:(C=l.options.value[l.activeOptionIndex.value])==null?void 0:C.id,"aria-labelledby":(P=(z=T(l.labelRef))==null?void 0:z.id)!=null?P:(s=T(l.buttonRef))==null?void 0:s.id,"aria-autocomplete":"list",id:i,onCompositionstart:S,onCompositionend:w,onKeydown:O,onInput:k,onFocus:I,onBlur:h,role:"combobox",type:(u=e.type)!=null?u:"text",tabIndex:0,ref:l.inputRef,defaultValue:D.value,disabled:l.disabled.value===!0?!0:void 0};return G({ourProps:M,theirProps:E,slot:f,attrs:e,slots:n,features:le.RenderStrategy|le.Static,name:"ComboboxInput"})}}}),ct=H({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(o,{attrs:c,slots:e,expose:n}){let t=Y("ComboboxOptions"),a=`headlessui-combobox-options-${ne()}`;n({el:t.optionsRef,$el:t.optionsRef}),te(()=>{t.optionsPropsRef.value.static=o.static}),te(()=>{t.optionsPropsRef.value.hold=o.hold});let i=$e(),l=x(()=>i!==null?(i.value&oe.Open)===oe.Open:t.comboboxState.value===0);return je({container:x(()=>T(t.optionsRef)),enabled:x(()=>t.comboboxState.value===0),accept(p){return p.getAttribute("role")==="option"?NodeFilter.FILTER_REJECT:p.hasAttribute("role")?NodeFilter.FILTER_SKIP:NodeFilter.FILTER_ACCEPT},walk(p){p.setAttribute("role","none")}}),()=>{var p,m,v;let r={open:t.comboboxState.value===0},y={"aria-labelledby":(v=(p=T(t.labelRef))==null?void 0:p.id)!=null?v:(m=T(t.buttonRef))==null?void 0:m.id,id:a,ref:t.optionsRef,role:"listbox","aria-multiselectable":t.mode.value===1?!0:void 0},S=re(o,["hold"]);return G({ourProps:y,theirProps:S,slot:r,attrs:c,slots:t.virtual.value&&t.comboboxState.value===0?{...e,default:()=>[ee(st,{},e.default)]}:e,features:le.RenderStrategy|le.Static,visible:l.value,name:"ComboboxOptions"})}}}),vt=H({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(o,{slots:c,attrs:e,expose:n}){let t=Y("ComboboxOption"),a=`headlessui-combobox-option-${ne()}`,i=_(null);n({el:i,$el:i});let l=x(()=>{var h;return t.virtual.value?t.activeOptionIndex.value===t.calculateIndex(o.value):t.activeOptionIndex.value===null?!1:((h=t.options.value[t.activeOptionIndex.value])==null?void 0:h.id)===a}),p=x(()=>t.isSelected(o.value)),m=xe(Oe,null),v=x(()=>({disabled:o.disabled,value:o.value,domRef:i,order:x(()=>o.order)}));ue(()=>t.registerOption(a,v)),Ee(()=>t.unregisterOption(a,l.value)),te(()=>{let h=T(i);h&&(m==null||m.value.measureElement(h))}),te(()=>{t.comboboxState.value===0&&l.value&&(t.virtual.value||t.activationTrigger.value!==0&&q(()=>{var h,I;return(I=(h=T(i))==null?void 0:h.scrollIntoView)==null?void 0:I.call(h,{block:"nearest"})}))});function r(h){var I;if(o.disabled||(I=t.virtual.value)!=null&&I.disabled(o.value))return h.preventDefault();t.selectOption(a),Ae()||requestAnimationFrame(()=>{var D;return(D=T(t.inputRef))==null?void 0:D.focus({preventScroll:!0})}),t.mode.value===0&&requestAnimationFrame(()=>t.closeCombobox())}function y(){var h;if(o.disabled||(h=t.virtual.value)!=null&&h.disabled(o.value))return t.goToOption(V.Nothing);let I=t.calculateIndex(o.value);t.goToOption(V.Specific,I)}let S=Ne();function w(h){S.update(h)}function O(h){var I;if(!S.wasMoved(h)||o.disabled||(I=t.virtual.value)!=null&&I.disabled(o.value)||l.value)return;let D=t.calculateIndex(o.value);t.goToOption(V.Specific,D,0)}function k(h){var I;S.wasMoved(h)&&(o.disabled||(I=t.virtual.value)!=null&&I.disabled(o.value)||l.value&&(t.optionsPropsRef.value.hold||t.goToOption(V.Nothing)))}return()=>{let{disabled:h}=o,I={active:l.value,selected:p.value,disabled:h},D={id:a,ref:i,role:"option",tabIndex:h===!0?void 0:-1,"aria-disabled":h===!0?!0:void 0,"aria-selected":p.value,disabled:void 0,onClick:r,onF
4ocus:y,onPointerenter:w,onMouseenter:w,onPointermove:O,onMousemove:O,onPointerleave:k,onMouseleave:k},d=re(o,["order","value"]);return G({ourProps:D,theirProps:d,slot:I,attrs:e,slots:c,name:"ComboboxOption"})}}});const ft={class:"relative mt-1"},pt={class:"relative w-full border cursor-default overflow-hidden rounded-lg bg-white text-left shadow-sm focus:outline-none focus-visible:ring-2 focus-visible:ring-white focus-visible:ring-opacity-75 focus-visible:ring-offset-2 focus-visible:ring-offset-teal-300 sm:text-sm"},mt={key:0,class:"flex flex-wrap gap-2 items-center mx-1.5 mt-1.5"},ht={class:"text-sm"},bt=["onClick"],gt={class:"absolute inset-y-0 right-0 flex items-center pr-2"},xt={key:0,class:"relative cursor-default select-none py-2 px-4 text-gray-700"},yt={key:0,class:"absolute inset-y-0 left-0 flex items-center pl-3 text-primary-500"},Pt=H({__name:"Autocomplete",props:{modelValue:{type:Object},multiple:{type:Boolean,default:!1},placeholder:{type:String,default:""},items:{type:Array,default:()=>[]},itemText:{type:String,default:"text"},itemValue:{type:String,default:"value"}},emits:["update:modelValue"],setup(o,{emit:c}){const e=o,n=c,t=e.multiple?[e.modelValue].filter(Boolean):e.modelValue,a=_(t),i=_(""),l=x(()=>i.value===""?e.items:e.items.filter(v=>v[e.itemText].toLowerCase().replace(/\s+/g,"").includes(i.value.toLowerCase().replace(/\s+/g,"")))),p=v=>{var r;e.multiple&&((r=a.value)==null||r.splice(v,1))},m=()=>{e.multiple?a.value=[]:a.value=null};return L(a,v=>{n("update:modelValue",v)}),(v,r)=>{const y=Ce;return B(),ce(A(ut),{modelValue:a.value,"onUpdate:modelValue":r[2]||(r[2]=S=>a.value=S),multiple:o.multiple},{default:Z(()=>{var S,w;return[K("div",ft,[K("div",pt,[o.multiple&&((S=a.value)==null?void 0:S.length)>0?(B(),U("ul",mt,[(B(!0),U(se,null,ve(a.value,(O,k)=>(B(),U("li",{key:k,class:"rounded-lg flex items-center gap-2 shrink-0 bg-gray-100 pl-3 pr-2"},[K("span",ht,fe(O[o.itemText]),1),K("button",{title:"Remove item",class:"text-lg rounded-full text-gray-500 hover:text-gray-700",type:"button",onClick:h=>p(k)},[j(y,{name:"heroicons:x-mark-20-solid",class:"h-4 w-4"})],8,bt)]))),128))])):Q("",!0),j(A(dt),{class:"w-full border-none py-2 pl-3 pr-10 text-sm leading-5 text-gray-900 focus:ring-0","display-value":O=>O==null?void 0:O[o.itemText],placeholder:o.placeholder,onChange:r[0]||(r[0]=O=>i.value=O.target.value)},null,8,["display-value","placeholder"]),K("div",gt,[(o.multiple?((w=a.value)==null?void 0:w.length)>0:a.value)?(B(),U("button",{key:0,type:"button","aria-label":"Clear",onClick:m},[j(y,{name:"heroicons:x-mark-20-solid",class:"h-5 w-5 text-gray-400","aria-hidden":"true"})])):Q("",!0),j(A(rt),null,{default:Z(()=>[j(y,{name:"heroicons:chevron-down-20-solid",class:"h-5 w-5 text-gray-400","aria-hidden":"true"})]),_:1})])]),j(A(Ue),{leave:"transition ease-in duration-100","leave-from":"opacity-100","leave-to":"opacity-0",onAfterLeave:r[1]||(r[1]=O=>i.value="")},{default:Z(()=>[j(A(ct),{class:"absolute mt-1 z-10 max-h-60 w-full overflow-auto rounded-md bg-white py-1 text-base shadow-lg ring-1 ring-black ring-opacity-5 focus:outline-none sm:text-sm"},{default:Z(()=>[l.value.length===0&&i.value!==""?(B(),U("div",xt," Nothing found. ")):Q("",!0),(B(!0),U(se,null,ve(l.value,O=>(B(),ce(A(vt),{key:O.id,as:"template",value:O},{default:Z(({selected:k,active:h})=>[K("li",{class:pe(["relative cursor-default select-none py-2 pl-10 pr-4",{"bg-gray-100 text-gray-900":h,"text-gray-900":!h}])},[K("span",{class:pe(["block truncate",{"font-medium":k,"font-normal":!k}])},fe(O[o.itemText]),3),k?(B(),U("span",yt,[j(y,{name:"heroicons:check-20-solid",class:"h-5 w-5","aria-hidden":"true"})])):Q("",!0)],2)]),_:2},1032,["value"]))),128))]),_:1})]),_:1})])]}),_:1},8,["modelValue","multiple"])}}});export{Pt 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.