@danielgindi/selectbox 1.0.137 → 1.0.139
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/lib.cjs.js +194 -2643
- package/dist/lib.cjs.js.map +1 -1
- package/dist/lib.cjs.min.js +2 -2
- package/dist/lib.cjs.min.js.map +1 -1
- package/dist/lib.es6.js +47 -19
- package/dist/lib.es6.js.map +1 -1
- package/dist/lib.es6.min.js +2 -2
- package/dist/lib.es6.min.js.map +1 -1
- package/dist/lib.umd.js +5949 -8398
- package/dist/lib.umd.js.map +1 -1
- package/dist/lib.umd.min.js +2 -2
- package/dist/lib.umd.min.js.map +1 -1
- package/eslint.config.mjs +143 -0
- package/lib/DropList.js +7 -6
- package/lib/SelectBox.js +39 -12
- package/package.json +14 -11
- package/vue/DropList.vue +1 -1
- package/vue/SelectBox.vue +4 -0
package/dist/lib.cjs.min.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* @danielgindi/selectbox 1.0.
|
|
2
|
+
* @danielgindi/selectbox 1.0.139
|
|
3
3
|
* git://github.com/danielgindi/selectbox.git
|
|
4
4
|
*/
|
|
5
|
-
"use strict";var e=require("@danielgindi/dom-utils/lib/Dom"),t=require("@danielgindi/dom-utils/lib/DomCompat"),s=require("@danielgindi/dom-utils/lib/Css"),i=require("@danielgindi/dom-utils/lib/DomEventsSink"),r=require("@danielgindi/virtual-list-helper"),n=require("keycode-js"),l=require("mitt"),o="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},a=function(e){return e&&e.Math===Math&&e},u=a("object"==typeof globalThis&&globalThis)||a("object"==typeof window&&window)||a("object"==typeof self&&self)||a("object"==typeof o&&o)||a("object"==typeof o&&o)||function(){return this}()||Function("return this")(),c="object"==typeof document&&document.all,d=void 0===c&&void 0!==c?function(e){return"function"==typeof e||e===c}:function(e){return"function"==typeof e},h=d,m=function(e){return"object"==typeof e?null!==e:h(e)},p=m,_=u.document,f=p(_)&&p(_.createElement),g=function(e){return f?_.createElement(e):{}},b=g("span").classList,I=b&&b.constructor&&b.constructor.prototype,v=I===Object.prototype?void 0:I,y=function(e){try{return!!e()}catch(e){return!0}},S=!y((function(){var e=function(){}.bind();return"function"!=typeof e||e.hasOwnProperty("prototype")})),E=S,L=Function.prototype,C=L.call,w=E&&L.bind.bind(C,C),k=E?w:function(e){return function(){return C.apply(e,arguments)}},x=k,T=x({}.toString),P=x("".slice),O=function(e){return P(T(e),8,-1)},A=y,N=O,V=Object,M=k("".split),F=A((function(){return!V("z").propertyIsEnumerable(0)}))?function(e){return"String"===N(e)?M(e,""):V(e)}:V,W=function(e){return null==e},B=W,D=TypeError,R=function(e){if(B(e))throw new D("Can't call method on "+e);return e},U=F,H=R,G=function(e){return U(H(e))},z={exports:{}},j=u,K=Object.defineProperty,$=function(e,t){try{K(j,e,{value:t,configurable:!0,writable:!0})}catch(s){j[e]=t}return t},q=$,Q="__core-js_shared__",Y=u[Q]||q(Q,{}),X=(z.exports,Y);(z.exports=function(e,t){return X[e]||(X[e]=void 0!==t?t:{})})("versions",[]).push({version:"3.35.1",mode:"global",copyright:"© 2014-2024 Denis Pushkarev (zloirock.ru)",license:"https://github.com/zloirock/core-js/blob/v3.35.1/LICENSE",source:"https://github.com/zloirock/core-js"});var J,Z,ee=z.exports,te=R,se=Object,ie=function(e){return se(te(e))},re=ie,ne=k({}.hasOwnProperty),le=Object.hasOwn||function(e,t){return ne(re(e),t)},oe=k,ae=0,ue=Math.random(),ce=oe(1..toString),de=function(e){return"Symbol("+(void 0===e?"":e)+")_"+ce(++ae+ue,36)},he=u,me="undefined"!=typeof navigator&&String(navigator.userAgent)||"",pe=he.process,_e=he.Deno,fe=pe&&pe.versions||_e&&_e.version,ge=fe&&fe.v8;ge&&(Z=(J=ge.split("."))[0]>0&&J[0]<4?1:+(J[0]+J[1])),!Z&&me&&(!(J=me.match(/Edge\/(\d+)/))||J[1]>=74)&&(J=me.match(/Chrome\/(\d+)/))&&(Z=+J[1]);var be,Ie=Z,ve=y,ye=u.String,Se=!!Object.getOwnPropertySymbols&&!ve((function(){var e=Symbol("symbol detection");return!ye(e)||!(Object(e)instanceof Symbol)||!Symbol.sham&&Ie&&Ie<41})),Ee=Se&&!Symbol.sham&&"symbol"==typeof Symbol.iterator,Le=ee,Ce=le,we=de,ke=Se,xe=Ee,Te=u.Symbol,Pe=Le("wks"),Oe=xe?Te.for||Te:Te&&Te.withoutSetter||we,Ae=function(e){return Ce(Pe,e)||(Pe[e]=ke&&Ce(Te,e)?Te[e]:Oe("Symbol."+e)),Pe[e]},Ne=m,Ve=String,Me=TypeError,Fe=function(e){if(Ne(e))return e;throw new Me(Ve(e)+" is not an object")},We={},Be=!y((function(){return 7!==Object.defineProperty({},1,{get:function(){return 7}})[1]})),De=Be&&y((function(){return 42!==Object.defineProperty((function(){}),"prototype",{value:42,writable:!1}).prototype})),Re={},Ue=g,He=!Be&&!y((function(){return 7!==Object.defineProperty(Ue("div"),"a",{get:function(){return 7}}).a})),Ge=S,ze=Function.prototype.call,je=Ge?ze.bind(ze):function(){return ze.apply(ze,arguments)},Ke=u,$e=d,qe=function(e,t){return arguments.length<2?(s=Ke[e],$e(s)?s:void 0):Ke[e]&&Ke[e][t];var s},Qe=k({}.isPrototypeOf),Ye=qe,Xe=d,Je=Qe,Ze=Object,et=Ee?function(e){return"symbol"==typeof e}:function(e){var t=Ye("Symbol");return Xe(t)&&Je(t.prototype,Ze(e))},tt=String,st=d,it=function(e){try{return tt(e)}catch(e){return"Object"}},rt=TypeError,nt=function(e){if(st(e))return e;throw new rt(it(e)+" is not a function")},lt=nt,ot=W,at=function(e,t){var s=e[t];return ot(s)?void 0:lt(s)},ut=je,ct=d,dt=m,ht=TypeError,mt=je,pt=m,_t=et,ft=at,gt=function(e,t){var s,i;if("string"===t&&ct(s=e.toString)&&!dt(i=ut(s,e)))return i;if(ct(s=e.valueOf)&&!dt(i=ut(s,e)))return i;if("string"!==t&&ct(s=e.toString)&&!dt(i=ut(s,e)))return i;throw new ht("Can't convert object to primitive value")},bt=TypeError,It=Ae("toPrimitive"),vt=function(e,t){if(!pt(e)||_t(e))return e;var s,i=ft(e,It);if(i){if(void 0===t&&(t="default"),s=mt(i,e,t),!pt(s)||_t(s))return s;throw new bt("Can't convert object to primitive value")}return void 0===t&&(t="number"),gt(e,t)},yt=et,St=function(e){var t=vt(e,"string");return yt(t)?t:t+""},Et=Be,Lt=He,Ct=De,wt=Fe,kt=St,xt=TypeError,Tt=Object.defineProperty,Pt=Object.getOwnPropertyDescriptor,Ot="enumerable",At="configurable",Nt="writable",Vt=(Re.f=Et?Ct?function(e,t,s){if(wt(e),t=kt(t),wt(s),"function"==typeof e&&"prototype"===t&&"value"in s&&Nt in s&&!s[Nt]){var i=Pt(e,t);i&&i[Nt]&&(e[t]=s.value,s={configurable:At in s?s[At]:i[At],enumerable:Ot in s?s[Ot]:i[Ot],writable:!1})}return Tt(e,t,s)}:Tt:function(e,t,s){if(wt(e),t=kt(t),wt(s),Lt)try{return Tt(e,t,s)}catch(e){}if("get"in s||"set"in s)throw new xt("Accessors not supported");return"value"in s&&(e[t]=s.value),e},Math.ceil),Mt=Math.floor,Ft=Math.trunc||function(e){var t=+e;return(t>0?Mt:Vt)(t)},Wt=function(e){var t=+e;return t!=t||0===t?0:Ft(t)},Bt=Wt,Dt=Math.max,Rt=Math.min,Ut=Wt,Ht=Math.min,Gt=function(e){var t=Ut(e);return t>0?Ht(t,9007199254740991):0},zt=Gt,jt=G,Kt=function(e,t){var s=Bt(e);return s<0?Dt(s+t,0):Rt(s,t)},$t=function(e){return zt(e.length)},qt=function(e){return function(t,s,i){var r,n=jt(t),l=$t(n),o=Kt(i,l);if(e&&s!=s){for(;l>o;)if((r=n[o++])!=r)return!0}else for(;l>o;o++)if((e||o in n)&&n[o]===s)return e||o||0;return!e&&-1}},Qt={includes:qt(!0),indexOf:qt(!1)},Yt={},Xt=le,Jt=G,Zt=Qt.indexOf,es=Yt,ts=k([].push),ss=function(e,t){var s,i=Jt(e),r=0,n=[];for(s in i)!Xt(es,s)&&Xt(i,s)&&ts(n,s);for(;t.length>r;)Xt(i,s=t[r++])&&(~Zt(n,s)||ts(n,s));return n},is=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],rs=ss,ns=is,ls=Object.keys||function(e){return rs(e,ns)},os=Be,as=De,us=Re,cs=Fe,ds=G,hs=ls,ms=(We.f=os&&!as?Object.defineProperties:function(e,t){cs(e);for(var s,i=ds(t),r=hs(t),n=r.length,l=0;n>l;)us.f(e,s=r[l++],i[s]);return e},qe("document","documentElement")),ps=de,_s=ee("keys"),fs=function(e){return _s[e]||(_s[e]=ps(e))},gs=Fe,bs=We,Is=is,vs=Yt,ys=ms,Ss=g,Es="prototype",Ls="script",Cs=fs("IE_PROTO"),ws=function(){},ks=function(e){return"<"+Ls+">"+e+"</"+Ls+">"},xs=function(e){e.write(ks("")),e.close();var t=e.parentWindow.Object;return e=null,t},Ts=function(){try{be=new ActiveXObject("htmlfile")}catch(e){}var e,t,s;Ts="undefined"!=typeof document?document.domain&&be?xs(be):(t=Ss("iframe"),s="java"+Ls+":",t.style.display="none",ys.appendChild(t),t.src=String(s),(e=t.contentWindow.document).open(),e.write(ks("document.F=Object")),e.close(),e.F):xs(be);for(var i=Is.length;i--;)delete Ts[Es][Is[i]];return Ts()};vs[Cs]=!0;var Ps=Object.create||function(e,t){var s;return null!==e?(ws[Es]=gs(e),s=new ws,ws[Es]=null,s[Cs]=e):s=Ts(),void 0===t?s:bs.f(s,t)},Os=Ae,As=Ps,Ns=Re.f,Vs=Os("unscopables"),Ms=Array.prototype;void 0===Ms[Vs]&&Ns(Ms,Vs,{configurable:!0,value:As(null)});var Fs,Ws,Bs,Ds={},Rs=d,Us=u.WeakMap,Hs=Rs(Us)&&/native code/.test(String(Us)),Gs=function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}},zs=Re,js=Gs,Ks=Be?function(e,t,s){return zs.f(e,t,js(1,s))}:function(e,t,s){return e[t]=s,e},$s=Hs,qs=u,Qs=m,Ys=Ks,Xs=le,Js=Y,Zs=fs,ei=Yt,ti="Object already initialized",si=qs.TypeError,ii=qs.WeakMap;if($s||Js.state){var ri=Js.state||(Js.state=new ii);ri.get=ri.get,ri.has=ri.has,ri.set=ri.set,Fs=function(e,t){if(ri.has(e))throw new si(ti);return t.facade=e,ri.set(e,t),t},Ws=function(e){return ri.get(e)||{}},Bs=function(e){return ri.has(e)}}else{var ni=Zs("state");ei[ni]=!0,Fs=function(e,t){if(Xs(e,ni))throw new si(ti);return t.facade=e,Ys(e,ni,t),t},Ws=function(e){return Xs(e,ni)?e[ni]:{}},Bs=function(e){return Xs(e,ni)}}var li={set:Fs,get:Ws,has:Bs,enforce:function(e){return Bs(e)?Ws(e):Fs(e,{})},getterFor:function(e){return function(t){var s;if(!Qs(t)||(s=Ws(t)).type!==e)throw new si("Incompatible receiver, "+e+" required");return s}}},oi={},ai={},ui={}.propertyIsEnumerable,ci=Object.getOwnPropertyDescriptor,di=ci&&!ui.call({1:2},1),hi=(ai.f=di?function(e){var t=ci(this,e);return!!t&&t.enumerable}:ui,Be),mi=je,pi=ai,_i=Gs,fi=G,gi=St,bi=le,Ii=He,vi=Object.getOwnPropertyDescriptor,yi=(oi.f=hi?vi:function(e,t){if(e=fi(e),t=gi(t),Ii)try{return vi(e,t)}catch(e){}if(bi(e,t))return _i(!mi(pi.f,e,t),e[t])},{exports:{}}),Si=Be,Ei=le,Li=Function.prototype,Ci=Si&&Object.getOwnPropertyDescriptor,wi=Ei(Li,"name"),ki={EXISTS:wi,PROPER:wi&&"something"===function(){}.name,CONFIGURABLE:wi&&(!Si||Si&&Ci(Li,"name").configurable)},xi=d,Ti=Y,Pi=k(Function.toString);xi(Ti.inspectSource)||(Ti.inspectSource=function(e){return Pi(e)});var Oi=Ti.inspectSource,Ai=(yi.exports,k),Ni=y,Vi=d,Mi=le,Fi=Be,Wi=ki.CONFIGURABLE,Bi=Oi,Di=li.enforce,Ri=li.get,Ui=String,Hi=Object.defineProperty,Gi=Ai("".slice),zi=Ai("".replace),ji=Ai([].join),Ki=Fi&&!Ni((function(){return 8!==Hi((function(){}),"length",{value:8}).length})),$i=String(String).split("String"),qi=yi.exports=function(e,t,s){"Symbol("===Gi(Ui(t),0,7)&&(t="["+zi(Ui(t),/^Symbol\(([^)]*)\).*$/,"$1")+"]"),s&&s.getter&&(t="get "+t),s&&s.setter&&(t="set "+t),(!Mi(e,"name")||Wi&&e.name!==t)&&(Fi?Hi(e,"name",{value:t,configurable:!0}):e.name=t),Ki&&s&&Mi(s,"arity")&&e.length!==s.arity&&Hi(e,"length",{value:s.arity});try{s&&Mi(s,"constructor")&&s.constructor?Fi&&Hi(e,"prototype",{writable:!1}):e.prototype&&(e.prototype=void 0)}catch(e){}var i=Di(e);return Mi(i,"source")||(i.source=ji($i,"string"==typeof t?t:"")),e};Function.prototype.toString=qi((function(){return Vi(this)&&Ri(this).source||Bi(this)}),"toString");var Qi,Yi,Xi,Ji=yi.exports,Zi=d,er=Re,tr=Ji,sr=$,ir=function(e,t,s,i){i||(i={});var r=i.enumerable,n=void 0!==i.name?i.name:t;if(Zi(s)&&tr(s,n,i),i.global)r?e[t]=s:sr(t,s);else{try{i.unsafe?e[t]&&(r=!0):delete e[t]}catch(e){}r?e[t]=s:er.f(e,t,{value:s,enumerable:!1,configurable:!i.nonConfigurable,writable:!i.nonWritable})}return e},rr={},nr=ss,lr=is.concat("length","prototype"),or=(rr.f=Object.getOwnPropertyNames||function(e){return nr(e,lr)},{}),ar=(or.f=Object.getOwnPropertySymbols,qe),ur=rr,cr=or,dr=Fe,hr=k([].concat),mr=ar("Reflect","ownKeys")||function(e){var t=ur.f(dr(e)),s=cr.f;return s?hr(t,s(e)):t},pr=le,_r=mr,fr=oi,gr=Re,br=y,Ir=d,vr=/#|\.prototype\./,yr=function(e,t){var s=Er[Sr(e)];return s===Cr||s!==Lr&&(Ir(t)?br(t):!!t)},Sr=yr.normalize=function(e){return String(e).replace(vr,".").toLowerCase()},Er=yr.data={},Lr=yr.NATIVE="N",Cr=yr.POLYFILL="P",wr=yr,kr=u,xr=oi.f,Tr=Ks,Pr=ir,Or=$,Ar=function(e,t,s){for(var i=_r(t),r=gr.f,n=fr.f,l=0;l<i.length;l++){var o=i[l];pr(e,o)||s&&pr(s,o)||r(e,o,n(t,o))}},Nr=wr,Vr=function(e,t){var s,i,r,n,l,o=e.target,a=e.global,u=e.stat;if(s=a?kr:u?kr[o]||Or(o,{}):kr[o]&&kr[o].prototype)for(i in t){if(n=t[i],r=e.dontCallGetSet?(l=xr(s,i))&&l.value:s[i],!Nr(a?i:o+(u?".":"#")+i,e.forced)&&void 0!==r){if(typeof n==typeof r)continue;Ar(n,r)}(e.sham||r&&r.sham)&&Tr(n,"sham",!0),Pr(s,i,n,e)}},Mr=!y((function(){function e(){}return e.prototype.constructor=null,Object.getPrototypeOf(new e)!==e.prototype})),Fr=le,Wr=d,Br=ie,Dr=Mr,Rr=fs("IE_PROTO"),Ur=Object,Hr=Ur.prototype,Gr=Dr?Ur.getPrototypeOf:function(e){var t=Br(e);if(Fr(t,Rr))return t[Rr];var s=t.constructor;return Wr(s)&&t instanceof s?s.prototype:t instanceof Ur?Hr:null},zr=y,jr=d,Kr=m,$r=Gr,qr=ir,Qr=Ae("iterator"),Yr=!1;[].keys&&("next"in(Xi=[].keys())?(Yi=$r($r(Xi)))!==Object.prototype&&(Qi=Yi):Yr=!0);var Xr=!Kr(Qi)||zr((function(){var e={};return Qi[Qr].call(e)!==e}));Xr&&(Qi={}),jr(Qi[Qr])||qr(Qi,Qr,(function(){return this}));var Jr={IteratorPrototype:Qi,BUGGY_SAFARI_ITERATORS:Yr},Zr=Re.f,en=le,tn=Ae("toStringTag"),sn=function(e,t,s){e&&!s&&(e=e.prototype),e&&!en(e,tn)&&Zr(e,tn,{configurable:!0,value:t})},rn=Jr.IteratorPrototype,nn=Ps,ln=Gs,on=sn,an=Ds,un=function(){return this},cn=k,dn=nt,hn=m,mn=function(e){return hn(e)||null===e},pn=String,_n=TypeError,fn=function(e,t,s){try{return cn(dn(Object.getOwnPropertyDescriptor(e,t)[s]))}catch(e){}},gn=Fe,bn=function(e){if(mn(e))return e;throw new _n("Can't set "+pn(e)+" as a prototype")},In=Object.setPrototypeOf||("__proto__"in{}?function(){var e,t=!1,s={};try{(e=fn(Object.prototype,"__proto__","set"))(s,[]),t=s instanceof Array}catch(e){}return function(s,i){return gn(s),bn(i),t?e(s,i):s.__proto__=i,s}}():void 0),vn=Vr,yn=je,Sn=d,En=function(e,t,s,i){var r=t+" Iterator";return e.prototype=nn(rn,{next:ln(+!i,s)}),on(e,r,!1,!0),an[r]=un,e},Ln=Gr,Cn=In,wn=sn,kn=Ks,xn=ir,Tn=Ds,Pn=ki.PROPER,On=ki.CONFIGURABLE,An=Jr.IteratorPrototype,Nn=Jr.BUGGY_SAFARI_ITERATORS,Vn=Ae("iterator"),Mn="keys",Fn="values",Wn="entries",Bn=function(){return this},Dn=G,Rn=function(e){Ms[Vs][e]=!0},Un=Ds,Hn=li,Gn=Re.f,zn=function(e,t,s,i,r,n,l){En(s,t,i);var o,a,u,c=function(e){if(e===r&&_)return _;if(!Nn&&e&&e in m)return m[e];switch(e){case Mn:case Fn:case Wn:return function(){return new s(this,e)}}return function(){return new s(this)}},d=t+" Iterator",h=!1,m=e.prototype,p=m[Vn]||m["@@iterator"]||r&&m[r],_=!Nn&&p||c(r),f="Array"===t&&m.entries||p;if(f&&(o=Ln(f.call(new e)))!==Object.prototype&&o.next&&(Ln(o)!==An&&(Cn?Cn(o,An):Sn(o[Vn])||xn(o,Vn,Bn)),wn(o,d,!0,!0)),Pn&&r===Fn&&p&&p.name!==Fn&&(On?kn(m,"name",Fn):(h=!0,_=function(){return yn(p,this)})),r)if(a={values:c(Fn),keys:n?_:c(Mn),entries:c(Wn)},l)for(u in a)(Nn||h||!(u in m))&&xn(m,u,a[u]);else vn({target:t,proto:!0,forced:Nn||h},a);return m[Vn]!==_&&xn(m,Vn,_,{name:r}),Tn[t]=_,a},jn=function(e,t){return{value:e,done:t}},Kn=Be,$n="Array Iterator",qn=Hn.set,Qn=Hn.getterFor($n),Yn=zn(Array,"Array",(function(e,t){qn(this,{type:$n,target:Dn(e),index:0,kind:t})}),(function(){var e=Qn(this),t=e.target,s=e.index++;if(!t||s>=t.length)return e.target=void 0,jn(void 0,!0);switch(e.kind){case"keys":return jn(s,!1);case"values":return jn(t[s],!1)}return jn([s,t[s]],!1)}),"values"),Xn=Un.Arguments=Un.Array;if(Rn("keys"),Rn("values"),Rn("entries"),Kn&&"values"!==Xn.name)try{Gn(Xn,"name",{value:"values"})}catch(e){}var Jn=u,Zn={CSSRuleList:0,CSSStyleDeclaration:0,CSSValueList:0,ClientRectList:0,DOMRectList:0,DOMStringList:0,DOMTokenList:1,DataTransferItemList:0,FileList:0,HTMLAllCollection:0,HTMLCollection:0,HTMLFormElement:0,HTMLSelectElement:0,MediaList:0,MimeTypeArray:0,NamedNodeMap:0,NodeList:1,PaintRequestList:0,Plugin:0,PluginArray:0,SVGLengthList:0,SVGNumberList:0,SVGPathSegList:0,SVGPointList:0,SVGStringList:0,SVGTransformList:0,SourceBufferList:0,StyleSheetList:0,TextTrackCueList:0,TextTrackList:0,TouchList:0},el=v,tl=Yn,sl=Ks,il=sn,rl=Ae("iterator"),nl=tl.values,ll=function(e,t){if(e){if(e[rl]!==nl)try{sl(e,rl,nl)}catch(t){e[rl]=nl}if(il(e,t,!0),Zn[t])for(var s in tl)if(e[s]!==tl[s])try{sl(e,s,tl[s])}catch(t){e[s]=tl[s]}}};for(var ol in Zn)ll(Jn[ol]&&Jn[ol].prototype,ol);ll(el,"DOMTokenList");var al=S,ul=Function.prototype,cl=ul.apply,dl=ul.call,hl="object"==typeof Reflect&&Reflect.apply||(al?dl.bind(cl):function(){return dl.apply(cl,arguments)}),ml={};ml[Ae("toStringTag")]="z";var pl,_l,fl="[object z]"===String(ml),gl=d,bl=O,Il=Ae("toStringTag"),vl=Object,yl="Arguments"===bl(function(){return arguments}()),Sl=fl?bl:function(e){var t,s,i;return void 0===e?"Undefined":null===e?"Null":"string"==typeof(s=function(e,t){try{return e[t]}catch(e){}}(t=vl(e),Il))?s:yl?bl(t):"Object"===(i=bl(t))&&gl(t.callee)?"Arguments":i},El=String,Ll=function(e){if("Symbol"===Sl(e))throw new TypeError("Cannot convert a Symbol value to a string");return El(e)},Cl=Fe,wl=y,kl=u.RegExp,xl=wl((function(){var e=kl("a","y");return e.lastIndex=2,null!==e.exec("abcd")})),Tl=xl||wl((function(){return!kl("a","y").sticky})),Pl={BROKEN_CARET:xl||wl((function(){var e=kl("^r","gy");return e.lastIndex=2,null!==e.exec("str")})),MISSED_STICKY:Tl,UNSUPPORTED_Y:xl},Ol=y,Al=u.RegExp,Nl=Ol((function(){var e=Al(".","s");return!(e.dotAll&&e.test("\n")&&"s"===e.flags)})),Vl=y,Ml=u.RegExp,Fl=Vl((function(){var e=Ml("(?<a>b)","g");return"b"!==e.exec("b").groups.a||"bc"!=="b".replace(e,"$<a>c")})),Wl=je,Bl=k,Dl=Ll,Rl=function(){var e=Cl(this),t="";return e.hasIndices&&(t+="d"),e.global&&(t+="g"),e.ignoreCase&&(t+="i"),e.multiline&&(t+="m"),e.dotAll&&(t+="s"),e.unicode&&(t+="u"),e.unicodeSets&&(t+="v"),e.sticky&&(t+="y"),t},Ul=Pl,Hl=Ps,Gl=li.get,zl=Nl,jl=Fl,Kl=ee("native-string-replace",String.prototype.replace),$l=RegExp.prototype.exec,ql=$l,Ql=Bl("".charAt),Yl=Bl("".indexOf),Xl=Bl("".replace),Jl=Bl("".slice),Zl=(_l=/b*/g,Wl($l,pl=/a/,"a"),Wl($l,_l,"a"),0!==pl.lastIndex||0!==_l.lastIndex),eo=Ul.BROKEN_CARET,to=void 0!==/()??/.exec("")[1];(Zl||to||eo||zl||jl)&&(ql=function(e){var t,s,i,r,n,l,o,a=this,u=Gl(a),c=Dl(e),d=u.raw;if(d)return d.lastIndex=a.lastIndex,t=Wl(ql,d,c),a.lastIndex=d.lastIndex,t;var h=u.groups,m=eo&&a.sticky,p=Wl(Rl,a),_=a.source,f=0,g=c;if(m&&(p=Xl(p,"y",""),-1===Yl(p,"g")&&(p+="g"),g=Jl(c,a.lastIndex),a.lastIndex>0&&(!a.multiline||a.multiline&&"\n"!==Ql(c,a.lastIndex-1))&&(_="(?: "+_+")",g=" "+g,f++),s=new RegExp("^(?:"+_+")",p)),to&&(s=new RegExp("^"+_+"$(?!\\s)",p)),Zl&&(i=a.lastIndex),r=Wl($l,m?s:a,g),m?r?(r.input=Jl(r.input,f),r[0]=Jl(r[0],f),r.index=a.lastIndex,a.lastIndex+=r[0].length):a.lastIndex=0:Zl&&r&&(a.lastIndex=a.global?r.index+r[0].length:i),to&&r&&r.length>1&&Wl(Kl,r[0],s,(function(){for(n=1;n<arguments.length-2;n++)void 0===arguments[n]&&(r[n]=void 0)})),r&&h)for(r.groups=l=Hl(null),n=0;n<h.length;n++)l[(o=h[n])[0]]=r[o[1]];return r});var so=ql;Vr({target:"RegExp",proto:!0,forced:/./.exec!==so},{exec:so});var io=je,ro=ir,no=so,lo=y,oo=Ae,ao=Ks,uo=oo("species"),co=RegExp.prototype,ho=k,mo=Wt,po=Ll,_o=R,fo=ho("".charAt),go=ho("".charCodeAt),bo=ho("".slice),Io=function(e){return function(t,s){var i,r,n=po(_o(t)),l=mo(s),o=n.length;return l<0||l>=o?e?"":void 0:(i=go(n,l))<55296||i>56319||l+1===o||(r=go(n,l+1))<56320||r>57343?e?fo(n,l):i:e?bo(n,l,l+2):r-56320+(i-55296<<10)+65536}},vo={codeAt:Io(!1),charAt:Io(!0)}.charAt,yo=k,So=ie,Eo=Math.floor,Lo=yo("".charAt),Co=yo("".replace),wo=yo("".slice),ko=/\$([$&'`]|\d{1,2}|<[^>]*>)/g,xo=/\$([$&'`]|\d{1,2})/g,To=je,Po=Fe,Oo=d,Ao=O,No=so,Vo=TypeError,Mo=hl,Fo=je,Wo=k,Bo=function(e,t,s,i){var r=oo(e),n=!lo((function(){var t={};return t[r]=function(){return 7},7!==""[e](t)})),l=n&&!lo((function(){var t=!1,s=/a/;return"split"===e&&((s={}).constructor={},s.constructor[uo]=function(){return s},s.flags="",s[r]=/./[r]),s.exec=function(){return t=!0,null},s[r](""),!t}));if(!n||!l||s){var o=/./[r],a=t(r,""[e],(function(e,t,s,i,r){var l=t.exec;return l===no||l===co.exec?n&&!r?{done:!0,value:io(o,t,s,i)}:{done:!0,value:io(e,s,t,i)}:{done:!1}}));ro(String.prototype,e,a[0]),ro(co,r,a[1])}i&&ao(co[r],"sham",!0)},Do=y,Ro=Fe,Uo=d,Ho=W,Go=Wt,zo=Gt,jo=Ll,Ko=R,$o=function(e,t,s){return t+(s?vo(e,t).length:1)},qo=at,Qo=function(e,t,s,i,r,n){var l=s+e.length,o=i.length,a=xo;return void 0!==r&&(r=So(r),a=ko),Co(n,a,(function(n,a){var u;switch(Lo(a,0)){case"$":return"$";case"&":return e;case"`":return wo(t,0,s);case"'":return wo(t,l);case"<":u=r[wo(a,1,-1)];break;default:var c=+a;if(0===c)return n;if(c>o){var d=Eo(c/10);return 0===d?n:d<=o?void 0===i[d-1]?Lo(a,1):i[d-1]+Lo(a,1):n}u=i[c-1]}return void 0===u?"":u}))},Yo=function(e,t){var s=e.exec;if(Oo(s)){var i=To(s,e,t);return null!==i&&Po(i),i}if("RegExp"===Ao(e))return To(No,e,t);throw new Vo("RegExp#exec called on incompatible receiver")},Xo=Ae("replace"),Jo=Math.max,Zo=Math.min,ea=Wo([].concat),ta=Wo([].push),sa=Wo("".indexOf),ia=Wo("".slice),ra="$0"==="a".replace(/./,"$0"),na=!!/./[Xo]&&""===/./[Xo]("a","$0");Bo("replace",(function(e,t,s){var i=na?"$":"$0";return[function(e,s){var i=Ko(this),r=Ho(e)?void 0:qo(e,Xo);return r?Fo(r,e,i,s):Fo(t,jo(i),e,s)},function(e,r){var n=Ro(this),l=jo(e);if("string"==typeof r&&-1===sa(r,i)&&-1===sa(r,"$<")){var o=s(t,n,l,r);if(o.done)return o.value}var a=Uo(r);a||(r=jo(r));var u,c=n.global;c&&(u=n.unicode,n.lastIndex=0);for(var d,h=[];null!==(d=Yo(n,l))&&(ta(h,d),c);)""===jo(d[0])&&(n.lastIndex=$o(l,zo(n.lastIndex),u));for(var m,p="",_=0,f=0;f<h.length;f++){for(var g,b=jo((d=h[f])[0]),I=Jo(Zo(Go(d.index),l.length),0),v=[],y=1;y<d.length;y++)ta(v,void 0===(m=d[y])?m:String(m));var S=d.groups;if(a){var E=ea([b],v,I,l);void 0!==S&&ta(E,S),g=jo(Mo(r,void 0,E))}else g=Qo(b,l,I,v,S,r);I>=_&&(p+=ia(l,_,I)+g,_=I+b.length)}return p+ia(l,_)}]}),!!Do((function(){var e=/./;return e.exec=function(){var e=[];return e.groups={a:"7"},e},"7"!=="".replace(e,"$<a>")}))||!ra||na);var la=e=>e.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&");const oa=Symbol("item"),aa=Symbol("destroyed"),ua=Symbol("ghost"),ca=Object.prototype.hasOwnProperty;let da={baseClassName:"droplist",autoItemBlur:!0,autoItemBlurDelay:300,capturesFocus:!0,multi:!1,keyDownHandler:null,autoCheckGroupChildren:!0,useExactTargetWidth:!1,constrainToWindow:!0,autoFlipDirection:!0,estimateWidth:!1,virtualMinItems:100,labelProp:"label",valueProp:"value",on:null};class ha{constructor(t){const n={...da};for(let[e,s]of Object.entries(t))void 0!==s&&(n[e]=s);const o=this._p={ownsEl:!0,elOriginalDisplay:"",baseClassName:n.baseClassName,additionalClasses:n.additionalClasses,direction:"ltr"===n.direction?"ltr":"rtl"===n.direction?"rtl":"auto",autoItemBlur:n.autoItemBlur,autoItemBlurDelay:n.autoItemBlurDelay,capturesFocus:n.capturesFocus,multi:n.multi,keyDownHandler:n.keyDownHandler,autoCheckGroupChildren:n.autoCheckGroupChildren,useExactTargetWidth:n.useExactTargetWidth,constrainToWindow:n.constrainToWindow,autoFlipDirection:n.autoFlipDirection,estimatedItemHeight:n.estimatedItemHeight,estimateWidth:n.estimateWidth,virtualMinItems:n.virtualMinItems,labelProp:n.labelProp,valueProp:n.valueProp,renderItem:n.renderItem,unrenderItem:n.unrenderItem,on:n.on||null,silenceEvents:!0,mitt:l(),focusItemIndex:-1,focusItemEl:null,sink:new i};let a=[o.baseClassName];o.additionalClasses&&(a=a.concat((o.additionalClasses+"").split(" ").filter((e=>e))));const u={top:"-9999px"};let c=n.el;if(c instanceof Element?(o.elOriginalDisplay=c.style.display||"",c.classList.add(...a),c.role="menu",s.setCssProps(c,u),o.ownsEl=!1):c=e.createElement("ul",{class:a.join(" "),role:"menu",css:u}),o.el=c,o.items=[],o.groupCount=0,o.mouseHandled=!1,o.virtualListHelper=new r({list:o.el,virtual:!0,buffer:5,estimatedItemHeight:n.estimatedItemHeight||20,itemElementCreatorFn:()=>e.createElement("li",{role:"menuitem",tabIndex:o.capturesFocus?-1:null}),onItemRender:(e,t)=>{let s;t===ua?(s={label:o.lastMeasureLongestLabelText,value:"Measure",[oa]:{[o.labelProp]:o.lastMeasureLongestLabelText,[o.valueProp]:"Measure"}},e.setAttribute("aria-hidden","true")):s=o.items[t],s||console.warn("onItemRender called for ("+t+") which has no item"),e.className="".concat(o.baseClassName,"__item");const i=e.classList;o.multi?s._nocheck?i.add("".concat(o.baseClassName,"__item_multi_nocheck")):(i.add("".concat(o.baseClassName,"__item_multi")),s._checked&&i.add("".concat(o.baseClassName,"__item_checked"))):i.add("".concat(o.baseClassName,"__item_single")),s._group&&i.add("".concat(o.baseClassName,"__item_group")),s._child&&i.add("".concat(o.baseClassName,"__item_child")),s._nointeraction&&i.add("".concat(o.baseClassName,"__item_nointeraction")),o.focusItemIndex===t&&(o.focusItemEl=e,i.add("".concat(o.baseClassName,"__item_focus"))),this._renderItemContent(s,e),e[oa]=s}}),"function"==typeof o.unrenderItem){const e=o.unrenderItem;o.virtualListHelper.setOnItemUnrender((t=>{try{e(t[oa][oa],t)}catch(e){console.error(e)}delete t[oa],o.focusItemEl===t&&(o.focusItemEl=null)}))}else o.virtualListHelper.setOnItemUnrender((e=>{delete e[oa],o.focusItemEl===e&&(o.focusItemEl=null)}));o.capturesFocus&&(c.tabIndex=0),this._hookMouseEvents(),this._hookTouchEvents(),this._hookFocusEvents(),this._hookKeyEvents(),this.silenceEvents=!1}destroy(){if(this[aa])return;this[aa]=!0;const e=this._p;var s;if(clearTimeout(e.blurTimer),clearTimeout(e.filterTimer),e.sink.remove(),e.virtualListHelper.destroy(),e.el&&t.remove(e.el),e.currentSubDropList&&(null===(s=e.currentSubDropList)||void 0===s||null===(s=s.droplist)||void 0===s||s.destroy(),e.currentSubDropList=null),!e.ownsEl){for(let t of Array.from(e.el.classList))t.startsWith(e.baseClassName)&&e.el.classList.remove(t);e.el.removeAttribute("role");for(let t of["position","left","top","right","bottom","z-index"])e.el.style[t]="";e.el.style.display=e.elOriginalDisplay}e.lastPositionTarget&&(e.lastPositionTarget.classList.remove("has_".concat(e.baseClassName),"has_".concat(e.baseClassName,"_above"),"has_".concat(e.baseClassName,"_below")),delete e.lastPositionTarget),this._p=null}get el(){return this._p.el}elContains(e){var t;let s=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return!!this.el.contains(e)||!(!s||null===(t=this._p.currentSubDropList)||void 0===t||null===(t=t.droplist)||void 0===t||!t.elContains(e))}setAdditionalClasses(e){return this._p.additionalClasses=e,this._syncBaseClasses(),this}setDirection(e){return this._p.direction="ltr"===e?"ltr":"rtl"===e?"rtl":"auto",this._syncBaseClasses(),this}getDirection(){return this._p.direction}setLabelProp(e){return this._p.labelProp=e,this}setRenderItem(e){return this._p.renderItem=e,this}setUnrenderItem(e){const t=this._p;if(t.unrenderItem=e,"function"==typeof t.unrenderItem){const e=t.unrenderItem;t.virtualListHelper.setOnItemUnrender((s=>{try{e(s[oa][oa],s)}catch(e){console.error(e)}delete s[oa],t.focusItemEl===s&&(t.focusItemEl=null)}))}else t.virtualListHelper.setOnItemUnrender((e=>{delete e[oa],t.focusItemEl===e&&(t.focusItemEl=null)}));return this}setValueProp(e){return this._p.valueProp=e,this}_syncBaseClasses(){const e=this._p,t=e.el;if(!t)return;let s=[e.baseClassName];"ltr"!==e.direction&&"rtl"!==e.direction||s.push("".concat(e.baseClassName,"__")+e.direction),e.additionalClasses&&(s=s.concat(e.additionalClasses)),t.className=s.join(" ")}blurFocusedItem(){var e;const t=this._p;if(clearTimeout(t.blurTimer),!this.hasFocusedItem())return;let s=t.focusItemEl;s&&(s.classList.remove("".concat(t.baseClassName,"__item_focus")),t.focusItemEl=null);const i=t.items[t.focusItemIndex];t.focusItemIndex=-1,i&&(t.currentSubDropList&&this._hideSublist(),this._trigger("itemblur",{value:i.value,item:null!==(e=i[oa])&&void 0!==e?e:i}))}nextPage(e){this._move("next_page",e)}previousPage(e){this._move("prev_page",e)}goToFirst(e){this._move("first",e)}goToLast(e){this._move("last",e)}toggleFocusedItem(){const e=this._p;if(this.hasFocusedItem()&&e.multi){var s;let i=e.items[e.focusItemIndex];if(i._nocheck||i._nointeraction)return this;i._checked=!i._checked,e.focusItemEl&&t.toggleClass(e.focusItemEl,"".concat(e.baseClassName,"__item_checked"),i._checked),this._trigger("check",{value:i.value,item:null!==(s=i[oa])&&void 0!==s?s:i,checked:i._checked,isGroup:i._group,isCheckingGroup:!1}),this._updateGroupStateForItem(i)}return this}triggerItemSelection(t,s){var i,r;const n=this._p;return n.focusItemEl=n.focusItemEl||e.closestUntil(s.target,"li",n.el),n.focusItemIndex=n.virtualListHelper.getItemIndexFromElement(n.focusItemEl),void 0===n.focusItemIndex&&(n.focusItemIndex=-1),!(t=null!==(i=t)&&void 0!==i?i:n.focusItemEl[oa])._nointeraction&&(n.multi||this._setSingleSelectedItemEl(n.focusItemEl),this._trigger("select",{value:t?t.value:void 0,item:null!==(r=t[oa])&&void 0!==r?r:t,event:s,el:n.focusItemEl}),!0)}addItem(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:-1;return this.addItems([e],t)}addItems(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:-1;const s=this._p,i=s.labelProp,r=s.valueProp;let n=s.multi,l=s.items;(null==t||t<0||t>=s.items.length)&&(t=-1),this._determineVirtualMode(l.length+e.length);for(let o=0,a=e.length;o<a;o++){let a=e[o],u={[oa]:a,label:a[i],value:a[r],_nocheck:!!a._nocheck,_nointeraction:!!a._nointeraction,_subitems:a._subitems};n&&(u._checked=!!a._checked),a._group&&(u._group=!0,s.groupCount++),a._child&&(u._child=!0),-1!==t?l.splice(t,0,u):l.push(u),-1!==t&&t++}return s.virtualListHelper.addItemsAt(e.length,-1===t?t:t-e.length).render(),this}setItems(e){const t=this._p;return t.items.length=0,t.groupCount=0,t.virtualListHelper.setCount(0),this.addItems(e)}updateItemByValue(e,t){const s=this._p;let i=this.itemIndexByValue(e);if(-1===i)return this;let r=this.itemAtIndex(i);return r[oa]=t,ca.call(t,s.labelProp)&&(r.label=t[s.labelProp]),ca.call(t,s.valueProp)&&(r.value=t[s.valueProp]),ca.call(t,"_nocheck")&&(r._nocheck=!!t._nocheck),ca.call(t,"_nointeraction")&&(r._nointeraction=!!t._nointeraction),ca.call(t,"_subitems")&&(r._subitems=!!t._subitems),s.multi&&ca.call(t,"_checked")&&(r._checked=!!t._checked),ca.call(t,"_group")&&!!t._group!==r._group&&(r._group?s.groupCount--:s.groupCount++,t._group=!!r._group),ca.call(t,"_child")&&(r._child=!!t._child),s.virtualListHelper.isItemRendered(i)&&s.virtualListHelper.refreshItemAt(i).render(),this}removeItem(e,t){const s=this._p;let i=this.itemIndexByValueOrLabel(e,t);return-1===i||(s.items.splice(i,1)[0]._group&&s.groupCount--,s.virtualListHelper.removeItemsAt(i,1).render()),this}removeAllItems(){const e=this._p;return e.items.length=0,e.groupCount=0,e.virtualListHelper.setCount(0).render(),this}invalidate(){return this._p.virtualListHelper.invalidate().render(),this}itemDataByValue(e){const t=this._p;for(let s=0,i=t.items.length;s<i;s++){let i=t.items[s];if(i.value===e)return i[oa]}return null}itemIndexByValue(e){const t=this._p;for(let s=0,i=t.items.length;s<i;s++)if(t.items[s].value===e)return s;return-1}itemIndexByValueOrLabel(e,t){const s=this._p;for(let i=0,r=s.items.length;i<r;i++){let r=s.items[i];if(r.value===e||r.label===t)return i}return-1}items(){return this._p.items.map((e=>e[oa]))}itemsReference(){return this._p.items}itemCount(){return this._p.items.length}itemAtIndex(e){var t;return null===(t=this._p.items[e])||void 0===t?void 0:t[oa]}relayout(e){const i=this._p,r=i.el;if(!this.isVisible())return this;let n=window,l={},o=e.targetOffset||s.getElementOffset(e.target);l.left=o.left,l.top=o.top,l.height=null==e.targetHeight?s.getElementHeight(e.target,!0,!0):e.targetHeight,l.width=null==e.targetWidth?s.getElementWidth(e.target,!0,!0):e.targetWidth,l.bottom=l.top+l.height;let a={};a.top=n.pageYOffset,a.left=n.pageXOffset,a.width=n.innerWidth,a.height=n.innerHeight,a.bottom=a.top+a.height,a.right=a.left+a.width;let u=e.position&&"bottom"===e.position.y?"above":"below";r.style.width="",(i.estimateWidth||i.virtualListHelper.isVirtual())&&this._measureItem(),i.virtualListHelper.isVirtual()&&i.virtualListHelper.render(),e.updateWidth||"number"==typeof e.updateWidth?this._updateWidth(e):this._updateWidth();let c,d=l.top-a.top,h=a.bottom-l.bottom;const m=getComputedStyle(r);let p="border-box"===m.boxSizing,_=(parseFloat(m.paddingTop)||0)+(parseFloat(m.paddingBottom)||0),f=(parseFloat(m.borderTopWidth)||0)+(parseFloat(m.borderBottomWidth)||0);i.virtualListHelper.isVirtual()?c=i.virtualListHelper.estimateFullHeight()+_+f:(r.style.height="",r.style.top="-9999px",c=Math.max(s.getElementHeight(i.el),r.scrollHeight),c+=_+f);let g=parseFloat(m.maxHeight);isNaN(g)||(p||(g+=_+f),c=Math.min(c,g));let b=d>=c,I=h>=c,v=i.currentDirection||u;"above"===v&&!b&&I?v="below":"below"===v&&!I&&b?v="above":b&&I?v!==u&&("above"===u&&d>=h||"below"===u&&h>=d)&&(v=u):b||I||(d>h?v="above":h>d&&(v="below")),i.currentDirection=v;let y={width:s.getElementWidth(r,!0,!0),height:Math.min(c,Math.max(d,h,0))},S=void 0!==e.targetRtl?e.targetRtl:null!=e.target&&"rtl"===getComputedStyle(e.target).direction,E="rtl"===getComputedStyle(document.documentElement).direction,L=s.anchoredPosition(e.target,e.anchor?e.anchor.x:"start",e.anchor?e.anchor.y:"bottom",l,S),C=s.anchoredPosition(r,e.position?e.position.x:"start",e.position?e.position.y:"top",y,S),w="top"===C.ySpec&&"above"===v||"bottom"===C.ySpec&&"below"===v||"bottom"!==C.ySpec&&"top"!==C.ySpec&&"above"===v,k=void 0!==n.pageXOffset?n.pageXOffset:(document.documentElement||document.body.parentNode||document.body).scrollLeft;k=Math.abs(k),E&&(k=document.documentElement.scrollWidth-k-document.documentElement.clientWidth);let x=k,T=document.documentElement.clientWidth+k-y.width,P={position:"absolute",left:l.left,top:l.top+(w?L.bottom-C.bottom:L.top-C.top)};if(E&&(P.left-=document.documentElement.clientWidth-document.documentElement.scrollWidth),P.left+=L.left-C.left,e.offset&&(e.offset.y&&(w?P.top-=e.offset.y:P.top+=e.offset.y),e.offset.x)){let t="rtl"===m.direction;P.left+=t?-e.offset.x:e.offset.x}if(i.autoFlipDirection&&("right"===C.xSpec&&P.left<x&&(Math.max(P.left,x)+y.width-l.left)/l.width>.5||"left"===C.xSpec&&P.left>T&&(Math.min(P.left,T)-l.left)/l.width<.5)&&(P.left-=L.left-C.left,P.left+=L.right-C.right),i.constrainToWindow)for(let e of E?["min","max"]:["max","min"])"min"===e&&P.left<x?P.left=x:"max"===e&&P.left>T&&(P.left=T);return P.left+="px",P.top+="px",s.setCssProps(r,P),s.setElementHeight(r,y.height,!0,!0),i.virtualListHelper.render(),e&&e.target&&(i.lastPositionTarget=e.target,t.toggleClass(e.target,"has_".concat(i.baseClassName),!0),t.toggleClass(e.target,"has_".concat(i.baseClassName,"_below"),"below"===v),t.toggleClass(e.target,"has_".concat(i.baseClassName,"_above"),"above"===v),t.toggleClass(r,"".concat(i.baseClassName,"__is_below"),"below"===v),t.toggleClass(r,"".concat(i.baseClassName,"__is_above"),"above"===v)),this}setItemChecked(e,s){const i=this._p;s=!!s;let r=this.itemIndexByValue(e);if(-1===r)return this;let n=i.virtualListHelper.getItemElementAt(r);if(!n)return this;let l=n[oa];return s=s&&!l._nocheck,l._checked!==s&&(l._checked=s,t.toggleClass(n,"".concat(i.baseClassName,"__item_checked"),l._checked),this._updateGroupStateForItem(l)),this}setCheckedValues(e){const s=this._p;let i=[];for(let r=0,n=s.items.length;r<n;r++){let n=s.items[r],l=!n._nocheck&&-1!==e.indexOf(n.value);if(n._group&&i.push(r),n._checked===l)continue;n._checked=l;let o=s.virtualListHelper.getItemElementAt(r);o&&t.toggleClass(o,"".concat(s.baseClassName,"__item_checked"),n._checked)}if(s.autoCheckGroupChildren)for(let e=0,t=i.length;e<t;e++)this._updateGroupCheckedState(i[e],!1);return this}getCheckedValues(e){const t=this._p;e=e&&t.groupCount>0;let s=[];for(let i=0,r=t.items.length;i<r;i++){let r=t.items[i];r._checked&&(e&&r._group||s.push(r.value))}return s}getCheckedItems(e){const t=this._p;e=e&&t.groupCount>0;let s=[];for(let i=0,r=t.items.length;i<r;i++){let r=t.items[i];r._checked&&(e&&r._group||s.push(r[oa]))}return s}show(e){const t=this._p;t.hiding=!1,this.isVisible()||this._trigger("show:before"),t.mouseHandled=!1,setTimeout((()=>{this[aa]||t.onDocumentMouseDown||t.sink.add(document,"mousedown",t.onDocumentMouseDown=e=>{t.el.contains(e.target)||this._delayBlurItemOnBlur()})}));const s=t.el;if(s.style.position="absolute",s.classList.remove("".concat(t.baseClassName,"__is-hiding")),document.body.appendChild(s),t.visible=!0,t.el.style.display="","none"===getComputedStyle(t.el).display&&(t.el.style.display="block"),e){const t=getComputedStyle(s),i=s.style.maxHeight;let r=document.body.clientHeight-(parseFloat(t.marginTop)||0)-(parseFloat(t.marginBottom)||0)-("border-box"===t.boxSizing?0:(parseFloat(t.borderTopWidth)||0)+(parseFloat(t.borderBottomWidth)||0));s.style.maxHeight=Math.min(r,parseFloat(t.maxHeight)||r)+"px",this.relayout(e),s.style.maxHeight=i}else t.virtualListHelper.isVirtual()&&t.virtualListHelper.render();return this.isVisible()&&this._trigger("show"),this}hide(){const e=this._p,i=e.el;if(e.onDocumentMouseDown&&(e.sink.remove(document,"mousedown",e.onDocumentMouseDown),e.onDocumentMouseDown=null),this.isVisible()){if(this._trigger("hide:before"),e.hiding=!0,i&&(i.classList.add("".concat(e.baseClassName,"__is-hiding")),s.parseTransition(getComputedStyle(e.el).transition).reduce(((e,t)=>Math.max(e,t.delay+t.duration)),0)>0?setTimeout((()=>{this[aa]||this._p&&i.parentNode&&e.hiding&&(t.remove(i),i.classList.remove("".concat(e.baseClassName,"__is-hiding")),e.visible=!1,this._trigger("hide:after"))})):(t.remove(i),i.classList.remove("".concat(e.baseClassName,"__is-hiding")))),e.visible=!1,this.blurFocusedItem(),this._trigger("hide"),this[aa])return;this._trigger("hide:after"),e.currentSubDropList&&this._hideSublist()}return e.lastPositionTarget&&(e.lastPositionTarget.classList.remove("has_".concat(e.baseClassName),"has_".concat(e.baseClassName,"_above"),"has_".concat(e.baseClassName,"_below")),delete e.lastPositionTarget),this}isVisible(){const e=this._p;return!!e.visible&&e.el.parentNode&&"none"!==getComputedStyle(e.el).display}hasFocusedItem(){return this._p.focusItemIndex>-1}getFocusedItemIndex(){return this.hasFocusedItem()?this._p.focusItemIndex:-1}setFocusedItemAtIndex(e){const t=this._p;t.focusItemIndex=e;let s=null;e>-1&&(s=t.items[e]),s&&s._nointeraction&&(s=null),e>-1&&this.scrollItemIndexIntoView(e);let i=s?t.virtualListHelper.getItemElementAt(e):null;if(t.focusItemEl!==i&&(t.focusItemEl&&(t.focusItemEl.classList.remove("".concat(t.baseClassName,"__item_focus")),t.focusItemEl=null),i)){var r;i.classList.add("".concat(t.baseClassName,"__item_focus")),t.focusItemEl=i;const e=i[oa];this._trigger("itemfocus",{value:e.value,item:null!==(r=e[oa])&&void 0!==r?r:e,event:null,el:i}),this._showSublist(e,i)}return this}_showSublist(e,t){var s,i;if(null===(s=e._subitems)||void 0===s||!s.length)return;const r=this._p,n=new ha({baseClassName:r.baseClassName,additionalClasses:r.additionalClasses,direction:r.direction,autoItemBlur:r.autoItemBlur,autoItemBlurDelay:r.autoItemBlurDelay,capturesFocus:r.capturesFocus,multi:r.multi,keyDownHandler:r.keyDownHandler,autoCheckGroupChildren:r.autoCheckGroupChildren,useExactTargetWidth:r.useExactTargetWidth,constrainToWindow:r.constrainToWindow,autoFlipDirection:r.autoFlipDirection,estimatedItemHeight:r.estimatedItemHeight,estimateWidth:r.estimateWidth,virtualMinItems:r.virtualMinItems,labelProp:r.labelProp,valueProp:r.valueProp,renderItem:r.renderItem,unrenderItem:r.unrenderItem});let l=e=>{this[aa]||e.relatedTarget&&this.elContains(e.relatedTarget,!0)||(this._delayBlurItemOnBlur(),this._trigger("subitems:blur",e))};n.on("select",(e=>{this._trigger("subitems:select",e)})).on("subitems:select",(e=>{this._trigger("subitems:select",e)})).on("blur",l).on("subitems:blur",l).on("_back_key_pressed",(()=>{this._hideSublist()})),n.setItems(e._subitems),this._trigger("show_subitems",{value:e.value,item:null!==(i=e[oa])&&void 0!==i?i:e,el:t,droplist:n}),n.show({target:t,position:{x:"start",y:"top"},anchor:{x:"end",y:"top"},offset:{x:0,y:0},updateWidth:!1}),r.currentSubDropList={item:e,itemElement:t,droplist:n},n.el.focus()}_hideSublist(){const e=this._p;if(!e.currentSubDropList)return;const t=e.currentSubDropList;let s=!!document.activeElement&&t.droplist.elContains(document.activeElement,!0);t.droplist.hide(),t.droplist.destroy(),e.currentSubDropList=null,s&&!this[aa]&&this.el.focus(),this._trigger("hide_subitems",{value:t.item.value,item:t.item,el:t.itemElement})}setFocusedItem(e){const t=this._p;let s=e._nointeraction?-1:this._getItemIndex(e);return s>-1&&t.items[s]._nointeraction&&(s=-1),this.setFocusedItemAtIndex(s)}setFocusedItemByValue(e){return this.setFocusedItemAtIndex(this.itemIndexByValue(e))}setSingleSelectedItemAtIndex(e){const t=this._p;let s=null;return e>-1&&!t.items[e]._nointeraction&&(s=t.virtualListHelper.getItemElementAt(e)),this._setSingleSelectedItemEl(s),this}setSingleSelectedItem(e){const t=this._p;let s=e._nointeraction?-1:this._getItemIndex(e);return s>-1&&t.items[s]._nointeraction&&(s=-1),this.setSingleSelectedItemAtIndex(s)}setSingleSelectedItemByValue(e){return this.setSingleSelectedItemAtIndex(this.itemIndexByValue(e))}next(e){this._move("next",e)}previous(e){this._move("prev",e)}isFirstItem(){const e=this._p;return 0===e.focusItemIndex&&e.focusItemIndex<e.items.length}isLastItem(){const e=this._p;return e.focusItemIndex>-1&&e.focusItemIndex===e.items.length-1}scrollItemIndexIntoView(e){const t=this._p;if(this._hasScroll()){const s=t.el,i=s.scrollTop;let r,n=-1,l=30;for(;l-- >0&&(r=t.virtualListHelper.getItemPosition(e),r!==n);){n=r;let l=t.virtualListHelper.getItemSize(e),o=s.clientHeight;r<i?s.scrollTop=r:r+l>i+o&&(s.scrollTop=r+l-o),t.virtualListHelper.render()}}return this}on(e,t){return this._p.mitt.on(e,t),this}once(e,t){let s=i=>{this._p.mitt.off(e,s),t(i)};return this._p.mitt.on(e,s),this}off(e,t){return e||e?this._p.mitt.off(e,t):this._p.mitt.all.clear(),this}emit(e,t){return this._p.mitt.emit(e,t),this}_getItemIndex(e){const t=this._p;let s=-1;if(e&&(s=t.items.indexOf(e),-1===s)){let t=e&&void 0!==e.value?e.value:e,i=e&&e.label?e.label:t;s=this.itemIndexByValueOrLabel(t,i)}return s}_setSingleSelectedItemEl(e){const t=this._p;return t.singleSelectedItemEl&&(t.singleSelectedItemEl.classList.remove("".concat(t.baseClassName,"__item_checked")),t.singleSelectedItemEl=null),e&&(e.classList.add("".concat(t.baseClassName,"__item_checked")),t.singleSelectedItemEl=e),this}_trigger(e,t){const s=this._p;s.on&&s.on(e,...void 0===t?[]:[t]),s.mitt.emit(e,t)}_itemUpAction(t,s){if(e.closestUntil(t.target,".requires-pointer-events,button",s))return;let i=this._p;if(!this._mouseHandled){if(this.triggerItemSelection(null,t),this[aa])return;this.toggleFocusedItem(),document.activeElement!==this.el&&i.focusItemEl&&clearTimeout(i.blurTimer),setTimeout((()=>{this._mouseHandled=!1}),0)}}_hookMouseEvents(){const t=this._p;t.sink.add(t.el,"mouseup",(t=>{const s=e.closestUntil(t.target,"li",t.currentTarget);s&&0===t.button&&this._itemUpAction(t,s)})).add(t.el,"mouseover",(t=>{const s=e.closestUntil(t.target,"li",t.currentTarget);s&&this._handleMouseOver(t,s)}))}_handleMouseOver(e,t){this._focus(e,t,null,!0)}_hookTouchEvents(){const t=this._p;let s;t.sink.add(t.el,"touchstart",(i=>{const r=e.closestUntil(i.target,"li",i.currentTarget);if(!r)return;if(s)return;if(e.closestUntil(i.target,".requires-pointer-events,button",r))return;s=i.changedTouches[0].identifier,this._handleMouseOver(i,r);let n=!1,l=()=>{n=!0},o=()=>{s=null,t.sink.remove(null,".dropdown_touchextra")},a=r.parentNode;for(;a;)t.sink.add(a,"scroll.dropdown_touchextra",l),a=a.parentNode;t.sink.add(window,"scroll.dropdown_touchextra",l),t.sink.add(window,"touchcancel.dropdown_touchextra",o),t.sink.add(t.el,"touchend.dropdown_touchextra",(t=>{const i=e.closestUntil(t.target,"li",t.currentTarget);return i&&Array.prototype.find.call(t.changedTouches,(e=>e.identifier===s))?(o(),void(n||(this._itemUpAction(t,i),t.preventDefault()))):o()}))}))}_hookFocusEvents(){const e=this._p;e.sink.add(e.el,"focus",(t=>{let s=e.focusItemEl||e.el.firstChild;this._focus(t,s,null,!1)})).add(e.el,"blur",(e=>{setTimeout((()=>{this[aa]||document.activeElement&&this.elContains(document.activeElement,!0)||(this._delayBlurItemOnBlur(),this._trigger("blur",e))}))}))}_hookKeyEvents(){const e=this._p;e.sink.add(e.el,"keydown",(e=>this._keydown(e)))}_keydown(e){const t=this._p;if(t.keyDownHandler&&t.keyDownHandler.call(this,e))return;let s=!0;switch(e.key){case n.VALUE_PAGE_UP:case n.VALUE_PAGE_DOWN:case n.VALUE_HOME:case n.VALUE_END:case n.VALUE_UP:case n.VALUE_DOWN:switch(e.preventDefault(),e.key){case n.VALUE_PAGE_UP:this.previousPage(e);break;case n.VALUE_PAGE_DOWN:this.nextPage(e);break;case n.VALUE_HOME:this._move("first",e);break;case n.VALUE_END:this._move("last",e);break;case n.VALUE_UP:this.previous(e);break;case n.VALUE_DOWN:this.next(e)}break;case n.VALUE_LEFT:case n.VALUE_RIGHT:if(e.key===n.VALUE_RIGHT&&"rtl"!==getComputedStyle(e.target).direction||e.key===n.VALUE_LEFT&&"rtl"===getComputedStyle(e.target).direction){let e=t.items[t.focusItemIndex];t.focusItemIndex>-1&&e._subitems&&this._showSublist(e,t.focusItemEl)}else t.currentSubDropList?(this._hideSublist(),s=!1):this._trigger("_back_key_pressed");break;case n.VALUE_ENTER:this.triggerItemSelection(null,e),e.preventDefault();break;case n.VALUE_SPACE:this.toggleFocusedItem(),e.preventDefault();break;case n.VALUE_ESCAPE:e.preventDefault(),this.hide();break;default:if("keydown"===e.type)return;this._keydownFreeType(e),s=!1}}_keydownFreeType(e){const t=this._p;let s=e.key||String.fromCharCode(e.keyCode);if(1!==s.length)return;clearTimeout(t.filterTimer);let i,r=(t.previousFilter||"")+s,n=new RegExp("^".concat(la(r)),"i"),l=-1,o=t.focusItemIndex;for(let e=0,s=t.items.length;e<s&&(-1!==l&&e<o||(i=t.items[e],!(n.test(i.label)&&(l=e,-1===o||e>=o))));e++);if(-1===l){r=s,n=new RegExp("^".concat(la(r)),"i");for(let e=0,s=t.items.length;e<s&&(-1!==l&&e<o||(i=t.items[e],!(n.test(i.label)&&(l=e,-1===o||e>=o))));e++);}if(l>-1){let s=t.virtualListHelper.getItemElementAt(l);this._focus(e,s||null,l,!0),this.isVisible()||this.triggerItemSelection(s?null:t.items[l],e),t.previousFilter=r,t.filterTimer=setTimeout((()=>{delete t.previousFilter}),1e3)}else delete t.previousFilter}_focus(e,t,s,i){var r;const n=this._p;if(n._isFocusingItem)return;n._isFocusingItem=!0,!s&&t&&(s=n.virtualListHelper.getItemIndexFromElement(t)),s>-1?this.scrollItemIndexIntoView(s):void 0===s&&(t=null);let l=t||n.virtualListHelper.getItemElementAt(s);if(!l||l[oa]._nointeraction)return n._isFocusingItem=!1,void this.blurFocusedItem();if(l===n.focusItemEl)return n._isFocusingItem=!1,void clearTimeout(n.blurTimer);this.blurFocusedItem(),l.classList.add("".concat(n.baseClassName,"__item_focus")),n.focusItemEl=l,n.focusItemIndex=s;const o=n.items[s];this._trigger("itemfocus",{value:o.value,item:null!==(r=o[oa])&&void 0!==r?r:o,event:e,el:l}),n._isFocusingItem=!1,i&&this._showSublist(o,l)}_delayBlurItemOnBlur(){if(this[aa])return;const e=this._p;e.autoItemBlur&&(clearTimeout(e.blurTimer),e.blurTimer=setTimeout((()=>{this[aa]||this.blurFocusedItem()}),e.autoItemBlurDelay))}_move(e,t){const i=this._p;let r,n,l=!1;if("first"===e)n=0,l=!1;else if("last"===e)n=i.items.length-1,l=!0;else if("prev"===e){if(!this.hasFocusedItem())return this._move("last",t);n=i.focusItemIndex-1,-1===n&&(n=i.items.length-1),l=!0}else if("next"===e){if(!this.hasFocusedItem())return this._move("first",t);n=i.focusItemIndex+1,n===i.items.length&&(n=0),l=!1}else{if("prev_page"!==e&&"next_page"!==e)return;if(!this.hasFocusedItem())return this._move("prev_page"===e?"prev":"next",t);if("prev_page"===e&&this.isFirstItem()||"next_page"===e&&this.isLastItem())return;if(!this._hasScroll())return this._move("prev_page"===e?"first":"last",t);if(i.virtualListHelper.isVirtual()){let t=i.virtualListHelper.getVisibleItemCount();n=i.focusItemIndex,"prev_page"===e?n-=t:n+=t,n<0?n=0:n>=i.items.length&&(n=i.items.length)}else if(i.focusItemEl){let t=s.getElementOffset(i.focusItemEl).top,l=s.getElementHeight(i.el,!0);for(;;){if(r=i.focusItemEl.nextElementSibling,!r)return;if("LI"===r.tagName)if("prev_page"===e){if(s.getElementOffset(r).top-t+l<=0)break}else if(s.getElementOffset(r).top-t-l>=0)break}r&&(n=i.virtualListHelper.getItemIndexFromElement(r),void 0===n&&(n=-1))}l="prev_page"===e}let o=i.items.length;if(n>=o)return;let a=i.items[n],u=n;for(;a&&a._nointeraction&&(l?(n--,-1===n&&(n=o)):(n++,n===o&&(n=0)),a=i.items[n],n!==u););r=i.virtualListHelper.getItemElementAt(n),this._focus(t,r||null,n,!1),this.isVisible()||this.triggerItemSelection(a,t)}_hasScroll(){return this.el.clientHeight<this.el.scrollHeight}_updateGroupStateForItem(e){const s=this._p;if(!s.multi)return this;if(e._group){var i;let n=0;if(s.autoCheckGroupChildren){let i=s.items;for(let l=i.indexOf(e)+1,o=i.length;l<o;l++){var r;let o=i[l];if(o._group||!o._child&&i[l-1]._child)break;if(!!o._checked===e._checked)continue;o._checked=e._checked,n++;let a=s.virtualListHelper.getItemElementAt(l);a&&t.toggleClass(a,"".concat(s.baseClassName,"__item_checked"),e._checked),this._trigger("check",{value:o.value,item:null!==(r=o[oa])&&void 0!==r?r:o,checked:o._checked,isGroup:o._group,isCheckingGroup:!0})}}this._trigger("groupcheck",{value:e.value,item:null!==(i=e[oa])&&void 0!==i?i:e,affectedItems:n})}else if(s.groupCount>0&&s.autoCheckGroupChildren){let t=s.items,i=-1;for(let s=t.indexOf(e)-1;s>=0;s--)if(t[s]._group){i=s;break}i>-1&&this._updateGroupCheckedState(i,!0)}return this}_updateGroupCheckedState(e,s){const i=this._p;if(!(i.multi&&i.autoCheckGroupChildren&&e>-1))return this;let r=i.items,n=r[e];if(!n||!n._group)return this;let l,o=!1,a=!1;for(let t=e+1,s=r.length;t<s&&(l=r[t],!(l._group||!l._child&&r[t-1]._child));t++)l._checked?o=!0:l._checked||(a=!0);if(!o&&!a)return this;let u=o&&!a;if(!!n._checked!==u){n._checked=u;let r=i.virtualListHelper.getItemElementAt(e);var c;r&&t.toggleClass(r,"".concat(i.baseClassName,"__item_checked"),n._checked),s&&this._trigger("check",{value:n.value,item:null!==(c=n[oa])&&void 0!==c?c:n,checked:n._checked,isGroup:n._group,isCheckingGroup:!1})}return this}_measureItem(){const e=this._p;if(e.lastMeasureItemCount!==e.items.length){let t=e.lastMeasureLongestLabel||1,s=e.lastMeasureLongestLabelText||"";for(let i=0,r=e.items,n=r.length;i<n;i++){const e=r[i];let n=e.label;null==n&&(n=e.value),null==n&&(n="");let l=n.length;l>t&&(t=l,s=n)}e.lastMeasureItemCount=e.items.length,e.lastMeasureLongestLabel=t,e.lastMeasureLongestLabelText=s}return(e.estimateWidth||e.virtualListHelper.isVirtual())&&e.virtualListHelper.createGhostItemElement(ua,!0,(t=>{e.lastMeasureItemWidth=s.getElementWidth(t,!0,!0)})),this}_determineVirtualMode(e){const t=this._p;let s=t.items;void 0===e&&(e=s.length);let i=e>=t.virtualMinItems;return i!==t.virtualListHelper.isVirtual()&&t.virtualListHelper.setVirtual(i).render(),this}_renderItemContent(t,s){const i=this._p;i.renderItem&&!1!==i.renderItem(t[oa]||t,s)||(s.appendChild(e.createElement("span",{class:"".concat(i.baseClassName,"__item_label"),textContent:t.label})),i.multi&&(t._nocheck||s.insertBefore(e.createElement("span",{class:"checkbox"}),s.firstChild)))}_updateWidth(e){const t=this._p,i=t.el;let r=0;e&&(r="number"==typeof e.updateWidth||null!=e.targetWidth?e.updateWidth:s.getElementWidth(e.target,!0,!0));let n=0;t.useExactTargetWidth||(t.estimateWidth||t.virtualListHelper.isVirtual()?n=t.lastMeasureItemWidth:(i.style.width="",n=s.getElementWidth(i,!0,!0)));let l=Math.max(n,r);s.setElementWidth(i,l,!0,!0);const o=getComputedStyle(i);let a=(parseFloat(o.borderLeftWidth)||0)+(parseFloat(o.borderRightWidth)||0),u=i.scrollWidth+a;if(u>l){let e=u-l;i.style.width="".concat(parseFloat(i.style.width)+e,"px"),l=u}return l}}const ma=(e,t,s)=>{let i,r,n,l,o=0;s||(s={});const a=()=>{o=!1===s.leading?0:Date.now(),i=null,l=e.apply(r,n),i||(r=n=null)},u=function(){const u=Date.now();o||!1!==s.leading||(o=u);const c=t-(u-o);return r=this,n=arguments,c<=0||c>t?(i&&(clearTimeout(i),i=null),o=u,l=e.apply(r,n),i||(r=n=null)):i||!1===s.trailing||(i=setTimeout(a,c)),l};return u.cancel=()=>{clearTimeout(i),o=0,i=r=n=null},u.isScheduled=()=>!!i,u},pa=Symbol("item"),_a=Symbol("destroyed"),fa=Symbol("no_results_items"),ga=Symbol("rest_multi_items"),ba=!!("ontouchstart"in window||window.DocumentTouch&&window.document instanceof window.DocumentTouch||window.navigator.maxTouchPoints),Ia=function(e,t){return e instanceof Element&&e.classList.contains(t)},va=["font-family","font-size","font-weight","font-size","letter-spacing","text-transform","word-spacing","text-indent","box-sizing","padding-left","padding-right"],ya={el:null,baseClassName:"selectbox",disabled:!1,clearable:!0,hasOpenIndicator:!0,placeholder:"",sortSelectedItems:!0,sortListItems:!1,sortListCheckedFirst:!0,stickyValues:null,sortItemComparator:null,splitListCheckedGroups:!0,treatGroupSelectionAsItems:!1,blurOnSingleSelection:"touch",multi:!1,showSelection:!0,showPlaceholderInTooltip:!1,multiPlaceholderFormatter:null,searchable:!0,noResultsText:"No matching results",filterThrottleWindow:300,filterOnEmptyTerm:!1,labelProp:"label",valueProp:"value",multiItemLabelProp:"short_label",maxMultiItems:null,multiItemsRestLabelProvider:null,items:[],selectedValues:void 0,value:void 0,isLoadingMode:!1};exports.DropList=ha,exports.SelectBox=class{constructor(s){const r={...ya};for(let[e,t]of Object.entries(s))void 0!==t&&(r[e]=t);const n=this._p={ownsEl:!0,baseClassName:r.baseClassName,additionalClasses:r.additionalClasses,direction:"ltr"===r.direction?"ltr":"rtl"===r.direction?"rtl":"auto",listOptions:r.listOptions,disabled:!!r.disabled,clearable:!!r.clearable,hasOpenIndicator:!!r.hasOpenIndicator,placeholder:r.placeholder,sortSelectedItems:!!r.sortSelectedItems,sortListItems:!!r.sortListItems,sortListCheckedFirst:!!r.sortListCheckedFirst,stickyValues:Array.isArray(r.stickyValues)?new Set(r.stickyValues):null,sortItemComparator:r.sortItemComparator,splitListCheckedGroups:!!r.splitListCheckedGroups,treatGroupSelectionAsItems:r.treatGroupSelectionAsItems,blurOnSingleSelection:r.blurOnSingleSelection,multi:r.multi,showSelection:r.showSelection,showPlaceholderInTooltip:r.showPlaceholderInTooltip,multiPlaceholderFormatter:r.multiPlaceholderFormatter,searchable:r.searchable,noResultsText:r.noResultsText,filterThrottleWindow:r.filterThrottleWindow,filterOnEmptyTerm:r.filterOnEmptyTerm,labelProp:r.labelProp,valueProp:r.valueProp,multiItemLabelProp:r.multiItemLabelProp,maxMultiItems:r.maxMultiItems,multiItemsRestLabelProvider:r.multiItemsRestLabelProvider,renderSingleItem:r.renderSingleItem,unrenderSingleItem:r.unrenderSingleItem,renderMultiItem:r.renderMultiItem,unrenderMultiItem:r.unrenderMultiItem,renderRestMultiItem:r.renderRestMultiItem,unrenderRestMultiItem:r.unrenderRestMultiItem,renderNoResultsItem:r.renderNoResultsItem,unrenderNoResultsItem:r.unrenderNoResultsItem,filterFn:r.filterFn,on:r.on||null,silenceEvents:!0,mitt:l(),isLoadingMode:!!r.isLoadingMode,items:[],filteredItems:null,currentItemsView:[],itemsChanged:!0,sink:new i,resizeObserver:null,selectedItems:[],selectedValues:[],selectionChanged:!0,resortBySelectionNeeded:!1,throttledUpdateListItems:ma((()=>this._updateListItems()),r.filterThrottleWindow,{leading:!0,trailing:!0}),filterTerm:""};let o=r.el;o instanceof Element?n.ownsEl=!1:o=e.createElement("span"),e.setElementAttrs(o,{role:"combobox","aria-haspopup":"true","aria-expanded":"false"}),n.el=o,this._syncBaseClasses(),this._renderBase(),n.multiItemEls=[],this.enable(!n.disabled),this._setupDropdownMenu(),n.sink.add(o,"click",(e=>{n.clearButtonWrapper&&n.clearButtonWrapper.contains(e.target)||o.contains(document.activeElement)||(n.input.focus(),n.input.selectionStart=n.input.selectionEnd=n.input.value.length)})),n.sink.add(o,"focus",(e=>{const t=e.target;if(!o.contains(e.relatedTarget)&&!Ia(t,"".concat(n.baseClassName,"__search_field"))&&!Ia(t,"".concat(n.baseClassName,"__item"))){let e=o.querySelector(".".concat(n.baseClassName,"__search_field"));e&&e.focus()}}),!0),n.sink.add(n.input,"keydown",(e=>{this._handleInputKeydown(e)})).add(n.input,"input",(()=>{this._resizeInput()}));const a=(()=>{let e;return()=>{e&&clearTimeout(e),e=setTimeout((()=>{t.toggleClass(o,"".concat(n.baseClassName,"__focus"),o.contains(document.activeElement))}))}})();if(n.sink.add(o,"focus",a,!0),n.sink.add(o,"blur",a,!0),n.sink.add(window,"resize",(()=>this._resizeInput())),n.sink.add(window,"orientationchange",(()=>this._resizeInput())),void 0!==window.ResizeObserver){let e={borderBoxSize:{blockSize:null,inlineSize:null},contentBoxSize:{blockSize:null,inlineSize:null}};n.resizeObserver=new ResizeObserver((t=>{if(this[_a])return;const s=t[0];e&&s.borderBoxSize[0].blockSize===e.borderBoxSize.blockSize&&s.borderBoxSize[0].inlineSize===e.borderBoxSize.inlineSize&&s.contentBoxSize[0].blockSize===e.contentBoxSize.blockSize&&s.contentBoxSize[0].inlineSize===e.contentBoxSize.inlineSize||(n.resizeObserver.unobserve(n.el),this._resizeInput(),requestAnimationFrame((()=>n.resizeObserver.observe(n.el)))),e.borderBoxSize=s.borderBoxSize[0],e.contentBoxSize=s.contentBoxSize[0]})),n.resizeObserver.observe(n.el)}return this.setItems(r.items),delete r.items,r.multi&&Array.isArray(r.selectedValues)?this.setSelectedValues(r.selectedValues):null!=r.value&&this.setValue(r.value),this._scheduleSync("full"),this.silenceEvents=!1,this}destroy(){var e;if(this[_a])return;this[_a]=!0;const s=this._p;if(s.syncTimeout&&(clearTimeout(s.syncTimeout),delete s.syncTimeout),this._stopTrackingPresence(),s.sink.remove(),s.dropList&&s.dropList.destroy(),s.throttledUpdateListItems&&s.throttledUpdateListItems.cancel(),this._cleanupSingleWrapper(),s.unrenderMultiItem||s.unrenderRestMultiItem)for(;s.multiItemEls.length>0;)this._removeMultiItemElementByIndex(s.multiItemEls.length-1);if(t.remove(s.list),t.remove(s.singleWrapper),t.remove(s.input),t.remove(s.inputBackBuffer),t.remove(s.clearButtonWrapper),t.remove(s.openIndicator),!s.ownsEl){for(let e of Array.from(s.el.classList))e.startsWith(s.baseClassName)&&s.el.classList.remove(e);s.el.removeAttribute("role"),s.el.removeAttribute("aria-haspopup"),s.el.removeAttribute("aria-expanded")}null===(e=s.resizeObserver)||void 0===e||e.disconnect(),this._p=null}get el(){return this._p.el}enable(e){const t=this._p;void 0===e&&(e=!0),t.disabled=!e,t.el.setAttribute("aria-disabled",t.disabled.toString()),t.input.disabled=!!t.disabled;const s=t.multiItemEls;for(let e of s)t.disabled?e.removeAttribute("tabindex"):e.setAttribute("tabindex","0");return this}isEnabled(){return!this._p.disabled}disable(e){return this.enable(void 0!==e&&!e)}isDisabled(){return this._p.disabled}setAdditionalClasses(e){return this._p.additionalClasses=e,this._syncBaseClasses(),this}setItems(e){let t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];const s=this._p;return e||(e=[]),s.items=e.slice(0),s.filteredItems=null,s.itemsChanged=!0,this._updateItemByValueMap(),t&&this.setSelectedValues(this.getSelectedValues()),this._trigger("itemschanged",{term:null,mutated:!0,count:this.getFilteredItemCount()}),this}getFilteredItemCount(){const e=this._p;return e.filteredItems?e.filteredItems.length:e.items?e.items.length:0}isFilterPending(){const e=this._p;return!!(e.throttledUpdateListItems.isScheduled()||!e.filteredItems&&(e.filterTerm||e.filterOnEmptyTerm&&e.filterFn))}updateItemByValue(e,t){const s=this._p;let i=s.itemByValueMap.get(e);i&&Object.assign(i,t),s.dropList&&s.dropList.updateItemByValue(e,t)}getItems(){return this._p.items}setClearable(e){return e=!!e,this._p.clearable===e||(this._p.clearable=!!e,this._scheduleSync("render_clear")),this}getClearable(){return this._p.clearable}setHasOpenIndicator(e){return e=!!e,this._p.hasOpenIndicator===e||(this._p.hasOpenIndicator=e,this._scheduleSync("render_base")),this}getHasOpenIndicator(){return this._p.hasOpenIndicator}setPlaceholder(e){return this._p.placeholder=null==e?"":String(e),this._scheduleSync("render_base"),this}getPlaceHolder(){return this._p.placeholder}setSearchTerm(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const s=this._p;return s.input?(s.input.value=e,this._scheduleSync("resize_input"),t&&(s.filterTerm=s.input.value.trim(),s.filteredItems=null,s.itemsChanged=!0,this._trigger("search",{value:s.input.value}),s.throttledUpdateListItems()),this):this}getSearchTerm(){const e=this._p;return e.input?e.input.value:""}invokeRefilter(){const e=this._p;return e.filterTerm||e.filterOnEmptyTerm||e.filteredItems?(e.filteredItems=null,e.itemsChanged=!0,e.throttledUpdateListItems(),this):this}setSortSelectedItems(e){const t=this._p;return e=!!e,t.sortSelectedItems===e||(t.sortSelectedItems=e,this._scheduleSync("render_items")),this}isSortSelectedItemsEnabled(){return this._p.sortSelectedItems}setSortListItems(e){const t=this._p;return e=!!e,t.sortListItems===e||(t.sortListItems=e,t.filteredItems=null,t.itemsChanged=!0,this._scheduleSync("render_list")),this}isSortListItemsEnabled(){return this._p.sortListItems}setSortListCheckedFirst(e){const t=this._p;return e=!!e,t.sortCheckedFirst===e||(t.sortCheckedFirst=e,t.itemsChanged=!0,this._scheduleSync("render_list")),this}isSortListCheckedFirstEnabled(){return this._p.sortListCheckedFirst}setStickyValues(e){const t=this._p;return t.stickyValues=Array.isArray(e)?new Set(e):null,t.itemsChanged=!0,this._scheduleSync("render_list"),this}getStickyValues(){return this._p.stickyValues?Array.from(this._p.stickyValues):null}setSortItemComparator(e){const t=this._p;return t.sortItemComparator===e||(t.sortItemComparator=e,t.itemsChanged=!0,this._scheduleSync("render_list")),this}getSortItemComparator(){return this._p.sortItemComparator}setTreatGroupSelectionAsItems(e){const t=this._p;return e=!!e,t.treatGroupSelectionAsItems===e||(t.treatGroupSelectionAsItems=e,t.itemsChanged=!0,this._scheduleSync("render_list")),this}isTreatGroupSelectionAsItemsEnabled(){return!this._p.treatGroupSelectionAsItems}setSplitListCheckedGroups(e){const t=this._p;return e=!!e,t.splitListCheckedGroups===e||(t.splitListCheckedGroups=e,t.itemsChanged=!0,this._scheduleSync("render_list")),this}isSplitListCheckedGroupsEnabled(){return this._p.splitListCheckedGroups}setShowSelection(e){const t=this._p;return e=!!e,t.showSelection===e||(t.showSelection=e,this._scheduleSync("render_items")),this}isShowSelectionEnabled(){return this._p.showSelection}setShowPlaceholderInTooltip(e){const t=this._p;return e=!!e,t.showPlaceholderInTooltip===e||(t.showPlaceholderInTooltip=e,this._scheduleSync("render_base")),this}isShowPlaceholderInTooltipEnabled(){return this._p.showPlaceholderInTooltip}setMultiPlaceholderFormatter(e){const t=this._p;return t.multiPlaceholderFormatter===e||(t.multiPlaceholderFormatter=e,this._scheduleSync("render_base")),this}setBlurOnSingleSelection(e){const t=this._p;return t.blurOnSingleSelection===e||(t.blurOnSingleSelection=e),this}getBlurOnSingleSelection(){return this._p.blurOnSingleSelection}setMulti(e){const s=this._p;return e=!!e,s.multi===e||(s.multi=e,this._setupDropdownMenu(),t.remove(s.clearButtonWrapper),delete s.clearButtonWrapper,e&&s.selectedValues&&1===s.selectedValues.length&&Array.isArray(s.selectedValues[0])&&this.setSelectedValues(s.selectedValues[0]),this._scheduleSync("full")),this}isMultiEnabled(){return this._p.multi}setSearchable(e){const t=this._p;return e=!!e,t.searchable===e||(t.searchable=e,this._scheduleSync("full")),this}isSearchableEnabled(){return this._p.searchable}setNoResultsText(e){return this._p.noResultsText=e,this._scheduleSync("render_list"),this}getNoResultsText(){return this._p.noResultsText}setFilterThrottleWindow(e){const t=this._p;t.filterThrottleWindow=e;let s=!!t.throttledUpdateListItems&&t.throttledUpdateListItems.isScheduled();return t.throttledUpdateListItems&&t.throttledUpdateListItems.cancel(),t.throttledUpdateListItems=ma((()=>this._updateListItems()),t.filterThrottleWindow,!0),s&&t.throttledUpdateListItems(),this}getFilterThrottleWindow(){return this._p.filterThrottleWindow}setFilterOnEmptyTerm(e){const t=this._p;return t.filterOnEmptyTerm===e||(t.filterOnEmptyTerm=e,t.throttledUpdateListItems()),this}getFilterOnEmptyTerm(){return this._p.filterOnEmptyTerm}setListOptions(e){return this._p.listOptions=e,this._setupDropdownMenu(),this}setRenderSingleItem(e,t){const s=this._p;return s.renderSingleItem=e,s.unrenderSingleItem=t,this}setRenderMultiItem(e,t){const s=this._p;return s.renderMultiItem=e,s.unrenderMultiItem=t,this}setRenderRestMultiItem(e,t){const s=this._p;return s.renderRestMultiItem=e,s.unrenderRestMultiItem=t,this}setRenderNoResultsItem(e,t){const s=this._p;return s.renderNoResultsItem=e,s.unrenderNoResultsItem=t,this}setLabelProp(e){const t=this._p;return t.labelProp=e,t.dropList&&t.dropList.setLabelProp(e),this}setValueProp(e){const t=this._p;return t.valueProp===e||(t.valueProp=e,t.dropList&&t.dropList.setValueProp(e),this._updateItemByValueMap()),this}setMultiItemLabelProp(e){return this._p.multiItemLabelProp=e,this}setMaxMultiItems(e){return this._p.maxMultiItems=e,this}setMultiItemsRestLabelProvider(e){return this._p.multiItemsRestLabelProvider=e,this}setFilterFn(e){const t=this._p;return t.filterFn===e||(t.filterFn=e,t.throttledUpdateListItems()),this}getFilterFn(){return this._p.filterFn}focusInput(){const e=this._p;return e.input&&e.input.focus(),this}blurInput(){const e=this._p;return e.input&&e.input.blur(),this}clear(){return this._performClearWithEvent(!0)?(this[_a],this):this}getValue(){const e=this._p;return e.multi?e.selectedValues.slice(0):e.selectedValues.length>0?e.selectedValues[0]:void 0}setValue(e){return this._p.multi?this.setSelectedValues(Array.isArray(e)?e:void 0!==e?[e]:[]):this.setSelectedValues(void 0!==e?[e]:[])}getSelectedValues(){return this._p.selectedValues.slice(0)}setSelectedValues(e){const t=this._p,s=t.valueProp;t.multi||(e=e.slice(0,1));let i=new Set,r=[],n=[];for(let l of e){if(i.has(l))continue;i.add(l),r.push(l);let e=t.itemByValueMap.get(l);void 0!==e?n.push(e):n.push({[s]:l})}return t.selectedValues=r,t.selectedItems=n,t.selectionChanged=!0,t.resortBySelectionNeeded=!0,this._scheduleSync("full"),this}getSelectedValueCount(){return this._p.selectedValues.length}getSelectedItems(){return this._p.selectedItems.slice(0)}setSelectedItems(e){return this._setSelectedItems(e),this}openList(){const e=this._p;return e.dropList.isVisible()||e.isLoadingMode&&0===e.items.length||(this._trigger("open:before",{list:e.dropList}),e.dropList.setDirection(getComputedStyle(e.el).direction),e.dropList.show(this._getDropListPositionOptions()),this._repositionDropList(),this._repositionDropList(),e.dropList.hasFocusedItem()&&e.dropList.setFocusedItemAtIndex(e.dropList.getFocusedItemIndex())),this}closeList(){const e=this._p;return this[_a]?this:e.dropList.isVisible()?(e.dropList.hide(),this):this}toggleList(e){const t=this._p;return(void 0===e?!t.dropList.isVisible():e)?this.openList():this.closeList()}isListOpen(){return!!this._p.dropListVisible}toggleLoading(e){return this.setIsLoadingMode(void 0===e?!this.getIsLoadingMode():!!e)}setIsLoadingMode(e){const t=this._p;return e=void 0===e||!!e,t.isLoadingMode===e||(t.isLoadingMode=e,t.isLoadingMode&&0===t.items.length&&this.isListOpen()?this.closeList():!t.isLoadingMode&&document.activeElement&&((t.multi||t.searchable)&&t.input.contains(document.activeElement)||!t.multi&&!t.searchable&&t.el.contains(document.activeElement))&&this.openList(),this._scheduleSync("render_base")),this}getIsLoadingMode(){return this._p.isLoadingMode}setDirection(e){return this._p.direction="ltr"===e?"ltr":"rtl"===e?"rtl":"auto",this._syncBaseClasses(),this}getDirection(){return this._p.direction}refreshSize(){return this._resizeInput(),this}on(e,t){return this._p.mitt.on(e,t),this}once(e,t){let s=i=>{this._p.mitt.off(e,s),t(i)};return this._p.mitt.on(e,s),this}off(e,t){return e||e?this._p.mitt.off(e,t):this._p.mitt.all.clear(),this}emit(e,t){return this._p.mitt.emit(e,t),this}_updateItemByValueMap(){const e=this._p,t=e.itemByValueMap=new Map,s=e.valueProp;for(let i of e.items)t.set(i[s],i)}_renderBase(){const s=this._p;if(s.inputBackBuffer||(s.inputBackBuffer=e.createElement("span",{css:{position:"absolute",zIndex:-1,left:0,top:"-9999px",whiteSpace:"pre"}})),s.input||(s.inputWrapper=e.createElement("span",{class:"".concat(s.baseClassName,"__search_wrapper")},s.input=e.createElement("input",{class:"".concat(s.baseClassName,"__search_field"),type:"search",autocomplete:"off",autocorrect:"off",autocapitalize:"off",spellcheck:"false",role:"textbox","aria-autocomplete":"list",readOnly:!(s.searchable||s.multi)}))),s.multi){if(s.singleWrapper&&(this._cleanupSingleWrapper(),t.remove(s.singleWrapper),delete s.singleWrapper),!s.list){this._unregisterDropdownEvents();const t=document.activeElement;s.list=e.createElement("ul",{class:"".concat(s.baseClassName,"__list")}),s.el.appendChild(s.list),s.list.appendChild(s.inputWrapper),s.el.classList.remove("".concat(s.baseClassName,"__single")),s.el.classList.add("".concat(s.baseClassName,"__multi")),s.sink.add(s.list,"click",(t=>{e.closestUntil(t.target,".".concat(s.baseClassName,"__item_remove"),t.currentTarget)&&(s.disabled||this._removeMultiItemFromEvent(e.closestUntil(t.target,".".concat(s.baseClassName,"__item"),t.currentTarget),t))})).add(s.list,"keydown",(t=>{e.closestUntil(t.target,".".concat(s.baseClassName,"__item"),t.currentTarget)&&this._handleMultiKeydown(t)})),t===s.input&&s.input.focus(),this._registerDropdownEvents()}}else if(s.list&&(t.remove(s.list),s.sink.remove(s.list),delete s.list),!s.singleWrapper){this._unregisterDropdownEvents();const t=document.activeElement;s.singleWrapper=e.createElement("div",{class:"".concat(s.baseClassName,"__single_wrapper")}),s.el.appendChild(s.singleWrapper),s.el.appendChild(s.inputWrapper),s.el.classList.remove("".concat(s.baseClassName,"__multi")),s.el.classList.add("".concat(s.baseClassName,"__single")),t===s.input&&s.input.focus(),this._registerDropdownEvents()}s.hasOpenIndicator!==!!s.openIndicator&&(s.hasOpenIndicator?(s.openIndicator=e.createElement("span",{class:"".concat(s.baseClassName,"__open_indicator")}),s.el.appendChild(s.openIndicator)):(t.remove(s.openIndicator),delete s.openIndicator,s.el.classList.remove("".concat(s.baseClassName,"__has_open_indicator")))),s.isLoadingMode!==!!s.spinner&&(s.isLoadingMode?(s.spinner=e.createElement("span",{class:"".concat(s.baseClassName,"__spinner")}),s.el.appendChild(s.spinner),s.el.classList.add("".concat(s.baseClassName,"__has_spinner"))):(t.remove(s.spinner),delete s.spinner,s.el.classList.remove("".concat(s.baseClassName,"__has_spinner"))))}_syncBaseClasses(){const e=this._p,t=e.el;if(!t)return;let s=[e.baseClassName];e.multi?s.push("".concat(e.baseClassName,"__multi")):s.push("".concat(e.baseClassName,"__single")),this.isListOpen()?s.push("".concat(e.baseClassName,"__open_list")):s.push("".concat(e.baseClassName,"__closed_list")),e.hasOpenIndicator&&s.push("".concat(e.baseClassName,"__has_open_indicator")),e.clearButtonWrapper&&s.push("".concat(e.baseClassName,"__has_clear")),e.isLoadingMode&&s.push("".concat(e.baseClassName,"__has_spinner")),0===e.selectedValues.length&&s.push("".concat(e.baseClassName,"__empty_selection")),e.selectedValues.length>0&&s.push("".concat(e.baseClassName,"__has_selection")),(e.searchable||e.multi)&&s.push("".concat(e.baseClassName,"__searchable")),"ltr"!==e.direction&&"rtl"!==e.direction||s.push("".concat(e.baseClassName,"__")+e.direction),e.additionalClasses&&(s=s.concat(e.additionalClasses)),t.className=s.join(" ")}_setupDropdownMenu(){const t=this._p,s=t.valueProp;t.dropList&&(t.dropList.destroy(),delete t.dropList,t.itemsChanged=!0,t.selectionChanged=!0,t.resortBySelectionNeeded=!0);const i=t.renderNoResultsItem,r=t.unrenderNoResultsItem,n=(t.listOptions||{}).renderItem,l=(t.listOptions||{}).unrenderItem,o=i||n?(r,l)=>r&&r[s]===fa?(i&&!1!==i(r,l)||l.appendChild(e.createElement("div",{class:"droplist-no-results-content",textContent:t.noResultsText})),!0):!!n&&n(r,l):null,a=r||n?(e,t)=>{if(e&&e[s]===fa){if(r)return r(e,t)}else if(l)return l(e,t);return!1}:null,u=t.dropList=new ha({virtualMinItems:10,...t.listOptions,renderItem:o,unrenderItem:a,multi:t.multi,capturesFocus:!1,labelProp:t.labelProp,valueProp:t.valueProp,on:(e,s)=>{switch(e){case"show:before":{t.dropListVisible=!0,t.el.setAttribute("aria-expanded","true"),t.el.classList.add("".concat(t.baseClassName,"__open_list")),t.el.classList.remove("".concat(t.baseClassName,"__closed_list")),t.resortBySelectionNeeded&&t.sortListCheckedFirst&&t.multi&&(t.itemsChanged=!0),this._updateListItems(),this._trigger("open",{list:u}),this._startTrackingPresence(),t.sink.add(window,"resize.trackposition",(()=>this._repositionDropList()));let e=t.el.parentNode;for(;e;)(e.scrollHeight>e.offsetHeight||e.scrollWidth>e.offsetWidth)&&(e===document.documentElement&&(e=window),t.sink.add(e,"scroll.trackposition",(()=>this._repositionDropList()))),e=e.parentNode}break;case"hide":if(t.dropListVisible=!1,t.el.setAttribute("aria-expanded","false"),t.el.classList.remove("".concat(t.baseClassName,"__open_list")),t.el.classList.add("".concat(t.baseClassName,"__closed_list")),t.multi||(this._setInputText(""),this._scheduleSync("render_base")),this._trigger("close"),this[_a])return;this._stopTrackingPresence(),t.sink.remove(null,".trackposition");break;case"check":{if(!t.multi)return;const e=s.item,i=s.value;let r=s.checked;if(s.isGroup&&!t.treatGroupSelectionAsItems)return;let n={value:i,item:e,cancel:!1};if(this._trigger((r?"addsel":"removesel")+":before",n),n.cancel)return void t.dropList.setItemChecked(i,!r);if(r)t.selectedItems.push(e),t.selectedValues.push(i);else{const e=t.selectedValues.indexOf(i);-1!==e&&(t.selectedItems.splice(e,1),t.selectedValues.splice(e,1))}const l=!!s.isCheckingGroup;t.showSelection&&(r?(1===u.itemCount()&&this._setInputText(""),t.sortSelectedItems?l||this._scheduleSync("full"):(null!=t.maxMultiItems&&(t.treatGroupSelectionAsItems?t.selectedItems:t.selectedItems.filter((e=>!e._group))).length>t.maxMultiItems?this._scheduleSync("addOrUpdateMultiItemRestElement"):this._scheduleSync("addMultiItemElement",e),l||this._scheduleSync("render_base"))):(null!=t.maxMultiItems&&(t.treatGroupSelectionAsItems?t.selectedItems:t.selectedItems.filter((e=>!e._group))).length===t.maxMultiItems?this._scheduleSync("removeMultiItemRestElement"):this._scheduleSync("removeMultiItemElement",e),l||this._scheduleSync("render_base"))),this._trigger(r?"addsel":"removesel",{value:i,item:e})}break;case"groupcheck":if(!t.multi)return;s.affectedItems&&this._scheduleSync(t.sortSelectedItems?"full":"render_base");break;case"select":{if(t.multi)return;const e=s.item,i=s.value;if(!this._performSelectWithEvent(e,i))return;if(this[_a])return;this.closeList(),("touch"===t.blurOnSingleSelection&&ba||"touch"!==t.blurOnSingleSelection&&t.blurOnSingleSelection)&&t.input&&t.input.blur()}}}});t.sink.add(u.el,"mousedown",(t=>{e.closestUntil(t.target,"li",t.currentTarget)&&t.preventDefault()})),this._registerDropdownEvents()}_unregisterDropdownEvents(){this._p.sink.remove(null,".dropdown")}_registerDropdownEvents(){const t=this._p;this._unregisterDropdownEvents();const s=t.dropList;if(!s)return;let i=!1,r=null;const l=t.multi||t.searchable?t.input:t.el;t.sink.add(l,"keydown.dropdown",(e=>{if(e.currentTarget.readOnly)return;let i=!1,r=t.lastKeyAllowsNonTypeKeys;t.lastKeyAllowsNonTypeKeys=!1;let l=t.input&&t.input.value.length>0;switch(e.key){case n.VALUE_PAGE_UP:case n.VALUE_PAGE_DOWN:case n.VALUE_UP:case n.VALUE_DOWN:case n.VALUE_HOME:case n.VALUE_END:if((e.key===n.VALUE_HOME||e.key===n.VALUE_END)&&l&&!r){s._keydownFreeType(e);break}switch(t.lastKeyAllowsNonTypeKeys=!0,e.preventDefault(),e.key){case n.VALUE_PAGE_UP:s.isVisible()&&s.previousPage(e);break;case n.VALUE_PAGE_DOWN:s.isVisible()&&s.nextPage(e);break;case n.VALUE_UP:s.isVisible()?s.previous(e):this._movePrev();break;case n.VALUE_DOWN:s.isVisible()?s.next(e):this._moveNext();break;case n.VALUE_HOME:s.goToFirst(e);break;case n.VALUE_END:s.goToLast(e)}break;case n.VALUE_SPACE:r&&(t.lastKeyAllowsNonTypeKeys=!0,s.isVisible()&&s.hasFocusedItem()&&(i=!0,t.multi?s.toggleFocusedItem(e):s.triggerItemSelection(null,e),e.preventDefault()));break;case n.VALUE_ENTER:s.isVisible()&&s.hasFocusedItem()&&(i=!0,e.preventDefault(),s.triggerItemSelection(null,e));break;case n.VALUE_TAB:s.isVisible()&&s.hasFocusedItem()&&s.triggerItemSelection(null,e);break;case n.VALUE_ESCAPE:s.isVisible()&&(s.hide(e),e.preventDefault());break;default:s._keydownFreeType(e)}i||e.key!==n.VALUE_ENTER&&(e.key!==n.VALUE_SPACE||!t.lastKeyAllowsNonTypeKeys||t.multi||s.hasFocusedItem()||t.disabled)||(this.toggleList(),e.preventDefault(),e.stopPropagation())})),t.input&&t.sink.add(t.input,"input.dropdown",(()=>{t.disabled||(t.filterTerm=t.input.value.trim(),t.filteredItems=null,t.itemsChanged=!0,this._trigger("search",{value:t.input.value}),t.throttledUpdateListItems())})).add(t.input,"click.dropdown",(()=>{t.disabled||!t.multi&&t.searchable&&this.openList()})).add(t.input,"focus.dropdown",(()=>{t.disabled||(this._trigger("search:focus"),this[_a]||(i=!1,this.openList(),i=!0,setTimeout((()=>{i=!1}),10)))})).add(t.input,"blur.dropdown",(()=>{t.disabled||(this._trigger("search:blur"),this[_a]||(t.throttledUpdateListItems&&t.throttledUpdateListItems.cancel(),this.closeList()))})),t.sink.add(t.el,"mousedown.dropdown",(()=>{t.multi||t.searchable||i||t.disabled||this.toggleList(),i=!1})).add(t.el,"touchstart.dropdown",(s=>{if(r)return;if(r=s.changedTouches[0].identifier,this.isDisabled())return;if(e.closestUntil(s.target,".".concat(t.baseClassName,"__item,.").concat(t.baseClassName,"__clear"),t.el))return;let i=()=>{r=null,t.sink.remove(t.el,".dropdown_touchextra")};(t.input||t.el).focus(),t.sink.add(t.el,"touchend.dropdown_touchextra",(e=>{if(!Array.prototype.find.call(s.changedTouches,(e=>e.identifier===r)))return i();e.preventDefault(),i()})).add(t.el,"touchmove.dropdown_touchextra",(e=>{e.preventDefault()})).add(t.el,"touchcancel.dropdown_touchextra",i)}))}_performSelectWithEvent(e,t){let s={value:t,item:e,cancel:!1};return this._trigger("select:before",s),!s.cancel&&!this[_a]&&(this._setSelectedItems([e]),this._trigger("select",{value:t,item:e}),!0)}_performClearWithEvent(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t={cancel:!1};return this._trigger("clear:before",t),!t.cancel&&!this[_a]&&(this._setSelectedItems([]),e&&this._setInputText(""),this._trigger("clear"),!0)}_movePrev(){var e;const t=this._p;if(this.isMultiEnabled())return;let s=this.getSelectedItems(),i=null!==(e=t.filteredItems)&&void 0!==e?e:t.items;if(t.currentItemsView&&t.currentItemsView.length===i.length&&(i=t.currentItemsView),i.length+(t.clearable?1:0)>1){let e=s.length>0?i.indexOf(s[0])-1:i.length-1;-1!==e||t.clearable||(e=i.length-1);let r=-1===e?null:i[e];r?this._performSelectWithEvent(r,r[t.valueProp]):this._performClearWithEvent()}}_moveNext(){var e;const t=this._p;if(this.isMultiEnabled())return;let s=this.getSelectedItems(),i=null!==(e=t.filteredItems)&&void 0!==e?e:t.items;if(t.currentItemsView&&t.currentItemsView.length===i.length&&(i=t.currentItemsView),i.length+(t.clearable?1:0)>1){let e=s.length>0?i.indexOf(s[0])+1:0;e===i.length&&(e=t.clearable?-1:0);let r=-1===e?null:i[e];r?this._performSelectWithEvent(r,r[t.valueProp]):this._performClearWithEvent()}}_updateListItems(){const e=this._p,t=e.dropList;if(!t||!e.dropListVisible)return;if(!e.filteredItems&&(e.filterTerm||e.filterOnEmptyTerm&&e.filterFn)&&this._refilterItems(),(e.itemsChanged||e.selectionChanged)&&(e.dropList._lastSerializedBox=null),e.itemsChanged){let s=e.filteredItems||e.items;(e.sortListItems||e.sortListCheckedFirst&&e.multi)&&(s=this._sortItems(s,e.sortListItems,e.sortListCheckedFirst&&e.multi,e.splitListCheckedGroups)),t.removeAllItems(),0===s.length&&e.noResultsText&&(s=[{[e.labelProp]:e.noResultsText,[e.valueProp]:fa,_nointeraction:!0,_nocheck:!0}]),t.addItems(s),e.currentItemsView=s,e.itemsChanged=!1,e.selectionChanged=!0,e.resortBySelectionNeeded=!1}let s=!1;if(e.selectionChanged){if(e.multi)e.dropList.setCheckedValues(e.selectedValues);else{const t=e.dropList.itemIndexByValue(this.getValue());e.dropList.setFocusedItemAtIndex(t).setSingleSelectedItemAtIndex(t),s=e.dropList.hasFocusedItem()}e.selectionChanged=!1}this._repositionDropList(),s&&e.dropList.setFocusedItemAtIndex(e.dropList.getFocusedItemIndex())}_refilterItems(){const e=this._p,t=e.filterTerm,s=e.treatGroupSelectionAsItems;if(t||e.filterOnEmptyTerm&&e.filterFn){let i;if("function"==typeof e.filterFn&&(i=e.filterFn(e.items,t)),!Array.isArray(i))if(t){const r=new RegExp(la(t),"i"),n=e.labelProp,l=e.multiItemLabelProp;i=e.items.filter((e=>!(s||!e._group)||r.test(e[n]||e[l])))}else i=null;if(e.filteredItems=i,i&&!s){let e=-1,t=i.length;for(let s=0;s<t;s++)i[s]._group&&(-1!==e&&e===s-1&&(i.splice(e,1),s--,t--),e=s);-1!==e&&e===t-1&&i.splice(e,1)}}else e.filteredItems=null;this._trigger("itemschanged",{term:t,mutated:!1,count:this.getFilteredItemCount()}),e.itemsChanged=!0}_setSelectedItems(e){const t=this._p,s=t.valueProp;t.multi?(t.selectedItems=e.filter((e=>void 0!==e[s])),t.selectedValues=t.selectedItems.map((e=>e[s]))):(t.selectedItems=e.slice(0,1),t.selectedValues=e.slice(0,1).map((e=>e[s]))),t.selectionChanged=!0,t.resortBySelectionNeeded=!0,this._updateListItems(),this._scheduleSync("full")}_scheduleSync(e,t){const s=this._p;s.syncQueue||(s.syncQueue=[]),("full"===e||"render_items"===e&&!s.syncQueue.some((e=>"full"===e.mode)))&&(s.syncQueue.length=0),0!==s.syncQueue.length&&["full","render_items"].includes(e)||s.syncQueue.push({mode:e,data:t}),s.syncTimeout||(s.syncTimeout=setTimeout((()=>{delete s.syncTimeout;let e=s.syncQueue;delete s.syncQueue,this._performSync(e)})))}_performSync(e){const t=this._p;if(!this[_a])for(let i of e)switch(i.mode){case"full":this._syncFull(!0,!0);break;case"render_base":this._syncFull(!1,!1);break;case"render_items":this._syncFull(!0,!1);break;case"render_list":this._syncFull(!1,!0);break;case"render_clear":this._syncClearButton(),this._resizeInput();break;case"singleItem":this._syncSingleItem();break;case"removeMultiItemElement":if(t.showSelection)this._syncPlaceholder();else{const e=t.valueProp,s=i.data[e];let r=t.multiItemEls.findIndex((t=>t[pa][e]===s));-1!==r&&this._removeMultiItemElementByIndex(r)}break;case"addMultiItemElement":t.showSelection?this._addMultiItemElement(i.data):this._syncPlaceholder();break;case"addOrUpdateMultiItemRestElement":t.showSelection?this._addMultiItemRestElement():this._syncPlaceholder();break;case"removeMultiItemRestElement":if(t.showSelection){var s;let e=t.multiItemEls[t.multiItemEls.length-1];(null==e||null===(s=e[pa])||void 0===s?void 0:s[t.valueProp])===ga&&this._removeMultiItemElementByIndex(t.multiItemEls.length-1)}else this._syncPlaceholder();break;case"resize_input":this._resizeInput()}}_cleanupSingleWrapper(){const e=this._p;if(e.singleWrapper){if(e.unrenderSingleItem&&e.singleWrapper.childNodes.length>0)try{e.unrenderSingleItem(e.singleWrapper[pa],e.singleWrapper)}catch(e){console.error(e)}delete e.singleWrapper[pa],e.singleWrapper.innerHTML=""}}_removeMultiItemElementByIndex(e){const s=this._p,i=s.multiItemEls;if(i.length>e){var r;const n=i[e],l=n[pa];let o=(null==l?void 0:l[s.valueProp])===ga&&null!==(r=s.unrenderRestMultiItem)&&void 0!==r?r:s.unrenderMultiItem;if(o&&n.childNodes.length>0)try{o(l,n)}catch(e){console.error(e)}t.remove(n),e===i.length-1?i.pop():i.splice(e,1)}}_renderSingleItemContent(e){const t=this._p;if(!t.renderSingleItem||!1===t.renderSingleItem(e,t.singleWrapper)){const s=t.labelProp;let i=e[t.multiItemLabelProp]||e[s];null==i&&(i=""),t.singleWrapper.appendChild(document.createTextNode(i))}}_renderMultiItemContent(t,s){var i;const r=this._p;let n=t[r.valueProp]===ga&&null!==(i=r.renderRestMultiItem)&&void 0!==i?i:r.renderMultiItem;if(!n||!1===n(t,s)){const i=r.labelProp,n=t[r.multiItemLabelProp]||t[i];s.appendChild(e.createElement("span",{textContent:n}))}}_addMultiItemElement(e){const s=this._p,i=this._renderMultiItem(e);return!!i&&(t.before(s.inputWrapper,i),s.multiItemEls.push(i),!0)}_addMultiItemRestElement(){const e=this._p;let t=e.selectedItems.slice(0),s=(e.treatGroupSelectionAsItems?t:t.filter((e=>!e._group))).length-e.maxMultiItems,i=e.multiItemsRestLabelProvider?e.multiItemsRestLabelProvider(s,t):"+ ".concat(s);this._addMultiItemElement({items:t,[e.valueProp]:ga,[e.labelProp]:i})}_syncClearButton(){const s=this._p,i=s.multiItemLabelProp;s.selectedItems.length>0&&s.selectedItems.some((e=>!1!==e[i]))&&s.clearable&&s.showSelection?s.clearButtonWrapper||(s.clearButtonWrapper=e.createElement(s.multi?"li":"span",{class:"".concat(s.baseClassName,"__clear")},s.clearButton=e.createElement("button")),s.multi?t.append(s.list,s.clearButtonWrapper):t.append(s.el,s.clearButtonWrapper),s.el.classList.add("".concat(s.baseClassName,"__has_clear")),s.sink.add(s.clearButton,"click",(()=>{this.isDisabled()||this.clear()}))):s.clearButtonWrapper&&(s.sink.remove(s.clearButton,"click"),t.remove(s.clearButtonWrapper),delete s.clearButtonWrapper,delete s.clearButton,s.el.classList.remove("".concat(s.baseClassName,"__has_clear")))}_syncPlaceholder(){const e=this._p,t=e.multiItemLabelProp;let s="";e.multi&&!e.showSelection?s="function"==typeof e.multiPlaceholderFormatter?e.multiPlaceholderFormatter(e.selectedItems):((e,t)=>{if(0===e.length)return"";let s=e[0][t]+"";return e.length>1&&(s+=" (+".concat(e.length-1,")")),s})(e.selectedItems,e.labelProp):0!==e.selectedItems.length&&e.showSelection&&!e.selectedItems.every((e=>!1===e[t]))||(s=null==e.placeholder?"":e.placeholder+""),e.input.setAttribute("placeholder",s),e.showPlaceholderInTooltip?e.input.setAttribute("title",s):e.input.removeAttribute("title")}_syncSingleItem(){const e=this._p;e.singleWrapper&&this._cleanupSingleWrapper();const t=e.selectedItems;t.length>0&&(this._renderSingleItemContent(t[0]),e.singleWrapper[pa]=t[0])}_syncFull(e,s){const i=this._p,r=i.multiItemLabelProp;if(this._renderBase(),this._syncClearButton(),this._syncPlaceholder(),(e=i.multi&&i.showSelection&&(e||i.selectedItems.filter((e=>!1!==e[r])).length!==i.multiItemEls.length))||!i.showSelection||!i.multi)for(;i.multiItemEls.length>0;)this._removeMultiItemElementByIndex(i.multiItemEls.length-1);if(i.multi){if(e){const e=i.selectedItems,t=i.treatGroupSelectionAsItems;if(i.sortSelectedItems){const t=i.labelProp,s=i.multiItemLabelProp,r=i.valueProp,n=i.stickyValues,l=i.sortItemComparator||((e,i)=>{if(null!==n){let t=n.has(e[r]),s=n.has(i[r]);if(t&&!s)return-1;if(!t&&s)return 1}const l=e[s]||e[t],o=i[s]||i[t];return l<o?-1:l>o?1:0});e.sort(l),i.selectedValues=e.map((e=>e[r]))}let s=0,r=i.maxMultiItems,n=!1;for(let i=0;i<e.length;i++)if(t||!e[i]._group){if(null!=r&&s===r){n=!0;break}this._addMultiItemElement(e[i])&&s++}n&&this._addMultiItemRestElement()}}else i.multi||this._syncSingleItem();return t.getRootNode(i.el)!==document||(t.toggleClass(i.el,"".concat(i.baseClassName,"__empty_selection"),0===i.selectedValues.length),t.toggleClass(i.el,"".concat(i.baseClassName,"__has_selection"),i.selectedValues.length>0),i.searchable||i.multi?(i.input&&(i.input.readOnly=!1),i.el.classList.add("".concat(i.baseClassName,"__searchable"))):(i.input&&(i.input.readOnly=!0),i.el.classList.remove("".concat(i.baseClassName,"__searchable"))),this._resizeInput(),s&&this._updateListItems()),this}_trigger(e,t){const s=this._p;s.on&&s.on(e,...void 0===t?[]:[t]),s.mitt.emit(e,t)}_renderMultiItem(t){var s;const i=this._p,r=i.labelProp,n=null!==(s=t[i.multiItemLabelProp])&&void 0!==s?s:t[r];if(!1===n)return null;const l=e.createElement("li",{class:"".concat(i.baseClassName,"__item"),tabindex:"0",title:n},[e.createElement("span",{class:"".concat(i.baseClassName,"__item_remove"),role:"presentation"})]);return this._renderMultiItemContent(t,l),l[pa]=t,l}_removeMultiItemFromEvent(t,s){const i=this._p;let r;if(/key/.test(s.type)){const l=s;l.key===n.VALUE_DELETE?r=e.next(t,".".concat(i.baseClassName,"__item,.").concat(i.baseClassName,"__search_wrapper")):l.key===n.VALUE_BACK_SPACE&&(r=e.prev(t,".".concat(i.baseClassName,"__item,.").concat(i.baseClassName,"__search_wrapper")))}else/click|mouse|touch/.test(s.type)&&(r=e.next(t,".".concat(i.baseClassName,"__item,.").concat(i.baseClassName,"__search_wrapper")));const l=t[pa],o=l[i.valueProp];if(void 0!==l)if(o===ga){let e=(i.treatGroupSelectionAsItems?i.selectedItems:i.selectedItems.filter((e=>!e._group))).slice(i.maxMultiItems),t=[];for(let s of e){let e={value:o,item:s,cancel:!1};this._trigger("removesel:before",e),e.cancel||t.push(s)}if(t.length>0){this._removeMultiItemElementByIndex(i.multiItemEls.length-1);for(let e of t){let t=i.selectedItems.indexOf(e);-1===t&&(t=i.selectedValues.indexOf(o[i.valueProp])),-1!==t&&(i.selectedItems.splice(t,1),i.selectedValues.splice(t,1),i.selectionChanged=!0,i.resortBySelectionNeeded=!0)}}e.length>t.length&&this._addMultiItemRestElement(),t.length>0&&this._scheduleSync("render_list")}else{let e={value:o,item:l,cancel:!1};if(this._trigger("removesel:before",e),e.cancel)return this;this._removeMultiItem(l),this._trigger("removesel",{value:o,item:l})}return r||(r=i.el.querySelector(".".concat(i.baseClassName,"__item, .").concat(i.baseClassName,"__search_field"))),Ia(r,"".concat(i.baseClassName,"__search_wrapper"))&&(r=r.querySelector("input")),r&&r.focus(),this}_removeMultiItem(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const s=this._p,i=s.valueProp,r=s.labelProp,n=e[i];let l=s.selectedItems.indexOf(e);-1===l&&(l=s.selectedValues.indexOf(n)),-1!==l&&(s.selectedItems.splice(l,1),s.selectedValues.splice(l,1),s.selectionChanged=!0,s.resortBySelectionNeeded=!0),l=s.multiItemEls.findIndex((t=>t[pa]===e)),-1===l&&(l=s.multiItemEls.findIndex((e=>e[pa][i]===n))),-1!==l&&this._removeMultiItemElementByIndex(l),t&&(this._setInputText(e[s.multiItemLabelProp]||e[r]),s.input.focus(),s.input.selectionStart=s.input.selectionEnd=s.input.value.length),this._scheduleSync("render_list")}_setInputText(e){const t=this._p;t.input.value=null==e?"":String(e),t.filterTerm="",t.filteredItems=null,t.itemsChanged=!0}_resizeInput(){const e=this._p,i=e.el;if(!i.parentNode||!document.body.contains(i))return this;const r=e.input,n=e.inputBackBuffer;let l=r.value||r.placeholder;t.toggleClass(i,"".concat(e.baseClassName,"__has_input"),!!l),t.toggleClass(i,"".concat(e.baseClassName,"__empty_input"),!l);let o=!1;if(e.multi&&0===e.multiItemEls.length&&e.showSelection){r.style.width="";let t=0,n=0,l=getComputedStyle(e.list||i,"::before");l.content&&"none"!==l.content&&"absolute"!==l.position&&"none"!==l.float&&(t=s.getPseudoElementWidth(e.list||i,"::before",!0,!0,!0));let a=getComputedStyle(e.list||i,"::after");a.content&&"none"!==a.content&&"absolute"!==a.position&&"none"!==a.float&&(n=s.getPseudoElementWidth(e.list||i,"::after",!0,!0,!0));let u=s.getElementWidth(e.list||i);u-=t+n,r.style.width="".concat(u,"px"),o=!0}else{s.setCssProps(n,s.getCssProps(r,va)),n.textContent=l,i.appendChild(n);const a=getComputedStyle(r),u=(parseFloat(a.paddingLeft)||0)+(parseFloat(a.paddingRight)||0),c=.75*(parseFloat(a["font-size"])||0)+u,d=s.getElementWidth(n,!0,!0),h=s.getElementWidth(r,!0,!0);let m=Math.max(d,c);if(m!==h){s.setElementWidth(r,m,!0,!0);let t=(parseFloat(a.borderLeftWidth)||0)+(parseFloat(a.borderRightWidth)||0),i=r.scrollWidth+t;if(i>m){let e=i-m;r.style.width="".concat(parseFloat(r.style.width)+e,"px"),m+=e}if(e.singleWrapper&&(e.singleWrapper.style.width="",l)){let i=m-u-t;s.getElementWidth(e.singleWrapper,!1,!1)<i&&s.setElementWidth(e.singleWrapper,i,!1,!1)}o=!0}t.remove(n)}return o&&this._trigger("input:resize"),this}_repositionDropList(){const e=this._p,t=e.el;if(!e.dropList||!e.dropListVisible||!e.dropList.isVisible())return this;const s=t.getBoundingClientRect(),i=s.left+","+s.top+","+s.right+","+s.bottom;return e.dropList._lastSerializedBox!==i&&(e.dropList.relayout(this._getDropListPositionOptions()),e.dropList._lastSerializedBox=i),this}_handleInputKeydown(e){const t=this._p,s=e.target;if(e.key===n.VALUE_BACK_SPACE&&e.ctrlKey&&0===s.value.length)this.clear(),e.preventDefault();else if(e.key===n.VALUE_BACK_SPACE&&0===s.value.length){const s=t.multiItemEls[t.multiItemEls.length-1];if(!s||void 0===s[pa].value)return;const i=s[pa],r=i[t.valueProp];let n={value:r,item:i,cancel:!1};if(this._trigger("removesel:before",n),n.cancel)return;this._removeMultiItem(i,!0),this._trigger("removesel",{value:r,item:i}),e.preventDefault()}}_handleMultiKeydown(t){const s=this._p;if(s.disabled)return;const i="rtl"===getComputedStyle(s.el).direction;let r;if(t.key===(i?n.VALUE_LEFT:n.VALUE_RIGHT))r=e.next(t.target,".".concat(s.baseClassName,"__item,.").concat(s.baseClassName,"__search_wrapper")),Ia(r,"".concat(s.baseClassName,"__search_wrapper"))&&(r=r.querySelector("input")),r&&r.focus(),t.preventDefault();else if(t.key===(i?n.VALUE_RIGHT:n.VALUE_LEFT))r=e.prev(t.target,".".concat(s.baseClassName,"__item,.").concat(s.baseClassName,"__search_wrapper")),Ia(r,"".concat(s.baseClassName,"__search_wrapper"))&&(r=r.querySelector("input")),r&&r.focus(),t.preventDefault();else if(t.key===n.VALUE_BACK_SPACE&&t.ctrlKey){const i=[];let r=t.target;for(;r;)i.push(r),r=e.prev(r,".".concat(s.baseClassName,"__item"));for(;i.length;)this._removeMultiItemFromEvent(i.shift(),t);t.preventDefault()}else t.key!==n.VALUE_DELETE&&t.key!==n.VALUE_BACK_SPACE||(this._removeMultiItemFromEvent(e.closestUntil(t.target,".".concat(s.baseClassName,"__item"),s.el),t),t.preventDefault())}_getDropListPositionOptions(){return{target:this._p.el,offset:{x:0,y:0},anchor:{x:"start",y:"bottom"},position:{x:"start",y:"top"},updateWidth:!0}}_startTrackingPresence(){const e=this._p;this._stopTrackingPresence(),e.presenceInt=setInterval((function(){t.getRootNode(e.el)!==document&&this.hide()}),200)}_stopTrackingPresence(){const e=this._p;e.presenceInt&&(clearInterval(e.presenceInt),e.presenceInt=null)}_sortItems(e,t,s,i){const r=this._p;if(!t&&!s)return e;const n=r.labelProp,l=r.multiItemLabelProp,o=r.valueProp,a=r.stickyValues,u=r.sortItemComparator||((e,t)=>{if(null!==a){let s=a.has(e[o]),i=a.has(t[o]);if(s&&!i)return-1;if(!s&&i)return 1}const s=e[n]||e[l],i=t[n]||t[l];return s<i?-1:s>i?1:0});let c=[],d=null,h=[c];const m=new Set(r.selectedValues);let p,_,f;for(_=0,f=e.length;_<f;_++)p=e[_],p._group&&c.length&&(c=[],h.push(c)),c.push(p);c.length||(h.length=0),a&&e.length>0&&!e[0]._group&&(d=h[0].filter((e=>a.has(e[o]))),d.length>0?(h[0]=h[0].filter((e=>!a.has(e[o]))),0===h[0].length&&h.shift()):d=null),t&&h.sort(((e,t)=>{if(e=e[0],t=t[0],null!==a){let s=a.has(e[o]),i=a.has(t[o]);if(s&&!i)return-1;if(!s&&i)return 1}return!e._group&&t._group?-1:e._group&&!t._group?1:u(e,t)})),d&&h.unshift(d);const g=[],b=[];for(let e=0,i=h.length;e<i;e++)c=h[e],c.sort(((e,i)=>{if(e._group&&!i._group)return-1;if(!e._group&&i._group)return 1;if(s){const t=m.has(e[o]),s=m.has(i[o]);if(t&&!s)return-1;if(!t&&s)return 1}return t?u(e,i):0})),b.push(c);if(s&&i){let e;for(let t=0,s=h.length;t<s;t++)if(c=h[t],c!==d){e=null;for(let t=0,s=c.length;t<s;t++)if(p=c[t],!p._group){if(!m.has(p[r.valueProp]))break;e||(e=[],c[0]._group&&e.push(c[0])),e.push(p),c.splice(t--,1),s--}if(e&&(g.push(e),0===c.length||1===c.length&&c[0]._group)){h.splice(t--,1),s--;let e=b.indexOf(c);-1!==e&&b.splice(e,1)}}else{g.push(d);let e=b.indexOf(d);-1!==e&&b.splice(e,1)}}const I=[];I.length=e.length;let v=0;h=g.length?g.concat(b):b;for(let e=0,t=h.length;e<t;e++)for(c=h[e],_=0,f=c.length;_<f;_++)I[v++]=c[_];return I}};
|
|
5
|
+
"use strict";var e=require("@danielgindi/dom-utils/lib/Dom"),t=require("@danielgindi/dom-utils/lib/DomCompat"),s=require("@danielgindi/dom-utils/lib/Css"),i=require("@danielgindi/dom-utils/lib/DomEventsSink"),l=require("@danielgindi/virtual-list-helper"),r=require("keycode-js"),n=require("mitt"),o=e=>e.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&");const a=Symbol("item"),u=Symbol("destroyed"),c=Symbol("ghost"),d=Object.prototype.hasOwnProperty;let m={baseClassName:"droplist",autoItemBlur:!0,autoItemBlurDelay:300,capturesFocus:!0,multi:!1,keyDownHandler:null,autoCheckGroupChildren:!0,useExactTargetWidth:!1,constrainToWindow:!0,autoFlipDirection:!0,estimateWidth:!1,virtualMinItems:100,labelProp:"label",valueProp:"value",on:null};class h{constructor(t){const r={...m};for(let[e,s]of Object.entries(t))void 0!==s&&(r[e]=s);const o=this._p={ownsEl:!0,elOriginalDisplay:"",baseClassName:r.baseClassName,additionalClasses:r.additionalClasses,direction:"ltr"===r.direction?"ltr":"rtl"===r.direction?"rtl":"auto",autoItemBlur:r.autoItemBlur,autoItemBlurDelay:r.autoItemBlurDelay,capturesFocus:r.capturesFocus,multi:r.multi,keyDownHandler:r.keyDownHandler,autoCheckGroupChildren:r.autoCheckGroupChildren,useExactTargetWidth:r.useExactTargetWidth,constrainToWindow:r.constrainToWindow,autoFlipDirection:r.autoFlipDirection,estimatedItemHeight:r.estimatedItemHeight,estimateWidth:r.estimateWidth,virtualMinItems:r.virtualMinItems,labelProp:r.labelProp,valueProp:r.valueProp,renderItem:r.renderItem,unrenderItem:r.unrenderItem,on:r.on||null,silenceEvents:!0,mitt:n(),focusItemIndex:-1,focusItemEl:null,sink:new i};let u=[o.baseClassName];o.additionalClasses&&(u=u.concat((o.additionalClasses+"").split(" ").filter((e=>e))));const d={top:"-9999px"};let h=r.el;if(h instanceof Element?(o.elOriginalDisplay=h.style.display||"",h.classList.add(...u),h.role="menu",s.setCssProps(h,d),o.ownsEl=!1):h=e.createElement("ul",{class:u.join(" "),role:"menu",css:d}),o.el=h,o.items=[],o.groupCount=0,o.mouseHandled=!1,o.virtualListHelper=new l({list:o.el,virtual:!0,buffer:5,estimatedItemHeight:r.estimatedItemHeight||20,itemElementCreatorFn:()=>e.createElement("li",{role:"menuitem",tabIndex:o.capturesFocus?-1:null}),onItemRender:(e,t)=>{let s;t===c?(s={label:o.lastMeasureLongestLabelText,value:"Measure",[a]:{[o.labelProp]:o.lastMeasureLongestLabelText,[o.valueProp]:"Measure"}},e.setAttribute("aria-hidden","true")):s=o.items[t],s||console.warn("onItemRender called for ("+t+") which has no item"),e.className=`${o.baseClassName}__item`;const i=e.classList;o.multi?s._nocheck?i.add(`${o.baseClassName}__item_multi_nocheck`):(i.add(`${o.baseClassName}__item_multi`),s._checked&&i.add(`${o.baseClassName}__item_checked`)):i.add(`${o.baseClassName}__item_single`),s._group&&i.add(`${o.baseClassName}__item_group`),s._child&&i.add(`${o.baseClassName}__item_child`),s._nointeraction&&i.add(`${o.baseClassName}__item_nointeraction`),o.focusItemIndex===t&&(o.focusItemEl=e,i.add(`${o.baseClassName}__item_focus`)),this._renderItemContent(s,e),e[a]=s}}),"function"==typeof o.unrenderItem){const e=o.unrenderItem;o.virtualListHelper.setOnItemUnrender((t=>{try{e(t[a][a],t)}catch(e){console.error(e)}delete t[a],o.focusItemEl===t&&(o.focusItemEl=null)}))}else o.virtualListHelper.setOnItemUnrender((e=>{delete e[a],o.focusItemEl===e&&(o.focusItemEl=null)}));o.capturesFocus&&(h.tabIndex=0),this._hookMouseEvents(),this._hookTouchEvents(),this._hookFocusEvents(),this._hookKeyEvents(),this.silenceEvents=!1}destroy(){if(this[u])return;this[u]=!0;const e=this._p;if(clearTimeout(e.blurTimer),clearTimeout(e.filterTimer),e.sink.remove(),e.virtualListHelper.destroy(),e.el&&t.remove(e.el),e.currentSubDropList&&(e.currentSubDropList?.droplist?.destroy(),e.currentSubDropList=null),!e.ownsEl){for(let t of Array.from(e.el.classList))t.startsWith(e.baseClassName)&&e.el.classList.remove(t);e.el.removeAttribute("role");for(let t of["position","left","top","right","bottom","z-index"])e.el.style[t]="";e.el.style.display=e.elOriginalDisplay}e.lastPositionTarget&&(e.lastPositionTarget.classList.remove(`has_${e.baseClassName}`,`has_${e.baseClassName}_above`,`has_${e.baseClassName}_below`),delete e.lastPositionTarget),this._p=null}get el(){return this._p.el}elContains(e){let t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return!!this.el.contains(e)||!(!t||!this._p.currentSubDropList?.droplist?.elContains(e))}setAdditionalClasses(e){return this._p.additionalClasses=e,this._syncBaseClasses(),this}setDirection(e){return this._p.direction="ltr"===e?"ltr":"rtl"===e?"rtl":"auto",this._syncBaseClasses(),this}getDirection(){return this._p.direction}setLabelProp(e){return this._p.labelProp=e,this}setRenderItem(e){return this._p.renderItem=e,this}setUnrenderItem(e){const t=this._p;if(t.unrenderItem=e,"function"==typeof t.unrenderItem){const e=t.unrenderItem;t.virtualListHelper.setOnItemUnrender((s=>{try{e(s[a][a],s)}catch(e){console.error(e)}delete s[a],t.focusItemEl===s&&(t.focusItemEl=null)}))}else t.virtualListHelper.setOnItemUnrender((e=>{delete e[a],t.focusItemEl===e&&(t.focusItemEl=null)}));return this}setValueProp(e){return this._p.valueProp=e,this}_syncBaseClasses(){const e=this._p,t=e.el;if(!t)return;let s=[e.baseClassName];"ltr"!==e.direction&&"rtl"!==e.direction||s.push(`${e.baseClassName}__`+e.direction),e.additionalClasses&&(s=s.concat(e.additionalClasses)),t.className=s.join(" ")}blurFocusedItem(){const e=this._p;if(clearTimeout(e.blurTimer),!this.hasFocusedItem())return;let t=e.focusItemEl;t&&(t.classList.remove(`${e.baseClassName}__item_focus`),e.focusItemEl=null);const s=e.items[e.focusItemIndex];e.focusItemIndex=-1,s&&(e.currentSubDropList&&this._hideSublist(),this._trigger("itemblur",{value:s.value,item:s[a]??s}))}nextPage(e){this._move("next_page",e)}previousPage(e){this._move("prev_page",e)}goToFirst(e){this._move("first",e)}goToLast(e){this._move("last",e)}toggleFocusedItem(){const e=this._p;if(this.hasFocusedItem()&&e.multi){let s=e.items[e.focusItemIndex];if(s._nocheck||s._nointeraction)return this;s._checked=!s._checked,e.focusItemEl&&t.toggleClass(e.focusItemEl,`${e.baseClassName}__item_checked`,s._checked),this._trigger("check",{value:s.value,item:s[a]??s,checked:s._checked,isGroup:s._group,isCheckingGroup:!1}),this._updateGroupStateForItem(s)}return this}triggerItemSelection(t,s){const i=this._p;return i.focusItemEl=i.focusItemEl||e.closestUntil(s.target,"li",i.el),i.focusItemIndex=i.virtualListHelper.getItemIndexFromElement(i.focusItemEl),void 0===i.focusItemIndex&&(i.focusItemIndex=-1),!(t=t??i.focusItemEl[a])._nointeraction&&(i.multi||this._setSingleSelectedItemEl(i.focusItemEl),this._trigger("select",{value:t?t.value:void 0,item:t[a]??t,event:s,el:i.focusItemEl}),!0)}addItem(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:-1;return this.addItems([e],t)}addItems(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:-1;const s=this._p,i=s.labelProp,l=s.valueProp;let r=s.multi,n=s.items;(null==t||t<0||t>=s.items.length)&&(t=-1),this._determineVirtualMode(n.length+e.length);for(let o=0,u=e.length;o<u;o++){let u=e[o],c={[a]:u,label:u[i],value:u[l],_nocheck:!!u._nocheck,_nointeraction:!!u._nointeraction,_subitems:u._subitems};r&&(c._checked=!!u._checked),u._group&&(c._group=!0,s.groupCount++),u._child&&(c._child=!0),-1!==t?n.splice(t,0,c):n.push(c),-1!==t&&t++}return s.virtualListHelper.addItemsAt(e.length,-1===t?t:t-e.length).render(),this}setItems(e){const t=this._p;return t.items.length=0,t.groupCount=0,t.virtualListHelper.setCount(0),this.addItems(e)}updateItemByValue(e,t){const s=this._p;let i=this.itemIndexByValue(e);if(-1===i)return this;let l=this.itemAtIndex(i);return l[a]=t,d.call(t,s.labelProp)&&(l.label=t[s.labelProp]),d.call(t,s.valueProp)&&(l.value=t[s.valueProp]),d.call(t,"_nocheck")&&(l._nocheck=!!t._nocheck),d.call(t,"_nointeraction")&&(l._nointeraction=!!t._nointeraction),d.call(t,"_subitems")&&(l._subitems=!!t._subitems),s.multi&&d.call(t,"_checked")&&(l._checked=!!t._checked),d.call(t,"_group")&&!!t._group!==l._group&&(l._group?s.groupCount--:s.groupCount++,t._group=!!l._group),d.call(t,"_child")&&(l._child=!!t._child),s.virtualListHelper.isItemRendered(i)&&s.virtualListHelper.refreshItemAt(i).render(),this}removeItem(e,t){const s=this._p;let i=this.itemIndexByValueOrLabel(e,t);return-1===i||(s.items.splice(i,1)[0]._group&&s.groupCount--,s.virtualListHelper.removeItemsAt(i,1).render()),this}removeAllItems(){const e=this._p;return e.items.length=0,e.groupCount=0,e.virtualListHelper.setCount(0).render(),this}invalidate(){return this._p.virtualListHelper.invalidate().render(),this}itemDataByValue(e){const t=this._p;for(let s=0,i=t.items.length;s<i;s++){let i=t.items[s];if(i.value===e)return i[a]}return null}itemIndexByValue(e){const t=this._p;for(let s=0,i=t.items.length;s<i;s++)if(t.items[s].value===e)return s;return-1}itemIndexByValueOrLabel(e,t){const s=this._p;for(let i=0,l=s.items.length;i<l;i++){let l=s.items[i];if(l.value===e||l.label===t)return i}return-1}items(){return this._p.items.map((e=>e[a]))}itemsReference(){return this._p.items}itemCount(){return this._p.items.length}itemAtIndex(e){return this._p.items[e]?.[a]}relayout(e){const i=this._p,l=i.el;if(!this.isVisible())return this;let r=window,n={},o=e.targetOffset||s.getElementOffset(e.target);n.left=o.left,n.top=o.top,n.height=null==e.targetHeight?s.getElementHeight(e.target,!0,!0):e.targetHeight,n.width=null==e.targetWidth?s.getElementWidth(e.target,!0,!0):e.targetWidth,n.bottom=n.top+n.height;let a={};a.top=r.pageYOffset,a.left=r.pageXOffset,a.width=r.innerWidth,a.height=r.innerHeight,a.bottom=a.top+a.height,a.right=a.left+a.width;let u=e.position&&"bottom"===e.position.y?"above":"below";l.style.width="",(i.estimateWidth||i.virtualListHelper.isVirtual())&&this._measureItem(),i.virtualListHelper.isVirtual()&&i.virtualListHelper.render(),e.updateWidth||"number"==typeof e.updateWidth?this._updateWidth(e):this._updateWidth();let c,d=n.top-a.top,m=a.bottom-n.bottom;const h=getComputedStyle(l);let p="border-box"===h.boxSizing,_=(parseFloat(h.paddingTop)||0)+(parseFloat(h.paddingBottom)||0),g=(parseFloat(h.borderTopWidth)||0)+(parseFloat(h.borderBottomWidth)||0);i.virtualListHelper.isVirtual()?c=i.virtualListHelper.estimateFullHeight()+_+g:(l.style.height="",l.style.top="-9999px",c=Math.max(s.getElementHeight(i.el),l.scrollHeight),c+=_+g);let I=parseFloat(h.maxHeight);isNaN(I)||(p||(I+=_+g),c=Math.min(c,I));let f=d>=c,b=m>=c,v=i.currentDirection||u;"above"===v&&!f&&b?v="below":"below"===v&&!b&&f?v="above":f&&b?v!==u&&("above"===u&&d>=m||"below"===u&&m>=d)&&(v=u):f||b||(d>m?v="above":m>d&&(v="below")),i.currentDirection=v;let y={width:s.getElementWidth(l,!0,!0),height:Math.min(c,Math.max(d,m,0))},C=void 0!==e.targetRtl?e.targetRtl:null!=e.target&&"rtl"===getComputedStyle(e.target).direction,E="rtl"===getComputedStyle(document.documentElement).direction,L=s.anchoredPosition(e.target,e.anchor?e.anchor.x:"start",e.anchor?e.anchor.y:"bottom",n,C),S=s.anchoredPosition(l,e.position?e.position.x:"start",e.position?e.position.y:"top",y,C),k="top"===S.ySpec&&"above"===v||"bottom"===S.ySpec&&"below"===v||"bottom"!==S.ySpec&&"top"!==S.ySpec&&"above"===v,x=void 0!==r.pageXOffset?r.pageXOffset:(document.documentElement||document.body.parentNode||document.body).scrollLeft;x=Math.abs(x),E&&(x=document.documentElement.scrollWidth-x-document.documentElement.clientWidth);let w=x,T=document.documentElement.clientWidth+x-y.width,P={position:"absolute",left:n.left,top:n.top+(k?L.bottom-S.bottom:L.top-S.top)};if(E&&(P.left-=document.documentElement.clientWidth-document.documentElement.scrollWidth),P.left+=L.left-S.left,e.offset&&(e.offset.y&&(k?P.top-=e.offset.y:P.top+=e.offset.y),e.offset.x)){let t="rtl"===h.direction;P.left+=t?-e.offset.x:e.offset.x}if(i.autoFlipDirection&&("right"===S.xSpec&&P.left<w&&(Math.max(P.left,w)+y.width-n.left)/n.width>.5||"left"===S.xSpec&&P.left>T&&(Math.min(P.left,T)-n.left)/n.width<.5)&&(P.left-=L.left-S.left,P.left+=L.right-S.right),i.constrainToWindow)for(let e of E?["min","max"]:["max","min"])"min"===e&&P.left<w?P.left=w:"max"===e&&P.left>T&&(P.left=T);return P.left+="px",P.top+="px",s.setCssProps(l,P),s.setElementHeight(l,y.height,!0,!0),i.virtualListHelper.render(),e&&e.target&&(i.lastPositionTarget=e.target,t.toggleClass(e.target,`has_${i.baseClassName}`,!0),t.toggleClass(e.target,`has_${i.baseClassName}_below`,"below"===v),t.toggleClass(e.target,`has_${i.baseClassName}_above`,"above"===v),t.toggleClass(l,`${i.baseClassName}__is_below`,"below"===v),t.toggleClass(l,`${i.baseClassName}__is_above`,"above"===v)),this}setItemChecked(e,s){const i=this._p;s=!!s;let l=this.itemIndexByValue(e);if(-1===l)return this;let r=i.virtualListHelper.getItemElementAt(l);if(!r)return this;let n=r[a];return s=s&&!n._nocheck,n._checked!==s&&(n._checked=s,t.toggleClass(r,`${i.baseClassName}__item_checked`,n._checked),this._updateGroupStateForItem(n)),this}setCheckedValues(e){const s=this._p;let i=[];for(let l=0,r=s.items.length;l<r;l++){let r=s.items[l],n=!r._nocheck&&-1!==e.indexOf(r.value);if(r._group&&i.push(l),r._checked===n)continue;r._checked=n;let o=s.virtualListHelper.getItemElementAt(l);o&&t.toggleClass(o,`${s.baseClassName}__item_checked`,r._checked)}if(s.autoCheckGroupChildren)for(let e=0,t=i.length;e<t;e++)this._updateGroupCheckedState(i[e],!1);return this}getCheckedValues(e){const t=this._p;e=e&&t.groupCount>0;let s=[];for(let i=0,l=t.items.length;i<l;i++){let l=t.items[i];l._checked&&(e&&l._group||s.push(l.value))}return s}getCheckedItems(e){const t=this._p;e=e&&t.groupCount>0;let s=[];for(let i=0,l=t.items.length;i<l;i++){let l=t.items[i];l._checked&&(e&&l._group||s.push(l[a]))}return s}show(e){const t=this._p;t.hiding=!1,this.isVisible()||this._trigger("show:before"),t.mouseHandled=!1,setTimeout((()=>{this[u]||t.onDocumentMouseDown||t.sink.add(document,"mousedown",t.onDocumentMouseDown=e=>{t.el.contains(e.target)||this._delayBlurItemOnBlur()})}));const s=t.el;if(s.style.position="absolute",s.classList.remove(`${t.baseClassName}__is-hiding`),document.body.appendChild(s),t.visible=!0,t.el.style.display="","none"===getComputedStyle(t.el).display&&(t.el.style.display="block"),e){const t=getComputedStyle(s),i=s.style.maxHeight;let l=document.body.clientHeight-(parseFloat(t.marginTop)||0)-(parseFloat(t.marginBottom)||0)-("border-box"===t.boxSizing?0:(parseFloat(t.borderTopWidth)||0)+(parseFloat(t.borderBottomWidth)||0));s.style.maxHeight=Math.min(l,parseFloat(t.maxHeight)||l)+"px",this.relayout(e),s.style.maxHeight=i}else t.virtualListHelper.isVirtual()&&t.virtualListHelper.render();return this.isVisible()&&this._trigger("show"),this}hide(){const e=this._p,i=e.el;if(e.onDocumentMouseDown&&(e.sink.remove(document,"mousedown",e.onDocumentMouseDown),e.onDocumentMouseDown=null),this.isVisible()){if(this._trigger("hide:before"),e.hiding=!0,i&&(i.classList.add(`${e.baseClassName}__is-hiding`),s.parseTransition(getComputedStyle(e.el).transition).reduce(((e,t)=>Math.max(e,t.delay+t.duration)),0)>0?setTimeout((()=>{this[u]||this._p&&i.parentNode&&e.hiding&&(t.remove(i),i.classList.remove(`${e.baseClassName}__is-hiding`),e.visible=!1,this._trigger("hide:after"))})):(t.remove(i),i.classList.remove(`${e.baseClassName}__is-hiding`))),e.visible=!1,this.blurFocusedItem(),this._trigger("hide"),this[u])return;this._trigger("hide:after"),e.currentSubDropList&&this._hideSublist()}return e.lastPositionTarget&&(e.lastPositionTarget.classList.remove(`has_${e.baseClassName}`,`has_${e.baseClassName}_above`,`has_${e.baseClassName}_below`),delete e.lastPositionTarget),this}isVisible(){const e=this._p;return!!e.visible&&e.el.parentNode&&"none"!==getComputedStyle(e.el).display}hasFocusedItem(){return this._p.focusItemIndex>-1}getFocusedItemIndex(){return this.hasFocusedItem()?this._p.focusItemIndex:-1}setFocusedItemAtIndex(e){const t=this._p;t.focusItemIndex=e;let s=null;e>-1&&(s=t.items[e]),s&&s._nointeraction&&(s=null),e>-1&&this.scrollItemIndexIntoView(e);let i=s?t.virtualListHelper.getItemElementAt(e):null;if(t.focusItemEl!==i&&(t.focusItemEl&&(t.focusItemEl.classList.remove(`${t.baseClassName}__item_focus`),t.focusItemEl=null),i)){i.classList.add(`${t.baseClassName}__item_focus`),t.focusItemEl=i;const e=i[a];this._trigger("itemfocus",{value:e.value,item:e[a]??e,event:null,el:i}),this._showSublist(e,i)}return this}_showSublist(e,t){if(!e._subitems?.length)return;const s=this._p,i=new h({baseClassName:s.baseClassName,additionalClasses:s.additionalClasses,direction:s.direction,autoItemBlur:s.autoItemBlur,autoItemBlurDelay:s.autoItemBlurDelay,capturesFocus:s.capturesFocus,multi:s.multi,keyDownHandler:s.keyDownHandler,autoCheckGroupChildren:s.autoCheckGroupChildren,useExactTargetWidth:s.useExactTargetWidth,constrainToWindow:s.constrainToWindow,autoFlipDirection:s.autoFlipDirection,estimatedItemHeight:s.estimatedItemHeight,estimateWidth:s.estimateWidth,virtualMinItems:s.virtualMinItems,labelProp:s.labelProp,valueProp:s.valueProp,renderItem:s.renderItem,unrenderItem:s.unrenderItem});let l=e=>{this[u]||e.relatedTarget&&this.elContains(e.relatedTarget,!0)||(this._delayBlurItemOnBlur(),this._trigger("subitems:blur",e))};i.on("select",(e=>{this._trigger("subitems:select",e)})).on("subitems:select",(e=>{this._trigger("subitems:select",e)})).on("blur",l).on("subitems:blur",l).on("_back_key_pressed",(()=>{this._hideSublist()})),i.setItems(e._subitems),this._trigger("show_subitems",{value:e.value,item:e[a]??e,el:t,droplist:i}),i.show({target:t,position:{x:"start",y:"top"},anchor:{x:"end",y:"top"},offset:{x:0,y:0},updateWidth:!1}),s.currentSubDropList={item:e,itemElement:t,droplist:i},i.el.focus()}_hideSublist(){const e=this._p;if(!e.currentSubDropList)return;const t=e.currentSubDropList;let s=!!document.activeElement&&t.droplist.elContains(document.activeElement,!0);t.droplist.hide(),t.droplist.destroy(),e.currentSubDropList=null,s&&!this[u]&&this.el.focus(),this._trigger("hide_subitems",{value:t.item.value,item:t.item,el:t.itemElement})}setFocusedItem(e){const t=this._p;let s=e._nointeraction?-1:this._getItemIndex(e);return s>-1&&t.items[s]._nointeraction&&(s=-1),this.setFocusedItemAtIndex(s)}setFocusedItemByValue(e){return this.setFocusedItemAtIndex(this.itemIndexByValue(e))}setSingleSelectedItemAtIndex(e){const t=this._p;let s=null;return e>-1&&!t.items[e]._nointeraction&&(s=t.virtualListHelper.getItemElementAt(e)),this._setSingleSelectedItemEl(s),this}setSingleSelectedItem(e){const t=this._p;let s=e._nointeraction?-1:this._getItemIndex(e);return s>-1&&t.items[s]._nointeraction&&(s=-1),this.setSingleSelectedItemAtIndex(s)}setSingleSelectedItemByValue(e){return this.setSingleSelectedItemAtIndex(this.itemIndexByValue(e))}next(e){this._move("next",e)}previous(e){this._move("prev",e)}isFirstItem(){const e=this._p;return 0===e.focusItemIndex&&e.focusItemIndex<e.items.length}isLastItem(){const e=this._p;return e.focusItemIndex>-1&&e.focusItemIndex===e.items.length-1}scrollItemIndexIntoView(e){const t=this._p;if(this._hasScroll()){const s=t.el,i=s.scrollTop;let l,r=-1,n=30;for(;n-- >0&&(l=t.virtualListHelper.getItemPosition(e),l!==r);){r=l;let n=t.virtualListHelper.getItemSize(e),o=s.clientHeight;l<i?s.scrollTop=l:l+n>i+o&&(s.scrollTop=l+n-o),t.virtualListHelper.render()}}return this}on(e,t){return this._p.mitt.on(e,t),this}once(e,t){let s=i=>{this._p.mitt.off(e,s),t(i)};return this._p.mitt.on(e,s),this}off(e,t){return e||e?this._p.mitt.off(e,t):this._p.mitt.all.clear(),this}emit(e,t){return this._p.mitt.emit(e,t),this}_getItemIndex(e){const t=this._p;let s=-1;if(e&&(s=t.items.indexOf(e),-1===s)){let t=e&&void 0!==e.value?e.value:e,i=e&&e.label?e.label:t;s=this.itemIndexByValueOrLabel(t,i)}return s}_setSingleSelectedItemEl(e){const t=this._p;return t.singleSelectedItemEl&&(t.singleSelectedItemEl.classList.remove(`${t.baseClassName}__item_checked`),t.singleSelectedItemEl=null),e&&(e.classList.add(`${t.baseClassName}__item_checked`),t.singleSelectedItemEl=e),this}_trigger(e,t){const s=this._p;s.on&&s.on(e,...void 0===t?[]:[t]),s.mitt.emit(e,t)}_itemUpAction(t,s){if(e.closestUntil(t.target,".requires-pointer-events,button",s))return;let i=this._p;if(!this._mouseHandled){if(this.triggerItemSelection(null,t),this[u])return;this.toggleFocusedItem(),document.activeElement!==this.el&&i.focusItemEl&&clearTimeout(i.blurTimer),setTimeout((()=>{this._mouseHandled=!1}),0)}}_hookMouseEvents(){const t=this._p;t.sink.add(t.el,"mouseup",(t=>{const s=e.closestUntil(t.target,"li",t.currentTarget);s&&0===t.button&&this._itemUpAction(t,s)})).add(t.el,"mouseover",(t=>{const s=e.closestUntil(t.target,"li",t.currentTarget);s&&this._handleMouseOver(t,s)}))}_handleMouseOver(e,t){this._focus(e,t,null,!0)}_hookTouchEvents(){const t=this._p;let s;t.sink.add(t.el,"touchstart",(i=>{const l=e.closestUntil(i.target,"li",i.currentTarget);if(!l)return;if(s)return;if(e.closestUntil(i.target,".requires-pointer-events,button",l))return;s=i.changedTouches[0].identifier,this._handleMouseOver(i,l);let r=!1,n=()=>{r=!0},o=()=>{s=null,t.sink.remove(null,".dropdown_touchextra")},a=l.parentNode;for(;a;)t.sink.add(a,"scroll.dropdown_touchextra",n),a=a.parentNode;t.sink.add(window,"scroll.dropdown_touchextra",n),t.sink.add(window,"touchcancel.dropdown_touchextra",o),t.sink.add(t.el,"touchend.dropdown_touchextra",(t=>{const i=e.closestUntil(t.target,"li",t.currentTarget);return i&&Array.prototype.find.call(t.changedTouches,(e=>e.identifier===s))?(o(),void(r||(this._itemUpAction(t,i),t.preventDefault()))):o()}))}))}_hookFocusEvents(){const e=this._p;e.sink.add(e.el,"focus",(t=>{let s=e.focusItemEl||e.el.firstChild;this._focus(t,s,null,!1)})).add(e.el,"blur",(e=>{setTimeout((()=>{this[u]||document.activeElement&&this.elContains(document.activeElement,!0)||(this._delayBlurItemOnBlur(),this._trigger("blur",e))}))}))}_hookKeyEvents(){const e=this._p;e.sink.add(e.el,"keydown",(e=>this._keydown(e)))}_keydown(e){const t=this._p;if(t.keyDownHandler&&t.keyDownHandler.call(this,e))return;let s=!0;switch(e.key){case r.VALUE_PAGE_UP:case r.VALUE_PAGE_DOWN:case r.VALUE_HOME:case r.VALUE_END:case r.VALUE_UP:case r.VALUE_DOWN:switch(e.preventDefault(),e.key){case r.VALUE_PAGE_UP:this.previousPage(e);break;case r.VALUE_PAGE_DOWN:this.nextPage(e);break;case r.VALUE_HOME:this._move("first",e);break;case r.VALUE_END:this._move("last",e);break;case r.VALUE_UP:this.previous(e);break;case r.VALUE_DOWN:this.next(e)}break;case r.VALUE_LEFT:case r.VALUE_RIGHT:if(e.key===r.VALUE_RIGHT&&"rtl"!==getComputedStyle(e.target).direction||e.key===r.VALUE_LEFT&&"rtl"===getComputedStyle(e.target).direction){let e=t.items[t.focusItemIndex];t.focusItemIndex>-1&&e._subitems&&this._showSublist(e,t.focusItemEl)}else t.currentSubDropList?(this._hideSublist(),s=!1):this._trigger("_back_key_pressed");break;case r.VALUE_ENTER:this.triggerItemSelection(null,e),e.preventDefault();break;case r.VALUE_SPACE:this.toggleFocusedItem(),e.preventDefault();break;case r.VALUE_ESCAPE:e.preventDefault(),this.hide();break;default:if("keydown"===e.type)return;this._keydownFreeType(e),s=!1}}_keydownFreeType(e){const t=this._p;let s=e.key||String.fromCharCode(e.keyCode);if(1!==s.length)return;clearTimeout(t.filterTimer);let i,l=(t.previousFilter||"")+s,r=new RegExp(`^${o(l)}`,"i"),n=-1,a=t.focusItemIndex;for(let e=0,s=t.items.length;e<s&&(-1!==n&&e<a||(i=t.items[e],!(r.test(i.label)&&(n=e,-1===a||e>=a))));e++);if(-1===n){l=s,r=new RegExp(`^${o(l)}`,"i");for(let e=0,s=t.items.length;e<s&&(-1!==n&&e<a||(i=t.items[e],!(r.test(i.label)&&(n=e,-1===a||e>=a))));e++);}if(n>-1){let s=t.virtualListHelper.getItemElementAt(n);this._focus(e,s||null,n,!0),this.isVisible()||this.triggerItemSelection(s?null:t.items[n],e),t.previousFilter=l,t.filterTimer=setTimeout((()=>{delete t.previousFilter}),1e3)}else delete t.previousFilter}_focus(e,t,s,i){const l=this._p;if(l._isFocusingItem)return;l._isFocusingItem=!0,!s&&t&&(s=l.virtualListHelper.getItemIndexFromElement(t)),s>-1?this.scrollItemIndexIntoView(s):void 0===s&&(t=null);let r=t||l.virtualListHelper.getItemElementAt(s);if(!r||r[a]._nointeraction)return l._isFocusingItem=!1,void this.blurFocusedItem();if(r===l.focusItemEl)return l._isFocusingItem=!1,void clearTimeout(l.blurTimer);this.blurFocusedItem(),r.classList.add(`${l.baseClassName}__item_focus`),l.focusItemEl=r,l.focusItemIndex=s;const n=l.items[s];this._trigger("itemfocus",{value:n.value,item:n[a]??n,event:e,el:r}),l._isFocusingItem=!1,i&&this._showSublist(n,r)}_delayBlurItemOnBlur(){if(this[u])return;const e=this._p;e.autoItemBlur&&(clearTimeout(e.blurTimer),e.blurTimer=setTimeout((()=>{this[u]||this.blurFocusedItem()}),e.autoItemBlurDelay))}_move(e,t){const i=this._p;let l,r,n=!1;if("first"===e)r=0,n=!1;else if("last"===e)r=i.items.length-1,n=!0;else if("prev"===e){if(!this.hasFocusedItem())return this._move("last",t);r=i.focusItemIndex-1,-1===r&&(r=i.items.length-1),n=!0}else if("next"===e){if(!this.hasFocusedItem())return this._move("first",t);r=i.focusItemIndex+1,r===i.items.length&&(r=0),n=!1}else{if("prev_page"!==e&&"next_page"!==e)return;if(!this.hasFocusedItem())return this._move("prev_page"===e?"prev":"next",t);if("prev_page"===e&&this.isFirstItem()||"next_page"===e&&this.isLastItem())return;if(!this._hasScroll())return this._move("prev_page"===e?"first":"last",t);if(i.virtualListHelper.isVirtual()){let t=i.virtualListHelper.getVisibleItemCount();r=i.focusItemIndex,"prev_page"===e?r-=t:r+=t,r<0?r=0:r>=i.items.length&&(r=i.items.length)}else if(i.focusItemEl){let t=s.getElementOffset(i.focusItemEl).top,n=s.getElementHeight(i.el,!0);for(;;){if(l=i.focusItemEl.nextElementSibling,!l)return;if("LI"===l.tagName)if("prev_page"===e){if(s.getElementOffset(l).top-t+n<=0)break}else if(s.getElementOffset(l).top-t-n>=0)break}l&&(r=i.virtualListHelper.getItemIndexFromElement(l),void 0===r&&(r=-1))}n="prev_page"===e}let o=i.items.length;if(r>=o)return;let a=i.items[r],u=r;for(;a&&a._nointeraction&&(n?(r--,-1===r&&(r=o)):(r++,r===o&&(r=0)),a=i.items[r],r!==u););l=i.virtualListHelper.getItemElementAt(r),this._focus(t,l||null,r,!1),this.isVisible()||this.triggerItemSelection(a,t)}_hasScroll(){return this.el.clientHeight<this.el.scrollHeight}_updateGroupStateForItem(e){const s=this._p;if(!s.multi)return this;if(e._group){let i=0;if(s.autoCheckGroupChildren){let l=s.items;for(let r=l.indexOf(e)+1,n=l.length;r<n;r++){let n=l[r];if(n._group||!n._child&&l[r-1]._child)break;if(!!n._checked===e._checked)continue;n._checked=e._checked,i++;let o=s.virtualListHelper.getItemElementAt(r);o&&t.toggleClass(o,`${s.baseClassName}__item_checked`,e._checked),this._trigger("check",{value:n.value,item:n[a]??n,checked:n._checked,isGroup:n._group,isCheckingGroup:!0})}}this._trigger("groupcheck",{value:e.value,item:e[a]??e,affectedItems:i})}else if(s.groupCount>0&&s.autoCheckGroupChildren){let t=s.items,i=-1;for(let s=t.indexOf(e)-1;s>=0;s--)if(t[s]._group){i=s;break}i>-1&&this._updateGroupCheckedState(i,!0)}return this}_updateGroupCheckedState(e,s){const i=this._p;if(!(i.multi&&i.autoCheckGroupChildren&&e>-1))return this;let l=i.items,r=l[e];if(!r||!r._group)return this;let n,o=!1,u=!1;for(let t=e+1,s=l.length;t<s&&(n=l[t],!(n._group||!n._child&&l[t-1]._child));t++)n._checked?o=!0:n._checked||(u=!0);if(!o&&!u)return this;let c=o&&!u;if(!!r._checked!==c){r._checked=c;let l=i.virtualListHelper.getItemElementAt(e);l&&t.toggleClass(l,`${i.baseClassName}__item_checked`,r._checked),s&&this._trigger("check",{value:r.value,item:r[a]??r,checked:r._checked,isGroup:r._group,isCheckingGroup:!1})}return this}_measureItem(){const e=this._p;if(e.lastMeasureItemCount!==e.items.length){let t=e.lastMeasureLongestLabel||1,s=e.lastMeasureLongestLabelText||"";for(let i=0,l=e.items,r=l.length;i<r;i++){const e=l[i];let r=e.label;null==r&&(r=e.value),null==r&&(r="");let n=r.length;n>t&&(t=n,s=r)}e.lastMeasureItemCount=e.items.length,e.lastMeasureLongestLabel=t,e.lastMeasureLongestLabelText=s}return(e.estimateWidth||e.virtualListHelper.isVirtual())&&e.virtualListHelper.createGhostItemElement(c,!0,(t=>{e.lastMeasureItemWidth=s.getElementWidth(t,!0,!0)})),this}_determineVirtualMode(e){const t=this._p;let s=t.items;void 0===e&&(e=s.length);let i=e>=t.virtualMinItems;return i!==t.virtualListHelper.isVirtual()&&t.virtualListHelper.setVirtual(i).render(),this}_renderItemContent(t,s){const i=this._p;i.renderItem&&!1!==i.renderItem(t[a]||t,s)||(s.appendChild(e.createElement("span",{class:`${i.baseClassName}__item_label`,textContent:t.label})),i.multi&&(t._nocheck||s.insertBefore(e.createElement("span",{class:"checkbox"}),s.firstChild)))}_updateWidth(e){const t=this._p,i=t.el;let l=0;e&&(l="number"==typeof e.updateWidth||null!=e.targetWidth?e.updateWidth:s.getElementWidth(e.target,!0,!0));let r=0;t.useExactTargetWidth||(t.estimateWidth||t.virtualListHelper.isVirtual()?r=t.lastMeasureItemWidth:(i.style.width="",r=s.getElementWidth(i,!0,!0)));let n=Math.max(r,l);s.setElementWidth(i,n,!0,!0);const o=getComputedStyle(i);let a=(parseFloat(o.borderLeftWidth)||0)+(parseFloat(o.borderRightWidth)||0),u=i.scrollWidth+a;if(u>n){let e=u-n;i.style.width=`${parseFloat(i.style.width)+e}px`,n=u}return n}}const p=(e,t,s)=>{let i,l,r,n,o=0;s||(s={});const a=()=>{o=!1===s.leading?0:Date.now(),i=null,n=e.apply(l,r),i||(l=r=null)},u=function(){const u=Date.now();o||!1!==s.leading||(o=u);const c=t-(u-o);return l=this,r=arguments,c<=0||c>t?(i&&(clearTimeout(i),i=null),o=u,n=e.apply(l,r),i||(l=r=null)):i||!1===s.trailing||(i=setTimeout(a,c)),n};return u.cancel=()=>{clearTimeout(i),o=0,i=l=r=null},u.isScheduled=()=>!!i,u},_=Symbol("item"),g=Symbol("destroyed"),I=Symbol("no_results_items"),f=Symbol("rest_multi_items"),b=!!("ontouchstart"in window||window.DocumentTouch&&window.document instanceof window.DocumentTouch||window.navigator.maxTouchPoints),v=function(e,t){return e instanceof Element&&e.classList.contains(t)},y=["font-family","font-size","font-weight","font-size","letter-spacing","text-transform","word-spacing","text-indent","box-sizing","padding-left","padding-right"],C={el:null,baseClassName:"selectbox",disabled:!1,clearable:!0,hasOpenIndicator:!0,placeholder:"",sortSelectedItems:!0,sortListItems:!1,sortListCheckedFirst:!0,stickyValues:null,sortItemComparator:null,splitListCheckedGroups:!0,treatGroupSelectionAsItems:!1,blurOnSingleSelection:"touch",multi:!1,showSelection:!0,showPlaceholderInTooltip:!1,multiPlaceholderFormatter:null,searchable:!0,noResultsText:"No matching results",filterThrottleWindow:300,filterOnEmptyTerm:!1,labelProp:"label",valueProp:"value",multiItemLabelProp:"short_label",maxMultiItems:null,multiItemsRestLabelProvider:null,items:[],selectedValues:void 0,value:void 0,isLoadingMode:!1};exports.DropList=h,exports.SelectBox=class{constructor(s){const l={...C};for(let[e,t]of Object.entries(s))void 0!==t&&(l[e]=t);const r=this._p={ownsEl:!0,baseClassName:l.baseClassName,additionalClasses:l.additionalClasses,direction:"ltr"===l.direction?"ltr":"rtl"===l.direction?"rtl":"auto",listOptions:l.listOptions,disabled:!!l.disabled,clearable:!!l.clearable,hasOpenIndicator:!!l.hasOpenIndicator,placeholder:l.placeholder,sortSelectedItems:!!l.sortSelectedItems,sortListItems:!!l.sortListItems,sortListCheckedFirst:!!l.sortListCheckedFirst,stickyValues:Array.isArray(l.stickyValues)?new Set(l.stickyValues):null,sortItemComparator:l.sortItemComparator,splitListCheckedGroups:!!l.splitListCheckedGroups,treatGroupSelectionAsItems:l.treatGroupSelectionAsItems,blurOnSingleSelection:l.blurOnSingleSelection,multi:l.multi,showSelection:l.showSelection,showPlaceholderInTooltip:l.showPlaceholderInTooltip,multiPlaceholderFormatter:l.multiPlaceholderFormatter,searchable:l.searchable,noResultsText:l.noResultsText,filterThrottleWindow:l.filterThrottleWindow,filterOnEmptyTerm:l.filterOnEmptyTerm,labelProp:l.labelProp,valueProp:l.valueProp,multiItemLabelProp:l.multiItemLabelProp,maxMultiItems:l.maxMultiItems,multiItemsRestLabelProvider:l.multiItemsRestLabelProvider,renderSingleItem:l.renderSingleItem,unrenderSingleItem:l.unrenderSingleItem,renderMultiItem:l.renderMultiItem,unrenderMultiItem:l.unrenderMultiItem,renderRestMultiItem:l.renderRestMultiItem,unrenderRestMultiItem:l.unrenderRestMultiItem,renderNoResultsItem:l.renderNoResultsItem,unrenderNoResultsItem:l.unrenderNoResultsItem,filterFn:l.filterFn,on:l.on||null,silenceEvents:!0,mitt:n(),isLoadingMode:!!l.isLoadingMode,items:[],filteredItems:null,currentItemsView:[],itemsChanged:!0,sink:new i,resizeObserver:null,selectedItems:[],selectedValues:[],selectionChanged:!0,resortBySelectionNeeded:!1,throttledUpdateListItems:p((()=>this._updateListItems()),l.filterThrottleWindow,{leading:!0,trailing:!0}),filterTerm:""};let o=l.el;o instanceof Element?r.ownsEl=!1:o=e.createElement("span"),e.setElementAttrs(o,{role:"combobox","aria-haspopup":"true","aria-expanded":"false"}),r.el=o,this._syncBaseClasses(),this._renderBase(),r.multiItemEls=[],this.enable(!r.disabled),this._setupDropdownMenu(),r.sink.add(o,"click",(e=>{r.clearButtonWrapper&&r.clearButtonWrapper.contains(e.target)||o.contains(document.activeElement)||(r.input.focus(),r.input.selectionStart=r.input.selectionEnd=r.input.value.length)})),r.sink.add(o,"focus",(e=>{const t=e.target;if(!o.contains(e.relatedTarget)&&!v(t,`${r.baseClassName}__search_field`)&&!v(t,`${r.baseClassName}__item`)){let e=o.querySelector(`.${r.baseClassName}__search_field`);e&&e.focus()}}),!0),r.sink.add(r.input,"keydown",(e=>{this._handleInputKeydown(e)})).add(r.input,"input",(()=>{this._resizeInput()}));const a=(()=>{let e;return()=>{e&&clearTimeout(e),e=setTimeout((()=>{t.toggleClass(o,`${r.baseClassName}__focus`,o.contains(document.activeElement))}))}})();if(r.sink.add(o,"focus",a,!0),r.sink.add(o,"blur",a,!0),r.sink.add(window,"resize",(()=>this._resizeInput())),r.sink.add(window,"orientationchange",(()=>this._resizeInput())),void 0!==window.ResizeObserver){let e={borderBoxSize:{blockSize:null,inlineSize:null},contentBoxSize:{blockSize:null,inlineSize:null}};r.resizeObserver=new ResizeObserver((t=>{if(this[g])return;const s=t[0];e&&s.borderBoxSize[0].blockSize===e.borderBoxSize.blockSize&&s.borderBoxSize[0].inlineSize===e.borderBoxSize.inlineSize&&s.contentBoxSize[0].blockSize===e.contentBoxSize.blockSize&&s.contentBoxSize[0].inlineSize===e.contentBoxSize.inlineSize||(r.resizeObserver.unobserve(r.el),this._resizeInput(),requestAnimationFrame((()=>r.resizeObserver.observe(r.el)))),e.borderBoxSize=s.borderBoxSize[0],e.contentBoxSize=s.contentBoxSize[0]})),r.resizeObserver.observe(r.el)}return this.setItems(l.items),delete l.items,l.multi&&Array.isArray(l.selectedValues)?this.setSelectedValues(l.selectedValues):null!=l.value&&this.setValue(l.value),this._scheduleSync("full"),this.silenceEvents=!1,this}destroy(){if(this[g])return;this[g]=!0;const e=this._p;if(e.syncTimeout&&(clearTimeout(e.syncTimeout),delete e.syncTimeout),this._stopTrackingPresence(),e.sink.remove(),e.dropList&&e.dropList.destroy(),e.throttledUpdateListItems&&e.throttledUpdateListItems.cancel(),this._cleanupSingleWrapper(),e.unrenderMultiItem||e.unrenderRestMultiItem)for(;e.multiItemEls.length>0;)this._removeMultiItemElementByIndex(e.multiItemEls.length-1);if(t.remove(e.list),t.remove(e.singleWrapper),t.remove(e.input),t.remove(e.inputBackBuffer),t.remove(e.clearButtonWrapper),t.remove(e.openIndicator),!e.ownsEl){for(let t of Array.from(e.el.classList))t.startsWith(e.baseClassName)&&e.el.classList.remove(t);e.el.removeAttribute("role"),e.el.removeAttribute("aria-haspopup"),e.el.removeAttribute("aria-expanded")}e.resizeObserver?.disconnect(),this._p=null}get el(){return this._p.el}get droplistInstance(){return this._p.dropList}droplistElContains(e){let t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return this._p.dropList?.elContains(e,t)}enable(e){const t=this._p;void 0===e&&(e=!0),t.disabled=!e,t.el.setAttribute("aria-disabled",t.disabled.toString()),t.input.disabled=!!t.disabled;const s=t.multiItemEls;for(let e of s)t.disabled?e.removeAttribute("tabindex"):e.setAttribute("tabindex","0");return this}isEnabled(){return!this._p.disabled}disable(e){return this.enable(void 0!==e&&!e)}isDisabled(){return this._p.disabled}setAdditionalClasses(e){return this._p.additionalClasses=e,this._syncBaseClasses(),this}setItems(e){let t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];const s=this._p;return e||(e=[]),s.items=e.slice(0),s.filteredItems=null,s.itemsChanged=!0,this._updateItemByValueMap(),t&&this.setSelectedValues(this.getSelectedValues()),this._trigger("itemschanged",{term:null,mutated:!0,count:this.getFilteredItemCount()}),this}getFilteredItemCount(){const e=this._p;return e.filteredItems?e.filteredItems.length:e.items?e.items.length:0}isFilterPending(){const e=this._p;return!!(e.throttledUpdateListItems.isScheduled()||!e.filteredItems&&(e.filterTerm||e.filterOnEmptyTerm&&e.filterFn))}updateItemByValue(e,t){const s=this._p;let i=s.itemByValueMap.get(e);i&&Object.assign(i,t),s.dropList&&s.dropList.updateItemByValue(e,t)}getItems(){return this._p.items}setClearable(e){return e=!!e,this._p.clearable===e||(this._p.clearable=!!e,this._scheduleSync("render_clear")),this}getClearable(){return this._p.clearable}setHasOpenIndicator(e){return e=!!e,this._p.hasOpenIndicator===e||(this._p.hasOpenIndicator=e,this._scheduleSync("render_base")),this}getHasOpenIndicator(){return this._p.hasOpenIndicator}setPlaceholder(e){return this._p.placeholder=null==e?"":String(e),this._scheduleSync("render_base"),this}getPlaceHolder(){return this._p.placeholder}setSearchTerm(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const s=this._p;return s.input?(s.input.value=e,this._scheduleSync("resize_input"),t&&(s.filterTerm=s.input.value.trim(),s.filteredItems=null,s.itemsChanged=!0,this._trigger("search",{value:s.input.value}),s.throttledUpdateListItems()),this):this}getSearchTerm(){const e=this._p;return e.input?e.input.value:""}invokeRefilter(){const e=this._p;return e.filterTerm||e.filterOnEmptyTerm||e.filteredItems?(e.filteredItems=null,e.itemsChanged=!0,e.throttledUpdateListItems(),this):this}setSortSelectedItems(e){const t=this._p;return e=!!e,t.sortSelectedItems===e||(t.sortSelectedItems=e,this._scheduleSync("render_items")),this}isSortSelectedItemsEnabled(){return this._p.sortSelectedItems}setSortListItems(e){const t=this._p;return e=!!e,t.sortListItems===e||(t.sortListItems=e,t.filteredItems=null,t.itemsChanged=!0,this._scheduleSync("render_list")),this}isSortListItemsEnabled(){return this._p.sortListItems}setSortListCheckedFirst(e){const t=this._p;return e=!!e,t.sortCheckedFirst===e||(t.sortCheckedFirst=e,t.itemsChanged=!0,this._scheduleSync("render_list")),this}isSortListCheckedFirstEnabled(){return this._p.sortListCheckedFirst}setStickyValues(e){const t=this._p;return t.stickyValues=Array.isArray(e)?new Set(e):null,t.itemsChanged=!0,this._scheduleSync("render_list"),this}getStickyValues(){return this._p.stickyValues?Array.from(this._p.stickyValues):null}setSortItemComparator(e){const t=this._p;return t.sortItemComparator===e||(t.sortItemComparator=e,t.itemsChanged=!0,this._scheduleSync("render_list")),this}getSortItemComparator(){return this._p.sortItemComparator}setTreatGroupSelectionAsItems(e){const t=this._p;return e=!!e,t.treatGroupSelectionAsItems===e||(t.treatGroupSelectionAsItems=e,t.itemsChanged=!0,this._scheduleSync("render_list")),this}isTreatGroupSelectionAsItemsEnabled(){return!this._p.treatGroupSelectionAsItems}setSplitListCheckedGroups(e){const t=this._p;return e=!!e,t.splitListCheckedGroups===e||(t.splitListCheckedGroups=e,t.itemsChanged=!0,this._scheduleSync("render_list")),this}isSplitListCheckedGroupsEnabled(){return this._p.splitListCheckedGroups}setShowSelection(e){const t=this._p;return e=!!e,t.showSelection===e||(t.showSelection=e,this._scheduleSync("render_items")),this}isShowSelectionEnabled(){return this._p.showSelection}setShowPlaceholderInTooltip(e){const t=this._p;return e=!!e,t.showPlaceholderInTooltip===e||(t.showPlaceholderInTooltip=e,this._scheduleSync("render_base")),this}isShowPlaceholderInTooltipEnabled(){return this._p.showPlaceholderInTooltip}setMultiPlaceholderFormatter(e){const t=this._p;return t.multiPlaceholderFormatter===e||(t.multiPlaceholderFormatter=e,this._scheduleSync("render_base")),this}setBlurOnSingleSelection(e){const t=this._p;return t.blurOnSingleSelection===e||(t.blurOnSingleSelection=e),this}getBlurOnSingleSelection(){return this._p.blurOnSingleSelection}setMulti(e){const s=this._p;return e=!!e,s.multi===e||(s.multi=e,this._setupDropdownMenu(),t.remove(s.clearButtonWrapper),delete s.clearButtonWrapper,e&&s.selectedValues&&1===s.selectedValues.length&&Array.isArray(s.selectedValues[0])&&this.setSelectedValues(s.selectedValues[0]),this._scheduleSync("full")),this}isMultiEnabled(){return this._p.multi}setSearchable(e){const t=this._p;return e=!!e,t.searchable===e||(t.searchable=e,this._scheduleSync("full")),this}isSearchableEnabled(){return this._p.searchable}setNoResultsText(e){return this._p.noResultsText=e,this._scheduleSync("render_list"),this}getNoResultsText(){return this._p.noResultsText}setFilterThrottleWindow(e){const t=this._p;t.filterThrottleWindow=e;let s=!!t.throttledUpdateListItems&&t.throttledUpdateListItems.isScheduled();return t.throttledUpdateListItems&&t.throttledUpdateListItems.cancel(),t.throttledUpdateListItems=p((()=>this._updateListItems()),t.filterThrottleWindow,!0),s&&t.throttledUpdateListItems(),this}getFilterThrottleWindow(){return this._p.filterThrottleWindow}setFilterOnEmptyTerm(e){const t=this._p;return t.filterOnEmptyTerm===e||(t.filterOnEmptyTerm=e,t.throttledUpdateListItems()),this}getFilterOnEmptyTerm(){return this._p.filterOnEmptyTerm}setListOptions(e){return this._p.listOptions=e,this._setupDropdownMenu(),this}setRenderSingleItem(e,t){const s=this._p;return s.renderSingleItem=e,s.unrenderSingleItem=t,this}setRenderMultiItem(e,t){const s=this._p;return s.renderMultiItem=e,s.unrenderMultiItem=t,this}setRenderRestMultiItem(e,t){const s=this._p;return s.renderRestMultiItem=e,s.unrenderRestMultiItem=t,this}setRenderNoResultsItem(e,t){const s=this._p;return s.renderNoResultsItem=e,s.unrenderNoResultsItem=t,this}setLabelProp(e){const t=this._p;return t.labelProp=e,t.dropList&&t.dropList.setLabelProp(e),this}setValueProp(e){const t=this._p;return t.valueProp===e||(t.valueProp=e,t.dropList&&t.dropList.setValueProp(e),this._updateItemByValueMap()),this}setMultiItemLabelProp(e){return this._p.multiItemLabelProp=e,this}setMaxMultiItems(e){return this._p.maxMultiItems=e,this}setMultiItemsRestLabelProvider(e){return this._p.multiItemsRestLabelProvider=e,this}setFilterFn(e){const t=this._p;return t.filterFn===e||(t.filterFn=e,t.throttledUpdateListItems()),this}getFilterFn(){return this._p.filterFn}focusInput(){const e=this._p;return e.input&&e.input.focus(),this}blurInput(){const e=this._p;return e.input&&e.input.blur(),this}clear(){return this._performClearWithEvent(!0)?(this[g],this):this}getValue(){const e=this._p;return e.multi?e.selectedValues.slice(0):e.selectedValues.length>0?e.selectedValues[0]:void 0}setValue(e){return this._p.multi?this.setSelectedValues(Array.isArray(e)?e:void 0!==e?[e]:[]):this.setSelectedValues(void 0!==e?[e]:[])}getSelectedValues(){return this._p.selectedValues.slice(0)}setSelectedValues(e){const t=this._p,s=t.valueProp;t.multi||(e=e.slice(0,1));let i=new Set,l=[],r=[];for(let n of e){if(i.has(n))continue;i.add(n),l.push(n);let e=t.itemByValueMap.get(n);void 0!==e?r.push(e):r.push({[s]:n})}return t.selectedValues=l,t.selectedItems=r,t.selectionChanged=!0,t.resortBySelectionNeeded=!0,this._scheduleSync("full"),this}getSelectedValueCount(){return this._p.selectedValues.length}getSelectedItems(){return this._p.selectedItems.slice(0)}setSelectedItems(e){return this._setSelectedItems(e),this}openList(){const e=this._p;return e.dropList.isVisible()||e.isLoadingMode&&0===e.items.length||(this._trigger("open:before",{list:e.dropList}),e.dropList.setDirection(getComputedStyle(e.el).direction),e.dropList.show(this._getDropListPositionOptions()),this._repositionDropList(),this._repositionDropList(),e.dropList.hasFocusedItem()&&e.dropList.setFocusedItemAtIndex(e.dropList.getFocusedItemIndex())),this}closeList(){const e=this._p;return this[g]?this:e.dropList.isVisible()?(e.dropList.hide(),this):this}toggleList(e){const t=this._p;return(void 0===e?!t.dropList.isVisible():e)?this.openList():this.closeList()}isListOpen(){return!!this._p.dropListVisible}toggleLoading(e){return this.setIsLoadingMode(void 0===e?!this.getIsLoadingMode():!!e)}setIsLoadingMode(e){const t=this._p;return e=void 0===e||!!e,t.isLoadingMode===e||(t.isLoadingMode=e,t.isLoadingMode&&0===t.items.length&&this.isListOpen()?this.closeList():!t.isLoadingMode&&document.activeElement&&((t.multi||t.searchable)&&t.input.contains(document.activeElement)||!t.multi&&!t.searchable&&t.el.contains(document.activeElement))&&this.openList(),this._scheduleSync("render_base")),this}getIsLoadingMode(){return this._p.isLoadingMode}setDirection(e){return this._p.direction="ltr"===e?"ltr":"rtl"===e?"rtl":"auto",this._syncBaseClasses(),this}getDirection(){return this._p.direction}refreshSize(){return this._resizeInput(),this}on(e,t){return this._p.mitt.on(e,t),this}once(e,t){let s=i=>{this._p.mitt.off(e,s),t(i)};return this._p.mitt.on(e,s),this}off(e,t){return e||e?this._p.mitt.off(e,t):this._p.mitt.all.clear(),this}emit(e,t){return this._p.mitt.emit(e,t),this}_updateItemByValueMap(){const e=this._p,t=e.itemByValueMap=new Map,s=e.valueProp;for(let i of e.items)t.set(i[s],i)}_renderBase(){const s=this._p;if(s.inputBackBuffer||(s.inputBackBuffer=e.createElement("span",{css:{position:"absolute",zIndex:-1,left:0,top:"-9999px",whiteSpace:"pre"}})),s.input||(s.inputWrapper=e.createElement("span",{class:`${s.baseClassName}__search_wrapper`},s.input=e.createElement("input",{class:`${s.baseClassName}__search_field`,type:"search",autocomplete:"off",autocorrect:"off",autocapitalize:"off",spellcheck:"false",role:"textbox","aria-autocomplete":"list",readOnly:!(s.searchable||s.multi)}))),s.multi){if(s.singleWrapper&&(this._cleanupSingleWrapper(),t.remove(s.singleWrapper),delete s.singleWrapper),!s.list){this._unregisterDropdownEvents();const t=document.activeElement;s.list=e.createElement("ul",{class:`${s.baseClassName}__list`}),s.el.appendChild(s.list),s.list.appendChild(s.inputWrapper),s.el.classList.remove(`${s.baseClassName}__single`),s.el.classList.add(`${s.baseClassName}__multi`),s.sink.add(s.list,"click",(t=>{e.closestUntil(t.target,`.${s.baseClassName}__item_remove`,t.currentTarget)&&(s.disabled||this._removeMultiItemFromEvent(e.closestUntil(t.target,`.${s.baseClassName}__item`,t.currentTarget),t))})).add(s.list,"keydown",(t=>{e.closestUntil(t.target,`.${s.baseClassName}__item`,t.currentTarget)&&this._handleMultiKeydown(t)})),t===s.input&&s.input.focus(),this._registerDropdownEvents()}}else if(s.list&&(t.remove(s.list),s.sink.remove(s.list),delete s.list),!s.singleWrapper){this._unregisterDropdownEvents();const t=document.activeElement;s.singleWrapper=e.createElement("div",{class:`${s.baseClassName}__single_wrapper`}),s.el.appendChild(s.singleWrapper),s.el.appendChild(s.inputWrapper),s.el.classList.remove(`${s.baseClassName}__multi`),s.el.classList.add(`${s.baseClassName}__single`),t===s.input&&s.input.focus(),this._registerDropdownEvents()}s.hasOpenIndicator!==!!s.openIndicator&&(s.hasOpenIndicator?(s.openIndicator=e.createElement("span",{class:`${s.baseClassName}__open_indicator`}),s.el.appendChild(s.openIndicator)):(t.remove(s.openIndicator),delete s.openIndicator,s.el.classList.remove(`${s.baseClassName}__has_open_indicator`))),s.isLoadingMode!==!!s.spinner&&(s.isLoadingMode?(s.spinner=e.createElement("span",{class:`${s.baseClassName}__spinner`}),s.el.appendChild(s.spinner),s.el.classList.add(`${s.baseClassName}__has_spinner`)):(t.remove(s.spinner),delete s.spinner,s.el.classList.remove(`${s.baseClassName}__has_spinner`)))}_syncBaseClasses(){const e=this._p,t=e.el;if(!t)return;let s=[e.baseClassName];e.multi?s.push(`${e.baseClassName}__multi`):s.push(`${e.baseClassName}__single`),this.isListOpen()?s.push(`${e.baseClassName}__open_list`):s.push(`${e.baseClassName}__closed_list`),e.hasOpenIndicator&&s.push(`${e.baseClassName}__has_open_indicator`),e.clearButtonWrapper&&s.push(`${e.baseClassName}__has_clear`),e.isLoadingMode&&s.push(`${e.baseClassName}__has_spinner`),0===e.selectedValues.length&&s.push(`${e.baseClassName}__empty_selection`),e.selectedValues.length>0&&s.push(`${e.baseClassName}__has_selection`),(e.searchable||e.multi)&&s.push(`${e.baseClassName}__searchable`),"ltr"!==e.direction&&"rtl"!==e.direction||s.push(`${e.baseClassName}__`+e.direction),e.additionalClasses&&(s=s.concat(e.additionalClasses)),t.className=s.join(" ")}_setupDropdownMenu(){const t=this._p,s=t.valueProp;t.dropList&&(t.dropList.destroy(),delete t.dropList,t.itemsChanged=!0,t.selectionChanged=!0,t.resortBySelectionNeeded=!0);const i=t.renderNoResultsItem,l=t.unrenderNoResultsItem,r=(t.listOptions||{}).renderItem,n=(t.listOptions||{}).unrenderItem,o=i||r?(l,n)=>l&&l[s]===I?(i&&!1!==i(l,n)||n.appendChild(e.createElement("div",{class:"droplist-no-results-content",textContent:t.noResultsText})),!0):!!r&&r(l,n):null,a=l||r?(e,t)=>{if(e&&e[s]===I){if(l)return l(e,t)}else if(n)return n(e,t);return!1}:null,u=t.dropList=new h({virtualMinItems:10,...t.listOptions,renderItem:o,unrenderItem:a,multi:t.multi,capturesFocus:!1,labelProp:t.labelProp,valueProp:t.valueProp,on:(e,s)=>{switch(e){case"show:before":{t.dropListVisible=!0,t.el.setAttribute("aria-expanded","true"),t.el.classList.add(`${t.baseClassName}__open_list`),t.el.classList.remove(`${t.baseClassName}__closed_list`),t.resortBySelectionNeeded&&t.sortListCheckedFirst&&t.multi&&(t.itemsChanged=!0),this._updateListItems(),this._trigger("open",{list:u}),this._startTrackingPresence(),t.sink.add(window,"resize.trackposition",(()=>this._repositionDropList()));let e=t.el.parentNode;for(;e;)(e.scrollHeight>e.offsetHeight||e.scrollWidth>e.offsetWidth)&&(e===document.documentElement&&(e=window),t.sink.add(e,"scroll.trackposition",(()=>this._repositionDropList()))),e=e.parentNode}break;case"hide":if(t.dropListVisible=!1,t.el.setAttribute("aria-expanded","false"),t.el.classList.remove(`${t.baseClassName}__open_list`),t.el.classList.add(`${t.baseClassName}__closed_list`),t.multi||(this._setInputText(""),this._scheduleSync("render_base")),this._trigger("close"),this[g])return;this._stopTrackingPresence(),t.sink.remove(null,".trackposition");break;case"check":{if(!t.multi)return;const e=s.item,i=s.value;let l=s.checked;if(s.isGroup&&!t.treatGroupSelectionAsItems)return;let r={value:i,item:e,cancel:!1};if(this._trigger((l?"addsel":"removesel")+":before",r),r.cancel)return void t.dropList.setItemChecked(i,!l);if(l)t.selectedItems.push(e),t.selectedValues.push(i);else{const e=t.selectedValues.indexOf(i);-1!==e&&(t.selectedItems.splice(e,1),t.selectedValues.splice(e,1))}const n=!!s.isCheckingGroup;t.showSelection&&(l?(1===u.itemCount()&&this._setInputText(""),t.sortSelectedItems?n||this._scheduleSync("full"):(null!=t.maxMultiItems&&(t.treatGroupSelectionAsItems?t.selectedItems:t.selectedItems.filter((e=>!e._group))).length>t.maxMultiItems?this._scheduleSync("addOrUpdateMultiItemRestElement"):this._scheduleSync("addMultiItemElement",e),n||this._scheduleSync("render_base"))):(null!=t.maxMultiItems&&(t.treatGroupSelectionAsItems?t.selectedItems:t.selectedItems.filter((e=>!e._group))).length===t.maxMultiItems?this._scheduleSync("removeMultiItemRestElement"):this._scheduleSync("removeMultiItemElement",e),n||this._scheduleSync("render_base"))),this._trigger(l?"addsel":"removesel",{value:i,item:e})}break;case"groupcheck":if(!t.multi)return;s.affectedItems&&this._scheduleSync(t.sortSelectedItems?"full":"render_base");break;case"select":{if(t.multi)return;const e=s.item,i=s.value;if(!this._performSelectWithEvent(e,i))return;if(this[g])return;this.closeList(),("touch"===t.blurOnSingleSelection&&b||"touch"!==t.blurOnSingleSelection&&t.blurOnSingleSelection)&&t.input&&t.input.blur()}break;case"blur":this._handleOnBlur()}}});t.sink.add(u.el,"mousedown",(t=>{e.closestUntil(t.target,"li",t.currentTarget)&&t.preventDefault()})),this._registerDropdownEvents()}_handleOnBlur(){const e=this._p;setTimeout((()=>{e.disabled||(this._trigger("search:blur"),this[g]||document.activeElement&&(e.input&&e.input.contains(document.activeElement)||e.dropList&&this.droplistElContains(document.activeElement,!0))||(e.throttledUpdateListItems&&e.throttledUpdateListItems.cancel(),this.closeList()))}))}_unregisterDropdownEvents(){this._p.sink.remove(null,".dropdown")}_registerDropdownEvents(){const t=this._p;this._unregisterDropdownEvents();const s=t.dropList;if(!s)return;let i=!1,l=null;const n=t.multi||t.searchable?t.input:t.el;t.sink.add(n,"keydown.dropdown",(e=>{if(e.currentTarget.readOnly)return;let i=!1,l=t.lastKeyAllowsNonTypeKeys;t.lastKeyAllowsNonTypeKeys=!1;let n=t.input&&t.input.value.length>0;switch(e.key){case r.VALUE_PAGE_UP:case r.VALUE_PAGE_DOWN:case r.VALUE_UP:case r.VALUE_DOWN:case r.VALUE_HOME:case r.VALUE_END:if((e.key===r.VALUE_HOME||e.key===r.VALUE_END)&&n&&!l){s._keydownFreeType(e);break}switch(t.lastKeyAllowsNonTypeKeys=!0,e.preventDefault(),e.key){case r.VALUE_PAGE_UP:s.isVisible()&&s.previousPage(e);break;case r.VALUE_PAGE_DOWN:s.isVisible()&&s.nextPage(e);break;case r.VALUE_UP:s.isVisible()?s.previous(e):this._movePrev();break;case r.VALUE_DOWN:s.isVisible()?s.next(e):this._moveNext();break;case r.VALUE_HOME:s.goToFirst(e);break;case r.VALUE_END:s.goToLast(e)}break;case r.VALUE_SPACE:l&&(t.lastKeyAllowsNonTypeKeys=!0,s.isVisible()&&s.hasFocusedItem()&&(i=!0,t.multi?s.toggleFocusedItem(e):s.triggerItemSelection(null,e),e.preventDefault()));break;case r.VALUE_ENTER:s.isVisible()&&s.hasFocusedItem()&&(i=!0,e.preventDefault(),s.triggerItemSelection(null,e));break;case r.VALUE_TAB:s.isVisible()&&s.hasFocusedItem()&&s.triggerItemSelection(null,e);break;case r.VALUE_ESCAPE:s.isVisible()&&(s.hide(e),e.preventDefault());break;default:s._keydownFreeType(e)}i||e.key!==r.VALUE_ENTER&&(e.key!==r.VALUE_SPACE||!t.lastKeyAllowsNonTypeKeys||t.multi||s.hasFocusedItem()||t.disabled)||(this.toggleList(),e.preventDefault(),e.stopPropagation())})),t.input&&t.sink.add(t.input,"input.dropdown",(()=>{t.disabled||(t.filterTerm=t.input.value.trim(),t.filteredItems=null,t.itemsChanged=!0,this._trigger("search",{value:t.input.value}),t.throttledUpdateListItems())})).add(t.input,"click.dropdown",(()=>{t.disabled||!t.multi&&t.searchable&&this.openList()})).add(t.input,"focus.dropdown",(()=>{t.disabled||(this._trigger("search:focus"),this[g]||(i=!1,this.openList(),i=!0,setTimeout((()=>{i=!1}),10)))})).add(t.input,"blur.dropdown",(()=>this._handleOnBlur())),t.sink.add(t.el,"mousedown.dropdown",(()=>{t.multi||t.searchable||i||t.disabled||this.toggleList(),i=!1})).add(t.el,"touchstart.dropdown",(s=>{if(l)return;if(l=s.changedTouches[0].identifier,this.isDisabled())return;if(e.closestUntil(s.target,`.${t.baseClassName}__item,.${t.baseClassName}__clear`,t.el))return;let i=()=>{l=null,t.sink.remove(t.el,".dropdown_touchextra")};(t.input||t.el).focus(),t.sink.add(t.el,"touchend.dropdown_touchextra",(e=>{if(!Array.prototype.find.call(s.changedTouches,(e=>e.identifier===l)))return i();e.preventDefault(),i()})).add(t.el,"touchmove.dropdown_touchextra",(e=>{e.preventDefault()})).add(t.el,"touchcancel.dropdown_touchextra",i)}))}_performSelectWithEvent(e,t){let s={value:t,item:e,cancel:!1};return this._trigger("select:before",s),!s.cancel&&!this[g]&&(this._setSelectedItems([e]),this._trigger("select",{value:t,item:e}),!0)}_performClearWithEvent(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t={cancel:!1};return this._trigger("clear:before",t),!t.cancel&&!this[g]&&(this._setSelectedItems([]),e&&this._setInputText(""),this._trigger("clear"),!0)}_movePrev(){const e=this._p;if(this.isMultiEnabled())return;let t=this.getSelectedItems(),s=e.filteredItems??e.items;if(e.currentItemsView&&e.currentItemsView.length===s.length&&(s=e.currentItemsView),s.length+(e.clearable?1:0)>1){let i=t.length>0?s.indexOf(t[0])-1:s.length-1;-1!==i||e.clearable||(i=s.length-1);let l=-1===i?null:s[i];l?this._performSelectWithEvent(l,l[e.valueProp]):this._performClearWithEvent()}}_moveNext(){const e=this._p;if(this.isMultiEnabled())return;let t=this.getSelectedItems(),s=e.filteredItems??e.items;if(e.currentItemsView&&e.currentItemsView.length===s.length&&(s=e.currentItemsView),s.length+(e.clearable?1:0)>1){let i=t.length>0?s.indexOf(t[0])+1:0;i===s.length&&(i=e.clearable?-1:0);let l=-1===i?null:s[i];l?this._performSelectWithEvent(l,l[e.valueProp]):this._performClearWithEvent()}}_updateListItems(){const e=this._p,t=e.dropList;if(!t||!e.dropListVisible)return;if(!e.filteredItems&&(e.filterTerm||e.filterOnEmptyTerm&&e.filterFn)&&this._refilterItems(),(e.itemsChanged||e.selectionChanged)&&(e.dropList._lastSerializedBox=null),e.itemsChanged){let s=e.filteredItems||e.items;(e.sortListItems||e.sortListCheckedFirst&&e.multi)&&(s=this._sortItems(s,e.sortListItems,e.sortListCheckedFirst&&e.multi,e.splitListCheckedGroups)),t.removeAllItems(),0===s.length&&e.noResultsText&&(s=[{[e.labelProp]:e.noResultsText,[e.valueProp]:I,_nointeraction:!0,_nocheck:!0}]),t.addItems(s),e.currentItemsView=s,e.itemsChanged=!1,e.selectionChanged=!0,e.resortBySelectionNeeded=!1}let s=!1;if(e.selectionChanged){if(e.multi)e.dropList.setCheckedValues(e.selectedValues);else{const t=e.dropList.itemIndexByValue(this.getValue());e.dropList.setFocusedItemAtIndex(t).setSingleSelectedItemAtIndex(t),s=e.dropList.hasFocusedItem()}e.selectionChanged=!1}this._repositionDropList(),s&&e.dropList.setFocusedItemAtIndex(e.dropList.getFocusedItemIndex())}_refilterItems(){const e=this._p,t=e.filterTerm,s=e.treatGroupSelectionAsItems;if(t||e.filterOnEmptyTerm&&e.filterFn){let i;if("function"==typeof e.filterFn&&(i=e.filterFn(e.items,t)),!Array.isArray(i))if(t){const l=new RegExp(o(t),"i"),r=e.labelProp,n=e.multiItemLabelProp;i=e.items.filter((e=>!(s||!e._group)||l.test(e[r]||e[n])))}else i=null;if(e.filteredItems=i,i&&!s){let e=-1,t=i.length;for(let s=0;s<t;s++)i[s]._group&&(-1!==e&&e===s-1&&(i.splice(e,1),s--,t--),e=s);-1!==e&&e===t-1&&i.splice(e,1)}}else e.filteredItems=null;this._trigger("itemschanged",{term:t,mutated:!1,count:this.getFilteredItemCount()}),e.itemsChanged=!0}_setSelectedItems(e){const t=this._p,s=t.valueProp;t.multi?(t.selectedItems=e.filter((e=>void 0!==e[s])),t.selectedValues=t.selectedItems.map((e=>e[s]))):(t.selectedItems=e.slice(0,1),t.selectedValues=e.slice(0,1).map((e=>e[s]))),t.selectionChanged=!0,t.resortBySelectionNeeded=!0,this._updateListItems(),this._scheduleSync("full")}_scheduleSync(e,t){const s=this._p;s.syncQueue||(s.syncQueue=[]),("full"===e||"render_items"===e&&!s.syncQueue.some((e=>"full"===e.mode)))&&(s.syncQueue.length=0),0!==s.syncQueue.length&&["full","render_items"].includes(e)||s.syncQueue.push({mode:e,data:t}),s.syncTimeout||(s.syncTimeout=setTimeout((()=>{delete s.syncTimeout;let e=s.syncQueue;delete s.syncQueue,this._performSync(e)})))}_performSync(e){const t=this._p;if(!this[g])for(let s of e)switch(s.mode){case"full":this._syncFull(!0,!0);break;case"render_base":this._syncFull(!1,!1);break;case"render_items":this._syncFull(!0,!1);break;case"render_list":this._syncFull(!1,!0);break;case"render_clear":this._syncClearButton(),this._resizeInput();break;case"singleItem":this._syncSingleItem();break;case"removeMultiItemElement":if(t.showSelection)this._syncPlaceholder();else{const e=t.valueProp,i=s.data[e];let l=t.multiItemEls.findIndex((t=>t[_][e]===i));-1!==l&&this._removeMultiItemElementByIndex(l)}break;case"addMultiItemElement":t.showSelection?this._addMultiItemElement(s.data):this._syncPlaceholder();break;case"addOrUpdateMultiItemRestElement":t.showSelection?this._addMultiItemRestElement():this._syncPlaceholder();break;case"removeMultiItemRestElement":if(t.showSelection){let e=t.multiItemEls[t.multiItemEls.length-1];e?.[_]?.[t.valueProp]===f&&this._removeMultiItemElementByIndex(t.multiItemEls.length-1)}else this._syncPlaceholder();break;case"resize_input":this._resizeInput()}}_cleanupSingleWrapper(){const e=this._p;if(e.singleWrapper){if(e.unrenderSingleItem&&e.singleWrapper.childNodes.length>0)try{e.unrenderSingleItem(e.singleWrapper[_],e.singleWrapper)}catch(e){console.error(e)}delete e.singleWrapper[_],e.singleWrapper.innerHTML=""}}_removeMultiItemElementByIndex(e){const s=this._p,i=s.multiItemEls;if(i.length>e){const l=i[e],r=l[_];let n=r?.[s.valueProp]===f?s.unrenderRestMultiItem??s.unrenderMultiItem:s.unrenderMultiItem;if(n&&l.childNodes.length>0)try{n(r,l)}catch(e){console.error(e)}t.remove(l),e===i.length-1?i.pop():i.splice(e,1)}}_renderSingleItemContent(e){const t=this._p;if(!t.renderSingleItem||!1===t.renderSingleItem(e,t.singleWrapper)){const s=t.labelProp;let i=e[t.multiItemLabelProp]||e[s];null==i&&(i=""),t.singleWrapper.appendChild(document.createTextNode(i))}}_renderMultiItemContent(t,s){const i=this._p;let l=t[i.valueProp]===f?i.renderRestMultiItem??i.renderMultiItem:i.renderMultiItem;if(!l||!1===l(t,s)){const l=i.labelProp,r=t[i.multiItemLabelProp]||t[l];s.appendChild(e.createElement("span",{textContent:r}))}}_addMultiItemElement(e){const s=this._p,i=this._renderMultiItem(e);return!!i&&(t.before(s.inputWrapper,i),s.multiItemEls.push(i),!0)}_addMultiItemRestElement(){const e=this._p;let t=e.selectedItems.slice(0),s=(e.treatGroupSelectionAsItems?t:t.filter((e=>!e._group))).length-e.maxMultiItems,i=e.multiItemsRestLabelProvider?e.multiItemsRestLabelProvider(s,t):`+ ${s}`;this._addMultiItemElement({items:t,[e.valueProp]:f,[e.labelProp]:i})}_syncClearButton(){const s=this._p,i=s.multiItemLabelProp;s.selectedItems.length>0&&s.selectedItems.some((e=>!1!==e[i]))&&s.clearable&&s.showSelection?s.clearButtonWrapper||(s.clearButtonWrapper=e.createElement(s.multi?"li":"span",{class:`${s.baseClassName}__clear`},s.clearButton=e.createElement("button")),s.multi?t.append(s.list,s.clearButtonWrapper):t.append(s.el,s.clearButtonWrapper),s.el.classList.add(`${s.baseClassName}__has_clear`),s.sink.add(s.clearButton,"click",(()=>{this.isDisabled()||this.clear()}))):s.clearButtonWrapper&&(s.sink.remove(s.clearButton,"click"),t.remove(s.clearButtonWrapper),delete s.clearButtonWrapper,delete s.clearButton,s.el.classList.remove(`${s.baseClassName}__has_clear`))}_syncPlaceholder(){const e=this._p,t=e.multiItemLabelProp;let s="";e.multi&&!e.showSelection?s="function"==typeof e.multiPlaceholderFormatter?e.multiPlaceholderFormatter(e.selectedItems):((e,t)=>{if(0===e.length)return"";let s=e[0][t]+"";return e.length>1&&(s+=` (+${e.length-1})`),s})(e.selectedItems,e.labelProp):0!==e.selectedItems.length&&e.showSelection&&!e.selectedItems.every((e=>!1===e[t]))||(s=null==e.placeholder?"":e.placeholder+""),e.input.setAttribute("placeholder",s),e.showPlaceholderInTooltip?e.input.setAttribute("title",s):e.input.removeAttribute("title")}_syncSingleItem(){const e=this._p;e.singleWrapper&&this._cleanupSingleWrapper();const t=e.selectedItems;t.length>0&&(this._renderSingleItemContent(t[0]),e.singleWrapper[_]=t[0])}_syncFull(e,s){const i=this._p,l=i.multiItemLabelProp;if(this._renderBase(),this._syncClearButton(),this._syncPlaceholder(),(e=i.multi&&i.showSelection&&(e||i.selectedItems.filter((e=>!1!==e[l])).length!==i.multiItemEls.length))||!i.showSelection||!i.multi)for(;i.multiItemEls.length>0;)this._removeMultiItemElementByIndex(i.multiItemEls.length-1);if(i.multi){if(e){const e=i.selectedItems,t=i.treatGroupSelectionAsItems;if(i.sortSelectedItems){const t=i.labelProp,s=i.multiItemLabelProp,l=i.valueProp,r=i.stickyValues,n=i.sortItemComparator||((e,i)=>{if(null!==r){let t=r.has(e[l]),s=r.has(i[l]);if(t&&!s)return-1;if(!t&&s)return 1}const n=e[s]||e[t],o=i[s]||i[t];return n<o?-1:n>o?1:0});e.sort(n),i.selectedValues=e.map((e=>e[l]))}let s=0,l=i.maxMultiItems,r=!1;for(let i=0;i<e.length;i++)if(t||!e[i]._group){if(null!=l&&s===l){r=!0;break}this._addMultiItemElement(e[i])&&s++}r&&this._addMultiItemRestElement()}}else i.multi||this._syncSingleItem();return t.getRootNode(i.el)!==document||(t.toggleClass(i.el,`${i.baseClassName}__empty_selection`,0===i.selectedValues.length),t.toggleClass(i.el,`${i.baseClassName}__has_selection`,i.selectedValues.length>0),i.searchable||i.multi?(i.input&&(i.input.readOnly=!1),i.el.classList.add(`${i.baseClassName}__searchable`)):(i.input&&(i.input.readOnly=!0),i.el.classList.remove(`${i.baseClassName}__searchable`)),this._resizeInput(),s&&this._updateListItems()),this}_trigger(e,t){const s=this._p;s.on&&s.on(e,...void 0===t?[]:[t]),s.mitt.emit(e,t)}_renderMultiItem(t){const s=this._p,i=s.labelProp,l=t[s.multiItemLabelProp]??t[i];if(!1===l)return null;const r=e.createElement("li",{class:`${s.baseClassName}__item`,tabindex:"0",title:l},[e.createElement("span",{class:`${s.baseClassName}__item_remove`,role:"presentation"})]);return this._renderMultiItemContent(t,r),r[_]=t,r}_removeMultiItemFromEvent(t,s){const i=this._p;let l;if(/key/.test(s.type)){const n=s;n.key===r.VALUE_DELETE?l=e.next(t,`.${i.baseClassName}__item,.${i.baseClassName}__search_wrapper`):n.key===r.VALUE_BACK_SPACE&&(l=e.prev(t,`.${i.baseClassName}__item,.${i.baseClassName}__search_wrapper`))}else/click|mouse|touch/.test(s.type)&&(l=e.next(t,`.${i.baseClassName}__item,.${i.baseClassName}__search_wrapper`));const n=t[_],o=n[i.valueProp];if(void 0!==n)if(o===f){let e=(i.treatGroupSelectionAsItems?i.selectedItems:i.selectedItems.filter((e=>!e._group))).slice(i.maxMultiItems),t=[];for(let s of e){let e={value:o,item:s,cancel:!1};this._trigger("removesel:before",e),e.cancel||t.push(s)}if(t.length>0){this._removeMultiItemElementByIndex(i.multiItemEls.length-1);for(let e of t){let t=i.selectedItems.indexOf(e);-1===t&&(t=i.selectedValues.indexOf(o[i.valueProp])),-1!==t&&(i.selectedItems.splice(t,1),i.selectedValues.splice(t,1),i.selectionChanged=!0,i.resortBySelectionNeeded=!0)}}e.length>t.length&&this._addMultiItemRestElement(),t.length>0&&this._scheduleSync("render_list")}else{let e={value:o,item:n,cancel:!1};if(this._trigger("removesel:before",e),e.cancel)return this;this._removeMultiItem(n),this._trigger("removesel",{value:o,item:n})}return l||(l=i.el.querySelector(`.${i.baseClassName}__item, .${i.baseClassName}__search_field`)),v(l,`${i.baseClassName}__search_wrapper`)&&(l=l.querySelector("input")),l&&l.focus(),this}_removeMultiItem(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const s=this._p,i=s.valueProp,l=s.labelProp,r=e[i];let n=s.selectedItems.indexOf(e);-1===n&&(n=s.selectedValues.indexOf(r)),-1!==n&&(s.selectedItems.splice(n,1),s.selectedValues.splice(n,1),s.selectionChanged=!0,s.resortBySelectionNeeded=!0),n=s.multiItemEls.findIndex((t=>t[_]===e)),-1===n&&(n=s.multiItemEls.findIndex((e=>e[_][i]===r))),-1!==n&&this._removeMultiItemElementByIndex(n),t&&(this._setInputText(e[s.multiItemLabelProp]||e[l]),s.input.focus(),s.input.selectionStart=s.input.selectionEnd=s.input.value.length),this._scheduleSync("render_list")}_setInputText(e){const t=this._p;t.input.value=null==e?"":String(e),t.filterTerm="",t.filteredItems=null,t.itemsChanged=!0}_resizeInput(){const e=this._p,i=e.el;if(!i.parentNode||!document.body.contains(i))return this;const l=e.input,r=e.inputBackBuffer;let n=l.value||l.placeholder;t.toggleClass(i,`${e.baseClassName}__has_input`,!!n),t.toggleClass(i,`${e.baseClassName}__empty_input`,!n);let o=!1;if(e.multi&&0===e.multiItemEls.length&&e.showSelection){l.style.width="";let t=0,r=0,n=getComputedStyle(e.list||i,"::before");n.content&&"none"!==n.content&&"absolute"!==n.position&&"none"!==n.float&&(t=s.getPseudoElementWidth(e.list||i,"::before",!0,!0,!0));let a=getComputedStyle(e.list||i,"::after");a.content&&"none"!==a.content&&"absolute"!==a.position&&"none"!==a.float&&(r=s.getPseudoElementWidth(e.list||i,"::after",!0,!0,!0));let u=s.getElementWidth(e.list||i);u-=t+r,l.style.width=`${u}px`,o=!0}else{s.setCssProps(r,s.getCssProps(l,y)),r.textContent=n,i.appendChild(r);const a=getComputedStyle(l),u=(parseFloat(a.paddingLeft)||0)+(parseFloat(a.paddingRight)||0),c=.75*(parseFloat(a["font-size"])||0)+u,d=s.getElementWidth(r,!0,!0),m=s.getElementWidth(l,!0,!0);let h=Math.max(d,c);if(h!==m){s.setElementWidth(l,h,!0,!0);let t=(parseFloat(a.borderLeftWidth)||0)+(parseFloat(a.borderRightWidth)||0),i=l.scrollWidth+t;if(i>h){let e=i-h;l.style.width=`${parseFloat(l.style.width)+e}px`,h+=e}if(e.singleWrapper&&(e.singleWrapper.style.width="",n)){let i=h-u-t;s.getElementWidth(e.singleWrapper,!1,!1)<i&&s.setElementWidth(e.singleWrapper,i,!1,!1)}o=!0}t.remove(r)}return o&&this._trigger("input:resize"),this}_repositionDropList(){const e=this._p,t=e.el;if(!e.dropList||!e.dropListVisible||!e.dropList.isVisible())return this;const s=t.getBoundingClientRect(),i=s.left+","+s.top+","+s.right+","+s.bottom;return e.dropList._lastSerializedBox!==i&&(e.dropList.relayout(this._getDropListPositionOptions()),e.dropList._lastSerializedBox=i),this}_handleInputKeydown(e){const t=this._p,s=e.target;if(e.key===r.VALUE_BACK_SPACE&&e.ctrlKey&&0===s.value.length)this.clear(),e.preventDefault();else if(e.key===r.VALUE_BACK_SPACE&&0===s.value.length){const s=t.multiItemEls[t.multiItemEls.length-1];if(!s||void 0===s[_].value)return;const i=s[_],l=i[t.valueProp];let r={value:l,item:i,cancel:!1};if(this._trigger("removesel:before",r),r.cancel)return;this._removeMultiItem(i,!0),this._trigger("removesel",{value:l,item:i}),e.preventDefault()}}_handleMultiKeydown(t){const s=this._p;if(s.disabled)return;const i="rtl"===getComputedStyle(s.el).direction;let l;if(t.key===(i?r.VALUE_LEFT:r.VALUE_RIGHT))l=e.next(t.target,`.${s.baseClassName}__item,.${s.baseClassName}__search_wrapper`),v(l,`${s.baseClassName}__search_wrapper`)&&(l=l.querySelector("input")),l&&l.focus(),t.preventDefault();else if(t.key===(i?r.VALUE_RIGHT:r.VALUE_LEFT))l=e.prev(t.target,`.${s.baseClassName}__item,.${s.baseClassName}__search_wrapper`),v(l,`${s.baseClassName}__search_wrapper`)&&(l=l.querySelector("input")),l&&l.focus(),t.preventDefault();else if(t.key===r.VALUE_BACK_SPACE&&t.ctrlKey){const i=[];let l=t.target;for(;l;)i.push(l),l=e.prev(l,`.${s.baseClassName}__item`);for(;i.length;)this._removeMultiItemFromEvent(i.shift(),t);t.preventDefault()}else t.key!==r.VALUE_DELETE&&t.key!==r.VALUE_BACK_SPACE||(this._removeMultiItemFromEvent(e.closestUntil(t.target,`.${s.baseClassName}__item`,s.el),t),t.preventDefault())}_getDropListPositionOptions(){return{target:this._p.el,offset:{x:0,y:0},anchor:{x:"start",y:"bottom"},position:{x:"start",y:"top"},updateWidth:!0}}_startTrackingPresence(){const e=this._p;this._stopTrackingPresence(),e.presenceInt=setInterval((function(){t.getRootNode(e.el)!==document&&this.hide()}),200)}_stopTrackingPresence(){const e=this._p;e.presenceInt&&(clearInterval(e.presenceInt),e.presenceInt=null)}_sortItems(e,t,s,i){const l=this._p;if(!t&&!s)return e;const r=l.labelProp,n=l.multiItemLabelProp,o=l.valueProp,a=l.stickyValues,u=l.sortItemComparator||((e,t)=>{if(null!==a){let s=a.has(e[o]),i=a.has(t[o]);if(s&&!i)return-1;if(!s&&i)return 1}const s=e[r]||e[n],i=t[r]||t[n];return s<i?-1:s>i?1:0});let c=[],d=null,m=[c];const h=new Set(l.selectedValues);let p,_,g;for(_=0,g=e.length;_<g;_++)p=e[_],p._group&&c.length&&(c=[],m.push(c)),c.push(p);c.length||(m.length=0),a&&e.length>0&&!e[0]._group&&(d=m[0].filter((e=>a.has(e[o]))),d.length>0?(m[0]=m[0].filter((e=>!a.has(e[o]))),0===m[0].length&&m.shift()):d=null),t&&m.sort(((e,t)=>{if(e=e[0],t=t[0],null!==a){let s=a.has(e[o]),i=a.has(t[o]);if(s&&!i)return-1;if(!s&&i)return 1}return!e._group&&t._group?-1:e._group&&!t._group?1:u(e,t)})),d&&m.unshift(d);const I=[],f=[];for(let e=0,i=m.length;e<i;e++)c=m[e],c.sort(((e,i)=>{if(e._group&&!i._group)return-1;if(!e._group&&i._group)return 1;if(s){const t=h.has(e[o]),s=h.has(i[o]);if(t&&!s)return-1;if(!t&&s)return 1}return t?u(e,i):0})),f.push(c);if(s&&i){let e;for(let t=0,s=m.length;t<s;t++)if(c=m[t],c!==d){e=null;for(let t=0,s=c.length;t<s;t++)if(p=c[t],!p._group){if(!h.has(p[l.valueProp]))break;e||(e=[],c[0]._group&&e.push(c[0])),e.push(p),c.splice(t--,1),s--}if(e&&(I.push(e),0===c.length||1===c.length&&c[0]._group)){m.splice(t--,1),s--;let e=f.indexOf(c);-1!==e&&f.splice(e,1)}}else{I.push(d);let e=f.indexOf(d);-1!==e&&f.splice(e,1)}}const b=[];b.length=e.length;let v=0;m=I.length?I.concat(f):f;for(let e=0,t=m.length;e<t;e++)for(c=m[e],_=0,g=c.length;_<g;_++)b[v++]=c[_];return b}};
|
|
6
6
|
//# sourceMappingURL=index.js.map
|
|
7
7
|
|
|
8
8
|
//# sourceMappingURL=lib.cjs.min.js.map
|