1
0
Fork 0
forked from Simnation/Main
Main/resources/[tools]/unlimited-spectre/html/assets/QSelect.d7ce3d4c.js
2025-06-07 08:51:21 +02:00

1 line
33 KiB
JavaScript

import{b as Te,aW as je,aX as St,aY as gt,aZ as ht,F as yt,a_ as pt,H as bt,a$ as Ht,q as m,M as Lt,x as k,S as Ee,b0 as Dt,Q as $t,h as Pe,ap as se,E as Kt,ai as Nt,G as jt,k as T,aj as Qt,I as Wt,ak as Ut,J as Xt,al as Yt,d as ce,b1 as Gt,aB as Jt,b2 as Zt,b3 as it,g as el,A as tl,ao as ll,f as Qe,aJ as ul,b4 as nl,b5 as ol,b6 as al,n as il,b7 as rl,b8 as sl,aG as cl,aH as dl,z as re,b9 as fl,ba as vl,bb as ml,bc as Sl,at as $e,bd as rt,be as Oe,as as gl,aA as Ve,bf as hl,ac as yl,bg as bl,v as wl}from"./app-014d9ed9.js";import{n as st,Q as Cl,c as kl,a as Vl}from"./QItemLabel.b6dd3adb.js";import{u as xl,v as ct,a as ql,b as Al,c as Ol,r as dt,s as zl,p as ft,d as Fl}from"./position-engine.65ebcb34.js";import{r as Ne}from"./rtl.b51694b1.js";const Il=Te({name:"QField",inheritAttrs:!1,props:je,emits:St,setup(){return gt(ht())}}),Ml={xs:8,sm:10,md:14,lg:20,xl:24},_l=Te({name:"QChip",props:{...yt,...pt,dense:Boolean,icon:String,iconRight:String,iconRemove:String,iconSelected:String,label:[String,Number],color:String,textColor:String,modelValue:{type:Boolean,default:!0},selected:{type:Boolean,default:null},square:Boolean,outline:Boolean,clickable:Boolean,removable:Boolean,removeAriaLabel:String,tabindex:[String,Number],disable:Boolean,ripple:{type:[Boolean,Object],default:!0}},emits:["update:modelValue","update:selected","remove","click"],setup(e,{slots:d,emit:r}){const{proxy:{$q:w}}=Pe(),A=bt(e,w),i=Ht(e,Ml),F=m(()=>e.selected===!0||e.icon!==void 0),g=m(()=>e.selected===!0?e.iconSelected||w.iconSet.chip.selected:e.icon),h=m(()=>e.iconRemove||w.iconSet.chip.remove),I=m(()=>e.disable===!1&&(e.clickable===!0||e.selected!==null)),s=m(()=>{const C=e.outline===!0&&e.color||e.textColor;return"q-chip row inline no-wrap items-center"+(e.outline===!1&&e.color!==void 0?` bg-${e.color}`:"")+(C?` text-${C} q-chip--colored`:"")+(e.disable===!0?" disabled":"")+(e.dense===!0?" q-chip--dense":"")+(e.outline===!0?" q-chip--outline":"")+(e.selected===!0?" q-chip--selected":"")+(I.value===!0?" q-chip--clickable cursor-pointer non-selectable q-hoverable":"")+(e.square===!0?" q-chip--square":"")+(A.value===!0?" q-chip--dark q-dark":"")}),V=m(()=>{const C=e.disable===!0?{tabindex:-1,"aria-disabled":"true"}:{tabindex:e.tabindex||0},$={...C,role:"button","aria-hidden":"false","aria-label":e.removeAriaLabel||w.lang.label.remove};return{chip:C,remove:$}});function x(C){C.keyCode===13&&y(C)}function y(C){e.disable||(r("update:selected",!e.selected),r("click",C))}function p(C){(C.keyCode===void 0||C.keyCode===13)&&(se(C),e.disable===!1&&(r("update:modelValue",!1),r("remove")))}function P(){const C=[];I.value===!0&&C.push(k("div",{class:"q-focus-helper"})),F.value===!0&&C.push(k(Ee,{class:"q-chip__icon q-chip__icon--left",name:g.value}));const $=e.label!==void 0?[k("div",{class:"ellipsis"},[e.label])]:void 0;return C.push(k("div",{class:"q-chip__content col row no-wrap items-center q-anchor--skip"},Dt(d.default,$))),e.iconRight&&C.push(k(Ee,{class:"q-chip__icon q-chip__icon--right",name:e.iconRight})),e.removable===!0&&C.push(k(Ee,{class:"q-chip__icon q-chip__icon--remove cursor-pointer",name:h.value,...V.value.remove,onClick:p,onKeyup:p})),C}return()=>{if(e.modelValue===!1)return;const C={class:s.value,style:i.value};return I.value===!0&&Object.assign(C,V.value.chip,{onClick:y,onKeyup:x}),Lt("div",C,P(),"ripple",e.ripple!==!1&&e.disable!==!0,()=>[[$t,e.ripple]])}}}),Bl=Te({name:"QMenu",inheritAttrs:!1,props:{...xl,...Kt,...yt,...Nt,persistent:Boolean,autoClose:Boolean,separateClosePopup:Boolean,noRouteDismiss:Boolean,noRefocus:Boolean,noFocus:Boolean,fit:Boolean,cover:Boolean,square:Boolean,anchor:{type:String,validator:ct},self:{type:String,validator:ct},offset:{type:Array,validator:ql},scrollTarget:{default:void 0},touchPosition:Boolean,maxHeight:{type:String,default:null},maxWidth:{type:String,default:null}},emits:[...jt,"click","escape-key"],setup(e,{slots:d,emit:r,attrs:w}){let A=null,i,F,g;const h=Pe(),{proxy:I}=h,{$q:s}=I,V=T(null),x=T(!1),y=m(()=>e.persistent!==!0&&e.noRouteDismiss!==!0),p=bt(e,s),{registerTick:P,removeTick:C}=Qt(),{registerTimeout:$}=Wt(),{transition:L,transitionStyle:W}=Ut(e,x),{localScrollTarget:M,changeScrollEvent:_,unconfigureScrollTarget:U}=Al(e,S),{anchorEl:j,canShow:ue}=Ol({showing:x}),{hide:ne}=Xt({showing:x,canShow:ue,handleShow:a,handleHide:n,hideOnRouteChange:y,processOnMount:!0}),{showPortal:Y,hidePortal:N,renderPortal:oe}=Yt(h,V,R),ee={anchorEl:j,innerRef:V,onClickOutside(l){if(e.persistent!==!0&&x.value===!0)return ne(l),(l.type==="touchstart"||l.target.classList.contains("q-dialog__backdrop"))&&se(l),!0}},ae=m(()=>ft(e.anchor||(e.cover===!0?"center middle":"bottom start"),s.lang.rtl)),te=m(()=>e.cover===!0?ae.value:ft(e.self||"top start",s.lang.rtl)),G=m(()=>(e.square===!0?" q-menu--square":"")+(p.value===!0?" q-menu--dark q-dark":"")),me=m(()=>e.autoClose===!0?{onClick:O}:{}),ie=m(()=>x.value===!0&&e.persistent!==!0);ce(ie,l=>{l===!0?(ol(b),Fl(ee)):(it(b),dt(ee))});function J(){ul(()=>{let l=V.value;l&&l.contains(document.activeElement)!==!0&&(l=l.querySelector("[autofocus], [data-autofocus]")||l,l.focus({preventScroll:!0}))})}function a(l){if(A=e.noRefocus===!1?document.activeElement:null,Gt(E),Y(),S(),i=void 0,l!==void 0&&(e.touchPosition||e.contextMenu)){const D=Jt(l);if(D.left!==void 0){const{top:le,left:de}=j.value.getBoundingClientRect();i={left:D.left-de,top:D.top-le}}}F===void 0&&(F=ce(()=>s.screen.width+"|"+s.screen.height+"|"+e.self+"|"+e.anchor+"|"+s.lang.rtl,f)),e.noFocus!==!0&&document.activeElement.blur(),P(()=>{f(),e.noFocus!==!0&&J()}),$(()=>{s.platform.is.ios===!0&&(g=e.autoClose,V.value.click()),f(),Y(!0),r("show",l)},e.transitionDuration)}function n(l){C(),N(),c(!0),A!==null&&(l===void 0||l.qClickOutside!==!0)&&(A.focus(),A=null),$(()=>{N(!0),r("hide",l)},e.transitionDuration)}function c(l){i=void 0,F!==void 0&&(F(),F=void 0),(l===!0||x.value===!0)&&(Zt(E),U(),dt(ee),it(b)),l!==!0&&(A=null)}function S(){(j.value!==null||e.scrollTarget!==void 0)&&(M.value=el(j.value,e.scrollTarget),_(M.value,f))}function O(l){g!==!0?(nl(I,l),r("click",l)):g=!1}function E(l){ie.value===!0&&e.noFocus!==!0&&al(V.value,l.target)!==!0&&J()}function b(l){r("escape-key"),ne(l)}function f(){const l=V.value;l===null||j.value===null||zl({el:l,offset:e.offset,anchorEl:j.value,anchorOrigin:ae.value,selfOrigin:te.value,absoluteOffset:i,fit:e.fit,cover:e.cover,maxHeight:e.maxHeight,maxWidth:e.maxWidth})}function R(){return k(ll,{name:L.value,appear:!0},()=>x.value===!0?k("div",{role:"menu",...w,ref:V,tabindex:-1,class:["q-menu q-position-engine scroll"+G.value,w.class],style:[w.style,W.value],...me.value},tl(d.default)):null)}return Qe(c),Object.assign(I,{focus:J,updatePosition:f}),oe}}),X=1e3,El=["start","center","end","start-force","center-force","end-force"],wt=Array.prototype.filter,Tl=window.getComputedStyle(document.body).overflowAnchor===void 0?il:function(e,d){e!==null&&(cancelAnimationFrame(e._qOverflowAnimationFrame),e._qOverflowAnimationFrame=requestAnimationFrame(()=>{if(e===null)return;const r=e.children||[];wt.call(r,A=>A.dataset&&A.dataset.qVsAnchor!==void 0).forEach(A=>{delete A.dataset.qVsAnchor});const w=r[d];w&&w.dataset&&(w.dataset.qVsAnchor="")}))};function xe(e,d){return e+d}function Ke(e,d,r,w,A,i,F,g){const h=e===window?document.scrollingElement||document.documentElement:e,I=A===!0?"offsetWidth":"offsetHeight",s={scrollStart:0,scrollViewSize:-F-g,scrollMaxSize:0,offsetStart:-F,offsetEnd:-g};if(A===!0?(e===window?(s.scrollStart=window.pageXOffset||window.scrollX||document.body.scrollLeft||0,s.scrollViewSize+=document.documentElement.clientWidth):(s.scrollStart=h.scrollLeft,s.scrollViewSize+=h.clientWidth),s.scrollMaxSize=h.scrollWidth,i===!0&&(s.scrollStart=(Ne===!0?s.scrollMaxSize-s.scrollViewSize:0)-s.scrollStart)):(e===window?(s.scrollStart=window.pageYOffset||window.scrollY||document.body.scrollTop||0,s.scrollViewSize+=document.documentElement.clientHeight):(s.scrollStart=h.scrollTop,s.scrollViewSize+=h.clientHeight),s.scrollMaxSize=h.scrollHeight),r!==null)for(let V=r.previousElementSibling;V!==null;V=V.previousElementSibling)V.classList.contains("q-virtual-scroll--skip")===!1&&(s.offsetStart+=V[I]);if(w!==null)for(let V=w.nextElementSibling;V!==null;V=V.nextElementSibling)V.classList.contains("q-virtual-scroll--skip")===!1&&(s.offsetEnd+=V[I]);if(d!==e){const V=h.getBoundingClientRect(),x=d.getBoundingClientRect();A===!0?(s.offsetStart+=x.left-V.left,s.offsetEnd-=x.width):(s.offsetStart+=x.top-V.top,s.offsetEnd-=x.height),e!==window&&(s.offsetStart+=s.scrollStart),s.offsetEnd+=s.scrollMaxSize-s.offsetStart}return s}function vt(e,d,r,w){d==="end"&&(d=(e===window?document.body:e)[r===!0?"scrollWidth":"scrollHeight"]),e===window?r===!0?(w===!0&&(d=(Ne===!0?document.body.scrollWidth-document.documentElement.clientWidth:0)-d),window.scrollTo(d,window.pageYOffset||window.scrollY||document.body.scrollTop||0)):window.scrollTo(window.pageXOffset||window.scrollX||document.body.scrollLeft||0,d):r===!0?(w===!0&&(d=(Ne===!0?e.scrollWidth-e.offsetWidth:0)-d),e.scrollLeft=d):e.scrollTop=d}function ze(e,d,r,w){if(r>=w)return 0;const A=d.length,i=Math.floor(r/X),F=Math.floor((w-1)/X)+1;let g=e.slice(i,F).reduce(xe,0);return r%X!==0&&(g-=d.slice(i*X,r).reduce(xe,0)),w%X!==0&&w!==A&&(g-=d.slice(w,F*X).reduce(xe,0)),g}const Ct={virtualScrollSliceSize:{type:[Number,String],default:null},virtualScrollSliceRatioBefore:{type:[Number,String],default:1},virtualScrollSliceRatioAfter:{type:[Number,String],default:1},virtualScrollItemSize:{type:[Number,String],default:24},virtualScrollStickySizeStart:{type:[Number,String],default:0},virtualScrollStickySizeEnd:{type:[Number,String],default:0},tableColspan:[Number,String]},Nl=Object.keys(Ct),Pl={virtualScrollHorizontal:Boolean,onVirtualScroll:Function,...Ct};function Rl({virtualScrollLength:e,getVirtualScrollTarget:d,getVirtualScrollEl:r,virtualScrollItemSizeComputed:w}){const A=Pe(),{props:i,emit:F,proxy:g}=A,{$q:h}=g;let I,s,V,x=[],y;const p=T(0),P=T(0),C=T({}),$=T(null),L=T(null),W=T(null),M=T({from:0,to:0}),_=m(()=>i.tableColspan!==void 0?i.tableColspan:100);w===void 0&&(w=m(()=>i.virtualScrollItemSize));const U=m(()=>w.value+";"+i.virtualScrollHorizontal),j=m(()=>U.value+";"+i.virtualScrollSliceRatioBefore+";"+i.virtualScrollSliceRatioAfter);ce(j,()=>{G()}),ce(U,ue);function ue(){te(s,!0)}function ne(n){te(n===void 0?s:n)}function Y(n,c){const S=d();if(S==null||S.nodeType===8)return;const O=Ke(S,r(),$.value,L.value,i.virtualScrollHorizontal,h.lang.rtl,i.virtualScrollStickySizeStart,i.virtualScrollStickySizeEnd);V!==O.scrollViewSize&&G(O.scrollViewSize),oe(S,O,Math.min(e.value-1,Math.max(0,parseInt(n,10)||0)),0,El.indexOf(c)>-1?c:s>-1&&n>s?"end":"start")}function N(){const n=d();if(n==null||n.nodeType===8)return;const c=Ke(n,r(),$.value,L.value,i.virtualScrollHorizontal,h.lang.rtl,i.virtualScrollStickySizeStart,i.virtualScrollStickySizeEnd),S=e.value-1,O=c.scrollMaxSize-c.offsetStart-c.offsetEnd-P.value;if(I===c.scrollStart)return;if(c.scrollMaxSize<=0){oe(n,c,0,0);return}V!==c.scrollViewSize&&G(c.scrollViewSize),ee(M.value.from);const E=Math.floor(c.scrollMaxSize-Math.max(c.scrollViewSize,c.offsetEnd)-Math.min(y[S],c.scrollViewSize/2));if(E>0&&Math.ceil(c.scrollStart)>=E){oe(n,c,S,c.scrollMaxSize-c.offsetEnd-x.reduce(xe,0));return}let b=0,f=c.scrollStart-c.offsetStart,R=f;if(f<=O&&f+c.scrollViewSize>=p.value)f-=p.value,b=M.value.from,R=f;else for(let l=0;f>=x[l]&&b<S;l++)f-=x[l],b+=X;for(;f>0&&b<S;)f-=y[b],f>-c.scrollViewSize?(b++,R=f):R=y[b]+f;oe(n,c,b,R)}function oe(n,c,S,O,E){const b=typeof E=="string"&&E.indexOf("-force")>-1,f=b===!0?E.replace("-force",""):E,R=f!==void 0?f:"start";let l=Math.max(0,S-C.value[R]),D=l+C.value.total;D>e.value&&(D=e.value,l=Math.max(0,D-C.value.total)),I=c.scrollStart;const le=l!==M.value.from||D!==M.value.to;if(le===!1&&f===void 0){ie(S);return}const{activeElement:de}=document,Z=W.value;le===!0&&Z!==null&&Z!==de&&Z.contains(de)===!0&&(Z.addEventListener("focusout",ae),setTimeout(()=>{Z!==null&&Z.removeEventListener("focusout",ae)})),Tl(Z,S-l);const Fe=f!==void 0?y.slice(l,S).reduce(xe,0):0;if(le===!0){const Se=D>=M.value.from&&l<=M.value.to?M.value.to:D;M.value={from:l,to:Se},p.value=ze(x,y,0,l),P.value=ze(x,y,D,e.value),requestAnimationFrame(()=>{M.value.to!==D&&I===c.scrollStart&&(M.value={from:M.value.from,to:D},P.value=ze(x,y,D,e.value))})}requestAnimationFrame(()=>{if(I!==c.scrollStart)return;le===!0&&ee(l);const Se=y.slice(l,S).reduce(xe,0),ge=Se+c.offsetStart+p.value,Ie=ge+y[S];let qe=ge+O;if(f!==void 0){const Q=Se-Fe,H=c.scrollStart+Q;qe=b!==!0&&H<ge&&Ie<H+c.scrollViewSize?H:f==="end"?Ie-c.scrollViewSize:ge-(f==="start"?0:Math.round((c.scrollViewSize-y[S])/2))}I=qe,vt(n,qe,i.virtualScrollHorizontal,h.lang.rtl),ie(S)})}function ee(n){const c=W.value;if(c){const S=wt.call(c.children,l=>l.classList&&l.classList.contains("q-virtual-scroll--skip")===!1),O=S.length,E=i.virtualScrollHorizontal===!0?l=>l.getBoundingClientRect().width:l=>l.offsetHeight;let b=n,f,R;for(let l=0;l<O;){for(f=E(S[l]),l++;l<O&&S[l].classList.contains("q-virtual-scroll--with-prev")===!0;)f+=E(S[l]),l++;R=f-y[b],R!==0&&(y[b]+=R,x[Math.floor(b/X)]+=R),b++}}}function ae(){W.value!==null&&W.value!==void 0&&W.value.focus()}function te(n,c){const S=1*w.value;(c===!0||Array.isArray(y)===!1)&&(y=[]);const O=y.length;y.length=e.value;for(let b=e.value-1;b>=O;b--)y[b]=S;const E=Math.floor((e.value-1)/X);x=[];for(let b=0;b<=E;b++){let f=0;const R=Math.min((b+1)*X,e.value);for(let l=b*X;l<R;l++)f+=y[l];x.push(f)}s=-1,I=void 0,p.value=ze(x,y,0,M.value.from),P.value=ze(x,y,M.value.to,e.value),n>=0?(ee(M.value.from),re(()=>{Y(n)})):J()}function G(n){if(n===void 0&&typeof window<"u"){const f=d();f!=null&&f.nodeType!==8&&(n=Ke(f,r(),$.value,L.value,i.virtualScrollHorizontal,h.lang.rtl,i.virtualScrollStickySizeStart,i.virtualScrollStickySizeEnd).scrollViewSize)}V=n;const c=parseFloat(i.virtualScrollSliceRatioBefore)||0,S=parseFloat(i.virtualScrollSliceRatioAfter)||0,O=1+c+S,E=n===void 0||n<=0?1:Math.ceil(n/w.value),b=Math.max(1,E,Math.ceil((i.virtualScrollSliceSize>0?i.virtualScrollSliceSize:10)/O));C.value={total:Math.ceil(b*O),start:Math.ceil(b*c),center:Math.ceil(b*(.5+c)),end:Math.ceil(b*(1+c)),view:E}}function me(n,c){const S=i.virtualScrollHorizontal===!0?"width":"height",O={["--q-virtual-scroll-item-"+S]:w.value+"px"};return[n==="tbody"?k(n,{class:"q-virtual-scroll__padding",key:"before",ref:$},[k("tr",[k("td",{style:{[S]:`${p.value}px`,...O},colspan:_.value})])]):k(n,{class:"q-virtual-scroll__padding",key:"before",ref:$,style:{[S]:`${p.value}px`,...O}}),k(n,{class:"q-virtual-scroll__content",key:"content",ref:W,tabindex:-1},c.flat()),n==="tbody"?k(n,{class:"q-virtual-scroll__padding",key:"after",ref:L},[k("tr",[k("td",{style:{[S]:`${P.value}px`,...O},colspan:_.value})])]):k(n,{class:"q-virtual-scroll__padding",key:"after",ref:L,style:{[S]:`${P.value}px`,...O}})]}function ie(n){s!==n&&(i.onVirtualScroll!==void 0&&F("virtual-scroll",{index:n,from:M.value.from,to:M.value.to-1,direction:n<s?"decrease":"increase",ref:g}),s=n)}G();const J=rl(N,h.platform.is.ios===!0?120:35);sl(()=>{G()});let a=!1;return cl(()=>{a=!0}),dl(()=>{if(a!==!0)return;const n=d();I!==void 0&&n!==void 0&&n!==null&&n.nodeType!==8?vt(n,I,i.virtualScrollHorizontal,h.lang.rtl):Y(s)}),Qe(()=>{J.cancel()}),Object.assign(g,{scrollTo:Y,reset:ue,refresh:ne}),{virtualScrollSliceRange:M,virtualScrollSliceSizeComputed:C,setVirtualScrollSize:G,onVirtualScrollEvt:J,localResetVirtualScroll:te,padVirtualScroll:me,scrollTo:Y,reset:ue,refresh:ne}}const mt=e=>["add","add-unique","toggle"].includes(e),pl=".*+?^${}()|[]\\",Hl=Object.keys(je),jl=Te({name:"QSelect",inheritAttrs:!1,props:{...Pl,...fl,...je,modelValue:{required:!0},multiple:Boolean,displayValue:[String,Number],displayValueHtml:Boolean,dropdownIcon:String,options:{type:Array,default:()=>[]},optionValue:[Function,String],optionLabel:[Function,String],optionDisable:[Function,String],hideSelected:Boolean,hideDropdownIcon:Boolean,fillInput:Boolean,maxValues:[Number,String],optionsDense:Boolean,optionsDark:{type:Boolean,default:null},optionsSelectedClass:String,optionsHtml:Boolean,optionsCover:Boolean,menuShrink:Boolean,menuAnchor:String,menuSelf:String,menuOffset:Array,popupContentClass:String,popupContentStyle:[String,Array,Object],useInput:Boolean,useChips:Boolean,newValueMode:{type:String,validator:mt},mapOptions:Boolean,emitValue:Boolean,inputDebounce:{type:[Number,String],default:500},inputClass:[Array,String,Object],inputStyle:[Array,String,Object],tabindex:{type:[String,Number],default:0},autocomplete:String,transitionShow:String,transitionHide:String,transitionDuration:[String,Number],behavior:{type:String,validator:e=>["default","menu","dialog"].includes(e),default:"default"},virtualScrollItemSize:{type:[Number,String],default:void 0},onNewValue:Function,onFilter:Function},emits:[...St,"add","remove","input-value","new-value","keyup","keypress","keydown","filter-abort"],setup(e,{slots:d,emit:r}){const{proxy:w}=Pe(),{$q:A}=w,i=T(!1),F=T(!1),g=T(-1),h=T(""),I=T(!1),s=T(!1);let V,x,y,p,P,C,$,L,W;const M=T(null),_=T(null),U=T(null),j=T(null),ue=T(null),ne=vl(e),Y=bl(lt),N=m(()=>Array.isArray(e.options)?e.options.length:0),oe=m(()=>e.virtualScrollItemSize===void 0?e.optionsDense===!0?24:48:e.virtualScrollItemSize),{virtualScrollSliceRange:ee,virtualScrollSliceSizeComputed:ae,localResetVirtualScroll:te,padVirtualScroll:G,onVirtualScrollEvt:me,scrollTo:ie,setVirtualScrollSize:J}=Rl({virtualScrollLength:N,getVirtualScrollTarget:qt,getVirtualScrollEl:et,virtualScrollItemSizeComputed:oe}),a=ht(),n=m(()=>{const t=e.mapOptions===!0&&e.multiple!==!0,o=e.modelValue!==void 0&&(e.modelValue!==null||t===!0)?e.multiple===!0&&Array.isArray(e.modelValue)?e.modelValue:[e.modelValue]:[];if(e.mapOptions===!0&&Array.isArray(e.options)===!0){const u=e.mapOptions===!0&&x!==void 0?x:[],v=o.map(z=>xt(z,u));return e.modelValue===null&&t===!0?v.filter(z=>z!==null):v}return o}),c=m(()=>{const t={};return Hl.forEach(o=>{const u=e[o];u!==void 0&&(t[o]=u)}),t}),S=m(()=>e.optionsDark===null?a.isDark.value:e.optionsDark),O=m(()=>rt(n.value)),E=m(()=>{let t="q-field__input q-placeholder col";return e.hideSelected===!0||n.value.length===0?[t,e.inputClass]:(t+=" q-field__input--padding",e.inputClass===void 0?t:[t,e.inputClass])}),b=m(()=>(e.virtualScrollHorizontal===!0?"q-virtual-scroll--horizontal":"")+(e.popupContentClass?" "+e.popupContentClass:"")),f=m(()=>N.value===0),R=m(()=>n.value.map(t=>H.value(t)).join(", ")),l=m(()=>e.optionsHtml===!0?()=>!0:t=>t!=null&&t.html===!0),D=m(()=>e.displayValueHtml===!0||e.displayValue===void 0&&(e.optionsHtml===!0||n.value.some(l.value))),le=m(()=>a.focused.value===!0?e.tabindex:-1),de=m(()=>({tabindex:e.tabindex,role:"combobox","aria-label":e.label,"aria-readonly":e.readonly===!0?"true":"false","aria-autocomplete":e.useInput===!0?"list":"none","aria-expanded":i.value===!0?"true":"false","aria-owns":`${a.targetUid.value}_lb`,"aria-controls":`${a.targetUid.value}_lb`})),Z=m(()=>{const t={id:`${a.targetUid.value}_lb`,role:"listbox","aria-multiselectable":e.multiple===!0?"true":"false"};return g.value>=0&&(t["aria-activedescendant"]=`${a.targetUid.value}_${g.value}`),t}),Fe=m(()=>n.value.map((t,o)=>({index:o,opt:t,html:l.value(t),selected:!0,removeAtIndex:Vt,toggleOption:fe,tabindex:le.value}))),Se=m(()=>{if(N.value===0)return[];const{from:t,to:o}=ee.value;return e.options.slice(t,o).map((u,v)=>{const z=he.value(u)===!0,q=t+v,B={clickable:!0,active:!1,activeClass:qe.value,manualFocus:!0,focused:!1,disable:z,tabindex:-1,dense:e.optionsDense,dark:S.value,role:"option",id:`${a.targetUid.value}_${q}`,onClick:()=>{fe(u)}};return z!==!0&&(He(u)===!0&&(B.active=!0),g.value===q&&(B.focused=!0),B["aria-selected"]=B.active===!0?"true":"false",A.platform.is.desktop===!0&&(B.onMousemove=()=>{i.value===!0&&ye(q)})),{index:q,opt:u,html:l.value(u),label:H.value(u),selected:B.active,focused:B.focused,toggleOption:fe,setOptionIndex:ye,itemProps:B}})}),ge=m(()=>e.dropdownIcon!==void 0?e.dropdownIcon:A.iconSet.arrow.dropdown),Ie=m(()=>e.optionsCover===!1&&e.outlined!==!0&&e.standout!==!0&&e.borderless!==!0&&e.rounded!==!0),qe=m(()=>e.optionsSelectedClass!==void 0?e.optionsSelectedClass:e.color!==void 0?`text-${e.color}`:""),Q=m(()=>pe(e.optionValue,"value")),H=m(()=>pe(e.optionLabel,"label")),he=m(()=>pe(e.optionDisable,"disable")),Me=m(()=>n.value.map(t=>Q.value(t))),kt=m(()=>{const t={onInput:lt,onChange:Y,onKeydown:Ze,onKeyup:Ge,onKeypress:Je,onFocus:Xe,onClick(o){y===!0&&Ve(o)}};return t.onCompositionstart=t.onCompositionupdate=t.onCompositionend=Y,t});ce(n,t=>{x=t,e.useInput===!0&&e.fillInput===!0&&e.multiple!==!0&&a.innerLoading.value!==!0&&(F.value!==!0&&i.value!==!0||O.value!==!0)&&(p!==!0&&ke(),(F.value===!0||i.value===!0)&&be(""))},{immediate:!0}),ce(()=>e.fillInput,ke),ce(i,Le),ce(N,Rt);function We(t){return e.emitValue===!0?Q.value(t):t}function Re(t){if(t>-1&&t<n.value.length)if(e.multiple===!0){const o=e.modelValue.slice();r("remove",{index:t,value:o.splice(t,1)[0]}),r("update:modelValue",o)}else r("update:modelValue",null)}function Vt(t){Re(t),a.focus()}function Ue(t,o){const u=We(t);if(e.multiple!==!0){e.fillInput===!0&&Ae(H.value(t),!0,!0),r("update:modelValue",u);return}if(n.value.length===0){r("add",{index:0,value:u}),r("update:modelValue",e.multiple===!0?[u]:u);return}if(o===!0&&He(t)===!0||e.maxValues!==void 0&&e.modelValue.length>=e.maxValues)return;const v=e.modelValue.slice();r("add",{index:v.length,value:u}),v.push(u),r("update:modelValue",v)}function fe(t,o){if(a.editable.value!==!0||t===void 0||he.value(t)===!0)return;const u=Q.value(t);if(e.multiple!==!0){o!==!0&&(Ae(e.fillInput===!0?H.value(t):"",!0,!0),ve()),_.value!==null&&_.value.focus(),(n.value.length===0||Oe(Q.value(n.value[0]),u)!==!0)&&r("update:modelValue",e.emitValue===!0?u:t);return}if((y!==!0||I.value===!0)&&a.focus(),Xe(),n.value.length===0){const q=e.emitValue===!0?u:t;r("add",{index:0,value:q}),r("update:modelValue",e.multiple===!0?[q]:q);return}const v=e.modelValue.slice(),z=Me.value.findIndex(q=>Oe(q,u));if(z>-1)r("remove",{index:z,value:v.splice(z,1)[0]});else{if(e.maxValues!==void 0&&v.length>=e.maxValues)return;const q=e.emitValue===!0?u:t;r("add",{index:v.length,value:q}),v.push(q)}r("update:modelValue",v)}function ye(t){if(A.platform.is.desktop!==!0)return;const o=t>-1&&t<N.value?t:-1;g.value!==o&&(g.value=o)}function _e(t=1,o){if(i.value===!0){let u=g.value;do u=st(u+t,-1,N.value-1);while(u!==-1&&u!==g.value&&he.value(e.options[u])===!0);g.value!==u&&(ye(u),ie(u),o!==!0&&e.useInput===!0&&e.fillInput===!0&&Be(u>=0?H.value(e.options[u]):C))}}function xt(t,o){const u=v=>Oe(Q.value(v),t);return e.options.find(u)||o.find(u)||t}function pe(t,o){const u=t!==void 0?t:o;return typeof u=="function"?u:v=>v!==null&&typeof v=="object"&&u in v?v[u]:v}function He(t){const o=Q.value(t);return Me.value.find(u=>Oe(u,o))!==void 0}function Xe(t){e.useInput===!0&&_.value!==null&&(t===void 0||_.value===t.target&&t.target.value===R.value)&&_.value.select()}function Ye(t){gl(t,27)===!0&&i.value===!0&&(Ve(t),ve(),ke()),r("keyup",t)}function Ge(t){const{value:o}=t.target;if(t.keyCode!==void 0){Ye(t);return}if(t.target.value="",clearTimeout(V),ke(),typeof o=="string"&&o.length>0){const u=o.toLocaleLowerCase(),v=q=>{const B=e.options.find(K=>q.value(K).toLocaleLowerCase()===u);return B===void 0?!1:(n.value.indexOf(B)===-1?fe(B):ve(),!0)},z=q=>{v(Q)!==!0&&(v(H)===!0||q===!0||be(o,!0,()=>z(!0)))};z()}else a.clearValue(t)}function Je(t){r("keypress",t)}function Ze(t){if(r("keydown",t),hl(t)===!0)return;const o=h.value.length>0&&(e.newValueMode!==void 0||e.onNewValue!==void 0),u=t.shiftKey!==!0&&e.multiple!==!0&&(g.value>-1||o===!0);if(t.keyCode===27){$e(t);return}if(t.keyCode===9&&u===!1){we();return}if(t.target===void 0||t.target.id!==a.targetUid.value)return;if(t.keyCode===40&&a.innerLoading.value!==!0&&i.value===!1){se(t),Ce();return}if(t.keyCode===8&&e.hideSelected!==!0&&h.value.length===0){e.multiple===!0&&Array.isArray(e.modelValue)===!0?Re(e.modelValue.length-1):e.multiple!==!0&&e.modelValue!==null&&r("update:modelValue",null);return}(t.keyCode===35||t.keyCode===36)&&(typeof h.value!="string"||h.value.length===0)&&(se(t),g.value=-1,_e(t.keyCode===36?1:-1,e.multiple)),(t.keyCode===33||t.keyCode===34)&&ae.value!==void 0&&(se(t),g.value=Math.max(-1,Math.min(N.value,g.value+(t.keyCode===33?-1:1)*ae.value.view)),_e(t.keyCode===33?1:-1,e.multiple)),(t.keyCode===38||t.keyCode===40)&&(se(t),_e(t.keyCode===38?-1:1,e.multiple));const v=N.value;if((L===void 0||W<Date.now())&&(L=""),v>0&&e.useInput!==!0&&t.key!==void 0&&t.key.length===1&&t.altKey===t.ctrlKey&&(t.keyCode!==32||L.length>0)){i.value!==!0&&Ce(t);const z=t.key.toLocaleLowerCase(),q=L.length===1&&L[0]===z;W=Date.now()+1500,q===!1&&(se(t),L+=z);const B=new RegExp("^"+L.split("").map(De=>pl.indexOf(De)>-1?"\\"+De:De).join(".*"),"i");let K=g.value;if(q===!0||K<0||B.test(H.value(e.options[K]))!==!0)do K=st(K+1,-1,v-1);while(K!==g.value&&(he.value(e.options[K])===!0||B.test(H.value(e.options[K]))!==!0));g.value!==K&&re(()=>{ye(K),ie(K),K>=0&&e.useInput===!0&&e.fillInput===!0&&Be(H.value(e.options[K]))});return}if(!(t.keyCode!==13&&(t.keyCode!==32||e.useInput===!0||L!=="")&&(t.keyCode!==9||u===!1))){if(t.keyCode!==9&&se(t),g.value>-1&&g.value<v){fe(e.options[g.value]);return}if(o===!0){const z=(q,B)=>{if(B){if(mt(B)!==!0)return}else B=e.newValueMode;if(q==null)return;Ae("",e.multiple!==!0,!0),(B==="toggle"?fe:Ue)(q,B==="add-unique"),e.multiple!==!0&&(_.value!==null&&_.value.focus(),ve())};if(e.onNewValue!==void 0?r("new-value",h.value,z):z(h.value),e.multiple!==!0)return}i.value===!0?we():a.innerLoading.value!==!0&&Ce()}}function et(){return y===!0?ue.value:U.value!==null&&U.value.__qPortalInnerRef.value!==null?U.value.__qPortalInnerRef.value:void 0}function qt(){return et()}function At(){return e.hideSelected===!0?[]:d["selected-item"]!==void 0?Fe.value.map(t=>d["selected-item"](t)).slice():d.selected!==void 0?[].concat(d.selected()):e.useChips===!0?Fe.value.map((t,o)=>k(_l,{key:"option-"+o,removable:a.editable.value===!0&&he.value(t.opt)!==!0,dense:!0,textColor:e.color,tabindex:le.value,onRemove(){t.removeAtIndex(o)}},()=>k("span",{class:"ellipsis",[t.html===!0?"innerHTML":"textContent"]:H.value(t.opt)}))):[k("span",{[D.value===!0?"innerHTML":"textContent"]:e.displayValue!==void 0?e.displayValue:R.value})]}function tt(){if(f.value===!0)return d["no-option"]!==void 0?d["no-option"]({inputValue:h.value}):void 0;const t=d.option!==void 0?d.option:u=>k(Vl,{key:u.index,...u.itemProps},()=>k(Cl,()=>k(kl,()=>k("span",{[u.html===!0?"innerHTML":"textContent"]:u.label}))));let o=G("div",Se.value.map(t));return d["before-options"]!==void 0&&(o=d["before-options"]().concat(o)),wl(d["after-options"],o)}function Ot(t,o){const u=o===!0?{...de.value,...a.splitAttrs.attributes.value}:void 0,v={ref:o===!0?_:void 0,key:"i_t",class:E.value,style:e.inputStyle,value:h.value!==void 0?h.value:"",type:"search",...u,id:o===!0?a.targetUid.value:void 0,maxlength:e.maxlength,autocomplete:e.autocomplete,"data-autofocus":t!==!0&&e.autofocus===!0||void 0,disabled:e.disable===!0,readonly:e.readonly===!0,...kt.value};return t!==!0&&y===!0&&(Array.isArray(v.class)===!0?v.class=[...v.class,"no-pointer-events"]:v.class+=" no-pointer-events"),k("input",v)}function lt(t){clearTimeout(V),!(t&&t.target&&t.target.qComposing===!0)&&(Be(t.target.value||""),p=!0,C=h.value,a.focused.value!==!0&&(y!==!0||I.value===!0)&&a.focus(),e.onFilter!==void 0&&(V=setTimeout(()=>{be(h.value)},e.inputDebounce)))}function Be(t){h.value!==t&&(h.value=t,r("input-value",t))}function Ae(t,o,u){p=u!==!0,e.useInput===!0&&(Be(t),(o===!0||u!==!0)&&(C=t),o!==!0&&be(t))}function be(t,o,u){if(e.onFilter===void 0||o!==!0&&a.focused.value!==!0)return;a.innerLoading.value===!0?r("filter-abort"):(a.innerLoading.value=!0,s.value=!0),t!==""&&e.multiple!==!0&&n.value.length>0&&p!==!0&&t===H.value(n.value[0])&&(t="");const v=setTimeout(()=>{i.value===!0&&(i.value=!1)},10);clearTimeout(P),P=v,r("filter",t,(z,q)=>{(o===!0||a.focused.value===!0)&&P===v&&(clearTimeout(P),typeof z=="function"&&z(),s.value=!1,re(()=>{a.innerLoading.value=!1,a.editable.value===!0&&(o===!0?i.value===!0&&ve():i.value===!0?Le(!0):i.value=!0),typeof q=="function"&&re(()=>{q(w)}),typeof u=="function"&&re(()=>{u(w)})}))},()=>{a.focused.value===!0&&P===v&&(clearTimeout(P),a.innerLoading.value=!1,s.value=!1),i.value===!0&&(i.value=!1)})}function zt(){return k(Bl,{ref:U,class:b.value,style:e.popupContentStyle,modelValue:i.value,fit:e.menuShrink!==!0,cover:e.optionsCover===!0&&f.value!==!0&&e.useInput!==!0,anchor:e.menuAnchor,self:e.menuSelf,offset:e.menuOffset,dark:S.value,noParentEvent:!0,noRefocus:!0,noFocus:!0,square:Ie.value,transitionShow:e.transitionShow,transitionHide:e.transitionHide,transitionDuration:e.transitionDuration,separateClosePopup:!0,...Z.value,onScrollPassive:me,onBeforeShow:nt,onBeforeHide:Ft,onShow:It},tt)}function Ft(t){ot(t),we()}function It(){J()}function Mt(t){Ve(t),_.value!==null&&_.value.focus(),I.value=!0,window.scrollTo(window.pageXOffset||window.scrollX||document.body.scrollLeft||0,0)}function _t(t){Ve(t),re(()=>{I.value=!1})}function Bt(){const t=[k(Il,{class:`col-auto ${a.fieldClass.value}`,...c.value,for:a.targetUid.value,dark:S.value,square:!0,loading:s.value,itemAligned:!1,filled:!0,stackLabel:h.value.length>0,...a.splitAttrs.listeners.value,onFocus:Mt,onBlur:_t},{...d,rawControl:()=>a.getControl(!0),before:void 0,after:void 0})];return i.value===!0&&t.push(k("div",{ref:ue,class:b.value+" scroll",style:e.popupContentStyle,...Z.value,onClick:$e,onScrollPassive:me},tt())),k(yl,{ref:j,modelValue:F.value,position:e.useInput===!0?"top":void 0,transitionShow:$,transitionHide:e.transitionHide,transitionDuration:e.transitionDuration,onBeforeShow:nt,onBeforeHide:Et,onHide:Tt,onShow:Pt},()=>k("div",{class:"q-select__dialog"+(S.value===!0?" q-select__dialog--dark q-dark":"")+(I.value===!0?" q-select__dialog--focused":"")},t))}function Et(t){ot(t),j.value!==null&&j.value.__updateRefocusTarget(a.rootRef.value.querySelector(".q-field__native > [tabindex]:last-child")),a.focused.value=!1}function Tt(t){ve(),a.focused.value===!1&&r("blur",t),ke()}function Pt(){const t=document.activeElement;(t===null||t.id!==a.targetUid.value)&&_.value!==null&&_.value!==t&&_.value.focus(),J()}function we(){F.value!==!0&&(g.value=-1,i.value===!0&&(i.value=!1),a.focused.value===!1&&(clearTimeout(P),P=void 0,a.innerLoading.value===!0&&(r("filter-abort"),a.innerLoading.value=!1,s.value=!1)))}function Ce(t){a.editable.value===!0&&(y===!0?(a.onControlFocusin(t),F.value=!0,re(()=>{a.focus()})):a.focus(),e.onFilter!==void 0?be(h.value):(f.value!==!0||d["no-option"]!==void 0)&&(i.value=!0))}function ve(){F.value=!1,we()}function ke(){e.useInput===!0&&Ae(e.multiple!==!0&&e.fillInput===!0&&n.value.length>0&&H.value(n.value[0])||"",!0,!0)}function Le(t){let o=-1;if(t===!0){if(n.value.length>0){const u=Q.value(n.value[0]);o=e.options.findIndex(v=>Oe(Q.value(v),u))}te(o)}ye(o)}function Rt(t,o){i.value===!0&&a.innerLoading.value===!1&&(te(-1,!0),re(()=>{i.value===!0&&a.innerLoading.value===!1&&(t>o?te():Le(!0))}))}function ut(){F.value===!1&&U.value!==null&&U.value.updatePosition()}function nt(t){t!==void 0&&Ve(t),r("popup-show",t),a.hasPopupOpen=!0,a.onControlFocusin(t)}function ot(t){t!==void 0&&Ve(t),r("popup-hide",t),a.hasPopupOpen=!1,a.onControlFocusout(t)}function at(){y=A.platform.is.mobile!==!0&&e.behavior!=="dialog"?!1:e.behavior!=="menu"&&(e.useInput===!0?d["no-option"]!==void 0||e.onFilter!==void 0||f.value===!1:!0),$=A.platform.is.ios===!0&&y===!0&&e.useInput===!0?"fade":e.transitionShow}return ml(at),Sl(ut),at(),Qe(()=>{clearTimeout(V)}),Object.assign(w,{showPopup:Ce,hidePopup:ve,removeAtIndex:Re,add:Ue,toggleOption:fe,getOptionIndex:()=>g.value,setOptionIndex:ye,moveOptionSelection:_e,filter:be,updateMenuPosition:ut,updateInputValue:Ae,isOptionSelected:He,getEmittingOptionValue:We,isOptionDisabled:(...t)=>he.value.apply(null,t)===!0,getOptionValue:(...t)=>Q.value.apply(null,t),getOptionLabel:(...t)=>H.value.apply(null,t)}),Object.assign(a,{innerValue:n,fieldClass:m(()=>`q-select q-field--auto-height q-select--with${e.useInput!==!0?"out":""}-input q-select--with${e.useChips!==!0?"out":""}-chips q-select--${e.multiple===!0?"multiple":"single"}`),inputRef:M,targetRef:_,hasValue:O,showPopup:Ce,floatingLabel:m(()=>e.hideSelected!==!0&&O.value===!0||typeof h.value=="number"||h.value.length>0||rt(e.displayValue)),getControlChild:()=>{if(a.editable.value!==!1&&(F.value===!0||f.value!==!0||d["no-option"]!==void 0))return y===!0?Bt():zt();a.hasPopupOpen===!0&&(a.hasPopupOpen=!1)},controlEvents:{onFocusin(t){a.onControlFocusin(t)},onFocusout(t){a.onControlFocusout(t,()=>{ke(),we()})},onClick(t){if($e(t),y!==!0&&i.value===!0){we(),_.value!==null&&_.value.focus();return}Ce(t)}},getControl:t=>{const o=At(),u=t===!0||F.value!==!0||y!==!0;if(e.useInput===!0)o.push(Ot(t,u));else if(a.editable.value===!0){const z=u===!0?de.value:void 0;o.push(k("input",{ref:u===!0?_:void 0,key:"d_t",class:"q-select__focus-target",id:u===!0?a.targetUid.value:void 0,readonly:!0,"data-autofocus":t!==!0&&e.autofocus===!0||void 0,...z,onKeydown:Ze,onKeyup:Ye,onKeypress:Je})),u===!0&&typeof e.autocomplete=="string"&&e.autocomplete.length>0&&o.push(k("input",{class:"q-select__autocomplete-input",autocomplete:e.autocomplete,tabindex:-1,onKeyup:Ge}))}if(ne.value!==void 0&&e.disable!==!0&&Me.value.length>0){const z=Me.value.map(q=>k("option",{value:q,selected:!0}));o.push(k("select",{class:"hidden",name:ne.value,multiple:e.multiple},z))}const v=e.useInput===!0||u!==!0?void 0:a.splitAttrs.attributes.value;return k("div",{class:"q-field__native row items-center",...v},o)},getInnerAppend:()=>e.loading!==!0&&s.value!==!0&&e.hideDropdownIcon!==!0?[k(Ee,{class:"q-select__dropdown-icon"+(i.value===!0?" rotate-180":""),name:ge.value})]:null}),gt(a)}});export{jl as Q,Rl as a,_l as b,Nl as c,Bl as d,Pl as u};