@danielgindi/selectbox 2.0.53 → 2.0.55
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/css/droplist.css +1 -1
- package/css/droplist.css.map +1 -1
- package/dist/lib.cjs.js +4732 -13521
- package/dist/lib.cjs.js.map +1 -1
- package/dist/lib.cjs.min.js +2 -4
- package/dist/lib.cjs.min.js.map +1 -1
- package/dist/lib.es6.js +4716 -7041
- package/dist/lib.es6.js.map +1 -1
- package/dist/lib.es6.min.js +2 -4
- package/dist/lib.es6.min.js.map +1 -1
- package/dist/lib.umd.js +4758 -13539
- package/dist/lib.umd.js.map +1 -1
- package/dist/lib.umd.min.js +2 -4
- package/dist/lib.umd.min.js.map +1 -1
- package/lib/DropList.js +150 -118
- package/lib/SelectBox.js +20 -9
- package/package.json +12 -18
- package/scss/droplist.scss +18 -12
package/dist/lib.cjs.min.js
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* @danielgindi/selectbox 2.0.
|
|
2
|
+
* @danielgindi/selectbox 2.0.55
|
|
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"),r=require("@danielgindi/dom-utils/lib/Css"),i=require("@danielgindi/dom-utils/lib/DomEventsSink"),n=require("@danielgindi/virtual-list-helper"),s=require("keycode-js"),l=require("mitt");function o(e,t){this.v=e,this.k=t}function a(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var i=r.call(e,t||"default");if("object"!=typeof i)return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function u(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,i)}return r}function c(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?u(Object(r),!0).forEach(function(t){a(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):u(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function d(e){var t,r;function i(t,r){try{var s=e[t](r),l=s.value,a=l instanceof o;Promise.resolve(a?l.v:l).then(function(r){if(a){var o="return"===t?"return":"next";if(!l.k||r.done)return i(o,r);r=e[o](r).value}n(s.done?"return":"normal",r)},function(e){i("throw",e)})}catch(e){n("throw",e)}}function n(e,n){switch(e){case"return":t.resolve({value:n,done:!0});break;case"throw":t.reject(n);break;default:t.resolve({value:n,done:!1})}(t=t.next)?i(t.key,t.arg):r=null}this._invoke=function(e,n){return new Promise(function(s,l){var o={key:e,arg:n,resolve:s,reject:l,next:null};r?r=r.next=o:(t=r=o,i(e,n))})},"function"!=typeof e.return&&(this.return=void 0)}d.prototype["function"==typeof Symbol&&Symbol.asyncIterator||"@@asyncIterator"]=function(){return this},d.prototype.next=function(e){return this._invoke("next",e)},d.prototype.throw=function(e){return this._invoke("throw",e)},d.prototype.return=function(e){return this._invoke("return",e)};var h="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};var p,m,f={};function _(){if(m)return p;m=1;var e=function(e){return e&&e.Math===Math&&e};return p=e("object"==typeof globalThis&&globalThis)||e("object"==typeof window&&window)||e("object"==typeof self&&self)||e("object"==typeof h&&h)||e("object"==typeof p&&p)||function(){return this}()||Function("return this")()}var g,v,b,I,y,S,E,C,L={};function x(){return v?g:(v=1,g=function(e){try{return!!e()}catch(e){return!0}})}function w(){if(I)return b;I=1;var e=x();return b=!e(function(){return 7!==Object.defineProperty({},1,{get:function(){return 7}})[1]})}function k(){if(S)return y;S=1;var e=x();return y=!e(function(){var e=function(){}.bind();return"function"!=typeof e||e.hasOwnProperty("prototype")})}function T(){if(C)return E;C=1;var e=k(),t=Function.prototype.call;return E=e?t.bind(t):function(){return t.apply(t,arguments)},E}var O,P,A,N,F,V,R,M,W,B,D,H,G,U,j,z,K,$,q,Q,Y,X,J,Z,ee,te,re,ie,ne,se,le,oe,ae,ue,ce,de,he,pe,me,fe,_e,ge={};function ve(){return A?P:(A=1,P=function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}})}function be(){if(F)return N;F=1;var e=k(),t=Function.prototype,r=t.call,i=e&&t.bind.bind(r,r);return N=e?i:function(e){return function(){return r.apply(e,arguments)}},N}function Ie(){if(R)return V;R=1;var e=be(),t=e({}.toString),r=e("".slice);return V=function(e){return r(t(e),8,-1)}}function ye(){return D?B:(D=1,B=function(e){return null==e})}function Se(){if(G)return H;G=1;var e=ye(),t=TypeError;return H=function(r){if(e(r))throw new t("Can't call method on "+r);return r}}function Ee(){if(j)return U;j=1;var e=function(){if(W)return M;W=1;var e=be(),t=x(),r=Ie(),i=Object,n=e("".split);return M=t(function(){return!i("z").propertyIsEnumerable(0)})?function(e){return"String"===r(e)?n(e,""):i(e)}:i}(),t=Se();return U=function(r){return e(t(r))}}function Ce(){if(K)return z;K=1;var e="object"==typeof document&&document.all;return z=void 0===e&&void 0!==e?function(t){return"function"==typeof t||t===e}:function(e){return"function"==typeof e}}function Le(){if(q)return $;q=1;var e=Ce();return $=function(t){return"object"==typeof t?null!==t:e(t)}}function xe(){if(Y)return Q;Y=1;var e=_(),t=Ce();return Q=function(r,i){return arguments.length<2?(n=e[r],t(n)?n:void 0):e[r]&&e[r][i];var n},Q}function we(){if(J)return X;J=1;var e=be();return X=e({}.isPrototypeOf)}function ke(){if(ee)return Z;ee=1;var e=_().navigator,t=e&&e.userAgent;return Z=t?String(t):""}function Te(){if(re)return te;re=1;var e,t,r=_(),i=ke(),n=r.process,s=r.Deno,l=n&&n.versions||s&&s.version,o=l&&l.v8;return o&&(t=(e=o.split("."))[0]>0&&e[0]<4?1:+(e[0]+e[1])),!t&&i&&(!(e=i.match(/Edge\/(\d+)/))||e[1]>=74)&&(e=i.match(/Chrome\/(\d+)/))&&(t=+e[1]),te=t}function Oe(){if(ne)return ie;ne=1;var e=Te(),t=x(),r=_().String;return ie=!!Object.getOwnPropertySymbols&&!t(function(){var t=Symbol("symbol detection");return!r(t)||!(Object(t)instanceof Symbol)||!Symbol.sham&&e&&e<41})}function Pe(){if(le)return se;le=1;var e=Oe();return se=e&&!Symbol.sham&&"symbol"==typeof Symbol.iterator}function Ae(){if(ae)return oe;ae=1;var e=xe(),t=Ce(),r=we(),i=Pe(),n=Object;return oe=i?function(e){return"symbol"==typeof e}:function(i){var s=e("Symbol");return t(s)&&r(s.prototype,n(i))}}function Ne(){if(ce)return ue;ce=1;var e=String;return ue=function(t){try{return e(t)}catch(e){return"Object"}}}function Fe(){if(he)return de;he=1;var e=Ce(),t=Ne(),r=TypeError;return de=function(i){if(e(i))return i;throw new r(t(i)+" is not a function")}}function Ve(){if(me)return pe;me=1;var e=Fe(),t=ye();return pe=function(r,i){var n=r[i];return t(n)?void 0:e(n)}}function Re(){if(_e)return fe;_e=1;var e=T(),t=Ce(),r=Le(),i=TypeError;return fe=function(n,s){var l,o;if("string"===s&&t(l=n.toString)&&!r(o=e(l,n)))return o;if(t(l=n.valueOf)&&!r(o=e(l,n)))return o;if("string"!==s&&t(l=n.toString)&&!r(o=e(l,n)))return o;throw new i("Can't convert object to primitive value")}}var Me,We,Be,De,He,Ge,Ue,je,ze,Ke,$e,qe,Qe,Ye,Xe,Je,Ze,et,tt,rt,it,nt,st,lt,ot={exports:{}};function at(){return We?Me:(We=1,Me=!1)}function ut(){if(De)return Be;De=1;var e=_(),t=Object.defineProperty;return Be=function(r,i){try{t(e,r,{value:i,configurable:!0,writable:!0})}catch(t){e[r]=i}return i}}function ct(){if(He)return ot.exports;He=1;var e=at(),t=_(),r=ut(),i="__core-js_shared__",n=ot.exports=t[i]||r(i,{});return(n.versions||(n.versions=[])).push({version:"3.48.0",mode:e?"pure":"global",copyright:"© 2013–2025 Denis Pushkarev (zloirock.ru), 2025–2026 CoreJS Company (core-js.io). All rights reserved.",license:"https://github.com/zloirock/core-js/blob/v3.48.0/LICENSE",source:"https://github.com/zloirock/core-js"}),ot.exports}function dt(){if(Ue)return Ge;Ue=1;var e=ct();return Ge=function(t,r){return e[t]||(e[t]=r||{})}}function ht(){if(ze)return je;ze=1;var e=Se(),t=Object;return je=function(r){return t(e(r))}}function pt(){if($e)return Ke;$e=1;var e=be(),t=ht(),r=e({}.hasOwnProperty);return Ke=Object.hasOwn||function(e,i){return r(t(e),i)}}function mt(){if(Qe)return qe;Qe=1;var e=be(),t=0,r=Math.random(),i=e(1.1.toString);return qe=function(e){return"Symbol("+(void 0===e?"":e)+")_"+i(++t+r,36)}}function ft(){if(Xe)return Ye;Xe=1;var e=_(),t=dt(),r=pt(),i=mt(),n=Oe(),s=Pe(),l=e.Symbol,o=t("wks"),a=s?l.for||l:l&&l.withoutSetter||i;return Ye=function(e){return r(o,e)||(o[e]=n&&r(l,e)?l[e]:a("Symbol."+e)),o[e]}}function _t(){if(Ze)return Je;Ze=1;var e=T(),t=Le(),r=Ae(),i=Ve(),n=Re(),s=ft(),l=TypeError,o=s("toPrimitive");return Je=function(s,a){if(!t(s)||r(s))return s;var u,c=i(s,o);if(c){if(void 0===a&&(a="default"),u=e(c,s,a),!t(u)||r(u))return u;throw new l("Can't convert object to primitive value")}return void 0===a&&(a="number"),n(s,a)}}function gt(){if(tt)return et;tt=1;var e=_t(),t=Ae();return et=function(r){var i=e(r,"string");return t(i)?i:i+""}}function vt(){if(it)return rt;it=1;var e=_(),t=Le(),r=e.document,i=t(r)&&t(r.createElement);return rt=function(e){return i?r.createElement(e):{}}}function bt(){if(st)return nt;st=1;var e=w(),t=x(),r=vt();return nt=!e&&!t(function(){return 7!==Object.defineProperty(r("div"),"a",{get:function(){return 7}}).a})}function It(){if(lt)return L;lt=1;var e=w(),t=T(),r=function(){if(O)return ge;O=1;var e={}.propertyIsEnumerable,t=Object.getOwnPropertyDescriptor,r=t&&!e.call({1:2},1);return ge.f=r?function(e){var r=t(this,e);return!!r&&r.enumerable}:e,ge}(),i=ve(),n=Ee(),s=gt(),l=pt(),o=bt(),a=Object.getOwnPropertyDescriptor;return L.f=e?a:function(e,u){if(e=n(e),u=s(u),o)try{return a(e,u)}catch(e){}if(l(e,u))return i(!t(r.f,e,u),e[u])},L}ot.exports;var yt,St,Et,Ct,Lt,xt,wt,kt={};function Tt(){if(St)return yt;St=1;var e=w(),t=x();return yt=e&&t(function(){return 42!==Object.defineProperty(function(){},"prototype",{value:42,writable:!1}).prototype})}function Ot(){if(Ct)return Et;Ct=1;var e=Le(),t=String,r=TypeError;return Et=function(i){if(e(i))return i;throw new r(t(i)+" is not an object")}}function Pt(){if(Lt)return kt;Lt=1;var e=w(),t=bt(),r=Tt(),i=Ot(),n=gt(),s=TypeError,l=Object.defineProperty,o=Object.getOwnPropertyDescriptor,a="enumerable",u="configurable",c="writable";return kt.f=e?r?function(e,t,r){if(i(e),t=n(t),i(r),"function"==typeof e&&"prototype"===t&&"value"in r&&c in r&&!r[c]){var s=o(e,t);s&&s[c]&&(e[t]=r.value,r={configurable:u in r?r[u]:s[u],enumerable:a in r?r[a]:s[a],writable:!1})}return l(e,t,r)}:l:function(e,r,o){if(i(e),r=n(r),i(o),t)try{return l(e,r,o)}catch(e){}if("get"in o||"set"in o)throw new s("Accessors not supported");return"value"in o&&(e[r]=o.value),e},kt}function At(){if(wt)return xt;wt=1;var e=w(),t=Pt(),r=ve();return xt=e?function(e,i,n){return t.f(e,i,r(1,n))}:function(e,t,r){return e[t]=r,e}}var Nt,Ft,Vt,Rt,Mt,Wt,Bt,Dt,Ht,Gt,Ut,jt,zt,Kt,$t,qt={exports:{}};function Qt(){if(Ft)return Nt;Ft=1;var e=w(),t=pt(),r=Function.prototype,i=e&&Object.getOwnPropertyDescriptor,n=t(r,"name"),s=n&&"something"===function(){}.name,l=n&&(!e||e&&i(r,"name").configurable);return Nt={EXISTS:n,PROPER:s,CONFIGURABLE:l}}function Yt(){if(Rt)return Vt;Rt=1;var e=be(),t=Ce(),r=ct(),i=e(Function.toString);return t(r.inspectSource)||(r.inspectSource=function(e){return i(e)}),Vt=r.inspectSource}function Xt(){if(Dt)return Bt;Dt=1;var e=dt(),t=mt(),r=e("keys");return Bt=function(e){return r[e]||(r[e]=t(e))}}function Jt(){return Gt?Ht:(Gt=1,Ht={})}function Zt(){if(jt)return Ut;jt=1;var e,t,r,i=function(){if(Wt)return Mt;Wt=1;var e=_(),t=Ce(),r=e.WeakMap;return Mt=t(r)&&/native code/.test(String(r))}(),n=_(),s=Le(),l=At(),o=pt(),a=ct(),u=Xt(),c=Jt(),d="Object already initialized",h=n.TypeError,p=n.WeakMap;if(i||a.state){var m=a.state||(a.state=new p);m.get=m.get,m.has=m.has,m.set=m.set,e=function(e,t){if(m.has(e))throw new h(d);return t.facade=e,m.set(e,t),t},t=function(e){return m.get(e)||{}},r=function(e){return m.has(e)}}else{var f=u("state");c[f]=!0,e=function(e,t){if(o(e,f))throw new h(d);return t.facade=e,l(e,f,t),t},t=function(e){return o(e,f)?e[f]:{}},r=function(e){return o(e,f)}}return Ut={set:e,get:t,has:r,enforce:function(i){return r(i)?t(i):e(i,{})},getterFor:function(e){return function(r){var i;if(!s(r)||(i=t(r)).type!==e)throw new h("Incompatible receiver, "+e+" required");return i}}}}function er(){if(zt)return qt.exports;zt=1;var e=be(),t=x(),r=Ce(),i=pt(),n=w(),s=Qt().CONFIGURABLE,l=Yt(),o=Zt(),a=o.enforce,u=o.get,c=String,d=Object.defineProperty,h=e("".slice),p=e("".replace),m=e([].join),f=n&&!t(function(){return 8!==d(function(){},"length",{value:8}).length}),_=String(String).split("String"),g=qt.exports=function(e,t,r){"Symbol("===h(c(t),0,7)&&(t="["+p(c(t),/^Symbol\(([^)]*)\).*$/,"$1")+"]"),r&&r.getter&&(t="get "+t),r&&r.setter&&(t="set "+t),(!i(e,"name")||s&&e.name!==t)&&(n?d(e,"name",{value:t,configurable:!0}):e.name=t),f&&r&&i(r,"arity")&&e.length!==r.arity&&d(e,"length",{value:r.arity});try{r&&i(r,"constructor")&&r.constructor?n&&d(e,"prototype",{writable:!1}):e.prototype&&(e.prototype=void 0)}catch(e){}var l=a(e);return i(l,"source")||(l.source=m(_,"string"==typeof t?t:"")),e};return Function.prototype.toString=g(function(){return r(this)&&u(this).source||l(this)},"toString"),qt.exports}function tr(){if($t)return Kt;$t=1;var e=Ce(),t=Pt(),r=er(),i=ut();return Kt=function(n,s,l,o){o||(o={});var a=o.enumerable,u=void 0!==o.name?o.name:s;if(e(l)&&r(l,u,o),o.global)a?n[s]=l:i(s,l);else{try{o.unsafe?n[s]&&(a=!0):delete n[s]}catch(e){}a?n[s]=l:t.f(n,s,{value:l,enumerable:!1,configurable:!o.nonConfigurable,writable:!o.nonWritable})}return n}}qt.exports;var rr,ir,nr,sr,lr,or,ar,ur,cr,dr,hr,pr,mr,fr,_r,gr,vr,br={};function Ir(){if(sr)return nr;sr=1;var e=function(){if(ir)return rr;ir=1;var e=Math.ceil,t=Math.floor;return rr=Math.trunc||function(r){var i=+r;return(i>0?t:e)(i)}}();return nr=function(t){var r=+t;return r!=r||0===r?0:e(r)}}function yr(){if(or)return lr;or=1;var e=Ir(),t=Math.max,r=Math.min;return lr=function(i,n){var s=e(i);return s<0?t(s+n,0):r(s,n)}}function Sr(){if(ur)return ar;ur=1;var e=Ir(),t=Math.min;return ar=function(r){var i=e(r);return i>0?t(i,9007199254740991):0}}function Er(){if(dr)return cr;dr=1;var e=Sr();return cr=function(t){return e(t.length)}}function Cr(){if(fr)return mr;fr=1;var e=be(),t=pt(),r=Ee(),i=function(){if(pr)return hr;pr=1;var e=Ee(),t=yr(),r=Er(),i=function(i){return function(n,s,l){var o=e(n),a=r(o);if(0===a)return!i&&-1;var u,c=t(l,a);if(i&&s!=s){for(;a>c;)if((u=o[c++])!=u)return!0}else for(;a>c;c++)if((i||c in o)&&o[c]===s)return i||c||0;return!i&&-1}};return hr={includes:i(!0),indexOf:i(!1)}}().indexOf,n=Jt(),s=e([].push);return mr=function(e,l){var o,a=r(e),u=0,c=[];for(o in a)!t(n,o)&&t(a,o)&&s(c,o);for(;l.length>u;)t(a,o=l[u++])&&(~i(c,o)||s(c,o));return c}}function Lr(){return gr?_r:(gr=1,_r=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"])}function xr(){if(vr)return br;vr=1;var e=Cr(),t=Lr().concat("length","prototype");return br.f=Object.getOwnPropertyNames||function(r){return e(r,t)},br}var wr,kr,Tr,Or,Pr,Ar,Nr,Fr,Vr,Rr,Mr,Wr,Br,Dr,Hr,Gr,Ur,jr,zr={};function Kr(){if(Tr)return kr;Tr=1;var e=xe(),t=be(),r=xr(),i=(wr||(wr=1,zr.f=Object.getOwnPropertySymbols),zr),n=Ot(),s=t([].concat);return kr=e("Reflect","ownKeys")||function(e){var t=r.f(n(e)),l=i.f;return l?s(t,l(e)):t}}function $r(){if(Pr)return Or;Pr=1;var e=pt(),t=Kr(),r=It(),i=Pt();return Or=function(n,s,l){for(var o=t(s),a=i.f,u=r.f,c=0;c<o.length;c++){var d=o[c];e(n,d)||l&&e(l,d)||a(n,d,u(s,d))}}}function qr(){if(Nr)return Ar;Nr=1;var e=x(),t=Ce(),r=/#|\.prototype\./,i=function(r,i){var a=s[n(r)];return a===o||a!==l&&(t(i)?e(i):!!i)},n=i.normalize=function(e){return String(e).replace(r,".").toLowerCase()},s=i.data={},l=i.NATIVE="N",o=i.POLYFILL="P";return Ar=i}function Qr(){if(Vr)return Fr;Vr=1;var e=_(),t=It().f,r=At(),i=tr(),n=ut(),s=$r(),l=qr();return Fr=function(o,a){var u,c,d,h,p,m=o.target,f=o.global,_=o.stat;if(u=f?e:_?e[m]||n(m,{}):e[m]&&e[m].prototype)for(c in a){if(h=a[c],d=o.dontCallGetSet?(p=t(u,c))&&p.value:u[c],!l(f?c:m+(_?".":"#")+c,o.forced)&&void 0!==d){if(typeof h==typeof d)continue;s(h,d)}(o.sham||d&&d.sham)&&r(h,"sham",!0),i(u,c,h,o)}}}function Yr(){if(Br)return Wr;Br=1;var e=function(){if(Mr)return Rr;Mr=1;var e={};return e[ft()("toStringTag")]="z",Rr="[object z]"===String(e)}(),t=Ce(),r=Ie(),i=ft()("toStringTag"),n=Object,s="Arguments"===r(function(){return arguments}());return Wr=e?r:function(e){var l,o,a;return void 0===e?"Undefined":null===e?"Null":"string"==typeof(o=function(e,t){try{return e[t]}catch(e){}}(l=n(e),i))?o:s?r(l):"Object"===(a=r(l))&&t(l.callee)?"Arguments":a}}function Xr(){if(Hr)return Dr;Hr=1;var e=Yr(),t=String;return Dr=function(r){if("Symbol"===e(r))throw new TypeError("Cannot convert a Symbol value to a string");return t(r)}}function Jr(){if(Ur)return Gr;Ur=1;var e=er(),t=Pt();return Gr=function(r,i,n){return n.get&&e(n.get,i,{getter:!0}),n.set&&e(n.set,i,{setter:!0}),t.f(r,i,n)}}!function(){if(jr)return f;jr=1;var e=Qr(),t=w(),r=_(),i=be(),n=pt(),s=Ce(),l=we(),o=Xr(),a=Jr(),u=$r(),c=r.Symbol,d=c&&c.prototype;if(t&&s(c)&&(!("description"in d)||void 0!==c().description)){var h={},p=function(){var e=arguments.length<1||void 0===arguments[0]?void 0:o(arguments[0]),t=l(d,this)?new c(e):void 0===e?c():c(e);return""===e&&(h[t]=!0),t};u(p,c),p.prototype=d,d.constructor=p;var m="Symbol(description detection)"===String(c("description detection")),g=i(d.valueOf),v=i(d.toString),b=/^Symbol\((.*)\)[^)]+$/,I=i("".replace),y=i("".slice);a(d,"description",{configurable:!0,get:function(){var e=g(this);if(n(h,e))return"";var t=v(e),r=m?y(t,7,-1):I(t,b,"$1");return""===r?void 0:r}}),e({global:!0,constructor:!0,forced:!0},{Symbol:p})}}();var Zr,ei,ti,ri,ii,ni,si,li,oi,ai,ui={};function ci(){if(ri)return ti;ri=1;var e=Le();return ti=function(t){return e(t)||null===t}}function di(){if(ni)return ii;ni=1;var e=ci(),t=String,r=TypeError;return ii=function(i){if(e(i))return i;throw new r("Can't set "+t(i)+" as a prototype")}}function hi(){if(li)return si;li=1;var e=function(){if(ei)return Zr;ei=1;var e=be(),t=Fe();return Zr=function(r,i,n){try{return e(t(Object.getOwnPropertyDescriptor(r,i)[n]))}catch(e){}}}(),t=Le(),r=Se(),i=di();return si=Object.setPrototypeOf||("__proto__"in{}?function(){var n,s=!1,l={};try{(n=e(Object.prototype,"__proto__","set"))(l,[]),s=l instanceof Array}catch(e){}return function(e,l){return r(e),i(l),t(e)?(s?n(e,l):e.__proto__=l,e):e}}():void 0)}function pi(){if(ai)return oi;ai=1;var e=Ce(),t=Le(),r=hi();return oi=function(i,n,s){var l,o;return r&&e(l=n.constructor)&&l!==s&&t(o=l.prototype)&&o!==s.prototype&&r(i,o),i}}var mi,fi,_i,gi,vi,bi,Ii,yi,Si,Ei,Ci,Li,xi,wi,ki,Ti,Oi,Pi,Ai,Ni,Fi,Vi,Ri,Mi,Wi,Bi,Di={};function Hi(){if(fi)return mi;fi=1;var e=Cr(),t=Lr();return mi=Object.keys||function(r){return e(r,t)}}function Gi(){if(vi)return gi;vi=1;var e=xe();return gi=e("document","documentElement")}function Ui(){if(Ii)return bi;Ii=1;var e,t=Ot(),r=function(){if(_i)return Di;_i=1;var e=w(),t=Tt(),r=Pt(),i=Ot(),n=Ee(),s=Hi();return Di.f=e&&!t?Object.defineProperties:function(e,t){i(e);for(var l,o=n(t),a=s(t),u=a.length,c=0;u>c;)r.f(e,l=a[c++],o[l]);return e},Di}(),i=Lr(),n=Jt(),s=Gi(),l=vt(),o=Xt(),a="prototype",u="script",c=o("IE_PROTO"),d=function(){},h=function(e){return"<"+u+">"+e+"</"+u+">"},p=function(e){e.write(h("")),e.close();var t=e.parentWindow.Object;return e=null,t},m=function(){try{e=new ActiveXObject("htmlfile")}catch(e){}var t,r,n;m="undefined"!=typeof document?document.domain&&e?p(e):(r=l("iframe"),n="java"+u+":",r.style.display="none",s.appendChild(r),r.src=String(n),(t=r.contentWindow.document).open(),t.write(h("document.F=Object")),t.close(),t.F):p(e);for(var o=i.length;o--;)delete m[a][i[o]];return m()};return n[c]=!0,bi=Object.create||function(e,i){var n;return null!==e?(d[a]=t(e),n=new d,d[a]=null,n[c]=e):n=m(),void 0===i?n:r.f(n,i)}}function ji(){if(xi)return Li;xi=1;var e=Ot();return Li=function(){var t=e(this),r="";return t.hasIndices&&(r+="d"),t.global&&(r+="g"),t.ignoreCase&&(r+="i"),t.multiline&&(r+="m"),t.dotAll&&(r+="s"),t.unicode&&(r+="u"),t.unicodeSets&&(r+="v"),t.sticky&&(r+="y"),r}}function zi(){if(ki)return wi;ki=1;var e=T(),t=pt(),r=we(),i=function(){if(Ci)return Ei;Ci=1;var e=_(),t=x(),r=e.RegExp,i=!t(function(){var e=!0;try{r(".","d")}catch(t){e=!1}var t={},i="",n=e?"dgimsy":"gimsy",s=function(e,r){Object.defineProperty(t,e,{get:function(){return i+=r,!0}})},l={dotAll:"s",global:"g",ignoreCase:"i",multiline:"m",sticky:"y"};for(var o in e&&(l.hasIndices="d"),l)s(o,l[o]);return Object.getOwnPropertyDescriptor(r.prototype,"flags").get.call(t)!==n||i!==n});return Ei={correct:i}}(),n=ji(),s=RegExp.prototype;return wi=i.correct?function(e){return e.flags}:function(l){return i.correct||!r(s,l)||t(l,"flags")?l.flags:e(n,l)}}function Ki(){if(Oi)return Ti;Oi=1;var e=x(),t=_().RegExp,r=e(function(){var e=t("a","y");return e.lastIndex=2,null!==e.exec("abcd")}),i=r||e(function(){return!t("a","y").sticky}),n=r||e(function(){var e=t("^r","gy");return e.lastIndex=2,null!==e.exec("str")});return Ti={BROKEN_CARET:n,MISSED_STICKY:i,UNSUPPORTED_Y:r}}function $i(){if(Ai)return Pi;Ai=1;var e=Pt().f;return Pi=function(t,r,i){i in t||e(t,i,{configurable:!0,get:function(){return r[i]},set:function(e){r[i]=e}})}}function qi(){if(Fi)return Ni;Fi=1;var e=xe(),t=Jr(),r=ft(),i=w(),n=r("species");return Ni=function(r){var s=e(r);i&&s&&!s[n]&&t(s,n,{configurable:!0,get:function(){return this}})}}function Qi(){if(Ri)return Vi;Ri=1;var e=x(),t=_().RegExp;return Vi=e(function(){var e=t(".","s");return!(e.dotAll&&e.test("\n")&&"s"===e.flags)})}function Yi(){if(Wi)return Mi;Wi=1;var e=x(),t=_().RegExp;return Mi=e(function(){var e=t("(?<a>b)","g");return"b"!==e.exec("b").groups.a||"bc"!=="b".replace(e,"$<a>c")})}!function(){if(Bi)return ui;Bi=1;var e=w(),t=_(),r=be(),i=qr(),n=pi(),s=At(),l=Ui(),o=xr().f,a=we(),u=function(){if(Si)return yi;Si=1;var e=Le(),t=Ie(),r=ft()("match");return yi=function(i){var n;return e(i)&&(void 0!==(n=i[r])?!!n:"RegExp"===t(i))}}(),c=Xr(),d=zi(),h=Ki(),p=$i(),m=tr(),f=x(),g=pt(),v=Zt().enforce,b=qi(),I=ft(),y=Qi(),S=Yi(),E=I("match"),C=t.RegExp,L=C.prototype,k=t.SyntaxError,T=r(L.exec),O=r("".charAt),P=r("".replace),A=r("".indexOf),N=r("".slice),F=/^\?<[^\s\d!#%&*+<=>@^][^\s!#%&*+<=>@^]*>/,V=/a/g,R=/a/g,M=new C(V)!==V,W=h.MISSED_STICKY,B=h.UNSUPPORTED_Y;if(i("RegExp",e&&(!M||W||y||S||f(function(){return R[E]=!1,C(V)!==V||C(R)===R||"/a/i"!==String(C(V,"i"))})))){for(var D=function(e,t){var r,i,o,h,p,m,f=a(L,this),_=u(e),b=void 0===t,I=[],E=e;if(!f&&_&&b&&e.constructor===D)return e;if((_||a(L,e))&&(e=e.source,b&&(t=d(E))),e=void 0===e?"":c(e),t=void 0===t?"":c(t),E=e,y&&"dotAll"in V&&(i=!!t&&A(t,"s")>-1)&&(t=P(t,/s/g,"")),r=t,W&&"sticky"in V&&(o=!!t&&A(t,"y")>-1)&&B&&(t=P(t,/y/g,"")),S&&(h=function(e){for(var t,r=e.length,i=0,n="",s=[],o=l(null),a=!1,u=!1,c=0,d="";i<r;i++){if("\\"===(t=O(e,i)))t+=O(e,++i);else if("]"===t)a=!1;else if(!a)switch(!0){case"["===t:a=!0;break;case"("===t:if(n+=t,"?:"===N(e,i+1,i+3))continue;T(F,N(e,i+1))&&(i+=2,u=!0),c++;continue;case">"===t&&u:if(""===d||g(o,d))throw new k("Invalid capture group name");o[d]=!0,s[s.length]=[d,c],u=!1,d="";continue}u?d+=t:n+=t}return[n,s]}(e),e=h[0],I=h[1]),p=n(C(e,t),f?this:L,D),(i||o||I.length)&&(m=v(p),i&&(m.dotAll=!0,m.raw=D(function(e){for(var t,r=e.length,i=0,n="",s=!1;i<r;i++)"\\"!==(t=O(e,i))?s||"."!==t?("["===t?s=!0:"]"===t&&(s=!1),n+=t):n+="[\\s\\S]":n+=t+O(e,++i);return n}(e),r)),o&&(m.sticky=!0),I.length&&(m.groups=I)),e!==E)try{s(p,"source",""===E?"(?:)":E)}catch(e){}return p},H=o(C),G=0;H.length>G;)p(D,C,H[G++]);L.constructor=D,D.prototype=L,m(t,"RegExp",D,{constructor:!0})}b("RegExp")}();var Xi,Ji,Zi,en={};function tn(){if(Ji)return Xi;Ji=1;var e,t,r=T(),i=be(),n=Xr(),s=ji(),l=Ki(),o=dt(),a=Ui(),u=Zt().get,c=Qi(),d=Yi(),h=o("native-string-replace",String.prototype.replace),p=RegExp.prototype.exec,m=p,f=i("".charAt),_=i("".indexOf),g=i("".replace),v=i("".slice),b=(t=/b*/g,r(p,e=/a/,"a"),r(p,t,"a"),0!==e.lastIndex||0!==t.lastIndex),I=l.BROKEN_CARET,y=void 0!==/()??/.exec("")[1];return(b||y||I||c||d)&&(m=function(e){var t,i,l,o,c,d,S,E=this,C=u(E),L=n(e),x=C.raw;if(x)return x.lastIndex=E.lastIndex,t=r(m,x,L),E.lastIndex=x.lastIndex,t;var w=C.groups,k=I&&E.sticky,T=r(s,E),O=E.source,P=0,A=L;if(k&&(T=g(T,"y",""),-1===_(T,"g")&&(T+="g"),A=v(L,E.lastIndex),E.lastIndex>0&&(!E.multiline||E.multiline&&"\n"!==f(L,E.lastIndex-1))&&(O="(?: "+O+")",A=" "+A,P++),i=new RegExp("^(?:"+O+")",T)),y&&(i=new RegExp("^"+O+"$(?!\\s)",T)),b&&(l=E.lastIndex),o=r(p,k?i:E,A),k?o?(o.input=v(o.input,P),o[0]=v(o[0],P),o.index=E.lastIndex,E.lastIndex+=o[0].length):E.lastIndex=0:b&&o&&(E.lastIndex=E.global?o.index+o[0].length:l),y&&o&&o.length>1&&r(h,o[0],i,function(){for(c=1;c<arguments.length-2;c++)void 0===arguments[c]&&(o[c]=void 0)}),o&&w)for(o.groups=d=a(null),c=0;c<w.length;c++)d[(S=w[c])[0]]=o[S[1]];return o}),Xi=m}function rn(){if(Zi)return en;Zi=1;var e=Qr(),t=tn();return e({target:"RegExp",proto:!0,forced:/./.exec!==t},{exec:t}),en}rn();var nn,sn,ln,on,an,un,cn,dn={};function hn(){return sn?nn:(sn=1,nn="\t\n\v\f\r \u2028\u2029\ufeff")}!function(){if(cn)return dn;cn=1;var e=Qr(),t=function(){if(on)return ln;on=1;var e=be(),t=Se(),r=Xr(),i=hn(),n=e("".replace),s=RegExp("^["+i+"]+"),l=RegExp("(^|[^"+i+"])["+i+"]+$"),o=function(e){return function(i){var o=r(t(i));return 1&e&&(o=n(o,s,"")),2&e&&(o=n(o,l,"$1")),o}};return ln={start:o(1),end:o(2),trim:o(3)}}().trim,r=function(){if(un)return an;un=1;var e=Qt().PROPER,t=x(),r=hn();return an=function(i){return t(function(){return!!r[i]()||"
"!=="
"[i]()||e&&r[i].name!==i})}}();e({target:"String",proto:!0,forced:r("trim")},{trim:function(){return t(this)}})}();var pn,mn,fn,_n,gn,vn,bn,In,yn,Sn,En,Cn,Ln,xn,wn,kn,Tn,On,Pn,An,Nn,Fn,Vn,Rn,Mn,Wn={};function Bn(){if(vn)return gn;vn=1;var e=ft(),t=Ui(),r=Pt().f,i=e("unscopables"),n=Array.prototype;return void 0===n[i]&&r(n,i,{configurable:!0,value:t(null)}),gn=function(e){n[i][e]=!0}}function Dn(){return In?bn:(In=1,bn={})}function Hn(){if(Cn)return En;Cn=1;var e=pt(),t=Ce(),r=ht(),i=Xt(),n=function(){if(Sn)return yn;Sn=1;var e=x();return yn=!e(function(){function e(){}return e.prototype.constructor=null,Object.getPrototypeOf(new e)!==e.prototype})}(),s=i("IE_PROTO"),l=Object,o=l.prototype;return En=n?l.getPrototypeOf:function(i){var n=r(i);if(e(n,s))return n[s];var a=n.constructor;return t(a)&&n instanceof a?a.prototype:n instanceof l?o:null}}function Gn(){if(xn)return Ln;xn=1;var e,t,r,i=x(),n=Ce(),s=Le(),l=Ui(),o=Hn(),a=tr(),u=ft(),c=at(),d=u("iterator"),h=!1;return[].keys&&("next"in(r=[].keys())?(t=o(o(r)))!==Object.prototype&&(e=t):h=!0),!s(e)||i(function(){var t={};return e[d].call(t)!==t})?e={}:c&&(e=l(e)),n(e[d])||a(e,d,function(){return this}),Ln={IteratorPrototype:e,BUGGY_SAFARI_ITERATORS:h}}function Un(){if(kn)return wn;kn=1;var e=Pt().f,t=pt(),r=ft()("toStringTag");return wn=function(i,n,s){i&&!s&&(i=i.prototype),i&&!t(i,r)&&e(i,r,{configurable:!0,value:n})}}function jn(){return Fn?Nn:(Fn=1,Nn=function(e,t){return{value:e,done:t}})}!function(){if(Mn)return Wn;Mn=1;var e=_(),t=mn?pn:(mn=1,pn={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}),r=function(){if(_n)return fn;_n=1;var e=vt()("span").classList,t=e&&e.constructor&&e.constructor.prototype;return fn=t===Object.prototype?void 0:t}(),i=function(){if(Rn)return Vn;Rn=1;var e=Ee(),t=Bn(),r=Dn(),i=Zt(),n=Pt().f,s=function(){if(An)return Pn;An=1;var e=Qr(),t=T(),r=at(),i=Qt(),n=Ce(),s=function(){if(On)return Tn;On=1;var e=Gn().IteratorPrototype,t=Ui(),r=ve(),i=Un(),n=Dn(),s=function(){return this};return Tn=function(l,o,a,u){var c=o+" Iterator";return l.prototype=t(e,{next:r(+!u,a)}),i(l,c,!1,!0),n[c]=s,l}}(),l=Hn(),o=hi(),a=Un(),u=At(),c=tr(),d=ft(),h=Dn(),p=Gn(),m=i.PROPER,f=i.CONFIGURABLE,_=p.IteratorPrototype,g=p.BUGGY_SAFARI_ITERATORS,v=d("iterator"),b="keys",I="values",y="entries",S=function(){return this};return Pn=function(i,d,p,E,C,L,x){s(p,d,E);var w,k,T,O=function(e){if(e===C&&V)return V;if(!g&&e&&e in N)return N[e];switch(e){case b:case I:case y:return function(){return new p(this,e)}}return function(){return new p(this)}},P=d+" Iterator",A=!1,N=i.prototype,F=N[v]||N["@@iterator"]||C&&N[C],V=!g&&F||O(C),R="Array"===d&&N.entries||F;if(R&&(w=l(R.call(new i)))!==Object.prototype&&w.next&&(r||l(w)===_||(o?o(w,_):n(w[v])||c(w,v,S)),a(w,P,!0,!0),r&&(h[P]=S)),m&&C===I&&F&&F.name!==I&&(!r&&f?u(N,"name",I):(A=!0,V=function(){return t(F,this)})),C)if(k={values:O(I),keys:L?V:O(b),entries:O(y)},x)for(T in k)(g||A||!(T in N))&&c(N,T,k[T]);else e({target:d,proto:!0,forced:g||A},k);return r&&!x||N[v]===V||c(N,v,V,{name:C}),h[d]=V,k}}(),l=jn(),o=at(),a=w(),u="Array Iterator",c=i.set,d=i.getterFor(u);Vn=s(Array,"Array",function(t,r){c(this,{type:u,target:e(t),index:0,kind:r})},function(){var e=d(this),t=e.target,r=e.index++;if(!t||r>=t.length)return e.target=null,l(void 0,!0);switch(e.kind){case"keys":return l(r,!1);case"values":return l(t[r],!1)}return l([r,t[r]],!1)},"values");var h=r.Arguments=r.Array;if(t("keys"),t("values"),t("entries"),!o&&a&&"values"!==h.name)try{n(h,"name",{value:"values"})}catch(e){}return Vn}(),n=At(),s=Un(),l=ft()("iterator"),o=i.values,a=function(e,r){if(e){if(e[l]!==o)try{n(e,l,o)}catch(t){e[l]=o}if(s(e,r,!0),t[r])for(var a in i)if(e[a]!==i[a])try{n(e,a,i[a])}catch(t){e[a]=i[a]}}};for(var u in t)a(e[u]&&e[u].prototype,u);a(r,"DOMTokenList")}();var zn,Kn,$n,qn,Qn,Yn,Xn,Jn,Zn,es,ts,rs,is,ns={};function ss(){if(Jn)return Xn;Jn=1;var e=function(){if(Yn)return Qn;Yn=1;var e=be(),t=Ir(),r=Xr(),i=Se(),n=e("".charAt),s=e("".charCodeAt),l=e("".slice),o=function(e){return function(o,a){var u,c,d=r(i(o)),h=t(a),p=d.length;return h<0||h>=p?e?"":void 0:(u=s(d,h))<55296||u>56319||h+1===p||(c=s(d,h+1))<56320||c>57343?e?n(d,h):u:e?l(d,h,h+2):c-56320+(u-55296<<10)+65536}};return Qn={codeAt:o(!1),charAt:o(!0)}}().charAt;return Xn=function(t,r,i){return r+(i?e(t,r).length:1)}}function ls(){if(es)return Zn;es=1;var e=be(),t=ht(),r=Math.floor,i=e("".charAt),n=e("".replace),s=e("".slice),l=/\$([$&'`]|\d{1,2}|<[^>]*>)/g,o=/\$([$&'`]|\d{1,2})/g;return Zn=function(e,a,u,c,d,h){var p=u+e.length,m=c.length,f=o;return void 0!==d&&(d=t(d),f=l),n(h,f,function(t,n){var l;switch(i(n,0)){case"$":return"$";case"&":return e;case"`":return s(a,0,u);case"'":return s(a,p);case"<":l=d[s(n,1,-1)];break;default:var o=+n;if(0===o)return t;if(o>m){var h=r(o/10);return 0===h?t:h<=m?void 0===c[h-1]?i(n,1):c[h-1]+i(n,1):t}l=c[o-1]}return void 0===l?"":l})}}!function(){if(is)return ns;is=1;var e=function(){if(Kn)return zn;Kn=1;var e=k(),t=Function.prototype,r=t.apply,i=t.call;return zn="object"==typeof Reflect&&Reflect.apply||(e?i.bind(r):function(){return i.apply(r,arguments)}),zn}(),t=T(),r=be(),i=function(){if(qn)return $n;qn=1,rn();var e=T(),t=tr(),r=tn(),i=x(),n=ft(),s=At(),l=n("species"),o=RegExp.prototype;return $n=function(a,u,c,d){var h=n(a),p=!i(function(){var e={};return e[h]=function(){return 7},7!==""[a](e)}),m=p&&!i(function(){var e=!1,t=/a/;if("split"===a){var r={};r[l]=function(){return t},(t={constructor:r,flags:""})[h]=/./[h]}return t.exec=function(){return e=!0,null},t[h](""),!e});if(!p||!m||c){var f=/./[h],_=u(h,""[a],function(t,i,n,s,l){var a=i.exec;return a===r||a===o.exec?p&&!l?{done:!0,value:e(f,i,n,s)}:{done:!0,value:e(t,n,i,s)}:{done:!1}});t(String.prototype,a,_[0]),t(o,h,_[1])}d&&s(o[h],"sham",!0)}}(),n=x(),s=Ot(),l=Ce(),o=Le(),a=Ir(),u=Sr(),c=Xr(),d=Se(),h=ss(),p=Ve(),m=ls(),f=zi(),_=function(){if(rs)return ts;rs=1;var e=T(),t=Ot(),r=Ce(),i=Ie(),n=tn(),s=TypeError;return ts=function(l,o){var a=l.exec;if(r(a)){var u=e(a,l,o);return null!==u&&t(u),u}if("RegExp"===i(l))return e(n,l,o);throw new s("RegExp#exec called on incompatible receiver")}}(),g=ft()("replace"),v=Math.max,b=Math.min,I=r([].concat),y=r([].push),S=r("".indexOf),E=r("".slice),C=function(e){return void 0===e?e:String(e)},L="$0"==="a".replace(/./,"$0"),w=!!/./[g]&&""===/./[g]("a","$0");i("replace",function(r,i,n){var L=w?"$":"$0";return[function(e,r){var n=d(this),s=o(e)?p(e,g):void 0;return s?t(s,e,n,r):t(i,c(n),e,r)},function(t,r){var o=s(this),d=c(t);if("string"==typeof r&&-1===S(r,L)&&-1===S(r,"$<")){var p=n(i,o,d,r);if(p.done)return p.value}var g=l(r);g||(r=c(r));var x,w=c(f(o)),k=-1!==S(w,"g");k&&(x=-1!==S(w,"u"),o.lastIndex=0);for(var T,O=[];null!==(T=_(o,d))&&(y(O,T),k);)""===c(T[0])&&(o.lastIndex=h(d,u(o.lastIndex),x));for(var P="",A=0,N=0;N<O.length;N++){for(var F,V=c((T=O[N])[0]),R=v(b(a(T.index),d.length),0),M=[],W=1;W<T.length;W++)y(M,C(T[W]));var B=T.groups;if(g){var D=I([V],M,R,d);void 0!==B&&y(D,B),F=c(e(r,void 0,D))}else F=m(V,d,R,M,B,r);R>=A&&(P+=E(d,A,R)+F,A=R+V.length)}return P+E(d,A)}]},!!n(function(){var e=/./;return e.exec=function(){var e=[];return e.groups={a:"7"},e},"7"!=="".replace(e,"$<a>")})||!L||w)}();var os=e=>e.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&");const as=(e,t,r)=>{let i,n,s,l,o=0;r||(r={});const a=()=>{o=!1===r.leading?0:Date.now(),i=null,l=e.apply(n,s),i||(n=s=null)},u=function(){const u=Date.now();o||!1!==r.leading||(o=u);const c=t-(u-o);return n=this,s=arguments,c<=0||c>t?(i&&(clearTimeout(i),i=null),o=u,l=e.apply(n,s),i||(n=s=null)):i||!1===r.trailing||(i=setTimeout(a,c)),l};return u.cancel=()=>{clearTimeout(i),o=0,i=n=s=null},u.isScheduled=()=>!!i,u},us=Symbol("item"),cs=Symbol("destroyed"),ds=Symbol("ghost"),hs=Symbol("no_results_items"),ps=Object.prototype.hasOwnProperty,ms={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,isHeaderVisible:!1,isFooterVisible:!1,searchable:!1,noResultsText:"No matching results",filterThrottleWindow:300,filterOnEmptyTerm:!1,filterGroups:!1,filterEmptyGroups:!1};class fs{constructor(t){var s;const o=c({},ms);for(let[e,r]of Object.entries(t))void 0!==r&&(o[e]=r);const a=this._p={ownsEl:!0,elOriginalDisplay:"",baseClassName:o.baseClassName,additionalClasses:o.additionalClasses,direction:"ltr"===o.direction?"ltr":"rtl"===o.direction?"rtl":"auto",autoItemBlur:o.autoItemBlur,autoItemBlurDelay:o.autoItemBlurDelay,capturesFocus:o.capturesFocus,multi:o.multi,keyDownHandler:o.keyDownHandler,autoCheckGroupChildren:o.autoCheckGroupChildren,useExactTargetWidth:o.useExactTargetWidth,constrainToWindow:o.constrainToWindow,autoFlipDirection:o.autoFlipDirection,estimatedItemHeight:o.estimatedItemHeight,estimateWidth:o.estimateWidth,virtualMinItems:o.virtualMinItems,labelProp:o.labelProp,valueProp:o.valueProp,renderItem:o.renderItem,unrenderItem:o.unrenderItem,renderNoResultsItem:o.renderNoResultsItem,unrenderNoResultsItem:o.unrenderNoResultsItem,on:o.on||null,positionOptionsProvider:null!==(s=o.positionOptionsProvider)&&void 0!==s?s:null,searchable:o.searchable,isHeaderVisible:o.isHeaderVisible,isFooterVisible:o.isFooterVisible,silenceEvents:!0,mitt:l(),filterThrottleWindow:o.filterThrottleWindow,filterOnEmptyTerm:o.filterOnEmptyTerm,filterGroups:o.filterGroups,filterEmptyGroups:o.filterEmptyGroups,filterFn:o.filterFn,filteredItems:null,filterTerm:"",needsRefilter:!1,throttledRefilterItems:null,focusItemIndex:-1,focusItemEl:null,sink:new i};let u=[a.baseClassName+"_wrapper"];a.additionalClasses&&(u=u.concat((a.additionalClasses+"").split(" ").filter(e=>e)));const d={top:"-9999px"};let h=o.el;h instanceof Element?(a.elOriginalDisplay=h.style.display||"",h.classList.add(...u),r.setCssProps(h,d),a.ownsEl=!1):h=e.createElement("div",{class:u.join(" "),css:d}),a.el=h;let p=e.createElement("ul");p.role="menu",a.menuEl=p,a.headerEl=e.createElement("div",{class:a.baseClassName+"_header"}),a.footerEl=e.createElement("div",{class:a.baseClassName+"_footer"}),o.searchable&&this.setSearchable(!0),o.isHeaderVisible&&this.setHeaderVisible(o.isHeaderVisible),h.appendChild(p),o.isFooterVisible&&this.setFooterVisible(o.isFooterVisible),a.items=[],a.groupCount=0,a.mouseHandled=!1,a.virtualListHelper=new n({list:a.menuEl,virtual:!0,buffer:5,estimatedItemHeight:o.estimatedItemHeight||20,itemElementCreatorFn:()=>e.createElement("li",{role:"menuitem",tabIndex:a.capturesFocus?-1:null}),onItemRender:(e,t)=>{let r;if(t===ds)r={label:a.lastMeasureLongestLabelText,value:"Measure",[us]:{[a.labelProp]:a.lastMeasureLongestLabelText,[a.valueProp]:"Measure"}},e.setAttribute("aria-hidden","true");else{var i;const e=null!==(i=a.filteredItems)&&void 0!==i?i:a.items;r=0===e.length&&a.noResultsText?{value:hs,label:a.noResultsText,_nointeraction:!0,_nocheck:!0,[us]:hs}:e[t]}r||console.warn("onItemRender called for ("+t+") which has no item"),e.className="".concat(a.baseClassName,"__item");const n=e.classList;a.multi?r._nocheck?n.add("".concat(a.baseClassName,"__item_multi_nocheck")):(n.add("".concat(a.baseClassName,"__item_multi")),r._checked&&n.add("".concat(a.baseClassName,"__item_checked"))):n.add("".concat(a.baseClassName,"__item_single")),r._group&&n.add("".concat(a.baseClassName,"__item_group")),r._child&&n.add("".concat(a.baseClassName,"__item_child")),r._nointeraction&&n.add("".concat(a.baseClassName,"__item_nointeraction")),a.focusItemIndex===t&&(a.focusItemEl=e,n.add("".concat(a.baseClassName,"__item_focus"))),this._renderItemContent(r,e),e[us]=r}}),this._setupUnrenderFunction(),a.capturesFocus&&(h.tabIndex=0),this.setFilterThrottleWindow(o.filterThrottleWindow),this.setNoResultsText(o.noResultsText),this._hookMouseEvents(),this._hookTouchEvents(),this._hookFocusEvents(),this._hookKeyEvents(),this._hookSearchEvents(),this.silenceEvents=!1}destroy(){var e;if(this[cs])return;this[cs]=!0;const r=this._p;var i;if(clearTimeout(r.blurTimer),clearTimeout(r.filterTimer),r.sink.remove(),r.virtualListHelper.destroy(),null!==(e=r.el)&&void 0!==e&&e.parentNode&&t.remove(r.el),r.currentSubDropList&&(null===(i=r.currentSubDropList)||void 0===i||null===(i=i.droplist)||void 0===i||i.destroy(),r.currentSubDropList=null),r.throttledRefilterItems&&r.throttledRefilterItems.cancel(),!r.ownsEl){for(let e of Array.from(r.el.classList))e.startsWith(r.baseClassName)&&r.el.classList.remove(e);for(let e of["position","left","top","right","bottom","z-index"])r.el.style[e]="";r.el.style.display=r.elOriginalDisplay}r.lastPositionTarget&&(r.lastPositionTarget.classList.remove("has_".concat(r.baseClassName),"has_".concat(r.baseClassName,"_above"),"has_".concat(r.baseClassName,"_below")),delete r.lastPositionTarget),delete r.lastPositionOptions,this._p=null}get el(){return this._p.el}elContains(e){var t;let r=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return!!this.el.contains(e)||!(!r||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){return this._p.unrenderItem=e,this._setupUnrenderFunction(),this}setRenderNoResultsItem(e,t){const r=this._p;return r.renderNoResultsItem=e,r.unrenderNoResultsItem=t,this._setupUnrenderFunction(),this}_setupUnrenderFunction(){const e=this._p;if("function"==typeof e.unrenderItem||"function"==typeof e.unrenderNoResultsItem){const t=e.unrenderItem,r=e.unrenderNoResultsItem;e.virtualListHelper.setOnItemUnrender(i=>{const n=i[us];if(n===hs)try{r(n,i)}catch(e){console.error(e)}else try{t(n[us],i)}catch(e){console.error(e)}delete i[us],e.focusItemEl===i&&(e.focusItemEl=null)})}else e.virtualListHelper.setOnItemUnrender(t=>{delete t[us],e.focusItemEl===t&&(e.focusItemEl=null)});return this}setValueProp(e){return this._p.valueProp=e,this}_syncBaseClasses(){const e=this._p,t=e.el;if(!t)return;let r=[e.baseClassName+"_wrapper"];"ltr"!==e.direction&&"rtl"!==e.direction||r.push("".concat(e.baseClassName,"__")+e.direction),e.additionalClasses&&(r=r.concat(e.additionalClasses)),t.className=r.join(" ")}blurFocusedItem(){var e,t;const r=this._p;if(clearTimeout(r.blurTimer),!this.hasFocusedItem())return;let i=r.focusItemEl;i&&(i.classList.remove("".concat(r.baseClassName,"__item_focus")),r.focusItemEl=null);const n=(null!==(e=r.filteredItems)&&void 0!==e?e:r.items)[r.focusItemIndex];r.focusItemIndex=-1,n&&(r.currentSubDropList&&this._hideSublist(),this._trigger("itemblur",{value:n.value,item:null!==(t=n[us])&&void 0!==t?t:n}))}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 r,i;let n=(null!==(r=e.filteredItems)&&void 0!==r?r:e.items)[e.focusItemIndex];if(!n||n._nocheck||n._nointeraction)return this;n._checked=!n._checked,e.focusItemEl&&t.toggleClass(e.focusItemEl,"".concat(e.baseClassName,"__item_checked"),n._checked),this._trigger("check",{value:n.value,item:null!==(i=n[us])&&void 0!==i?i:n,checked:n._checked,isGroup:n._group,isCheckingGroup:!1}),this._updateGroupStateForItem(n)}return this}triggerItemSelection(t,r){const i=this._p;return i.focusItemEl=i.focusItemEl||e.closestUntil(r.target,"li",i.el),i.focusItemIndex=i.virtualListHelper.getItemIndexFromElement(i.focusItemEl),void 0===i.focusItemIndex&&(i.focusItemIndex=-1),!(t=null!=t?t:i.focusItemEl[us])._nointeraction&&(i.multi?this.hasFocusedItem()&&this.toggleFocusedItem():(this._setSingleSelectedItemEl(i.focusItemEl),this._trigger("select",{value:t?t.value:void 0,item:null!==(n=t[us])&&void 0!==n?n:t,event:r,el:i.focusItemEl})),!0);var n}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 r=this._p,i=r.labelProp,n=r.valueProp;let s=r.multi;const l=r.items;(null==t||t<0||t>=r.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={[us]:a,label:a[i],value:a[n],_nocheck:!!a._nocheck,_nointeraction:!!a._nointeraction,_subitems:a._subitems};s&&(u._checked=!!a._checked),a._group&&(u._group=!0,r.groupCount++),"number"==typeof a._level&&(u._level=a._level),a._child&&(u._child=!0),-1!==t?l.splice(t,0,u):l.push(u),-1!==t&&t++}if(r.filteredItems)r.needsRefilter=!0;else{let i=r.hasNoResultsItem;r.hasNoResultsItem=0===r.items.length&&!!r.noResultsText,r.hasNoResultsItem?r.virtualListHelper.setCount(1).render():(i&&r.virtualListHelper.removeItemsAt(1,0),r.virtualListHelper.addItemsAt(e.length,-1===t?t:t-e.length).render())}return this}setItems(e){const t=this._p;return t.items.length=0,t.filteredItems=null,t.groupCount=0,t.hasNoResultsItem=!!t.noResultsText,t.virtualListHelper.setCount(t.hasNoResultsItem?1:0),this.addItems(e),this.updateSublist(),this}updateItemByValue(e,t){const r=this._p;let i=this.itemIndexByValue(e);if(-1===i)return this;let n=this.itemAtIndex(i);n[us]=t,ps.call(t,r.labelProp)&&(n.label=t[r.labelProp]),ps.call(t,r.valueProp)&&(n.value=t[r.valueProp]),ps.call(t,"_nocheck")&&(n._nocheck=!!t._nocheck),ps.call(t,"_nointeraction")&&(n._nointeraction=!!t._nointeraction),ps.call(t,"_subitems")&&(n._subitems=!!t._subitems),r.multi&&ps.call(t,"_checked")&&(n._checked=!!t._checked),ps.call(t,"_group")&&!!t._group!==n._group&&(n._group?r.groupCount--:r.groupCount++,t._group=!!n._group),ps.call(t,"_level")&&(t._level=n._level),ps.call(t,"_child")&&(n._child=!!t._child);let s=i;return r.filteredItems&&(s=r.filteredItems.indexOf(n),-1!==s&&r.filteredItems.splice(s,1)),-1!==s&&r.virtualListHelper.isItemRendered(s)&&r.virtualListHelper.refreshItemAt(s).render(),this}removeItem(e,t){const r=this._p;let i=this.itemIndexByValueOrLabel(e,t);if(-1===i)return this;let n=r.items.splice(i,1);n[0]._group&&r.groupCount--;let s=i;var l;return r.filteredItems&&(s=r.filteredItems.indexOf(n[0]),-1!==s&&r.filteredItems.splice(s,1)),-1!==s&&(r.hasNoResultsItem=0===(null!==(l=r.filteredItems)&&void 0!==l?l:r.items).length&&!!r.noResultsText,r.hasNoResultsItem?r.virtualListHelper.setCount(1).render():r.virtualListHelper.removeItemsAt(s,1).render()),this}removeAllItems(){const e=this._p;return e.items.length=0,e.filteredItems=null,e.groupCount=0,e.hasNoResultsItem=!!e.noResultsText,e.virtualListHelper.setCount(e.hasNoResultsItem?1:0).render(),this}invalidate(){return this._p.virtualListHelper.invalidate().render(),this}itemDataByValue(e){const t=this._p;for(let r=0,i=t.items.length;r<i;r++){let i=t.items[r];if(i.value===e)return i[us]}return null}itemIndexByValue(e){const t=this._p.items;for(let r=0,i=t.length;r<i;r++)if(t[r].value===e)return r;return-1}filteredItemIndexByValue(e){var t;const r=this._p,i=null!==(t=r.filteredItems)&&void 0!==t?t:r.items;for(let t=0,r=i.length;t<r;t++)if(i[t].value===e)return t;return-1}itemIndexByValueOrLabel(e,t){const r=this._p.items;for(let i=0,n=r.length;i<n;i++){let n=r[i];if(n.value===e||n.label===t)return i}return-1}filteredItemIndexByValueOrLabel(e,t){var r;const i=this._p,n=null!==(r=i.filteredItems)&&void 0!==r?r:i.items;for(let r=0,i=n.length;r<i;r++){let i=n[r];if(i.value===e||i.label===t)return r}return-1}itemIndexByItem(e){const t=this._p.items;for(let r=0,i=t.length;r<i;r++)if(t[r][us]===e)return r;return-1}filteredItemIndexByItem(e){var t;const r=this._p,i=null!==(t=r.filteredItems)&&void 0!==t?t:r.items;for(let t=0,r=i.length;t<r;t++)if(i[t][us]===e)return t;return-1}items(){return this._p.items.map(e=>e[us])}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[us]}filteredItemAtIndex(e){var t,r;const i=this._p;return null===(r=(null!==(t=i.filteredItems)&&void 0!==t?t:i.items)[e])||void 0===r?void 0:r[us]}itemElementAtIndex(e){const t=this._p;if(!t.filteredItems)return this.filteredElementItemAtIndex(e);e=t.filteredItems.indexOf(this._p.items[e]);const r=t.virtualListHelper.getItemElementAt(e);return null!=r?r:null}filteredElementItemAtIndex(e){const t=this._p.virtualListHelper.getItemElementAt(e);return null!=t?t:null}setPositionOptionsProvider(e){const t=this._p;return t.positionOptionsProvider===e||(t.positionOptionsProvider=null!=e?e:null,this.relayout()),this}getPositionOptionsProvider(){return this._p.positionOptionsProvider}setSearchTerm(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const r=this._p;return r.searchInput&&(r.searchInput.value=e),t&&(r.filterTerm=e.trim(),r.filteredItems=null,this._trigger("search",{value:e}),r.throttledRefilterItems()),this}isFilterPending(){const e=this._p;return!!(e.throttledRefilterItems.isScheduled()||!e.filteredItems&&(e.filterTerm||e.filterOnEmptyTerm&&e.filterFn))}_refilterItems(){var e;const t=this._p,r=t.filterTerm,i=t.filterGroups,n=t.filterEmptyGroups;if(r||t.filterOnEmptyTerm&&t.filterFn){let e;if("function"==typeof t.filterFn&&(e=t.filterFn(t.items.map(e=>{const t=e[us];return void 0!==t?(t[us]=Object.seal({[us]:e}),t):e}),r),Array.isArray(e)&&(e=e.map(e=>{var r;let i=null===(r=e[us])||void 0===r?void 0:r[us];return i||(i={[us]:e,label:e[t.labelProp],value:e[t.valueProp],_nocheck:!!e._nocheck,_nointeraction:!!e._nointeraction,_subitems:e._subitems,_group:!!e._group,_level:!!e._level,_checked:!!e._checked}),i}))),!Array.isArray(e))if(r){const n=new RegExp(os(r),"i");e=t.items.filter(e=>!(i||!e._group)||n.test(e.label))}else e=null;if(t.filteredItems=e,e&&n){let t=-1,r=e.length;for(let i=0;i<r;i++)e[i]._group&&(-1!==t&&t===i-1&&(e.splice(t,1),i--,r--),t=i);-1!==t&&t===r-1&&e.splice(t,1)}}else t.filteredItems=null;t.needsRefilter=!1;const s=null!==(e=t.filteredItems)&&void 0!==e?e:t.items;t.hasNoResultsItem=0===s.length&&!!t.noResultsText,t.virtualListHelper.setCount(s.length+(t.hasNoResultsItem?1:0)).render(),this._trigger("itemschanged",{term:r,mutated:!1,count:this.getFilteredItemCount()}),this.relayout()}invokeRefilter(){const e=this._p;return e.filterTerm||e.filterOnEmptyTerm||e.filteredItems?(e.filteredItems=null,e.throttledRefilterItems(),this):this}rushRefilter(){return this._p.needsRefilter&&this._refilterItems(),this}getFilteredItemCount(){const e=this._p;return this.rushRefilter(),e.filteredItems?e.filteredItems.length:e.items?e.items.length:0}setNoResultsText(e){const t=this._p;return t.noResultsText=e,t.hasNoResultsItem&&t.virtualListHelper.refreshItemAt(0).render(),this}getNoResultsText(){return this._p.noResultsText}setFilterThrottleWindow(e){const t=this._p;t.filterThrottleWindow=e;let r=!!t.throttledRefilterItems&&t.throttledRefilterItems.isScheduled();return t.throttledRefilterItems&&t.throttledRefilterItems.cancel(),t.throttledRefilterItems=as(()=>this._refilterItems(),t.filterThrottleWindow,!0),r&&t.throttledRefilterItems(),this}getFilterThrottleWindow(){return this._p.filterThrottleWindow}setFilterOnEmptyTerm(e){const t=this._p;return t.filterOnEmptyTerm===e||(t.filterOnEmptyTerm=e,t.throttledRefilterItems()),this}getFilterOnEmptyTerm(){return this._p.filterOnEmptyTerm}setFilterGroups(e){const t=this._p;return t.filterGroups===e||(t.filterGroups=e,t.throttledRefilterItems()),this}getFilterGroups(){return this._p.filterGroups}setFilterEmptyGroups(e){const t=this._p;return t.filterEmptyGroups===e||(t.filterEmptyGroups=e,t.throttledRefilterItems()),this}getFilterEmptyGroups(){return this._p.filterEmptyGroups}setFilterFn(e){const t=this._p;return t.filterFn===e||(t.filterFn=e,t.throttledRefilterItems()),this}getFilterFn(){return this._p.filterFn}relayout(e){var i,n;const s=this._p,l=s.el,o=s.menuEl;if(!this.isVisible())return this;let a=window;e||(e=null!==(i=null===(n=s.positionOptionsProvider)||void 0===n?void 0:n.call(s))&&void 0!==i?i:s.lastPositionOptions),e||(e={targetOffset:{left:window.innerWidth/2,top:window.innerHeight/2},targetWidth:0,targetHeight:0,position:{x:"center",y:"center"},anchor:{x:"center",y:"center"},targetRtl:"rtl"===getComputedStyle(document.body).direction});let u={},c=e.targetOffset||r.getElementOffset(e.target);u.left=c.left,u.top=c.top,u.height=null==e.targetHeight?r.getElementHeight(e.target,!0,!0):e.targetHeight,u.width=null==e.targetWidth?r.getElementWidth(e.target,!0,!0):e.targetWidth,u.bottom=u.top+u.height;let d={};d.top=a.pageYOffset,d.left=a.pageXOffset,d.width=a.innerWidth,d.height=a.innerHeight,d.bottom=d.top+d.height,d.right=d.left+d.width;let h=e.position&&"bottom"===e.position.y?"above":"below";l.style.width="",(s.estimateWidth||s.virtualListHelper.isVirtual())&&this._measureItem(),s.virtualListHelper.isVirtual()&&(o.style.height=Math.min(l.clientHeight,document.body.clientHeight)+"px",s.virtualListHelper.render()),e.updateWidth||"number"==typeof e.updateWidth?this._updateWidth(e):this._updateWidth(),s.virtualListHelper.isVirtual()&&s.virtualListHelper.render();let p,m=u.top-d.top,f=d.bottom-u.bottom;const _=getComputedStyle(l);let g="border-box"===_.boxSizing,v=(parseFloat(_.paddingTop)||0)+(parseFloat(_.paddingBottom)||0),b=(parseFloat(_.borderTopWidth)||0)+(parseFloat(_.borderBottomWidth)||0),I=0;s.headerEl&&(I=r.getElementHeight(s.headerEl,!0,!0));let y=0;s.footerEl&&(y=r.getElementHeight(s.footerEl,!0,!0)),s.virtualListHelper.isVirtual()?p=s.virtualListHelper.estimateFullHeight()+v+b+I+y:(l.style.height="",o.style.height="",l.style.top="-9999px",p=Math.max(r.getElementHeight(s.el),o.scrollHeight),p+=v+b);let S=parseFloat(_.maxHeight);isNaN(S)||(g||(S+=v+b),p=Math.min(p,S));let E=m>=p,C=f>=p,L=s.currentDirection||h;"above"===L&&!E&&C?L="below":"below"===L&&!C&&E?L="above":E&&C?L!==h&&("above"===h&&m>=f||"below"===h&&f>=m)&&(L=h):E||C||(m>f?L="above":f>m&&(L="below")),s.currentDirection=L;let x={width:r.getElementWidth(l,!0,!0),height:Math.min(p,Math.max(m,f,0))},w=void 0!==e.targetRtl?e.targetRtl:null!=e.target&&"rtl"===getComputedStyle(e.target).direction,k="rtl"===getComputedStyle(document.documentElement).direction,T=r.anchoredPosition(e.target,e.anchor?e.anchor.x:"start",e.anchor?e.anchor.y:"bottom",u,w),O=r.anchoredPosition(l,e.position?e.position.x:"start",e.position?e.position.y:"top",x,w),P="top"===O.ySpec&&"above"===L||"bottom"===O.ySpec&&"below"===L||"bottom"!==O.ySpec&&"top"!==O.ySpec&&"above"===L,A=void 0!==a.pageXOffset?a.pageXOffset:(document.documentElement||document.body.parentNode||document.body).scrollLeft;A=Math.abs(A),k&&(A=document.documentElement.scrollWidth-A-document.documentElement.clientWidth);let N=A,F=document.documentElement.clientWidth+A-x.width,V={position:"absolute",left:u.left,top:u.top+(P?T.bottom-O.bottom:T.top-O.top)};if(k&&(V.left-=document.documentElement.clientWidth-document.documentElement.scrollWidth),V.left+=T.left-O.left,e.offset&&(e.offset.y&&(P?V.top-=e.offset.y:V.top+=e.offset.y),e.offset.x)){let t="rtl"===_.direction;V.left+=t?-e.offset.x:e.offset.x}if(s.autoFlipDirection&&("right"===O.xSpec&&V.left<N&&(Math.max(V.left,N)+x.width-u.left)/u.width>.5||"left"===O.xSpec&&V.left>F&&(Math.min(V.left,F)-u.left)/u.width<.5)&&(V.left-=T.left-O.left,V.left+=T.right-O.right),s.constrainToWindow)for(let e of k?["min","max"]:["max","min"])"min"===e&&V.left<N?V.left=N:"max"===e&&V.left>F&&(V.left=F);if(V.left+="px",V.top+="px",r.setCssProps(l,V),r.setElementHeight(l,x.height,!0,!0),o!==l){let e=x.height-I-y-b-v;r.setElementHeight(o,e,!0,!0)}return s.virtualListHelper.render(),e&&e.target&&(s.lastPositionTarget=e.target,t.toggleClass(e.target,"has_".concat(s.baseClassName),!0),t.toggleClass(e.target,"has_".concat(s.baseClassName,"_below"),"below"===L),t.toggleClass(e.target,"has_".concat(s.baseClassName,"_above"),"above"===L),t.toggleClass(l,"".concat(s.baseClassName,"__is_below"),"below"===L),t.toggleClass(l,"".concat(s.baseClassName,"__is_above"),"above"===L)),this}setItemChecked(e,r){const i=this._p;r=!!r;let n=this.itemIndexByValue(e);if(-1===n)return this;let s=i.virtualListHelper.getItemElementAt(n);if(!s)return this;let l=s[us];return r=r&&!l._nocheck,l._checked!==r&&(l._checked=r,t.toggleClass(s,"".concat(i.baseClassName,"__item_checked"),l._checked),this._updateGroupStateForItem(l)),this}setCheckedValues(e){const r=this._p;this.rushRefilter();let i=[];for(let n=0,s=r.items.length;n<s;n++){let s=r.items[n],l=!s._nocheck&&-1!==e.indexOf(s.value),o=r.filteredItems?r.filteredItems.indexOf(s):n;if(s._group&&-1!==o&&i.push(o),s._checked===l)continue;if(s._checked=l,-1===o)continue;let a=r.virtualListHelper.getItemElementAt(o);a&&t.toggleClass(a,"".concat(r.baseClassName,"__item_checked"),s._checked)}if(r.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 r=[];for(let i=0,n=t.items.length;i<n;i++){let n=t.items[i];n._checked&&(e&&n._group||r.push(n.value))}return r}getCheckedItems(e){const t=this._p;e=e&&t.groupCount>0;const r=[];for(let i=0,n=t.items.length;i<n;i++){let n=t.items[i];n._checked&&(e&&n._group||r.push(n[us]))}return r}show(e){const t=this._p;t.hiding=!1,this.isVisible()||this._trigger("show:before"),t.mouseHandled=!1,setTimeout(()=>{this[cs]||t.onDocumentMouseDown||t.sink.add(document,"mousedown",t.onDocumentMouseDown=e=>{t.el.contains(e.target)||this._delayBlurItemOnBlur()})}),this.rushRefilter();const r=t.el;var i,n;if(r.style.position="absolute",r.classList.remove("".concat(t.baseClassName,"__is-hiding")),document.body.appendChild(r),t.visible=!0,t.el.style.display="","none"===getComputedStyle(t.el).display&&(t.el.style.display="block"),t.lastPositionOptions=null,void 0===e?e=null!==(i=null===(n=t.positionOptionsProvider)||void 0===n?void 0:n.call(t))&&void 0!==i?i:t.lastPositionOptions:t.lastPositionOptions=e,e){const t=getComputedStyle(r),i=r.style.maxHeight;let n=document.body.clientHeight-(parseFloat(t.marginTop)||0)-(parseFloat(t.marginBottom)||0)-("border-box"===t.boxSizing?0:(parseFloat(t.borderTopWidth)||0)+(parseFloat(t.borderBottomWidth)||0));r.style.maxHeight=Math.min(n,parseFloat(t.maxHeight)||n)+"px",this.relayout(e),r.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,this.isFilterPending()&&(e.throttledRefilterItems.cancel(),e.needsRefilter=!0),i&&(i.classList.add("".concat(e.baseClassName,"__is-hiding")),r.parseTransition(getComputedStyle(e.el).transition).reduce((e,t)=>Math.max(e,t.delay+t.duration),0)>0?setTimeout(()=>{this[cs]||this._p&&i.parentNode&&e.hiding&&(t.remove(i),i.classList.remove("".concat(e.baseClassName,"__is-hiding")),e.visible=!1,this._trigger("hide:after"))}):(i.parentNode&&t.remove(i),i.classList.remove("".concat(e.baseClassName,"__is-hiding")))),e.visible=!1,this.blurFocusedItem(),this._trigger("hide"),this[cs])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}setHeaderVisible(e){var t;this.isHeaderVisible()!==!!e&&(e?this._p.el.insertBefore(this._p.headerEl,null!==(t=this._p.el.firstChild)&&void 0!==t?t:null):this._p.headerEl.remove())}isHeaderVisible(){return!!this._p.headerEl.parentNode}getHeaderElement(){return this._p.headerEl}setFooterVisible(e){this.isFooterVisible()!==!!e&&(e?this._p.el.appendChild(this._p.footerEl):this._p.footerEl.remove())}isFooterVisible(){return!!this._p.footerEl.parentNode}getFooterElement(){return this._p.footerEl}setSearchable(t){const r=this._p;!!r.searchInput!=!!t&&(t?(r.searchInput=e.createElement("input",{type:"search",role:"searchbox",tabindex:"0",autocorrect:"off",autocomplete:"off",autocapitalize:"off",spellcheck:"false","aria-autocomplete":"list"}),r.headerEl.appendChild(r.searchInput)):(r.searchInput.parentNode&&r.searchInput.remove(),r.searchInput=null),this.setHeaderVisible(t))}hasFocusedItem(){return this._p.focusItemIndex>-1&&this._p.focusItemIndex<this._p.items.length}getFocusedItemIndex(){return this.hasFocusedItem()?this._p.focusItemIndex:-1}setFocusedItemAtIndex(e){var t;const r=this._p;if(this.rushRefilter(),r.filteredItems){const t=r.filteredItems[e];e=r.items.indexOf(t)}r.focusItemIndex=e;const i=null!==(t=r.filteredItems)&&void 0!==t?t:r.items;let n=null;e>-1&&(n=i[e]),n&&n._nointeraction&&(n=null),e>-1&&this._scrollItemIndexIntoView(e);let s=n?r.virtualListHelper.getItemElementAt(e):null;if(r.focusItemEl!==s&&(r.focusItemEl&&(r.focusItemEl.classList.remove("".concat(r.baseClassName,"__item_focus")),r.focusItemEl=null),s)){var l;s.classList.add("".concat(r.baseClassName,"__item_focus")),r.focusItemEl=s;const e=s[us];this._trigger("itemfocus",{value:e.value,item:null!==(l=e[us])&&void 0!==l?l:e,event:null,el:s}),this._showSublist(e,s)}return this}_showSublist(e,t){var r,i;if(null===(r=e._subitems)||void 0===r||!r.length)return;const n=this._p,s=new fs({baseClassName:n.baseClassName,additionalClasses:n.additionalClasses,direction:n.direction,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,positionOptionsProvider:()=>n.currentSubDropList.showOptions});let l=e=>{this[cs]||e.relatedTarget&&this.elContains(e.relatedTarget,!0)||(this._delayBlurItemOnBlur(),this._trigger("subitems:blur",e))};s.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()}),s.setItems(e._subitems),this._trigger("show_subitems",{value:e.value,item:null!==(i=e[us])&&void 0!==i?i:e,el:t,droplist:s}),n.currentSubDropList={item:e,itemElement:t,droplist:s,showOptions:{target:t,position:{x:"start",y:"top"},anchor:{x:"end",y:"top"},offset:{x:0,y:0},updateWidth:!1}},s.show(),s.el.focus()}_hideSublist(){const e=this._p;if(!e.currentSubDropList)return;const t=e.currentSubDropList;let r=!!document.activeElement&&t.droplist.elContains(document.activeElement,!0);t.droplist.hide(),t.droplist.destroy(),e.currentSubDropList=null,r&&!this[cs]&&this.el.focus(),this._trigger("hide_subitems",{value:t.item.value,item:t.item,el:t.itemElement})}updateSublist(){const e=this._p;if(!e.currentSubDropList)return;const t=e.currentSubDropList.item,r=e.currentSubDropList,i=e.items.find(e=>e===t)||e.items.find(e=>e.value===r.item.value);if(i){e.currentSubDropList.item=i;const t=e.virtualListHelper.getItemElementAt(this._getItemIndex(i));e.currentSubDropList.itemElement=t,i._subitems&&(e.currentSubDropList.droplist.setItems(i._subitems),t&&(e.currentSubDropList.showOptions.target=t,e.currentSubDropList.droplist.relayout()))}}setFocusedItem(e){const t=this._p;let r=e._nointeraction?-1:this._getItemIndex(e);const i=t.items;return r>-1&&i[r]._nointeraction&&(r=-1),this.setFocusedItemAtIndex(r)}setFocusedItemByValue(e){return this.setFocusedItemAtIndex(this.itemIndexByValue(e))}setSingleSelectedItemAtIndex(e){const t=this._p;this.rushRefilter();let r=null;if(e>-1&&!t.items[e]._nointeraction){if(t.filteredItems){const r=t.items[e];e=t.filteredItems.indexOf(r)}e>-1&&(r=t.virtualListHelper.getItemElementAt(e))}return this._setSingleSelectedItemEl(r),this}setSingleSelectedItem(e){const t=this._p;let r=e._nointeraction?-1:this._getItemIndex(e);const i=t.items;return r>-1&&i[r]._nointeraction&&(r=-1),this.setSingleSelectedItemAtIndex(r)}setSingleSelectedItemByValue(e){return this.setSingleSelectedItemAtIndex(this.itemIndexByValue(e))}next(e){this._move("next",e)}previous(e){this._move("prev",e)}isFirstItem(){var e;const t=this._p,r=null!==(e=t.filteredItems)&&void 0!==e?e:t.items;return 0===t.focusItemIndex&&t.focusItemIndex<r.length}isLastItem(){var e;const t=this._p,r=null!==(e=t.filteredItems)&&void 0!==e?e:t.items;return t.focusItemIndex>-1&&t.focusItemIndex===r.length-1}scrollItemIndexIntoView(e){const t=this._p;if(this._hasScroll()){if(t.filteredItems){const r=t.items[e];e=t.items.indexOf(r)}-1!==e&&this._scrollItemIndexIntoView(e)}return this}_scrollItemIndexIntoView(e){const t=this._p;if(this._hasScroll()){const r=t.menuEl,i=r.scrollTop;let n,s=-1,l=30;for(;l-- >0&&(n=t.virtualListHelper.getItemPosition(e),n!==s);){s=n;let l=t.virtualListHelper.getItemSize(e),o=r.clientHeight;n<i?r.scrollTop=n:n+l>i+o&&(r.scrollTop=n+l-o),t.virtualListHelper.render()}}}on(e,t){return this._p.mitt.on(e,t),this}once(e,t){let r=i=>{this._p.mitt.off(e,r),t(i)};return this._p.mitt.on(e,r),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 r=-1;var i;if(e&&(r=(null!==(i=t.filteredItems)&&void 0!==i?i:t.items).indexOf(e),-1===r)){let t=e&&void 0!==e.value?e.value:e,i=e&&e.label?e.label:t;r=this.itemIndexByValueOrLabel(t,i)}return r}_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 r=this._p;r.on&&r.on(e,...void 0===t?[]:[t]),r.mitt.emit(e,t)}_itemUpAction(t,r){if(e.closestUntil(t.target,".requires-pointer-events,button",r))return;let i=this._p;if(!this._mouseHandled){if(this.triggerItemSelection(null,t),this[cs])return;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 r=e.closestUntil(t.target,"li",t.currentTarget);r&&0===t.button&&this._itemUpAction(t,r)}).add(t.el,"mouseover",t=>{const r=e.closestUntil(t.target,"li",t.currentTarget);r&&this._handleMouseOver(t,r)})}_handleMouseOver(e,t){this._focus(e,t,null,!0)}_hookTouchEvents(){const t=this._p;let r;t.sink.add(t.el,"touchstart",i=>{const n=e.closestUntil(i.target,"li",i.currentTarget);if(!n)return;if(r)return;if(e.closestUntil(i.target,".requires-pointer-events,button",n))return;r=i.changedTouches[0].identifier,this._handleMouseOver(i,n);let s=!1,l=()=>{s=!0},o=()=>{r=null,t.sink.remove(null,".dropdown_touchextra")},a=n.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===r)?(o(),void(s||(this._itemUpAction(t,i),t.preventDefault()))):o()})})}_hookFocusEvents(){const e=this._p;e.sink.add(e.el,"focus",t=>{if(t.target===this.el&&e.searchable&&e.searchInput.focus(),t.relatedTarget&&this.elContains(t.relatedTarget,!0)&&this.elContains(t.target,!0))return;let r=e.focusItemEl||e.el.firstChild;this._focus(t,r,null,!1)},!0).add(e.el,"blur",e=>{e.relatedTarget&&this.elContains(e.relatedTarget,!0)&&this.elContains(e.target,!0)||setTimeout(()=>{this[cs]||document.activeElement&&this.elContains(document.activeElement,!0)||(this._delayBlurItemOnBlur(),this._trigger("blur",e))})},!0)}_hookKeyEvents(){const e=this._p;e.sink.add(e.el,"keydown",e=>this._keydown(e))}_hookSearchEvents(){const e=this._p;e.searchInput&&e.sink.add(e.searchInput,"input",()=>{e.filterTerm=e.searchInput.value.trim(),e.filteredItems=null,this._trigger("search",{value:e.searchInput.value}),e.throttledRefilterItems()})}_keydown(e){const t=this._p;if(t.keyDownHandler&&t.keyDownHandler.call(this,e))return;let r=!0;switch(e.key){case s.VALUE_PAGE_UP:case s.VALUE_PAGE_DOWN:case s.VALUE_HOME:case s.VALUE_END:case s.VALUE_UP:case s.VALUE_DOWN:switch(t.lastKeyWasChar=!1,e.preventDefault(),e.key){case s.VALUE_PAGE_UP:this.previousPage(e);break;case s.VALUE_PAGE_DOWN:this.nextPage(e);break;case s.VALUE_HOME:this._move("first",e);break;case s.VALUE_END:this._move("last",e);break;case s.VALUE_UP:this.previous(e);break;case s.VALUE_DOWN:this.next(e)}break;case s.VALUE_LEFT:case s.VALUE_RIGHT:if(t.lastKeyWasChar=!1,e.key===s.VALUE_RIGHT&&"rtl"!==getComputedStyle(e.target).direction||e.key===s.VALUE_LEFT&&"rtl"===getComputedStyle(e.target).direction){var i;let e=(null!==(i=t.filteredItems)&&void 0!==i?i:t.items)[t.focusItemIndex];t.focusItemIndex>-1&&e._subitems&&this._showSublist(e,t.focusItemEl)}else t.currentSubDropList?(this._hideSublist(),r=!1):this._trigger("_back_key_pressed");break;case s.VALUE_ENTER:t.lastKeyWasChar=!1,this.triggerItemSelection(null,e),e.preventDefault();break;case s.VALUE_SPACE:if("BUTTON"===e.target.tagName||"INPUT"===e.target.tagName&&t.lastKeyWasChar)return;this.toggleFocusedItem(),e.preventDefault();break;case s.VALUE_ESCAPE:t.lastKeyWasChar=!1,e.preventDefault(),this.hide();break;default:if("INPUT"===e.target.tagName||"TEXTAREA"===e.target.tagName){const r=e.key||String.fromCharCode(e.keyCode);t.lastKeyWasChar=1===r.length||e.key===s.VALUE_BACK_SPACE}t.searchable||this._keydownFreeType(e,!this.isVisible()),r=!1}}_keydownFreeType(e,t){var r;const i=this._p,n=e.key||String.fromCharCode(e.keyCode),l=1===n.length;if(i.lastKeyWasChar=l||e.key===s.VALUE_BACK_SPACE,!l)return;clearTimeout(i.filterTimer);let o,a=(i.previousFilter||"")+n,u=new RegExp("^".concat(os(a)),"i"),c=-1,d=i.focusItemIndex;const h=null!==(r=i.filteredItems)&&void 0!==r?r:i.items;for(let e=0,t=h.length;e<t&&(-1!==c&&e<d||(o=h[e],!(u.test(o.label)&&(c=e,-1===d||e>=d))));e++);if(-1===c){a=n,u=new RegExp("^".concat(os(a)),"i");for(let e=0,t=h.length;e<t&&(-1!==c&&e<d||(o=h[e],!(u.test(o.label)&&(c=e,-1===d||e>=d))));e++);}if(c>-1){let r=i.virtualListHelper.getItemElementAt(c);this._focus(e,r||null,c,!0),t&&this.triggerItemSelection(r?null:h[c],e),i.previousFilter=a,i.filterTimer=setTimeout(()=>{delete i.previousFilter},1e3)}else delete i.previousFilter}_focus(e,t,r,i){var n,s,l;const o=this._p;if(o._isFocusingItem)return;o._isFocusingItem=!0,!r&&t&&(r=o.virtualListHelper.getItemIndexFromElement(t)),r>-1&&(null===(n=t)||void 0===n||null===(n=n[us])||void 0===n?void 0:n[us])===hs&&(r=void 0),r>-1?this.scrollItemIndexIntoView(r):void 0===r&&(t=null);let a=t||o.virtualListHelper.getItemElementAt(r);if(!a||a[us]._nointeraction)return o._isFocusingItem=!1,void this.blurFocusedItem();if(a===o.focusItemEl)return o._isFocusingItem=!1,void clearTimeout(o.blurTimer);this.blurFocusedItem(),a.classList.add("".concat(o.baseClassName,"__item_focus")),o.focusItemEl=a,o.focusItemIndex=r;const u=(null!==(s=o.filteredItems)&&void 0!==s?s:o.items)[r];this._trigger("itemfocus",{value:u.value,item:null!==(l=u[us])&&void 0!==l?l:u,event:e,el:a}),o._isFocusingItem=!1,i&&this._showSublist(u,a)}_delayBlurItemOnBlur(){if(this[cs])return;const e=this._p;e.autoItemBlur&&(clearTimeout(e.blurTimer),e.blurTimer=setTimeout(()=>{this[cs]||this.blurFocusedItem()},e.autoItemBlurDelay))}_move(e,t){var i;const n=this._p;let s,l,o=!1;const a=null!==(i=n.filteredItems)&&void 0!==i?i:n.items;if("first"===e)l=0,o=!1;else if("last"===e)l=a.length-1,o=!0;else if("prev"===e){if(!this.hasFocusedItem())return this._move("last",t);l=n.focusItemIndex-1,-1===l&&(l=a.length-1),o=!0}else if("next"===e){if(!this.hasFocusedItem())return this._move("first",t);l=n.focusItemIndex+1,l===a.length&&(l=0),o=!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(n.virtualListHelper.isVirtual()){let t=n.virtualListHelper.getVisibleItemCount();l=n.focusItemIndex,"prev_page"===e?l-=t:l+=t,l<0?l=0:l>=a.length&&(l=a.length)}else if(n.focusItemEl){let t=r.getElementOffset(n.focusItemEl).top,i=r.getElementHeight(n.el,!0);for(;;){if(s=n.focusItemEl.nextElementSibling,!s)return;if("LI"===s.tagName)if("prev_page"===e){if(r.getElementOffset(s).top-t+i<=0)break}else if(r.getElementOffset(s).top-t-i>=0)break}s&&(l=n.virtualListHelper.getItemIndexFromElement(s),void 0===l&&(l=-1))}o="prev_page"===e}let u=a.length;if(l>=u)return;let c=a[l],d=l;for(;c&&c._nointeraction&&(o?(l--,-1===l&&(l=u)):(l++,l===u&&(l=0)),c=a[l],l!==d););s=n.virtualListHelper.getItemElementAt(l),this._focus(t,s||null,l,!1),this.isVisible()||this.triggerItemSelection(c,t)}_hasScroll(){const e=this._p.menuEl;return e.clientHeight<e.scrollHeight}_updateGroupStateForItem(e){const r=this._p;if(!r.multi)return this;if(e._group){var i;let l=0;if(r.autoCheckGroupChildren){var n;const i=null!==(n=r.filteredItems)&&void 0!==n?n:r.items;let o=i.indexOf(e);const a=e._level;for(let n=o+1,u=i.length;n<u;n++){var s;let o=i[n];if(!o._child&&i[n-1]._child||(void 0===a?o._group||void 0!==o._level:o._level<=a))break;if(!!o._checked===e._checked)continue;o._checked=e._checked,l++;let u=r.virtualListHelper.getItemElementAt(n);u&&t.toggleClass(u,"".concat(r.baseClassName,"__item_checked"),e._checked),this._trigger("check",{value:o.value,item:null!==(s=o[us])&&void 0!==s?s:o,checked:o._checked,isGroup:o._group,isCheckingGroup:!0})}}this._trigger("groupcheck",{value:e.value,item:null!==(i=e[us])&&void 0!==i?i:e,affectedCount:l})}else if(r.groupCount>0&&r.autoCheckGroupChildren){var l;const t=null!==(l=r.filteredItems)&&void 0!==l?l:r.items;let i=-1;for(let r=t.indexOf(e)-1;r>=0;r--)if(t[r]._group){i=r;break}i>-1&&this._updateGroupCheckedState(i,!0)}return this}_updateGroupCheckedState(e,r){var i;const n=this._p;if(!(n.multi&&n.autoCheckGroupChildren&&e>-1))return this;const s=null!==(i=n.filteredItems)&&void 0!==i?i:n.items;let l=s[e];if(!l||!l._group)return this;let o,a=!1,u=!1;const c=l._level;for(let t=e+1,r=s.length;t<r&&(o=s[t],!(!o._child&&s[t-1]._child||(void 0===c?o._group||void 0!==o._level:o._level<=c)));t++)o._checked?a=!0:o._checked||(u=!0);if(!a&&!u)return this;let d=a&&!u;if(!!l._checked!==d){l._checked=d;let i=n.virtualListHelper.getItemElementAt(e);var h;i&&t.toggleClass(i,"".concat(n.baseClassName,"__item_checked"),l._checked),r&&this._trigger("check",{value:l.value,item:null!==(h=l[us])&&void 0!==h?h:l,checked:l._checked,isGroup:l._group,isCheckingGroup:!1})}return this}_measureItem(){const t=this._p;if(t.lastMeasureItemCount!==t.items.length){let e=t.lastMeasureLongestLabel||1,r=t.lastMeasureLongestLabelText||"";for(let i=0,n=t.items,s=n.length;i<s;i++){const t=n[i];let s=t.label;null==s&&(s=t.value),null==s&&(s="");let l=s.length;l>e&&(e=l,r=s)}t.lastMeasureItemCount=t.items.length,t.lastMeasureLongestLabel=e,t.lastMeasureLongestLabelText=r}return(t.estimateWidth||t.virtualListHelper.isVirtual())&&t.virtualListHelper.createGhostItemElement(ds,!0,i=>{let n=e.createElement("span",{css:{display:"block",width:"100px",height:"100px",overflow:"scroll",position:"absolute"}}),s=e.createElement("span",{css:{display:"block",position:"relative",width:"0",height:"0",overflow:"hidden"}},[n]);i.appendChild(s);let l=n.offsetWidth-n.clientWidth;i.removeChild(s),t.lastMeasureItemWidth=r.getElementWidth(i,!0,!0)+l}),this}_determineVirtualMode(e){var t;const r=this._p,i=null!==(t=r.filteredItems)&&void 0!==t?t:r.items;void 0===e&&(e=i.length);let n=e>=r.virtualMinItems;return n!==r.virtualListHelper.isVirtual()&&r.virtualListHelper.setVirtual(n).render(),this}_renderItemContent(t,r){const i=this._p,n=t[us];if(n===hs)return!(!i.renderNoResultsItem||!1===i.renderNoResultsItem(t,r))||void r.appendChild(e.createElement("div",{class:"droplist-no-results-content",textContent:i.noResultsText}));i.renderItem&&!1!==i.renderItem(n||t,r)||(r.appendChild(e.createElement("span",{class:"".concat(i.baseClassName,"__item_label"),textContent:t.label})),i.multi&&(t._nocheck||r.insertBefore(e.createElement("span",{class:"checkbox"}),r.firstChild)))}_updateWidth(e){const t=this._p,i=t.el;let n=0;e&&(n="number"==typeof e.updateWidth||null!=e.targetWidth?e.updateWidth:r.getElementWidth(e.target,!0,!0));let s=0;t.useExactTargetWidth&&n||(t.estimateWidth||t.virtualListHelper.isVirtual()?s=t.lastMeasureItemWidth:(i.style.width="",s=r.getElementWidth(i,!0,!0)));let l=Math.max(s,n);r.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}}var _s,gs,vs,bs,Is,ys,Ss,Es,Cs,Ls,xs,ws,ks,Ts,Os,Ps={};function As(){if(gs)return _s;gs=1;var e=Ne(),t=TypeError;return _s=function(r,i){if(!delete r[i])throw new t("Cannot delete property "+e(i)+" of "+e(r))}}function Ns(){if(bs)return vs;bs=1;var e=be();return vs=e([].slice)}function Fs(){if(Es)return Ss;Es=1;var e=x();return Ss=function(t,r){var i=[][t];return!!i&&e(function(){i.call(null,r||function(){return 1},1)})}}!function(){if(Os)return Ps;Os=1;var e=Qr(),t=be(),r=Fe(),i=ht(),n=Er(),s=As(),l=Xr(),o=x(),a=function(){if(ys)return Is;ys=1;var e=Ns(),t=Math.floor,r=function(i,n){var s=i.length;if(s<8)for(var l,o,a=1;a<s;){for(o=a,l=i[a];o&&n(i[o-1],l)>0;)i[o]=i[--o];o!==a++&&(i[o]=l)}else for(var u=t(s/2),c=r(e(i,0,u),n),d=r(e(i,u),n),h=c.length,p=d.length,m=0,f=0;m<h||f<p;)i[m+f]=m<h&&f<p?n(c[m],d[f])<=0?c[m++]:d[f++]:m<h?c[m++]:d[f++];return i};return Is=r}(),u=Fs(),c=function(){if(Ls)return Cs;Ls=1;var e=ke().match(/firefox\/(\d+)/i);return Cs=!!e&&+e[1]}(),d=function(){if(ws)return xs;ws=1;var e=ke();return xs=/MSIE|Trident/.test(e)}(),h=Te(),p=function(){if(Ts)return ks;Ts=1;var e=ke().match(/AppleWebKit\/(\d+)\./);return ks=!!e&&+e[1]}(),m=[],f=t(m.sort),_=t(m.push),g=o(function(){m.sort(void 0)}),v=o(function(){m.sort(null)}),b=u("sort"),I=!o(function(){if(h)return h<70;if(!(c&&c>3)){if(d)return!0;if(p)return p<603;var e,t,r,i,n="";for(e=65;e<76;e++){switch(t=String.fromCharCode(e),e){case 66:case 69:case 70:case 72:r=3;break;case 68:case 71:r=4;break;default:r=2}for(i=0;i<47;i++)m.push({k:t+i,v:r})}for(m.sort(function(e,t){return t.v-e.v}),i=0;i<m.length;i++)t=m[i].k.charAt(0),n.charAt(n.length-1)!==t&&(n+=t);return"DGBEFHACIJK"!==n}});e({target:"Array",proto:!0,forced:g||!v||!b||!I},{sort:function(e){void 0!==e&&r(e);var t=i(this);if(I)return void 0===e?f(t):f(t,e);var o,u,c=[],d=n(t);for(u=0;u<d;u++)u in t&&_(c,t[u]);for(a(c,function(e){return function(t,r){return void 0===r?-1:void 0===t?1:void 0!==e?+e(t,r)||0:l(t)>l(r)?1:-1}}(e)),o=n(c),u=0;u<o;)t[u]=c[u++];for(;u<d;)s(t,u++);return t}})}();const Vs=Symbol("destroyed"),Rs=Symbol("rest_multi_items"),Ms=!!("ontouchstart"in window||window.DocumentTouch&&window.document instanceof window.DocumentTouch||window.navigator.maxTouchPoints),Ws=function(e,t){return e instanceof Element&&e.classList.contains(t)},Bs=["font-family","font-size","font-weight","font-size","letter-spacing","text-transform","word-spacing","text-indent","box-sizing","padding-left","padding-right"],Ds={el:null,baseClassName:"selectbox",disabled:!1,readOnly:!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",autoSelectTextOnCheck:!0,filterThrottleWindow:300,filterOnEmptyTerm:!1,labelProp:"label",valueProp:"value",multiItemLabelProp:"short_label",multiItemRemovePosition:"after",maxMultiItems:null,multiItemsRestLabelProvider:null,items:[],selectedValues:void 0,value:void 0,isLoadingMode:!1,closeListWhenLoading:!0,clearInputWhen:["single_close","multi_select_single"]};exports.DropList=fs,exports.DropListDefaultOptions=ms,exports.ItemSymbol=us,exports.SelectBox=class{constructor(r){const n=c({},Ds);for(let[e,t]of Object.entries(r))void 0!==t&&(n[e]=t);const s=this._p={ownsEl:!0,baseClassName:n.baseClassName,additionalClasses:n.additionalClasses,direction:"ltr"===n.direction?"ltr":"rtl"===n.direction?"rtl":"auto",listOptions:n.listOptions,disabled:!!n.disabled,readOnly:!!n.readOnly,clearable:!!n.clearable,hasOpenIndicator:!!n.hasOpenIndicator,placeholder:n.placeholder,sortSelectedItems:!!n.sortSelectedItems,sortListItems:!!n.sortListItems,sortListCheckedFirst:!!n.sortListCheckedFirst,stickyValues:Array.isArray(n.stickyValues)?new Set(n.stickyValues):null,sortItemComparator:n.sortItemComparator,splitListCheckedGroups:!!n.splitListCheckedGroups,treatGroupSelectionAsItems:n.treatGroupSelectionAsItems,blurOnSingleSelection:n.blurOnSingleSelection,multi:n.multi,showSelection:n.showSelection,showPlaceholderInTooltip:n.showPlaceholderInTooltip,multiPlaceholderFormatter:n.multiPlaceholderFormatter,searchable:n.searchable,allowTypeToSelect:n.allowTypeToSelect,noResultsText:n.noResultsText,autoSelectTextOnCheck:n.autoSelectTextOnCheck,labelProp:n.labelProp,valueProp:n.valueProp,multiItemLabelProp:n.multiItemLabelProp,multiItemRemovePosition:n.multiItemRemovePosition,maxMultiItems:n.maxMultiItems,multiItemsRestLabelProvider:n.multiItemsRestLabelProvider,renderSingleItem:n.renderSingleItem,unrenderSingleItem:n.unrenderSingleItem,renderMultiItem:n.renderMultiItem,unrenderMultiItem:n.unrenderMultiItem,renderRestMultiItem:n.renderRestMultiItem,unrenderRestMultiItem:n.unrenderRestMultiItem,on:n.on||null,silenceEvents:!0,mitt:l(),isLoadingMode:!!n.isLoadingMode,closeListWhenLoading:!!n.closeListWhenLoading,clearInputWhen:Array.isArray(n.clearInputWhen)?n.clearInputWhen.slice(0):[],items:[],itemsChanged:!0,sink:new i,resizeObserver:null,selectedItems:[],selectedValues:[],selectionChanged:!0,resortBySelectionNeeded:!1,filterThrottleWindow:n.filterThrottleWindow,filterOnEmptyTerm:n.filterOnEmptyTerm,filterFn:null,filterTerm:""};let o=n.el;o instanceof Element?s.ownsEl=!1:o=e.createElement("span"),e.setElementAttrs(o,{role:"combobox","aria-haspopup":"true","aria-expanded":"false"}),s.el=o,this._syncBaseClasses(),this._renderBase(),s.multiItemEls=[],this.enable(!s.disabled),this.setReadOnly(s.readOnly),this._setupDropdownMenu(),s.sink.add(o,"click",e=>{s.clearButtonWrapper&&s.clearButtonWrapper.contains(e.target)||o.contains(document.activeElement)||(s.input.focus(),s.input.selectionStart=s.input.selectionEnd=s.input.value.length)}),s.sink.add(o,"focus",e=>{const t=e.target;if(!o.contains(e.relatedTarget)&&!Ws(t,"".concat(s.baseClassName,"__search_field"))&&!Ws(t,"".concat(s.baseClassName,"__item"))){let e=o.querySelector(".".concat(s.baseClassName,"__search_field"));e&&e.focus()}},!0),s.sink.add(s.input,"keydown",e=>{this._handleInputKeydown(e)}).add(s.input,"input",()=>{this._resizeInput()});const a=(()=>{let e;return()=>{e&&clearTimeout(e),e=setTimeout(()=>{t.toggleClass(o,"".concat(s.baseClassName,"__focus"),o.contains(document.activeElement))})}})();if(s.sink.add(o,"focus",a,!0),s.sink.add(o,"blur",a,!0),s.sink.add(window,"resize",()=>this._resizeInput()),s.sink.add(window,"orientationchange",()=>this._resizeInput()),void 0!==window.ResizeObserver){let e={borderBoxSize:{blockSize:null,inlineSize:null},contentBoxSize:{blockSize:null,inlineSize:null}};s.resizeObserver=new ResizeObserver(t=>{if(this[Vs])return;const r=t[0];e&&r.borderBoxSize[0].blockSize===e.borderBoxSize.blockSize&&r.borderBoxSize[0].inlineSize===e.borderBoxSize.inlineSize&&r.contentBoxSize[0].blockSize===e.contentBoxSize.blockSize&&r.contentBoxSize[0].inlineSize===e.contentBoxSize.inlineSize||(s.resizeObserver.unobserve(s.el),this._resizeInput(),requestAnimationFrame(()=>s.resizeObserver.observe(s.el))),e.borderBoxSize=r.borderBoxSize[0],e.contentBoxSize=r.contentBoxSize[0]}),s.resizeObserver.observe(s.el)}return this.setFilterFn(n.filterFn),this.setItems(n.items),delete n.items,n.multi&&Array.isArray(n.selectedValues)?this.setSelectedValues(n.selectedValues):null!=n.value&&this.setValue(n.value),this._scheduleSync("full"),this.silenceEvents=!1,this}destroy(){var e;if(this[Vs])return;this[Vs]=!0;const r=this._p;if(r.syncTimeout&&(clearTimeout(r.syncTimeout),delete r.syncTimeout),this._stopTrackingPresence(),r.sink.remove(),r.dropList&&r.dropList.destroy(),this._cleanupSingleWrapper(),r.unrenderMultiItem||r.unrenderRestMultiItem)for(;r.multiItemEls.length>0;)this._removeMultiItemElementByIndex(r.multiItemEls.length-1);if(t.remove(r.list),t.remove(r.singleWrapper),t.remove(r.input),t.remove(r.inputBackBuffer),t.remove(r.clearButtonWrapper),t.remove(r.openIndicator),!r.ownsEl){for(let e of Array.from(r.el.classList))e.startsWith(r.baseClassName)&&r.el.classList.remove(e);r.el.removeAttribute("role"),r.el.removeAttribute("aria-haspopup"),r.el.removeAttribute("aria-expanded")}null===(e=r.resizeObserver)||void 0===e||e.disconnect(),this._p=null}get el(){return this._p.el}get droplistInstance(){return this._p.dropList}droplistElContains(e){var t;let r=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return null===(t=this._p.dropList)||void 0===t?void 0:t.elContains(e,r)}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 r=t.multiItemEls;for(let e of r)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}setReadOnly(e){const t=this._p;return void 0===e&&(e=!0),t.readOnly=e,t.el.setAttribute("aria-readOnly",t.readOnly.toString()),t.input.readOnly=!(t.searchable||t.multi)||!!t.readOnly,this}isReadOnly(){return this._p.readOnly}setAdditionalClasses(e){return this._p.additionalClasses=e,this._syncBaseClasses(),this}setItems(e){let t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];const r=this._p;return e||(e=[]),r.items=e.slice(0),r.itemsChanged=!0,this._refreshItemByValueMap(),t&&this.setSelectedValues(this.getSelectedValues()),this._trigger("itemschanged",{term:null,mutated:!0,count:this.getFilteredItemCount()}),this}getFilteredItemCount(){const e=this._p;return e.dropList?e.dropList.getFilteredItemCount():e.items?e.items.length:0}isFilterPending(){var e;return!0===(null===(e=this._p.dropList)||void 0===e?void 0:e.isFilterPending())}updateItemByValue(e,t){const r=this._p;let i=this._getItemByValue(e);if(i){var n;const e=i[r.valueProp];null!==(n=r.itemByValueMap)&&void 0!==n&&n.has(e)&&r.itemByValueMap.delete(e),Object.assign(i,t),r.itemByValueMap.set(i[r.valueProp],i)}r.dropList&&r.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 r=this._p;return r.input?(r.input.value=e,this._scheduleSync("resize_input"),t&&(r.filterTerm=r.input.value.trim(),this._trigger("search:term",r.filterTerm),null===(i=r.dropList)||void 0===i||i.setSearchTerm(r.filterTerm,t)),this):this;var i}getSearchTerm(){const e=this._p;return e.input?e.input.value:""}invokeRefilter(){var e;return null===(e=this._p.dropList)||void 0===e||e.invokeRefilter(),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.itemsChanged=!0,this._scheduleSync("render_list")),this}isSortListItemsEnabled(){return this._p.sortListItems}setSortListCheckedFirst(e){const t=this._p;return e=!!e,t.sortListCheckedFirst===e||(t.sortListCheckedFirst=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){var t,r;const i=this._p;return e=!!e,i.treatGroupSelectionAsItems===e||(i.treatGroupSelectionAsItems=e,null===(t=i.dropList)||void 0===t||t.setFilterGroups(e),null===(r=i.dropList)||void 0===r||r.setFilterEmptyGroups(!e),i.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 r=this._p;return e=!!e,r.multi===e||(r.multi=e,this._setupDropdownMenu(),t.remove(r.clearButtonWrapper),delete r.clearButtonWrapper,e&&r.selectedValues&&1===r.selectedValues.length&&Array.isArray(r.selectedValues[0])&&this.setSelectedValues(r.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}setAllowTypeToSelect(e){const t=this._p;return e=!!e,t.allowTypeToSelect===e||(t.allowTypeToSelect=e),this}isSearchableEnabled(){return this._p.searchable}setNoResultsText(e){var t;return null===(t=this._p.dropList)||void 0===t||t.setNoResultsText(e),this}getNoResultsText(){return this._p.noResultsText}setAutoSelectTextOnCheck(e){return this._p.autoSelectTextOnCheck=e,this}getAutoSelectTextOnCheck(){return this._p.autoSelectTextOnCheck}setFilterThrottleWindow(e){var t;const r=this._p;return r.filterThrottleWindow=e,null===(t=r.dropList)||void 0===t||t.setFilterThrottleWindow(e),this}getFilterThrottleWindow(){return this._p.filterThrottleWindow}setFilterOnEmptyTerm(e){var t;const r=this._p;return r.filterOnEmptyTerm===e||null===(t=r.dropList)||void 0===t||t.setFilterOnEmptyTerm(e),this}getFilterOnEmptyTerm(){return this._p.filterOnEmptyTerm}setListOptions(e){return this._p.listOptions=e,this._setupDropdownMenu(),this}setRenderSingleItem(e,t){const r=this._p;return r.renderSingleItem=e,r.unrenderSingleItem=t,this}setRenderMultiItem(e,t){const r=this._p;return r.renderMultiItem=e,r.unrenderMultiItem=t,this}setRenderRestMultiItem(e,t){const r=this._p;return r.renderRestMultiItem=e,r.unrenderRestMultiItem=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._refreshItemByValueMap()),this}setMultiItemLabelProp(e){return this._p.multiItemLabelProp=e,this._scheduleSync("render_items"),this}setMultiItemRemovePosition(e){return this._p.multiItemRemovePosition=e,this._scheduleSync("render_items"),this}setMaxMultiItems(e){return this._p.maxMultiItems=e,this}setMultiItemsRestLabelProvider(e){return this._p.multiItemsRestLabelProvider=e,this}setFilterFn(e){var t;const r=this._p;return r.filterFn===e||(r.filterFn=e,e||(e=(e,t)=>{const i=new RegExp(os(t),"i"),n=r.labelProp,s=r.multiItemLabelProp;return r.items.filter(e=>!(r.treatGroupSelectionAsItems||!e._group)||i.test(e[n]||e[s]))}),r.actualFilterFn=e,null===(t=r.dropList)||void 0===t||t.setFilterFn(e)),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[Vs],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,r=t.valueProp;t.multi||(e=e.slice(0,1));let i=new Set,n=[],s=[];for(let t of e){if(i.has(t))continue;i.add(t),n.push(t);let e=this._getItemByValue(t);void 0!==e?s.push(e):s.push({[r]:t})}return t.selectedValues=n,t.selectedItems=s,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}),document.activeElement!==e.input&&(e.lastActiveElement=document.activeElement===document.body?null:function(e){if(!e)return null;const t={element:e};return"number"==typeof e.selectionStart&&"number"==typeof e.selectionEnd&&(t.selectionStart=e.selectionStart,t.selectionEnd=e.selectionEnd,t.selectionDirection=e.selectionDirection),t}(document.activeElement)),e.dropList.setDirection(getComputedStyle(e.el).direction),e.dropList.show(),this._repositionDropList(),this._repositionDropList(),e.dropList.hasFocusedItem()?e.dropList.setFocusedItemAtIndex(e.dropList.getFocusedItemIndex()):e.multi||void 0===this.getValue()||e.dropList.setFocusedItemByValue(this.getValue())),this}closeList(){const e=this._p;return this[Vs]?this:e.dropList.isVisible()?(e.dropList.hide(),e.lastActiveElement&&(e.multi||e.searchable||null!=(t=e.lastActiveElement)&&t.element&&document.body.contains(t.element)&&(t.element.focus(),"number"==typeof t.selectionStart&&"number"==typeof t.selectionEnd&&"function"==typeof t.element.setSelectionRange&&t.element.setSelectionRange(t.selectionStart,t.selectionEnd,null!==(r=t.selectionDirection)&&void 0!==r?r:"none")),e.lastActiveElement=null),this):this;var t,r}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&&t.closeListWhenLoading&&0===t.items.length&&this.isListOpen()?this.closeList():!t.isLoadingMode&&t.closeListWhenLoading&&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}setCloseListWhenLoading(e){return this._p.closeListWhenLoading=e,this}getCloseListWhenLoading(){return this._p.closeListWhenLoading}setClearInputWhen(e){return this._p.clearInputWhen=Array.isArray(e)?e.slice(0):[],this}getClearInputWhen(){return this._p.clearInputWhen}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 r=i=>{this._p.mitt.off(e,r),t(i)};return this._p.mitt.on(e,r),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}_refreshItemByValueMap(){const e=this._p,t=e.itemByValueMap=new Map,r=e.valueProp;for(let i of e.items)t.set(i[r],i);e.subitemByValueMap=null}_getItemByValue(e){const t=this._p;let r=t.itemByValueMap.get(e);return void 0!==r?r:(t.subitemByValueMap||this._refreshSubitemByValueMap(),t.subitemByValueMap.get(e))}_refreshSubitemByValueMap(){const e=this._p,t=e.subitemByValueMap=new Map;this._addSubitemsToValueMap(e.items,t,e.valueProp)}_addSubitemsToValueMap(e,t,r){for(let n of e){var i;if(null!==(i=n._subitems)&&void 0!==i&&i.length){for(let e of n._subitems)t.has(e[r])||t.set(e[r],e);this._addSubitemsToValueMap(n._subitems,t,r)}}}_renderBase(){const r=this._p;if(r.inputBackBuffer||(r.inputBackBuffer=e.createElement("span",{css:{position:"absolute",zIndex:-1,left:0,top:"-9999px",whiteSpace:"pre"}})),r.input||(r.inputWrapper=e.createElement("span",{class:"".concat(r.baseClassName,"__search_wrapper")},r.input=e.createElement("input",{class:"".concat(r.baseClassName,"__search_field"),type:"search",autocomplete:"off",autocorrect:"off",autocapitalize:"off",spellcheck:"false",role:"textbox","aria-autocomplete":"list",readOnly:!(r.searchable||r.multi)||!!r.readOnly}))),r.multi){if(r.singleWrapper&&(this._cleanupSingleWrapper(),t.remove(r.singleWrapper),delete r.singleWrapper),!r.list){this._unregisterDropdownEvents();const t=document.activeElement;r.list=e.createElement("ul",{class:"".concat(r.baseClassName,"__list")}),r.el.appendChild(r.list),r.list.appendChild(r.inputWrapper),r.el.classList.remove("".concat(r.baseClassName,"__single")),r.el.classList.add("".concat(r.baseClassName,"__multi")),r.sink.add(r.list,"click",t=>{e.closestUntil(t.target,".".concat(r.baseClassName,"__item_remove"),t.currentTarget)&&(r.disabled||r.readOnly||this._removeMultiItemFromEvent(e.closestUntil(t.target,".".concat(r.baseClassName,"__item"),t.currentTarget),t))}).add(r.list,"keydown",t=>{e.closestUntil(t.target,".".concat(r.baseClassName,"__item"),t.currentTarget)&&this._handleMultiKeydown(t)}),t===r.input&&r.input.focus(),this._registerDropdownEvents()}}else if(r.list&&(t.remove(r.list),r.sink.remove(r.list),delete r.list),!r.singleWrapper){this._unregisterDropdownEvents();const t=document.activeElement;r.singleWrapper=e.createElement("div",{class:"".concat(r.baseClassName,"__single_wrapper")}),r.el.appendChild(r.singleWrapper),r.el.appendChild(r.inputWrapper),r.el.classList.remove("".concat(r.baseClassName,"__multi")),r.el.classList.add("".concat(r.baseClassName,"__single")),t===r.input&&r.input.focus(),this._registerDropdownEvents()}r.hasOpenIndicator!==!!r.openIndicator&&(r.hasOpenIndicator?(r.openIndicator=e.createElement("span",{class:"".concat(r.baseClassName,"__open_indicator")}),r.el.appendChild(r.openIndicator),r.el.classList.add("".concat(r.baseClassName,"__has_open_indicator"))):(t.remove(r.openIndicator),delete r.openIndicator,r.el.classList.remove("".concat(r.baseClassName,"__has_open_indicator")))),r.isLoadingMode!==!!r.spinner&&(r.isLoadingMode?(r.spinner=e.createElement("span",{class:"".concat(r.baseClassName,"__spinner")}),r.el.appendChild(r.spinner),r.el.classList.add("".concat(r.baseClassName,"__has_spinner"))):(t.remove(r.spinner),delete r.spinner,r.el.classList.remove("".concat(r.baseClassName,"__has_spinner"))))}_syncBaseClasses(){const e=this._p,t=e.el;if(!t)return;let r=[e.baseClassName];e.multi?r.push("".concat(e.baseClassName,"__multi")):r.push("".concat(e.baseClassName,"__single")),this.isListOpen()?r.push("".concat(e.baseClassName,"__open_list")):r.push("".concat(e.baseClassName,"__closed_list")),e.hasOpenIndicator&&r.push("".concat(e.baseClassName,"__has_open_indicator")),e.clearButtonWrapper&&r.push("".concat(e.baseClassName,"__has_clear")),e.isLoadingMode&&r.push("".concat(e.baseClassName,"__has_spinner")),0===e.selectedValues.length&&r.push("".concat(e.baseClassName,"__empty_selection")),e.selectedValues.length>0&&r.push("".concat(e.baseClassName,"__has_selection")),(e.searchable||e.multi)&&r.push("".concat(e.baseClassName,"__searchable")),"ltr"!==e.direction&&"rtl"!==e.direction||r.push("".concat(e.baseClassName,"__")+e.direction),e.additionalClasses&&(r=r.concat(e.additionalClasses)),t.className=r.join(" ")}_setupDropdownMenu(){const t=this._p;t.valueProp,t.dropList&&(t.dropList.destroy(),delete t.dropList,t.itemsChanged=!0,t.selectionChanged=!0,t.resortBySelectionNeeded=!0);const r=t.dropList=new fs(c(c({virtualMinItems:10,searchable:!1},t.listOptions),{},{multi:t.multi,capturesFocus:!1,labelProp:t.labelProp,valueProp:t.valueProp,noResultsText:t.noResultsText,filterThrottleWindow:t.filterThrottleWindow,filterOnEmptyTerm:t.filterOnEmptyTerm,filterGroups:t.treatGroupSelectionAsItems,filterEmptyGroups:!t.treatGroupSelectionAsItems,filterFn:t.actualFilterFn,positionOptionsProvider:()=>this._getDropListPositionOptions(),on:(e,i)=>{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:r}),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?t.clearInputWhen.includes("multi_close")&&this._setInputText(""):(t.clearInputWhen.includes("single_close")&&this._setInputText(""),this._scheduleSync("render_base")),this._trigger("close"),this[Vs])return;this._stopTrackingPresence(),t.sink.remove(null,".trackposition");break;case"check":{if(!t.multi)return;t.autoSelectTextOnCheck&&t.input&&document.activeElement===t.input&&t.input.setSelectionRange(0,t.input.value.length);const e=i.item,n=i.value;let s=i.checked;if(i.isGroup&&!t.treatGroupSelectionAsItems)return;let l={value:n,item:e,cancel:!1,isCheckingGroup:i.isCheckingGroup};if(this._trigger((s?"addsel":"removesel")+":before",l),l.cancel)return void t.dropList.setItemChecked(n,!s);if(s)t.selectedItems.push(e),t.selectedValues.push(n);else{const e=t.selectedValues.indexOf(n);-1!==e&&(t.selectedItems.splice(e,1),t.selectedValues.splice(e,1))}t.selectionChanged=!0,t.resortBySelectionNeeded=!0;const o=!!i.isCheckingGroup;t.showSelection?s?(1===r.itemCount()&&t.clearInputWhen.includes("multi_select_single")&&this._setInputText(""),t.sortSelectedItems?o||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),o||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),o||this._scheduleSync("render_base")):t.multi&&this._scheduleSync("syncPlaceholder"),this._trigger(s?"addsel":"removesel",{value:n,item:e,isCheckingGroup:i.isCheckingGroup})}break;case"groupcheck":if(!t.multi)return;t.autoSelectTextOnCheck&&t.input&&document.activeElement===t.input&&t.input.setSelectionRange(0,t.input.value.length),i.affectedCount&&this._scheduleSync(t.sortSelectedItems?"full":"render_base"),this._trigger("groupcheck",{value:i.value,item:i.item,affectedCount:i.affectedCount});break;case"select":case"subitems:select":{if(t.multi)return;const e=i.item,r=i.value;if(!this._performSelectWithEvent(e,r))return;if(this[Vs])return;this.closeList(),("touch"===t.blurOnSingleSelection&&Ms||"touch"!==t.blurOnSingleSelection&&t.blurOnSingleSelection)&&t.input&&document.activeElement===t.input&&t.input.blur()}break;case"blur":this._handleOnBlur();break;case"search":this._trigger("search",i);break;case"itemschanged":this._trigger("itemschanged",i)}}}));t.sink.add(r.el,"mousedown",t=>{e.closestUntil(t.target,"li",t.currentTarget)&&t.preventDefault()}),this._registerDropdownEvents()}_handleOnBlur(){const e=this._p;setTimeout(()=>{this[Vs]||e.disabled||e.readOnly||(this._trigger("search:blur"),this[Vs]||document.activeElement&&(e.input&&e.input.contains(document.activeElement)||e.dropList&&this.droplistElContains(document.activeElement,!0))||this.closeList())})}_unregisterDropdownEvents(){this._p.sink.remove(null,".dropdown")}_registerDropdownEvents(){const t=this._p;this._unregisterDropdownEvents();const r=t.dropList;if(!r)return;let i=!1,n=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,n=t.lastKeyAllowsNonTypeKeys;t.lastKeyAllowsNonTypeKeys=!1;let l=t.input&&t.input.value.length>0;switch(e.key){case s.VALUE_PAGE_UP:case s.VALUE_PAGE_DOWN:case s.VALUE_UP:case s.VALUE_DOWN:case s.VALUE_HOME:case s.VALUE_END:if((e.key===s.VALUE_HOME||e.key===s.VALUE_END)&&l&&!n){r._keydownFreeType(e);break}switch(t.lastKeyAllowsNonTypeKeys=!0,e.preventDefault(),e.key){case s.VALUE_PAGE_UP:r.isVisible()&&r.previousPage(e);break;case s.VALUE_PAGE_DOWN:r.isVisible()&&r.nextPage(e);break;case s.VALUE_UP:r.isVisible()?r.previous(e):this._movePrev();break;case s.VALUE_DOWN:r.isVisible()?r.next(e):this._moveNext();break;case s.VALUE_HOME:r.goToFirst(e);break;case s.VALUE_END:r.goToLast(e)}break;case s.VALUE_SPACE:n&&(t.lastKeyAllowsNonTypeKeys=!0,r.isVisible()&&r.hasFocusedItem()&&(i=!0,t.multi?r.toggleFocusedItem(e):r.triggerItemSelection(null,e),e.preventDefault()));break;case s.VALUE_ENTER:r.isVisible()&&r.hasFocusedItem()&&(i=!0,e.preventDefault(),r.triggerItemSelection(null,e));break;case s.VALUE_TAB:r.isVisible()&&r.hasFocusedItem()&&r.triggerItemSelection(null,e);break;case s.VALUE_ESCAPE:r.isVisible()&&(r.hide(e),e.preventDefault());break;default:r.isVisible()?r._keydownFreeType(e,!1):t.allowTypeToSelect?r._keydownFreeType(e,!0):(this.openList(),setTimeout(()=>{this[Vs]||r._keydownFreeType(e,!1)}))}i||e.key!==s.VALUE_ENTER&&(e.key!==s.VALUE_SPACE||!t.lastKeyAllowsNonTypeKeys||t.multi||r.hasFocusedItem()||t.disabled||t.readOnly)||(this.toggleList(),e.preventDefault(),e.stopPropagation())}),t.input&&t.sink.add(t.input,"input.dropdown",()=>{var e;t.disabled||t.readOnly||(t.filterTerm=t.input.value.trim(),this._trigger("search:term",t.filterTerm),null===(e=t.dropList)||void 0===e||e.setSearchTerm(t.filterTerm,!0))}).add(t.input,"click.dropdown",()=>{t.disabled||t.readOnly||!t.multi&&t.searchable&&this.openList()}).add(t.input,"focus.dropdown",()=>{t.disabled||t.readOnly||(this._trigger("search:focus"),this[Vs]||(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||t.readOnly||this.toggleList(),i=!1}).add(t.el,"touchstart.dropdown",r=>{if(n)return;if(n=r.changedTouches[0].identifier,this.isDisabled()||this.isReadOnly())return;if(e.closestUntil(r.target,".".concat(t.baseClassName,"__item,.").concat(t.baseClassName,"__clear"),t.el))return;let i=()=>{n=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(r.changedTouches,e=>e.identifier===n))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 r={value:t,item:e,cancel:!1};return this._trigger("select:before",r),!r.cancel&&!this[Vs]&&(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[Vs]&&(this._setSelectedItems([]),e&&this._setInputText(""),this._trigger("clear"),!0)}_movePrev(){const e=this._p;if(this.isMultiEnabled())return;let t=this.getSelectedItems(),r=e.dropList.getFilteredItemCount();if(r+(e.clearable?1:0)>1){let i=t.length>0?e.dropList.filteredItemIndexByItem(t[0])-1:r-1;-1!==i||e.clearable||(i=r-1);let n=-1===i?null:e.dropList.filteredItemAtIndex(i);n?this._performSelectWithEvent(n,n[e.valueProp]):this._performClearWithEvent()}}_moveNext(){const e=this._p;if(this.isMultiEnabled())return;let t=this.getSelectedItems(),r=e.dropList.getFilteredItemCount();if(r+(e.clearable?1:0)>1){let i=t.length>0?e.dropList.filteredItemIndexByItem(t[0])+1:0;i===r&&(i=e.clearable?-1:0);let n=-1===i?null:e.dropList.filteredItemAtIndex(i);n?this._performSelectWithEvent(n,n[e.valueProp]):this._performClearWithEvent()}}_updateListItems(){const e=this._p,t=e.dropList;if(!t||!e.dropListVisible)return;if((e.itemsChanged||e.selectionChanged)&&(e.dropList._lastSerializedBox=null),e.itemsChanged){let r=e.items;(e.sortListItems||e.sortListCheckedFirst&&e.multi)&&(r=this._sortItems(r,e.sortListItems,e.sortListCheckedFirst&&e.multi,e.splitListCheckedGroups)),t.setItems(r),t.invokeRefilter(),e.itemsChanged=!1,e.selectionChanged=!0,e.resortBySelectionNeeded=!1}let r=!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),r=e.dropList.hasFocusedItem()}e.selectionChanged=!1}this._repositionDropList(),r&&e.dropList.setFocusedItemAtIndex(e.dropList.getFocusedItemIndex())}_setSelectedItems(e){const t=this._p,r=t.valueProp;t.multi?(t.selectedItems=e.filter(e=>void 0!==e[r]),t.selectedValues=t.selectedItems.map(e=>e[r])):(t.selectedItems=e.slice(0,1),t.selectedValues=e.slice(0,1).map(e=>e[r])),t.selectionChanged=!0,t.resortBySelectionNeeded=!0,this._updateListItems(),this._scheduleSync("full")}_scheduleSync(e,t){const r=this._p;r.syncQueue||(r.syncQueue=[]),("full"===e||"render_items"===e&&!r.syncQueue.some(e=>"full"===e.mode))&&(r.syncQueue.length=0),0!==r.syncQueue.length&&["full","render_items"].includes(e)||r.syncQueue.push({mode:e,data:t}),r.syncTimeout||(r.syncTimeout=setTimeout(()=>{delete r.syncTimeout;let e=r.syncQueue;delete r.syncQueue,this._performSync(e)}))}_performSync(e){const t=this._p;if(!this[Vs])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"syncPlaceholder":this._syncPlaceholder();break;case"removeMultiItemElement":if(t.showSelection)this._syncPlaceholder();else{const e=t.valueProp,r=i.data[e];let n=t.multiItemEls.findIndex(t=>t[us][e]===r);-1!==n&&this._removeMultiItemElementByIndex(n)}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 r;let e=t.multiItemEls[t.multiItemEls.length-1];(null==e||null===(r=e[us])||void 0===r?void 0:r[t.valueProp])===Rs&&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[us],e.singleWrapper)}catch(e){console.error(e)}delete e.singleWrapper[us],e.singleWrapper.innerHTML=""}}_removeMultiItemElementByIndex(e){const r=this._p,i=r.multiItemEls;if(i.length>e){var n;const s=i[e],l=s[us];let o=(null==l?void 0:l[r.valueProp])===Rs&&null!==(n=r.unrenderRestMultiItem)&&void 0!==n?n:r.unrenderMultiItem;if(o&&s.childNodes.length>0)try{o(l,s)}catch(e){console.error(e)}t.remove(s),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 r=t.labelProp;let i=e[t.multiItemLabelProp]||e[r];null==i&&(i=""),t.singleWrapper.appendChild(document.createTextNode(i))}}_renderMultiItemContent(t,r){var i;const n=this._p;let s=t[n.valueProp]===Rs&&null!==(i=n.renderRestMultiItem)&&void 0!==i?i:n.renderMultiItem;if(!s||!1===s(t,r)){const i=n.labelProp,s=t[n.multiItemLabelProp]||t[i];r.appendChild(e.createElement("span",{textContent:s}))}}_addMultiItemElement(e){const r=this._p,i=this._renderMultiItem(e);return!!i&&(t.before(r.inputWrapper,i),r.multiItemEls.push(i),!0)}_addMultiItemRestElement(){const e=this._p;let t=e.selectedItems.slice(0),r=(e.treatGroupSelectionAsItems?t:t.filter(e=>!e._group)).length-e.maxMultiItems,i=e.multiItemsRestLabelProvider?e.multiItemsRestLabelProvider(r,t):"+ ".concat(r);this._addMultiItemElement({items:t,[e.valueProp]:Rs,[e.labelProp]:i})}_syncClearButton(){const r=this._p,i=r.multiItemLabelProp;r.selectedItems.length>0&&r.selectedItems.some(e=>!1!==e[i])&&r.clearable&&r.showSelection?r.clearButtonWrapper||(r.clearButtonWrapper=e.createElement(r.multi?"li":"span",{class:"".concat(r.baseClassName,"__clear")},r.clearButton=e.createElement("button")),r.multi?t.append(r.list,r.clearButtonWrapper):t.append(r.el,r.clearButtonWrapper),r.el.classList.add("".concat(r.baseClassName,"__has_clear")),r.sink.add(r.clearButton,"click",()=>{this.isDisabled()||this.isReadOnly()||this.clear()})):r.clearButtonWrapper&&(r.sink.remove(r.clearButton,"click"),t.remove(r.clearButtonWrapper),delete r.clearButtonWrapper,delete r.clearButton,r.el.classList.remove("".concat(r.baseClassName,"__has_clear")))}_syncPlaceholder(){const e=this._p,t=e.multiItemLabelProp;let r="";e.multi&&!e.showSelection?r="function"==typeof e.multiPlaceholderFormatter?e.multiPlaceholderFormatter(e.selectedItems):0===e.selectedItems.length?e.placeholder||"":((e,t)=>{if(0===e.length)return"";let r=e[0][t]+"";return e.length>1&&(r+=" (+".concat(e.length-1,")")),r})(e.selectedItems,e.labelProp):0!==e.selectedItems.length&&e.showSelection&&!e.selectedItems.every(e=>!1===e[t])||(r=null==e.placeholder?"":e.placeholder+""),e.input.setAttribute("placeholder",r),e.showPlaceholderInTooltip?e.input.setAttribute("title",r):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[us]=t[0])}_syncFull(e,r){const i=this._p,n=i.multiItemLabelProp;if(this._renderBase(),this._syncClearButton(),this._syncPlaceholder(),(e=i.multi&&i.showSelection&&(e||i.selectedItems.filter(e=>!1!==e[n]).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,r=i.multiItemLabelProp,n=i.valueProp,s=i.stickyValues,l=i.sortItemComparator||((e,i)=>{if(null!==s){let t=s.has(e[n]),r=s.has(i[n]);if(t&&!r)return-1;if(!t&&r)return 1}const l=e[r]||e[t],o=i[r]||i[t];return l<o?-1:l>o?1:0});e.sort(l),i.selectedValues=e.map(e=>e[n])}let r=0,n=i.maxMultiItems,s=!1;for(let i=0;i<e.length;i++)if(t||!e[i]._group){if(null!=n&&r===n){s=!0;break}this._addMultiItemElement(e[i])&&r++}s&&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.input&&(i.input.readOnly=i.readOnly),i.el.classList.add("".concat(i.baseClassName,"__searchable"))):(i.input&&(i.input.readOnly=!0),i.el.classList.remove("".concat(i.baseClassName,"__searchable"))),this._resizeInput(),r&&this._updateListItems()),this}_trigger(e,t){const r=this._p;void 0!==r&&(r.on&&r.on(e,...void 0===t?[]:[t]),r.mitt.emit(e,t))}_renderMultiItem(t){var r;const i=this._p,n=i.labelProp,s=null!==(r=t[i.multiItemLabelProp])&&void 0!==r?r:t[n];if(!1===s)return null;const l=e.createElement("span",{class:"".concat(i.baseClassName,"__item_remove"),role:"presentation"}),o=e.createElement("li",{class:"".concat(i.baseClassName,"__item"),tabindex:"0",title:s});return"before"===i.multiItemRemovePosition&&o.appendChild(l),this._renderMultiItemContent(t,o),"after"===i.multiItemRemovePosition&&o.appendChild(l),o[us]=t,o}_removeMultiItemFromEvent(t,r){const i=this._p;let n;if(/key/.test(r.type)){const l=r;l.key===s.VALUE_DELETE?n=e.next(t,".".concat(i.baseClassName,"__item,.").concat(i.baseClassName,"__search_wrapper")):l.key===s.VALUE_BACK_SPACE&&(n=e.prev(t,".".concat(i.baseClassName,"__item,.").concat(i.baseClassName,"__search_wrapper")))}else/click|mouse|touch/.test(r.type)&&(n=e.next(t,".".concat(i.baseClassName,"__item,.").concat(i.baseClassName,"__search_wrapper")));const l=t[us],o=l[i.valueProp];if(void 0!==l)if(o===Rs){let e=(i.treatGroupSelectionAsItems?i.selectedItems:i.selectedItems.filter(e=>!e._group)).slice(i.maxMultiItems),t=[];for(let r of e){let e={value:o,item:r,cancel:!1};this._trigger("removesel:before",e),e.cancel||t.push(r)}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 n||(n=i.el.querySelector(".".concat(i.baseClassName,"__item, .").concat(i.baseClassName,"__search_field"))),Ws(n,"".concat(i.baseClassName,"__search_wrapper"))&&(n=n.querySelector("input")),n&&n.focus(),this}_removeMultiItem(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const r=this._p,i=r.valueProp,n=r.labelProp,s=e[i];let l=r.selectedItems.indexOf(e);-1===l&&(l=r.selectedValues.indexOf(s)),-1!==l&&(r.selectedItems.splice(l,1),r.selectedValues.splice(l,1),r.selectionChanged=!0,r.resortBySelectionNeeded=!0),l=r.multiItemEls.findIndex(t=>t[us]===e),-1===l&&(l=r.multiItemEls.findIndex(e=>e[us][i]===s)),-1!==l&&this._removeMultiItemElementByIndex(l),t&&(this._setInputText(e[r.multiItemLabelProp]||e[n]),r.input.focus(),r.input.selectionStart=r.input.selectionEnd=r.input.value.length),this._scheduleSync("render_list")}_setInputText(e){var t;const r=this._p;r.input.value=null==e?"":String(e),r.filterTerm="",this._trigger("search:term",r.filterTerm),null===(t=r.dropList)||void 0===t||t.setSearchTerm("",!0)}_resizeInput(){const e=this._p,i=e.el;if(!i.parentNode||!document.body.contains(i))return this;const n=e.input,s=e.inputBackBuffer;let l=n.value||n.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){n.style.width="";let t=0,s=0,l=getComputedStyle(e.list||i,"::before");l.content&&"none"!==l.content&&"absolute"!==l.position&&"none"!==l.float&&(t=r.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&&(s=r.getPseudoElementWidth(e.list||i,"::after",!0,!0,!0));let u=r.getElementWidth(e.list||i);u-=t+s,n.style.width="".concat(u,"px"),o=!0}else{r.setCssProps(s,r.getCssProps(n,Bs)),s.textContent=l,i.appendChild(s);const a=getComputedStyle(n),u=(parseFloat(a.paddingLeft)||0)+(parseFloat(a.paddingRight)||0),c=.75*(parseFloat(a["font-size"])||0)+u,d=r.getElementWidth(s,!0,!0),h=r.getElementWidth(n,!0,!0);let p=Math.max(d,c);if(p!==h){r.setElementWidth(n,p,!0,!0);let t=(parseFloat(a.borderLeftWidth)||0)+(parseFloat(a.borderRightWidth)||0),i=n.scrollWidth+t;if(i>p){let e=i-p;n.style.width="".concat(parseFloat(n.style.width)+e,"px"),p+=e}if(e.singleWrapper&&(e.singleWrapper.style.width="",l)){let i=p-u-t;r.getElementWidth(e.singleWrapper,!1,!1)<i&&r.setElementWidth(e.singleWrapper,i,!1,!1)}o=!0}t.remove(s)}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 r=t.getBoundingClientRect(),i=r.left+","+r.top+","+r.right+","+r.bottom;return e.dropList._lastSerializedBox!==i&&(e.dropList.relayout(),e.dropList._lastSerializedBox=i),this}_handleInputKeydown(e){const t=this._p,r=e.target;if(e.key===s.VALUE_BACK_SPACE&&e.ctrlKey&&0===r.value.length)this.clear(),e.preventDefault();else if(e.key===s.VALUE_BACK_SPACE&&0===r.value.length){const r=t.multiItemEls[t.multiItemEls.length-1];if(!r)return;const i=r[us],n=i[t.valueProp];if(void 0===n)return;let s={value:n,item:i,cancel:!1};if(this._trigger("removesel:before",s),s.cancel)return;this._removeMultiItem(i,!0),this._trigger("removesel",{value:n,item:i}),e.preventDefault()}}_handleMultiKeydown(t){const r=this._p;if(r.disabled||r.readOnly)return;const i="rtl"===getComputedStyle(r.el).direction;let n;if(t.key===(i?s.VALUE_LEFT:s.VALUE_RIGHT))n=e.next(t.target,".".concat(r.baseClassName,"__item,.").concat(r.baseClassName,"__search_wrapper")),Ws(n,"".concat(r.baseClassName,"__search_wrapper"))&&(n=n.querySelector("input")),n&&n.focus(),t.preventDefault();else if(t.key===(i?s.VALUE_RIGHT:s.VALUE_LEFT))n=e.prev(t.target,".".concat(r.baseClassName,"__item,.").concat(r.baseClassName,"__search_wrapper")),Ws(n,"".concat(r.baseClassName,"__search_wrapper"))&&(n=n.querySelector("input")),n&&n.focus(),t.preventDefault();else if(t.key===s.VALUE_BACK_SPACE&&t.ctrlKey){const i=[];let n=t.target;for(;n;)i.push(n),n=e.prev(n,".".concat(r.baseClassName,"__item"));for(;i.length;)this._removeMultiItemFromEvent(i.shift(),t);t.preventDefault()}else t.key!==s.VALUE_DELETE&&t.key!==s.VALUE_BACK_SPACE||(this._removeMultiItemFromEvent(e.closestUntil(t.target,".".concat(r.baseClassName,"__item"),r.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(()=>{t.getRootNode(e.el)!==document&&this.closeList()},200)}_stopTrackingPresence(){const e=this._p;e.presenceInt&&(clearInterval(e.presenceInt),e.presenceInt=null)}_sortItems(e,t,r,i){const n=this._p;if(!t&&!r)return e;const s=n.labelProp,l=n.multiItemLabelProp,o=n.valueProp,a=n.stickyValues,u=n.sortItemComparator||((e,t)=>{if(null!==a){let r=a.has(e[o]),i=a.has(t[o]);if(r&&!i)return-1;if(!r&&i)return 1}const r=e[s]||e[l],i=t[s]||t[l];return r<i?-1:r>i?1:0});let c=[],d=null,h=[c],p=!1;const m=new Set(n.selectedValues);let f,_,g;for(_=0,g=e.length;_<g;_++)f=e[_],(f._group&&c.length||p&&!f._group&&!f._child)&&(p=!!f._group,c=[],h.push(c)),c.push(f);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 r=a.has(e[o]),i=a.has(t[o]);if(r&&!i)return-1;if(!r&&i)return 1}return!e._group&&t._group?-1:e._group&&!t._group?1:u(e,t)}),d&&h.unshift(d);const v=[],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(r){const t=m.has(e[o]),r=m.has(i[o]);if(t&&!r)return-1;if(!t&&r)return 1}return t?u(e,i):0}),b.push(c);if(r&&i){let e;for(let t=0,r=h.length;t<r;t++){if(c=h[t],c===d){v.push(d);let e=b.indexOf(d);-1!==e&&b.splice(e,1);continue}e=null;for(let t=0,r=c.length;t<r;t++)if(f=c[t],!f._group){if(!m.has(f[n.valueProp]))break;e||(e=[],c[0]._group&&e.push(c[0])),e.push(f),c.splice(t--,1),r--}if(e&&(v.push(e),0===c.length||1===c.length&&c[0]._group)){h.splice(t--,1),r--;let e=b.indexOf(c);-1!==e&&b.splice(e,1)}}}const I=[];I.length=e.length;let y=0;h=v.length?v.concat(b):b;for(let e=0,t=h.length;e<t;e++)for(c=h[e],_=0,g=c.length;_<g;_++)I[y++]=c[_];return I}},exports.SelectBoxDefaultOptions=Ds;
|
|
6
|
-
//# sourceMappingURL=index.js.map
|
|
7
|
-
|
|
5
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});var e=Object.create,t=Object.defineProperty,s=Object.getOwnPropertyDescriptor,i=Object.getOwnPropertyNames,l=Object.getPrototypeOf,r=Object.prototype.hasOwnProperty,n=(n,o,a)=>(a=null!=n?e(l(n)):{},((e,l,n,o)=>{if(l&&"object"==typeof l||"function"==typeof l)for(var a,u=i(l),c=0,d=u.length;c<d;c++)a=u[c],r.call(e,a)||void 0===a||t(e,a,{get:(e=>l[e]).bind(null,a),enumerable:!(o=s(l,a))||o.enumerable});return e})(!o&&n&&n.__esModule?a:t(a,"default",{value:n,enumerable:!0}),n));let o=require("@danielgindi/dom-utils/lib/Dom"),a=require("@danielgindi/dom-utils/lib/DomCompat"),u=require("@danielgindi/dom-utils/lib/Css"),c=require("@danielgindi/dom-utils/lib/DomEventsSink");c=n(c);let d=require("@danielgindi/virtual-list-helper");d=n(d);let h=require("keycode-js"),m=require("mitt");m=n(m);var p=e=>e.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),_=(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},g=Symbol("item"),f=Symbol("destroyed"),I=Symbol("ghost"),b=Symbol("no_results_items"),v=Object.prototype.hasOwnProperty,y={baseClassName:"droplist",autoItemBlur:!0,autoItemBlurDelay:300,capturesFocus:!0,multi:!1,singleSelectedValue:void 0,keyDownHandler:null,autoCheckGroupChildren:!0,useExactTargetWidth:!1,constrainToWindow:!0,autoFlipDirection:!0,estimateWidth:!1,virtualMinItems:100,labelProp:"label",valueProp:"value",on:null,isHeaderVisible:!1,isFooterVisible:!1,searchable:!1,noResultsText:"No matching results",filterThrottleWindow:300,filterOnEmptyTerm:!1,filterGroups:!1,filterEmptyGroups:!1},E=class e{constructor(e){const t={...y};for(let[o,a]of Object.entries(e))void 0!==a&&(t[o]=a);const s=this._p={ownsEl:!0,elOriginalDisplay:"",baseClassName:t.baseClassName,additionalClasses:t.additionalClasses,direction:"ltr"===t.direction?"ltr":"rtl"===t.direction?"rtl":"auto",autoItemBlur:t.autoItemBlur,autoItemBlurDelay:t.autoItemBlurDelay,capturesFocus:t.capturesFocus,multi:t.multi,singleSelectedValue:t.singleSelectedValue,keyDownHandler:t.keyDownHandler,autoCheckGroupChildren:t.autoCheckGroupChildren,useExactTargetWidth:t.useExactTargetWidth,constrainToWindow:t.constrainToWindow,autoFlipDirection:t.autoFlipDirection,estimatedItemHeight:t.estimatedItemHeight,estimateWidth:t.estimateWidth,virtualMinItems:t.virtualMinItems,labelProp:t.labelProp,valueProp:t.valueProp,renderItem:t.renderItem,unrenderItem:t.unrenderItem,renderNoResultsItem:t.renderNoResultsItem,unrenderNoResultsItem:t.unrenderNoResultsItem,on:t.on||null,positionOptionsProvider:t.positionOptionsProvider??null,searchable:t.searchable,isHeaderVisible:t.isHeaderVisible,isFooterVisible:t.isFooterVisible,silenceEvents:!0,mitt:(0,m.default)(),filterThrottleWindow:t.filterThrottleWindow,filterOnEmptyTerm:t.filterOnEmptyTerm,filterGroups:t.filterGroups,filterEmptyGroups:t.filterEmptyGroups,filterFn:t.filterFn,filteredItems:null,filterTerm:"",needsRefilter:!1,throttledRefilterItems:null,focusItemIndex:-1,focusItemEl:null,sink:new c.default};let i=[s.baseClassName+"_wrapper"];s.additionalClasses&&(i=i.concat((s.additionalClasses+"").split(" ").filter(e=>e)));const l={top:"-9999px"};let r=t.el;r instanceof Element?(s.elOriginalDisplay=r.style.display||"",r.classList.add(...i),(0,u.setCssProps)(r,l),s.ownsEl=!1):r=(0,o.createElement)("div",{class:i.join(" "),css:l}),s.el=r;let n=(0,o.createElement)("ul");n.role="menu",s.menuEl=n,s.headerEl=(0,o.createElement)("div",{class:s.baseClassName+"_header"}),s.footerEl=(0,o.createElement)("div",{class:s.baseClassName+"_footer"}),t.searchable&&this.setSearchable(!0),t.isHeaderVisible&&this.setHeaderVisible(t.isHeaderVisible),r.appendChild(n),t.isFooterVisible&&this.setFooterVisible(t.isFooterVisible),s.items=[],s.groupCount=0,s.mouseHandled=!1,s.virtualListHelper=new d.default({list:s.menuEl,virtual:!0,buffer:5,estimatedItemHeight:t.estimatedItemHeight||20,itemElementCreatorFn:()=>(0,o.createElement)("li",{role:"menuitem",tabIndex:s.capturesFocus?-1:null}),onItemRender:(e,t)=>{let i;if(t===I)i={label:s.lastMeasureLongestLabelText,value:"Measure",[g]:{[s.labelProp]:s.lastMeasureLongestLabelText,[s.valueProp]:"Measure"}},e.setAttribute("aria-hidden","true");else{const e=s.filteredItems??s.items;i=0===e.length&&s.noResultsText?{value:b,label:s.noResultsText,_nointeraction:!0,_nocheck:!0,[g]:b}:e[t]}i||console.warn("onItemRender called for ("+t+") which has no item"),e.className=`${s.baseClassName}__item`;const l=e.classList;i&&(s.multi?i._nocheck?l.add(`${s.baseClassName}__item_multi_nocheck`):(l.add(`${s.baseClassName}__item_multi`),i._checked&&l.add(`${s.baseClassName}__item_checked`)):(l.add(`${s.baseClassName}__item_single`),void 0!==s.singleSelectedValue&&i.value===s.singleSelectedValue?(l.add(`${s.baseClassName}__item_selected`),s.singleSelectedItemEl=e):s.singleSelectedItemEl===e&&(s.singleSelectedItemEl=null)),i._group&&l.add(`${s.baseClassName}__item_group`),i._child&&l.add(`${s.baseClassName}__item_child`),i._nointeraction&&l.add(`${s.baseClassName}__item_nointeraction`)),s.focusItemIndex===t&&(s.focusItemEl=e,l.add(`${s.baseClassName}__item_focus`)),this._renderItemContent(i,e),e[g]=i}}),this._setupUnrenderFunction(),s.capturesFocus&&(r.tabIndex=0),this.setFilterThrottleWindow(t.filterThrottleWindow),this.setNoResultsText(t.noResultsText),this._hookMouseEvents(),this._hookTouchEvents(),this._hookFocusEvents(),this._hookKeyEvents(),this._hookSearchEvents(),this.silenceEvents=!1}destroy(){if(this[f])return;this[f]=!0;const e=this._p;if(clearTimeout(e.blurTimer),clearTimeout(e.filterTimer),e.sink.remove(),e.virtualListHelper.destroy(),e.el?.parentNode&&(0,a.remove)(e.el),e.currentSubDropList&&(e.currentSubDropList?.droplist?.destroy(),e.currentSubDropList=null),e.throttledRefilterItems&&e.throttledRefilterItems.cancel(),!e.ownsEl){for(let t of Array.from(e.el.classList))t.startsWith(e.baseClassName)&&e.el.classList.remove(t);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),delete e.lastPositionOptions,this._p=null}get el(){return this._p?.el??null}elContains(e,t=!0){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){return this._p.unrenderItem=e,this._setupUnrenderFunction(),this}setRenderNoResultsItem(e,t){const s=this._p;return s.renderNoResultsItem=e,s.unrenderNoResultsItem=t,this._setupUnrenderFunction(),this}_setupUnrenderFunction(){const e=this._p;if("function"==typeof e.unrenderItem||"function"==typeof e.unrenderNoResultsItem){const t=e.unrenderItem,s=e.unrenderNoResultsItem;e.virtualListHelper.setOnItemUnrender(i=>{const l=i[g];if(l===b)try{s(l,i)}catch(r){console.error(r)}else try{t(l[g],i)}catch(r){console.error(r)}delete i[g],e.focusItemEl===i&&(e.focusItemEl=null)})}else e.virtualListHelper.setOnItemUnrender(t=>{delete t[g],e.focusItemEl===t&&(e.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+"_wrapper"];"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.filteredItems??e.items)[e.focusItemIndex];e.focusItemIndex=-1,s&&(e.currentSubDropList&&this._hideSublist(),this._trigger("itemblur",{value:s.value,item:s[g]??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 t=(e.filteredItems??e.items)[e.focusItemIndex];if(!t||t._nocheck||t._nointeraction)return this;t._checked=!t._checked,e.focusItemEl&&(0,a.toggleClass)(e.focusItemEl,`${e.baseClassName}__item_checked`,t._checked),this._trigger("check",{value:t.value,item:t[g]??t,checked:t._checked,isGroup:t._group,isCheckingGroup:!1}),this._updateGroupStateForItem(t)}return this}triggerItemSelection(e,t){const s=this._p;return s.focusItemEl=s.focusItemEl||(0,o.closestUntil)(t.target,"li",s.el),s.focusItemIndex=s.virtualListHelper.getItemIndexFromElement(s.focusItemEl),void 0===s.focusItemIndex&&(s.focusItemIndex=-1),!(e=e??s.focusItemEl[g])._nointeraction&&(e._subitems?.length?(this._showSublist(e,s.focusItemEl),!1):(s.multi?this.hasFocusedItem()&&this.toggleFocusedItem():(this._setSingleSelectedItemEl(s.focusItemEl,e?e.value:void 0),this._trigger("select",{value:e?e.value:void 0,item:e[g]??e,event:t,el:s.focusItemEl})),!0))}addItem(e,t=-1){return this.addItems([e],t)}addItems(e,t=-1){const s=this._p,i=s.labelProp,l=s.valueProp;let r=s.multi;const n=s.items;(null==t||t<0||t>=s.items.length)&&(t=-1),this._determineVirtualMode(n.length+e.length);for(let o=0,a=e.length;o<a;o++){let a=e[o],u={[g]:a,label:a[i],value:a[l],_nocheck:!!a._nocheck,_nointeraction:!!a._nointeraction,_subitems:a._subitems};r&&(u._checked=!!a._checked),a._group&&(u._group=!0,s.groupCount++),"number"==typeof a._level&&(u._level=a._level),a._child&&(u._child=!0),-1!==t?n.splice(t,0,u):n.push(u),-1!==t&&t++}if(s.filteredItems)s.needsRefilter=!0;else{let i=s.hasNoResultsItem;s.hasNoResultsItem=0===s.items.length&&!!s.noResultsText,s.hasNoResultsItem?s.virtualListHelper.setCount(1).render():(i&&s.virtualListHelper.removeItemsAt(1,0),s.virtualListHelper.addItemsAt(e.length,-1===t?t:t-e.length).render())}return this}setItems(e){const t=this._p;return t.items.length=0,t.filteredItems=null,t.groupCount=0,t.hasNoResultsItem=!!t.noResultsText,t.virtualListHelper.setCount(t.hasNoResultsItem?1:0),this.addItems(e),this.updateSublist(),this}updateItemByValue(e,t){const s=this._p;let i=this.itemIndexByValue(e);if(-1===i)return this;let l=this.itemAtIndex(i);l[g]=t,v.call(t,s.labelProp)&&(l.label=t[s.labelProp]),v.call(t,s.valueProp)&&(l.value=t[s.valueProp]),v.call(t,"_nocheck")&&(l._nocheck=!!t._nocheck),v.call(t,"_nointeraction")&&(l._nointeraction=!!t._nointeraction),v.call(t,"_subitems")&&(l._subitems=!!t._subitems),s.multi&&v.call(t,"_checked")&&(l._checked=!!t._checked),v.call(t,"_group")&&!!t._group!==l._group&&(l._group?s.groupCount--:s.groupCount++,t._group=!!l._group),v.call(t,"_level")&&(t._level=l._level),v.call(t,"_child")&&(l._child=!!t._child);let r=i;return s.filteredItems&&(r=s.filteredItems.indexOf(l),-1!==r&&s.filteredItems.splice(r,1)),-1!==r&&s.virtualListHelper.isItemRendered(r)&&s.virtualListHelper.refreshItemAt(r).render(),this}removeItem(e,t){const s=this._p;let i=this.itemIndexByValueOrLabel(e,t);if(-1===i)return this;let l=s.items.splice(i,1);l[0]._group&&s.groupCount--;let r=i;return s.filteredItems&&(r=s.filteredItems.indexOf(l[0]),-1!==r&&s.filteredItems.splice(r,1)),-1!==r&&(s.hasNoResultsItem=0===(s.filteredItems??s.items).length&&!!s.noResultsText,s.hasNoResultsItem?s.virtualListHelper.setCount(1).render():s.virtualListHelper.removeItemsAt(r,1).render()),this}removeAllItems(){const e=this._p;return e.items.length=0,e.filteredItems=null,e.groupCount=0,e.hasNoResultsItem=!!e.noResultsText,e.virtualListHelper.setCount(e.hasNoResultsItem?1: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[g]}return null}itemIndexByValue(e){const t=this._p.items;for(let s=0,i=t.length;s<i;s++)if(t[s].value===e)return s;return-1}filteredItemIndexByValue(e){const t=this._p,s=t.filteredItems??t.items;for(let i=0,l=s.length;i<l;i++)if(s[i].value===e)return i;return-1}itemIndexByValueOrLabel(e,t){const s=this._p.items;for(let i=0,l=s.length;i<l;i++){let l=s[i];if(l.value===e||l.label===t)return i}return-1}filteredItemIndexByValueOrLabel(e,t){const s=this._p,i=s.filteredItems??s.items;for(let l=0,r=i.length;l<r;l++){let s=i[l];if(s.value===e||s.label===t)return l}return-1}itemIndexByItem(e){const t=this._p.items;for(let s=0,i=t.length;s<i;s++)if(t[s][g]===e)return s;return-1}filteredItemIndexByItem(e){const t=this._p,s=t.filteredItems??t.items;for(let i=0,l=s.length;i<l;i++)if(s[i][g]===e)return i;return-1}items(){return this._p.items.map(e=>e[g])}itemsReference(){return this._p.items}itemCount(){return this._p.items.length}itemAtIndex(e){return this._p.items[e]?.[g]}filteredItemAtIndex(e){const t=this._p,s=t.filteredItems??t.items;return s[e]?.[g]}itemElementAtIndex(e){const t=this._p;return t.filteredItems?(e=t.filteredItems.indexOf(this._p.items[e]),t.virtualListHelper.getItemElementAt(e)??null):this.filteredElementItemAtIndex(e)}filteredElementItemAtIndex(e){return this._p.virtualListHelper.getItemElementAt(e)??null}setPositionOptionsProvider(e){const t=this._p;return t.positionOptionsProvider===e||(t.positionOptionsProvider=e??null,this.relayout()),this}getPositionOptionsProvider(){return this._p.positionOptionsProvider}setSearchTerm(e,t=!1){const s=this._p;return s.searchInput&&(s.searchInput.value=e),t&&(s.filterTerm=e.trim(),s.filteredItems=null,this._trigger("search",{value:e}),s.throttledRefilterItems()),this}isFilterPending(){const e=this._p;return!!(e.throttledRefilterItems.isScheduled()||!e.filteredItems&&(e.filterTerm||e.filterOnEmptyTerm&&e.filterFn))}_refilterItems(){const e=this._p,t=e.filterTerm,s=e.filterGroups,i=e.filterEmptyGroups;if(t||e.filterOnEmptyTerm&&e.filterFn){let l;if("function"==typeof e.filterFn&&(l=e.filterFn(e.items.map(e=>{const t=e[g];return void 0!==t?(t[g]=Object.seal({[g]:e}),t):e}),t),Array.isArray(l)&&(l=l.map(t=>{let s=t[g]?.[g];return s||(s={[g]:t,label:t[e.labelProp],value:t[e.valueProp],_nocheck:!!t._nocheck,_nointeraction:!!t._nointeraction,_subitems:t._subitems,_group:!!t._group,_level:!!t._level,_checked:!!t._checked}),s}))),!Array.isArray(l))if(t){const i=new RegExp(p(t),"i");l=e.items.filter(e=>!(s||!e._group)||i.test(e.label))}else l=null;if(e.filteredItems=l,l&&i){let e=-1,t=l.length;for(let s=0;s<t;s++)l[s]._group&&(-1!==e&&e===s-1&&(l.splice(e,1),s--,t--),e=s);-1!==e&&e===t-1&&l.splice(e,1)}}else e.filteredItems=null;e.needsRefilter=!1;const l=e.filteredItems??e.items;e.hasNoResultsItem=0===l.length&&!!e.noResultsText,e.virtualListHelper.setCount(l.length+(e.hasNoResultsItem?1:0)).render(),this._trigger("itemschanged",{term:t,mutated:!1,count:this.getFilteredItemCount()}),this.relayout()}invokeRefilter(){const e=this._p;return e.filterTerm||e.filterOnEmptyTerm||e.filteredItems?(e.filteredItems=null,e.throttledRefilterItems(),this):this}rushRefilter(){return this._p.needsRefilter&&this._refilterItems(),this}getFilteredItemCount(){const e=this._p;return this.rushRefilter(),e.filteredItems?e.filteredItems.length:e.items?e.items.length:0}setNoResultsText(e){const t=this._p;return t.noResultsText=e,t.hasNoResultsItem&&t.virtualListHelper.refreshItemAt(0).render(),this}getNoResultsText(){return this._p.noResultsText}setFilterThrottleWindow(e){const t=this._p;t.filterThrottleWindow=e;let s=!!t.throttledRefilterItems&&t.throttledRefilterItems.isScheduled();return t.throttledRefilterItems&&t.throttledRefilterItems.cancel(),t.throttledRefilterItems=_(()=>this._refilterItems(),t.filterThrottleWindow,!0),s&&t.throttledRefilterItems(),this}getFilterThrottleWindow(){return this._p.filterThrottleWindow}setFilterOnEmptyTerm(e){const t=this._p;return t.filterOnEmptyTerm===e||(t.filterOnEmptyTerm=e,t.throttledRefilterItems()),this}getFilterOnEmptyTerm(){return this._p.filterOnEmptyTerm}setFilterGroups(e){const t=this._p;return t.filterGroups===e||(t.filterGroups=e,t.throttledRefilterItems()),this}getFilterGroups(){return this._p.filterGroups}setFilterEmptyGroups(e){const t=this._p;return t.filterEmptyGroups===e||(t.filterEmptyGroups=e,t.throttledRefilterItems()),this}getFilterEmptyGroups(){return this._p.filterEmptyGroups}setFilterFn(e){const t=this._p;return t.filterFn===e||(t.filterFn=e,t.throttledRefilterItems()),this}getFilterFn(){return this._p.filterFn}relayout(e){const t=this._p,s=t.el,i=t.menuEl;if(!this.isVisible())return this;let l=window;e||(e=t.positionOptionsProvider?.()??t.lastPositionOptions),e||(e={targetOffset:{left:window.innerWidth/2,top:window.innerHeight/2},targetWidth:0,targetHeight:0,position:{x:"center",y:"center"},anchor:{x:"center",y:"center"},targetRtl:"rtl"===getComputedStyle(document.body).direction});let r={},n=e.targetOffset||(0,u.getElementOffset)(e.target);r.left=n.left,r.top=n.top,r.height=null==e.targetHeight?(0,u.getElementHeight)(e.target,!0,!0):e.targetHeight,r.width=null==e.targetWidth?(0,u.getElementWidth)(e.target,!0,!0):e.targetWidth,r.bottom=r.top+r.height;let o={};o.top=l.pageYOffset,o.left=l.pageXOffset,o.width=l.innerWidth,o.height=l.innerHeight,o.bottom=o.top+o.height,o.right=o.left+o.width;let c=e.position&&"bottom"===e.position.y?"above":"below";s.style.width="",(t.estimateWidth||t.virtualListHelper.isVirtual())&&this._measureItem(),t.virtualListHelper.isVirtual()&&(i.style.height=Math.min(s.clientHeight,document.body.clientHeight)+"px",t.virtualListHelper.render()),e.updateWidth||"number"==typeof e.updateWidth?this._updateWidth(e):this._updateWidth(),t.virtualListHelper.isVirtual()&&t.virtualListHelper.render();let d,h=r.top-o.top,m=o.bottom-r.bottom;const p=getComputedStyle(s);let _="border-box"===p.boxSizing,g=(parseFloat(p.paddingTop)||0)+(parseFloat(p.paddingBottom)||0),f=(parseFloat(p.borderTopWidth)||0)+(parseFloat(p.borderBottomWidth)||0),I=0;t.headerEl&&(I=(0,u.getElementHeight)(t.headerEl,!0,!0));let b=0;t.footerEl&&(b=(0,u.getElementHeight)(t.footerEl,!0,!0)),t.virtualListHelper.isVirtual()?d=t.virtualListHelper.estimateFullHeight()+g+f+I+b:(s.style.height="",i.style.height="",s.style.top="-9999px",d=Math.max((0,u.getElementHeight)(t.el),i.scrollHeight),d+=g+f);let v=parseFloat(p.maxHeight);isNaN(v)||(_||(v+=g+f),d=Math.min(d,v));let y=h>=d,E=m>=d,C=t.currentDirection||c;"above"===C&&!y&&E?C="below":"below"===C&&!E&&y?C="above":y&&E?C!==c&&("above"===c&&h>=m||"below"===c&&m>=h)&&(C=c):y||E||(h>m?C="above":m>h&&(C="below")),t.currentDirection=C;let S={width:(0,u.getElementWidth)(s,!0,!0),height:Math.min(d,Math.max(h,m,0))},L=void 0!==e.targetRtl?e.targetRtl:null!=e.target&&"rtl"===getComputedStyle(e.target).direction,k="rtl"===getComputedStyle(document.documentElement).direction,x=(0,u.anchoredPosition)(e.target,e.anchor?e.anchor.x:"start",e.anchor?e.anchor.y:"bottom",r,L),T=(0,u.anchoredPosition)(s,e.position?e.position.x:"start",e.position?e.position.y:"top",S,L),w="top"===T.ySpec&&"above"===C||"bottom"===T.ySpec&&"below"===C||"bottom"!==T.ySpec&&"top"!==T.ySpec&&"above"===C,V=void 0!==l.pageXOffset?l.pageXOffset:(document.documentElement||document.body.parentNode||document.body).scrollLeft;V=Math.abs(V),k&&(V=document.documentElement.scrollWidth-V-document.documentElement.clientWidth);let P=V,N=document.documentElement.clientWidth+V-S.width,F={position:"absolute",left:r.left,top:r.top+(w?x.bottom-T.bottom:x.top-T.top)};if(k&&(F.left-=document.documentElement.clientWidth-document.documentElement.scrollWidth),F.left+=x.left-T.left,e.offset&&(e.offset.y&&(w?F.top-=e.offset.y:F.top+=e.offset.y),e.offset.x)){let t="rtl"===p.direction;F.left+=t?-e.offset.x:e.offset.x}if(t.autoFlipDirection&&("right"===T.xSpec&&F.left<P&&(Math.max(F.left,P)+S.width-r.left)/r.width>.5||"left"===T.xSpec&&F.left>N&&(Math.min(F.left,N)-r.left)/r.width<.5)&&(F.left-=x.left-T.left,F.left+=x.right-T.right),t.constrainToWindow)for(let a of k?["min","max"]:["max","min"])"min"===a&&F.left<P?F.left=P:"max"===a&&F.left>N&&(F.left=N);if(F.left+="px",F.top+="px",(0,u.setCssProps)(s,F),(0,u.setElementHeight)(s,S.height,!0,!0),i!==s){let e=S.height-I-b-f-g;(0,u.setElementHeight)(i,e,!0,!0)}return t.virtualListHelper.render(),e&&e.target&&(t.lastPositionTarget=e.target,(0,a.toggleClass)(e.target,`has_${t.baseClassName}`,!0),(0,a.toggleClass)(e.target,`has_${t.baseClassName}_below`,"below"===C),(0,a.toggleClass)(e.target,`has_${t.baseClassName}_above`,"above"===C),(0,a.toggleClass)(s,`${t.baseClassName}__is_below`,"below"===C),(0,a.toggleClass)(s,`${t.baseClassName}__is_above`,"above"===C)),this}setItemChecked(e,t){const s=this._p;t=!!t;let i=this.itemIndexByValue(e);if(-1===i)return this;let l=s.virtualListHelper.getItemElementAt(i);if(!l)return this;let r=l[g];return t=t&&!r._nocheck,r._checked!==t&&(r._checked=t,(0,a.toggleClass)(l,`${s.baseClassName}__item_checked`,r._checked),this._updateGroupStateForItem(r)),this}setCheckedValues(e){const t=this._p;this.rushRefilter();let s=[];for(let i=0,l=t.items.length;i<l;i++){let l=t.items[i],r=!l._nocheck&&-1!==e.indexOf(l.value),n=t.filteredItems?t.filteredItems.indexOf(l):i;if(l._group&&-1!==n&&s.push(n),l._checked===r)continue;if(l._checked=r,-1===n)continue;let o=t.virtualListHelper.getItemElementAt(n);o&&(0,a.toggleClass)(o,`${t.baseClassName}__item_checked`,l._checked)}if(t.autoCheckGroupChildren)for(let i=0,l=s.length;i<l;i++)this._updateGroupCheckedState(s[i],!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;const 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[g]))}return s}show(e){const t=this._p;t.hiding=!1,this.isVisible()||this._trigger("show:before"),t.mouseHandled=!1,setTimeout(()=>{this[f]||t.onDocumentMouseDown||t.sink.add(document,"mousedown",t.onDocumentMouseDown=e=>{this.elContains(e.target,!0)||this._delayBlurItemOnBlur()})}),this.rushRefilter();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"),t.lastPositionOptions=null,void 0===e?e=t.positionOptionsProvider?.()??t.lastPositionOptions:t.lastPositionOptions=e,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,t=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,this.isFilterPending()&&(e.throttledRefilterItems.cancel(),e.needsRefilter=!0),t&&(t.classList.add(`${e.baseClassName}__is-hiding`),(0,u.parseTransition)(getComputedStyle(e.el).transition).reduce((e,t)=>Math.max(e,t.delay+t.duration),0)>0?setTimeout(()=>{this[f]||this._p&&t.parentNode&&e.hiding&&((0,a.remove)(t),t.classList.remove(`${e.baseClassName}__is-hiding`),e.visible=!1,this._trigger("hide:after"))}):(t.parentNode&&(0,a.remove)(t),t.classList.remove(`${e.baseClassName}__is-hiding`))),e.visible=!1,this.blurFocusedItem(),this._trigger("hide"),this[f])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}setHeaderVisible(e){this.isHeaderVisible()!==!!e&&(e?this._p.el.insertBefore(this._p.headerEl,this._p.el.firstChild??null):this._p.headerEl.remove())}isHeaderVisible(){return!!this._p.headerEl.parentNode}getHeaderElement(){return this._p.headerEl}setFooterVisible(e){this.isFooterVisible()!==!!e&&(e?this._p.el.appendChild(this._p.footerEl):this._p.footerEl.remove())}isFooterVisible(){return!!this._p.footerEl.parentNode}getFooterElement(){return this._p.footerEl}setSearchable(e){const t=this._p;!!t.searchInput!=!!e&&(e?(t.searchInput=(0,o.createElement)("input",{type:"search",role:"searchbox",tabindex:"0",autocorrect:"off",autocomplete:"off",autocapitalize:"off",spellcheck:"false","aria-autocomplete":"list"}),t.headerEl.appendChild(t.searchInput)):(t.searchInput.parentNode&&t.searchInput.remove(),t.searchInput=null),this.setHeaderVisible(e))}hasFocusedItem(){return this._p.focusItemIndex>-1&&this._p.focusItemIndex<this._p.items.length}getFocusedItemIndex(){return this.hasFocusedItem()?this._p.focusItemIndex:-1}setFocusedItemAtIndex(e){const t=this._p;if(this.rushRefilter(),t.filteredItems){const s=t.filteredItems[e];e=t.items.indexOf(s)}t.focusItemIndex=e;const s=t.filteredItems??t.items;let i=null;e>-1&&(i=s[e]),i&&i._nointeraction&&(i=null),e>-1&&this._scrollItemIndexIntoView(e);let l=i?t.virtualListHelper.getItemElementAt(e):null;if(t.focusItemEl!==l&&(t.focusItemEl&&(t.focusItemEl.classList.remove(`${t.baseClassName}__item_focus`),t.focusItemEl=null),l)){l.classList.add(`${t.baseClassName}__item_focus`),t.focusItemEl=l;const e=l[g];this._trigger("itemfocus",{value:e.value,item:e[g]??e,event:null,el:l}),this._showSublist(e,l)}return this}_showSublist(t,s){if(!t._subitems?.length)return;const i=this._p;if(i.currentSubDropList?.item===t)return;const l=new e({baseClassName:i.baseClassName,additionalClasses:i.additionalClasses,direction:i.direction,autoItemBlur:i.autoItemBlur,autoItemBlurDelay:i.autoItemBlurDelay,capturesFocus:i.capturesFocus,multi:i.multi,keyDownHandler:i.keyDownHandler,autoCheckGroupChildren:i.autoCheckGroupChildren,useExactTargetWidth:i.useExactTargetWidth,constrainToWindow:i.constrainToWindow,autoFlipDirection:i.autoFlipDirection,estimatedItemHeight:i.estimatedItemHeight,estimateWidth:i.estimateWidth,virtualMinItems:i.virtualMinItems,singleSelectedValue:i.singleSelectedValue,labelProp:i.labelProp,valueProp:i.valueProp,renderItem:i.renderItem,unrenderItem:i.unrenderItem,positionOptionsProvider:()=>i.currentSubDropList.showOptions});let r=e=>{this[f]||e.relatedTarget&&this.elContains(e.relatedTarget,!0)||(this._delayBlurItemOnBlur(),this._trigger("subitems:blur",e))};l.on("select",e=>{this._trigger("subitems:select",e)}).on("subitems:select",e=>{this._trigger("subitems:select",e)}).on("show_subitems",e=>{this._trigger("show_subitems",e)}).on("hide_subitems",e=>{this._trigger("hide_subitems",e)}).on("blur",r).on("subitems:blur",r).on("_back_key_pressed",()=>{this._hideSublist()}),l.setItems(t._subitems),this._trigger("show_subitems",{value:t.value,item:t[g]??t,el:s,droplist:l}),i.currentSubDropList={item:t,itemElement:s,droplist:l,showOptions:{target:s,position:{x:"start",y:"top"},anchor:{x:"end",y:"top"},offset:{x:0,y:0},updateWidth:!1}},l.show(),l.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[f]&&this.el.focus(),this._trigger("hide_subitems",{value:t.item.value,item:t.item,el:t.itemElement,droplist:t.droplist})}updateSublist(){const e=this._p;if(!e.currentSubDropList)return;const t=e.currentSubDropList.item,s=e.currentSubDropList,i=e.items.find(e=>e===t)||e.items.find(e=>e.value===s.item.value);if(i){e.currentSubDropList.item=i;const t=e.virtualListHelper.getItemElementAt(this._getItemIndex(i));e.currentSubDropList.itemElement=t,i._subitems&&(e.currentSubDropList.droplist.setItems(i._subitems),t&&(e.currentSubDropList.showOptions.target=t,e.currentSubDropList.droplist.relayout()))}}setFocusedItem(e){const t=this._p;let s=e._nointeraction?-1:this._getItemIndex(e);const i=t.items;return s>-1&&i[s]._nointeraction&&(s=-1),this.setFocusedItemAtIndex(s)}setFocusedItemByValue(e){return this.setFocusedItemAtIndex(this.itemIndexByValue(e))}setSingleSelectedItemAtIndex(e,t){const s=this._p;this.rushRefilter();let i,l=null;return e>-1&&!s.items[e]._nointeraction&&(i=s.items[e],t=i.value,s.filteredItems&&(e=s.filteredItems.indexOf(i)),e>-1&&(l=s.virtualListHelper.getItemElementAt(e))),this._setSingleSelectedItemEl(l,t),this}setSingleSelectedItem(e){const t=this._p;let s=e._nointeraction?-1:this._getItemIndex(e);const i=t.items;return s>-1&&i[s]._nointeraction&&(s=-1),this.setSingleSelectedItemAtIndex(s)}setSingleSelectedItemByValue(e){return this.setSingleSelectedItemAtIndex(this.itemIndexByValue(e),e)}next(e){this._move("next",e)}previous(e){this._move("prev",e)}isFirstItem(){const e=this._p,t=e.filteredItems??e.items;return 0===e.focusItemIndex&&e.focusItemIndex<t.length}isLastItem(){const e=this._p,t=e.filteredItems??e.items;return e.focusItemIndex>-1&&e.focusItemIndex===t.length-1}scrollItemIndexIntoView(e){const t=this._p;if(this._hasScroll()){if(t.filteredItems){const s=t.items[e];e=t.items.indexOf(s)}-1!==e&&this._scrollItemIndexIntoView(e)}return this}_scrollItemIndexIntoView(e){const t=this._p;if(this._hasScroll()){const s=t.menuEl,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()}}}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.filteredItems??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,t){const s=this._p;return s.singleSelectedItemEl&&(s.singleSelectedItemEl.classList.remove(`${s.baseClassName}__item_selected`),s.singleSelectedItemEl=null),s.singleSelectedValue=t,e&&void 0!==t&&(e.classList.add(`${s.baseClassName}__item_selected`),s.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(e,t){if((0,o.closestUntil)(e.target,".requires-pointer-events,button",t))return;let s=this._p;if(!this._mouseHandled){if(this.triggerItemSelection(null,e),this[f])return;document.activeElement!==this.el&&s.focusItemEl&&clearTimeout(s.blurTimer),setTimeout(()=>{this._mouseHandled=!1},0)}}_hookMouseEvents(){const e=this._p;e.sink.add(e.el,"mouseup",e=>{const t=(0,o.closestUntil)(e.target,"li",e.currentTarget);t&&0===e.button&&this._itemUpAction(e,t)}).add(e.el,"mouseover",e=>{const t=(0,o.closestUntil)(e.target,"li",e.currentTarget);t&&this._handleMouseOver(e,t)})}_handleMouseOver(e,t){this._focus(e,t,null,!0)}_hookTouchEvents(){const e=this._p;let t;e.sink.add(e.el,"touchstart",s=>{const i=(0,o.closestUntil)(s.target,"li",s.currentTarget);if(!i)return;if(t)return;if((0,o.closestUntil)(s.target,".requires-pointer-events,button",i))return;t=s.changedTouches[0].identifier,this._handleMouseOver(s,i);let l=!1,r=()=>{l=!0},n=()=>{t=null,e.sink.remove(null,".dropdown_touchextra")},a=i.parentNode;for(;a;)e.sink.add(a,"scroll.dropdown_touchextra",r),a=a.parentNode;e.sink.add(window,"scroll.dropdown_touchextra",r),e.sink.add(window,"touchcancel.dropdown_touchextra",n),e.sink.add(e.el,"touchend.dropdown_touchextra",e=>{const s=(0,o.closestUntil)(e.target,"li",e.currentTarget);return s&&Array.prototype.find.call(e.changedTouches,e=>e.identifier===t)?(n(),void(l||(this._itemUpAction(e,s),e.preventDefault()))):n()})})}_hookFocusEvents(){const e=this._p;e.sink.add(e.el,"focus",t=>{if(t.target===this.el&&e.searchable&&e.searchInput.focus(),t.relatedTarget&&this.elContains(t.relatedTarget,!0)&&this.elContains(t.target,!0))return;let s=e.focusItemEl||e.el.firstChild;this._focus(t,s,null,!1)},!0).add(e.el,"blur",e=>{e.relatedTarget&&this.elContains(e.relatedTarget,!0)&&this.elContains(e.target,!0)||setTimeout(()=>{this[f]||document.activeElement&&this.elContains(document.activeElement,!0)||(this._delayBlurItemOnBlur(),this._trigger("blur",e))})},!0)}_hookKeyEvents(){const e=this._p;e.sink.add(e.el,"keydown",e=>this._keydown(e))}_hookSearchEvents(){const e=this._p;e.searchInput&&e.sink.add(e.searchInput,"input",()=>{e.filterTerm=e.searchInput.value.trim(),e.filteredItems=null,this._trigger("search",{value:e.searchInput.value}),e.throttledRefilterItems()})}_keydown(e){const t=this._p;if(t.keyDownHandler&&t.keyDownHandler.call(this,e))return;let s=!0;switch(e.key){case h.VALUE_PAGE_UP:case h.VALUE_PAGE_DOWN:case h.VALUE_HOME:case h.VALUE_END:case h.VALUE_UP:case h.VALUE_DOWN:switch(t.lastKeyWasChar=!1,e.preventDefault(),e.key){case h.VALUE_PAGE_UP:this.previousPage(e);break;case h.VALUE_PAGE_DOWN:this.nextPage(e);break;case h.VALUE_HOME:this._move("first",e);break;case h.VALUE_END:this._move("last",e);break;case h.VALUE_UP:this.previous(e);break;case h.VALUE_DOWN:this.next(e)}break;case h.VALUE_LEFT:case h.VALUE_RIGHT:if(t.lastKeyWasChar=!1,e.key===h.VALUE_RIGHT&&"rtl"!==getComputedStyle(e.target).direction||e.key===h.VALUE_LEFT&&"rtl"===getComputedStyle(e.target).direction){let e=(t.filteredItems??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 h.VALUE_ENTER:t.lastKeyWasChar=!1,this.triggerItemSelection(null,e),e.preventDefault();break;case h.VALUE_SPACE:if("BUTTON"===e.target.tagName||"INPUT"===e.target.tagName&&t.lastKeyWasChar)return;this.toggleFocusedItem(),e.preventDefault();break;case h.VALUE_ESCAPE:t.lastKeyWasChar=!1,e.preventDefault(),this.hide();break;default:if("INPUT"===e.target.tagName||"TEXTAREA"===e.target.tagName){const s=e.key||String.fromCharCode(e.keyCode);t.lastKeyWasChar=1===s.length||e.key===h.VALUE_BACK_SPACE}t.searchable||this._keydownFreeType(e,!this.isVisible()),s=!1}}_keydownFreeType(e,t){const s=this._p,i=e.key||String.fromCharCode(e.keyCode),l=1===i.length;if(s.lastKeyWasChar=l||e.key===h.VALUE_BACK_SPACE,!l)return;clearTimeout(s.filterTimer);let r,n=(s.previousFilter||"")+i,o=new RegExp(`^${p(n)}`,"i"),a=-1,u=s.focusItemIndex;const c=s.filteredItems??s.items;for(let d=0,h=c.length;d<h&&(-1!==a&&d<u||(r=c[d],!(o.test(r.label)&&(a=d,-1===u||d>=u))));d++);if(-1===a){n=i,o=new RegExp(`^${p(n)}`,"i");for(let e=0,t=c.length;e<t&&(-1!==a&&e<u||(r=c[e],!(o.test(r.label)&&(a=e,-1===u||e>=u))));e++);}if(a>-1){let i=s.virtualListHelper.getItemElementAt(a);this._focus(e,i||null,a,!0),t&&this.triggerItemSelection(i?null:c[a],e),s.previousFilter=n,s.filterTimer=setTimeout(()=>{delete s.previousFilter},1e3)}else delete s.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&&t?.[g]?.[g]===b&&(s=void 0),s>-1?this.scrollItemIndexIntoView(s):void 0===s&&(t=null);let r=t||l.virtualListHelper.getItemElementAt(s);if(!r||r[g]._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.filteredItems??l.items)[s];this._trigger("itemfocus",{value:n.value,item:n[g]??n,event:e,el:r}),l._isFocusingItem=!1,i&&this._showSublist(n,r)}_delayBlurItemOnBlur(){if(this[f])return;const e=this._p;e.autoItemBlur&&(clearTimeout(e.blurTimer),e.blurTimer=setTimeout(()=>{this[f]||this.blurFocusedItem()},e.autoItemBlurDelay))}_move(e,t){const s=this._p;let i,l,r;const n=s.filteredItems??s.items;if("first"===e)l=0,r=!1;else if("last"===e)l=n.length-1,r=!0;else if("prev"===e){if(!this.hasFocusedItem())return this._move("last",t);l=s.focusItemIndex-1,-1===l&&(l=n.length-1),r=!0}else if("next"===e){if(!this.hasFocusedItem())return this._move("first",t);l=s.focusItemIndex+1,l===n.length&&(l=0),r=!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(s.virtualListHelper.isVirtual()){let t=s.virtualListHelper.getVisibleItemCount();l=s.focusItemIndex,"prev_page"===e?l-=t:l+=t,l<0?l=0:l>=n.length&&(l=n.length)}else if(s.focusItemEl){let t=(0,u.getElementOffset)(s.focusItemEl).top,r=(0,u.getElementHeight)(s.el,!0);for(;;){if(i=s.focusItemEl.nextElementSibling,!i)return;if("LI"===i.tagName)if("prev_page"===e){if((0,u.getElementOffset)(i).top-t+r<=0)break}else if((0,u.getElementOffset)(i).top-t-r>=0)break}i&&(l=s.virtualListHelper.getItemIndexFromElement(i),void 0===l&&(l=-1))}r="prev_page"===e}let o=n.length;if(l>=o)return;let a=n[l],c=l;for(;a&&a._nointeraction&&(r?(l--,-1===l&&(l=o)):(l++,l===o&&(l=0)),a=n[l],l!==c););i=s.virtualListHelper.getItemElementAt(l),this._focus(t,i||null,l,!1),this.isVisible()||this.triggerItemSelection(a,t)}_hasScroll(){const e=this._p.menuEl;return e.clientHeight<e.scrollHeight}_updateGroupStateForItem(e){const t=this._p;if(!t.multi)return this;if(e._group){let s=0;if(t.autoCheckGroupChildren){const i=t.filteredItems??t.items;let l=i.indexOf(e);const r=e._level;for(let n=l+1,o=i.length;n<o;n++){let l=i[n];if(!l._child&&i[n-1]._child||(void 0===r?l._group||void 0!==l._level:l._level<=r))break;if(!!l._checked===e._checked)continue;l._checked=e._checked,s++;let o=t.virtualListHelper.getItemElementAt(n);o&&(0,a.toggleClass)(o,`${t.baseClassName}__item_checked`,e._checked),this._trigger("check",{value:l.value,item:l[g]??l,checked:l._checked,isGroup:l._group,isCheckingGroup:!0})}}this._trigger("groupcheck",{value:e.value,item:e[g]??e,affectedCount:s})}else if(t.groupCount>0&&t.autoCheckGroupChildren){const s=t.filteredItems??t.items;let i=-1;for(let t=s.indexOf(e)-1;t>=0;t--)if(s[t]._group){i=t;break}i>-1&&this._updateGroupCheckedState(i,!0)}return this}_updateGroupCheckedState(e,t){const s=this._p;if(!(s.multi&&s.autoCheckGroupChildren&&e>-1))return this;const i=s.filteredItems??s.items;let l=i[e];if(!l||!l._group)return this;let r,n=!1,o=!1;const u=l._level;for(let a=e+1,d=i.length;a<d&&(r=i[a],!(!r._child&&i[a-1]._child||(void 0===u?r._group||void 0!==r._level:r._level<=u)));a++)r._checked?n=!0:r._checked||(o=!0);if(!n&&!o)return this;let c=n&&!o;if(!!l._checked!==c){l._checked=c;let i=s.virtualListHelper.getItemElementAt(e);i&&(0,a.toggleClass)(i,`${s.baseClassName}__item_checked`,l._checked),t&&this._trigger("check",{value:l.value,item:l[g]??l,checked:l._checked,isGroup:l._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(I,!0,t=>{let s=(0,o.createElement)("span",{css:{display:"block",width:"100px",height:"100px",overflow:"scroll",position:"absolute"}}),i=(0,o.createElement)("span",{css:{display:"block",position:"relative",width:"0",height:"0",overflow:"hidden"}},[s]);t.appendChild(i);let l=s.offsetWidth-s.clientWidth;t.removeChild(i),e.lastMeasureItemWidth=(0,u.getElementWidth)(t,!0,!0)+l}),this}_determineVirtualMode(e){const t=this._p,s=t.filteredItems??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(e,t){const s=this._p,i=e[g];if(i===b)return!(!s.renderNoResultsItem||!1===s.renderNoResultsItem(e,t))||void t.appendChild((0,o.createElement)("div",{class:"droplist-no-results-content",textContent:s.noResultsText}));s.renderItem&&!1!==s.renderItem(i||e,t)||(t.appendChild((0,o.createElement)("span",{class:`${s.baseClassName}__item_label`,textContent:e.label})),s.multi&&(e._nocheck||t.insertBefore((0,o.createElement)("span",{class:"checkbox"}),t.firstChild)))}_updateWidth(e){const t=this._p,s=t.el;let i=0;e&&(i="number"==typeof e.updateWidth||null!=e.targetWidth?e.updateWidth:(0,u.getElementWidth)(e.target,!0,!0));let l=0;t.useExactTargetWidth&&i||(t.estimateWidth||t.virtualListHelper.isVirtual()?l=t.lastMeasureItemWidth:(s.style.width="",l=(0,u.getElementWidth)(s,!0,!0)));let r=Math.max(l,i);(0,u.setElementWidth)(s,r,!0,!0);const n=getComputedStyle(s);let o=(parseFloat(n.borderLeftWidth)||0)+(parseFloat(n.borderRightWidth)||0),a=s.scrollWidth+o;if(a>r){let e=a-r;s.style.width=`${parseFloat(s.style.width)+e}px`,r=a}return r}},C=Symbol("destroyed"),S=Symbol("rest_multi_items"),L=!!("ontouchstart"in window||window.DocumentTouch&&window.document instanceof window.DocumentTouch||window.navigator.maxTouchPoints),k=function(e,t){return e instanceof Element&&e.classList.contains(t)},x=["font-family","font-size","font-weight","font-size","letter-spacing","text-transform","word-spacing","text-indent","box-sizing","padding-left","padding-right"],T={el:null,baseClassName:"selectbox",disabled:!1,readOnly:!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",autoSelectTextOnCheck:!0,filterThrottleWindow:300,filterOnEmptyTerm:!1,labelProp:"label",valueProp:"value",multiItemLabelProp:"short_label",multiItemRemovePosition:"after",maxMultiItems:null,multiItemsRestLabelProvider:null,items:[],selectedValues:void 0,value:void 0,isLoadingMode:!1,closeListWhenLoading:!0,clearInputWhen:["single_close","multi_select_single"]};exports.DropList=E,exports.DropListDefaultOptions=y,exports.ItemSymbol=g,exports.SelectBox=class{constructor(e){const t={...T};for(let[r,n]of Object.entries(e))void 0!==n&&(t[r]=n);const s=this._p={ownsEl:!0,baseClassName:t.baseClassName,additionalClasses:t.additionalClasses,direction:"ltr"===t.direction?"ltr":"rtl"===t.direction?"rtl":"auto",listOptions:t.listOptions,disabled:!!t.disabled,readOnly:!!t.readOnly,clearable:!!t.clearable,hasOpenIndicator:!!t.hasOpenIndicator,placeholder:t.placeholder,sortSelectedItems:!!t.sortSelectedItems,sortListItems:!!t.sortListItems,sortListCheckedFirst:!!t.sortListCheckedFirst,stickyValues:Array.isArray(t.stickyValues)?new Set(t.stickyValues):null,sortItemComparator:t.sortItemComparator,splitListCheckedGroups:!!t.splitListCheckedGroups,treatGroupSelectionAsItems:t.treatGroupSelectionAsItems,blurOnSingleSelection:t.blurOnSingleSelection,multi:t.multi,showSelection:t.showSelection,showPlaceholderInTooltip:t.showPlaceholderInTooltip,multiPlaceholderFormatter:t.multiPlaceholderFormatter,searchable:t.searchable,allowTypeToSelect:t.allowTypeToSelect,noResultsText:t.noResultsText,autoSelectTextOnCheck:t.autoSelectTextOnCheck,labelProp:t.labelProp,valueProp:t.valueProp,multiItemLabelProp:t.multiItemLabelProp,multiItemRemovePosition:t.multiItemRemovePosition,maxMultiItems:t.maxMultiItems,multiItemsRestLabelProvider:t.multiItemsRestLabelProvider,renderSingleItem:t.renderSingleItem,unrenderSingleItem:t.unrenderSingleItem,renderMultiItem:t.renderMultiItem,unrenderMultiItem:t.unrenderMultiItem,renderRestMultiItem:t.renderRestMultiItem,unrenderRestMultiItem:t.unrenderRestMultiItem,on:t.on||null,silenceEvents:!0,mitt:(0,m.default)(),isLoadingMode:!!t.isLoadingMode,closeListWhenLoading:!!t.closeListWhenLoading,clearInputWhen:Array.isArray(t.clearInputWhen)?t.clearInputWhen.slice(0):[],items:[],itemsChanged:!0,sink:new c.default,resizeObserver:null,selectedItems:[],selectedValues:[],selectionChanged:!0,resortBySelectionNeeded:!1,filterThrottleWindow:t.filterThrottleWindow,filterOnEmptyTerm:t.filterOnEmptyTerm,filterFn:null,filterTerm:""};let i=t.el;i instanceof Element?s.ownsEl=!1:i=(0,o.createElement)("span"),(0,o.setElementAttrs)(i,{role:"combobox","aria-haspopup":"true","aria-expanded":"false"}),s.el=i,this._syncBaseClasses(),this._renderBase(),s.multiItemEls=[],this.enable(!s.disabled),this.setReadOnly(s.readOnly),this._setupDropdownMenu(),s.sink.add(i,"click",e=>{s.clearButtonWrapper&&s.clearButtonWrapper.contains(e.target)||i.contains(document.activeElement)||(s.input.focus(),s.input.selectionStart=s.input.selectionEnd=s.input.value.length)}),s.sink.add(i,"focus",e=>{const t=e.target;if(!i.contains(e.relatedTarget)&&!k(t,`${s.baseClassName}__search_field`)&&!k(t,`${s.baseClassName}__item`)){let e=i.querySelector(`.${s.baseClassName}__search_field`);e&&e.focus()}},!0),s.sink.add(s.input,"keydown",e=>{this._handleInputKeydown(e)}).add(s.input,"input",()=>{this._resizeInput()});const l=(()=>{let e;return()=>{e&&clearTimeout(e),e=setTimeout(()=>{(0,a.toggleClass)(i,`${s.baseClassName}__focus`,i.contains(document.activeElement))})}})();if(s.sink.add(i,"focus",l,!0),s.sink.add(i,"blur",l,!0),s.sink.add(window,"resize",()=>this._resizeInput()),s.sink.add(window,"orientationchange",()=>this._resizeInput()),void 0!==window.ResizeObserver){let e={borderBoxSize:{blockSize:null,inlineSize:null},contentBoxSize:{blockSize:null,inlineSize:null}};s.resizeObserver=new ResizeObserver(t=>{if(this[C])return;const i=t[0];e&&i.borderBoxSize[0].blockSize===e.borderBoxSize.blockSize&&i.borderBoxSize[0].inlineSize===e.borderBoxSize.inlineSize&&i.contentBoxSize[0].blockSize===e.contentBoxSize.blockSize&&i.contentBoxSize[0].inlineSize===e.contentBoxSize.inlineSize||(s.resizeObserver.unobserve(s.el),this._resizeInput(),requestAnimationFrame(()=>s.resizeObserver.observe(s.el))),e.borderBoxSize=i.borderBoxSize[0],e.contentBoxSize=i.contentBoxSize[0]}),s.resizeObserver.observe(s.el)}return this.setFilterFn(t.filterFn),this.setItems(t.items),delete t.items,t.multi&&Array.isArray(t.selectedValues)?this.setSelectedValues(t.selectedValues):null!=t.value&&this.setValue(t.value),this._scheduleSync("full"),this.silenceEvents=!1,this}destroy(){if(this[C])return;this[C]=!0;const e=this._p;if(e.syncTimeout&&(clearTimeout(e.syncTimeout),delete e.syncTimeout),this._stopTrackingPresence(),e.sink.remove(),e.dropList&&e.dropList.destroy(),this._cleanupSingleWrapper(),e.unrenderMultiItem||e.unrenderRestMultiItem)for(;e.multiItemEls.length>0;)this._removeMultiItemElementByIndex(e.multiItemEls.length-1);if((0,a.remove)(e.list),(0,a.remove)(e.singleWrapper),(0,a.remove)(e.input),(0,a.remove)(e.inputBackBuffer),(0,a.remove)(e.clearButtonWrapper),(0,a.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??null}get droplistInstance(){return this._p.dropList}droplistElContains(e,t=!0){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 i of s)t.disabled?i.removeAttribute("tabindex"):i.setAttribute("tabindex","0");return this}isEnabled(){return!this._p.disabled}disable(e){return this.enable(void 0!==e&&!e)}isDisabled(){return this._p.disabled}setReadOnly(e){const t=this._p;return void 0===e&&(e=!0),t.readOnly=e,t.el.setAttribute("aria-readOnly",t.readOnly.toString()),t.input.readOnly=!(t.searchable||t.multi)||!!t.readOnly,this}isReadOnly(){return this._p.readOnly}setAdditionalClasses(e){return this._p.additionalClasses=e,this._syncBaseClasses(),this}setItems(e,t=!0){const s=this._p;return e||(e=[]),s.items=e.slice(0),s.itemsChanged=!0,this._refreshItemByValueMap(),t&&this.setSelectedValues(this.getSelectedValues()),this._trigger("itemschanged",{term:null,mutated:!0,count:this.getFilteredItemCount()}),this}getFilteredItemCount(){const e=this._p;return e.dropList?e.dropList.getFilteredItemCount():e.items?e.items.length:0}isFilterPending(){const e=this._p;return!0===e.dropList?.isFilterPending()}updateItemByValue(e,t){const s=this._p;let i=this._getItemByValue(e);if(i){const e=i[s.valueProp];s.itemByValueMap?.has(e)&&s.itemByValueMap.delete(e),Object.assign(i,t),s.itemByValueMap.set(i[s.valueProp],i)}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,t=!1){const s=this._p;return s.input?(s.input.value=e,this._scheduleSync("resize_input"),t&&(s.filterTerm=s.input.value.trim(),this._trigger("search:term",s.filterTerm),s.dropList?.setSearchTerm(s.filterTerm,t)),this):this}getSearchTerm(){const e=this._p;return e.input?e.input.value:""}invokeRefilter(){const e=this._p;return e.dropList?.invokeRefilter(),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.itemsChanged=!0,this._scheduleSync("render_list")),this}isSortListItemsEnabled(){return this._p.sortListItems}setSortListCheckedFirst(e){const t=this._p;return e=!!e,t.sortListCheckedFirst===e||(t.sortListCheckedFirst=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.dropList?.setFilterGroups(e),t.dropList?.setFilterEmptyGroups(!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 t=this._p;return e=!!e,t.multi===e||(t.multi=e,this._setupDropdownMenu(),(0,a.remove)(t.clearButtonWrapper),delete t.clearButtonWrapper,e&&t.selectedValues&&1===t.selectedValues.length&&Array.isArray(t.selectedValues[0])&&this.setSelectedValues(t.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}setAllowTypeToSelect(e){const t=this._p;return e=!!e,t.allowTypeToSelect===e||(t.allowTypeToSelect=e),this}isSearchableEnabled(){return this._p.searchable}setNoResultsText(e){return this._p.dropList?.setNoResultsText(e),this}getNoResultsText(){return this._p.noResultsText}setAutoSelectTextOnCheck(e){return this._p.autoSelectTextOnCheck=e,this}getAutoSelectTextOnCheck(){return this._p.autoSelectTextOnCheck}setFilterThrottleWindow(e){const t=this._p;return t.filterThrottleWindow=e,t.dropList?.setFilterThrottleWindow(e),this}getFilterThrottleWindow(){return this._p.filterThrottleWindow}setFilterOnEmptyTerm(e){const t=this._p;return t.filterOnEmptyTerm===e||t.dropList?.setFilterOnEmptyTerm(e),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}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._refreshItemByValueMap()),this}setMultiItemLabelProp(e){return this._p.multiItemLabelProp=e,this._scheduleSync("render_items"),this}setMultiItemRemovePosition(e){return this._p.multiItemRemovePosition=e,this._scheduleSync("render_items"),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,e||(e=(e,s)=>{const i=new RegExp(p(s),"i"),l=t.labelProp,r=t.multiItemLabelProp;return t.items.filter(e=>!(t.treatGroupSelectionAsItems||!e._group)||i.test(e[l]||e[r]))}),t.actualFilterFn=e,t.dropList?.setFilterFn(e)),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[C],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=this._getItemByValue(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}),document.activeElement!==e.input&&(e.lastActiveElement=document.activeElement===document.body?null:function(e){if(!e)return null;const t={element:e};return"number"==typeof e.selectionStart&&"number"==typeof e.selectionEnd&&(t.selectionStart=e.selectionStart,t.selectionEnd=e.selectionEnd,t.selectionDirection=e.selectionDirection),t}(document.activeElement)),e.dropList.setDirection(getComputedStyle(e.el).direction),e.dropList.show(),this._repositionDropList(),this._repositionDropList(),e.dropList.hasFocusedItem()?e.dropList.setFocusedItemAtIndex(e.dropList.getFocusedItemIndex()):e.multi||void 0===this.getValue()||e.dropList.setFocusedItemByValue(this.getValue())),this}closeList(){const e=this._p;return this[C]?this:e.dropList.isVisible()?(e.dropList.hide(),e.lastActiveElement&&(e.multi||e.searchable||(t=e.lastActiveElement,t?.element&&document.body.contains(t.element)&&(t.element.focus(),"number"==typeof t.selectionStart&&"number"==typeof t.selectionEnd&&"function"==typeof t.element.setSelectionRange&&t.element.setSelectionRange(t.selectionStart,t.selectionEnd,t.selectionDirection??"none"))),e.lastActiveElement=null),this):this;var t}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&&t.closeListWhenLoading&&0===t.items.length&&this.isListOpen()?this.closeList():!t.isLoadingMode&&t.closeListWhenLoading&&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}setCloseListWhenLoading(e){return this._p.closeListWhenLoading=e,this}getCloseListWhenLoading(){return this._p.closeListWhenLoading}setClearInputWhen(e){return this._p.clearInputWhen=Array.isArray(e)?e.slice(0):[],this}getClearInputWhen(){return this._p.clearInputWhen}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}_refreshItemByValueMap(){const e=this._p,t=e.itemByValueMap=new Map,s=e.valueProp;for(let i of e.items)t.set(i[s],i);e.subitemByValueMap=null}_getItemByValue(e){const t=this._p;let s=t.itemByValueMap.get(e);return void 0!==s?s:(t.subitemByValueMap||this._refreshSubitemByValueMap(),t.subitemByValueMap.get(e))}_refreshSubitemByValueMap(){const e=this._p,t=e.subitemByValueMap=new Map;this._addSubitemsToValueMap(e.items,t,e.valueProp)}_addSubitemsToValueMap(e,t,s){for(let i of e)if(i._subitems?.length){for(let e of i._subitems)t.has(e[s])||t.set(e[s],e);this._addSubitemsToValueMap(i._subitems,t,s)}}_renderBase(){const e=this._p;if(e.inputBackBuffer||(e.inputBackBuffer=(0,o.createElement)("span",{css:{position:"absolute",zIndex:-1,left:0,top:"-9999px",whiteSpace:"pre"}})),e.input||(e.inputWrapper=(0,o.createElement)("span",{class:`${e.baseClassName}__search_wrapper`},e.input=(0,o.createElement)("input",{class:`${e.baseClassName}__search_field`,type:"search",autocomplete:"off",autocorrect:"off",autocapitalize:"off",spellcheck:"false",role:"textbox","aria-autocomplete":"list",readOnly:!(e.searchable||e.multi)||!!e.readOnly}))),e.multi){if(e.singleWrapper&&(this._cleanupSingleWrapper(),(0,a.remove)(e.singleWrapper),delete e.singleWrapper),!e.list){this._unregisterDropdownEvents();const t=document.activeElement;e.list=(0,o.createElement)("ul",{class:`${e.baseClassName}__list`}),e.el.appendChild(e.list),e.list.appendChild(e.inputWrapper),e.el.classList.remove(`${e.baseClassName}__single`),e.el.classList.add(`${e.baseClassName}__multi`),e.sink.add(e.list,"click",t=>{(0,o.closestUntil)(t.target,`.${e.baseClassName}__item_remove`,t.currentTarget)&&(e.disabled||e.readOnly||this._removeMultiItemFromEvent((0,o.closestUntil)(t.target,`.${e.baseClassName}__item`,t.currentTarget),t))}).add(e.list,"keydown",t=>{(0,o.closestUntil)(t.target,`.${e.baseClassName}__item`,t.currentTarget)&&this._handleMultiKeydown(t)}),t===e.input&&e.input.focus(),this._registerDropdownEvents()}}else if(e.list&&((0,a.remove)(e.list),e.sink.remove(e.list),delete e.list),!e.singleWrapper){this._unregisterDropdownEvents();const t=document.activeElement;e.singleWrapper=(0,o.createElement)("div",{class:`${e.baseClassName}__single_wrapper`}),e.el.appendChild(e.singleWrapper),e.el.appendChild(e.inputWrapper),e.el.classList.remove(`${e.baseClassName}__multi`),e.el.classList.add(`${e.baseClassName}__single`),t===e.input&&e.input.focus(),this._registerDropdownEvents()}e.hasOpenIndicator!==!!e.openIndicator&&(e.hasOpenIndicator?(e.openIndicator=(0,o.createElement)("span",{class:`${e.baseClassName}__open_indicator`}),e.el.appendChild(e.openIndicator),e.el.classList.add(`${e.baseClassName}__has_open_indicator`)):((0,a.remove)(e.openIndicator),delete e.openIndicator,e.el.classList.remove(`${e.baseClassName}__has_open_indicator`))),e.isLoadingMode!==!!e.spinner&&(e.isLoadingMode?(e.spinner=(0,o.createElement)("span",{class:`${e.baseClassName}__spinner`}),e.el.appendChild(e.spinner),e.el.classList.add(`${e.baseClassName}__has_spinner`)):((0,a.remove)(e.spinner),delete e.spinner,e.el.classList.remove(`${e.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 e=this._p;e.valueProp,e.dropList&&(e.dropList.destroy(),delete e.dropList,e.itemsChanged=!0,e.selectionChanged=!0,e.resortBySelectionNeeded=!0);const t=e=>{(0,o.closestUntil)(e.target,"li",e.currentTarget)&&e.preventDefault()},s=e.dropList=new E({virtualMinItems:10,searchable:!1,...e.listOptions,multi:e.multi,singleSelectedValue:e.multi?void 0:this.getValue(),capturesFocus:!1,labelProp:e.labelProp,valueProp:e.valueProp,noResultsText:e.noResultsText,filterThrottleWindow:e.filterThrottleWindow,filterOnEmptyTerm:e.filterOnEmptyTerm,filterGroups:e.treatGroupSelectionAsItems,filterEmptyGroups:!e.treatGroupSelectionAsItems,filterFn:e.actualFilterFn,positionOptionsProvider:()=>this._getDropListPositionOptions(),on:(i,l)=>{switch(i){case"show:before":{e.dropListVisible=!0,e.el.setAttribute("aria-expanded","true"),e.el.classList.add(`${e.baseClassName}__open_list`),e.el.classList.remove(`${e.baseClassName}__closed_list`),e.resortBySelectionNeeded&&e.sortListCheckedFirst&&e.multi&&(e.itemsChanged=!0),this._updateListItems(),this._trigger("open",{list:s}),this._startTrackingPresence(),e.sink.add(window,"resize.trackposition",()=>this._repositionDropList());let t=e.el.parentNode;for(;t;)(t.scrollHeight>t.offsetHeight||t.scrollWidth>t.offsetWidth)&&(t===document.documentElement&&(t=window),e.sink.add(t,"scroll.trackposition",()=>this._repositionDropList())),t=t.parentNode}break;case"hide":if(e.dropListVisible=!1,e.el.setAttribute("aria-expanded","false"),e.el.classList.remove(`${e.baseClassName}__open_list`),e.el.classList.add(`${e.baseClassName}__closed_list`),e.multi?e.clearInputWhen.includes("multi_close")&&this._setInputText(""):(e.clearInputWhen.includes("single_close")&&this._setInputText(""),this._scheduleSync("render_base")),this._trigger("close"),this[C])return;this._stopTrackingPresence(),e.sink.remove(null,".trackposition");break;case"check":{if(!e.multi)return;e.autoSelectTextOnCheck&&e.input&&document.activeElement===e.input&&e.input.setSelectionRange(0,e.input.value.length);const t=l.item,i=l.value;let r=l.checked;if(l.isGroup&&!e.treatGroupSelectionAsItems)return;let n={value:i,item:t,cancel:!1,isCheckingGroup:l.isCheckingGroup};if(this._trigger((r?"addsel":"removesel")+":before",n),n.cancel)return void e.dropList.setItemChecked(i,!r);if(r)e.selectedItems.push(t),e.selectedValues.push(i);else{const t=e.selectedValues.indexOf(i);-1!==t&&(e.selectedItems.splice(t,1),e.selectedValues.splice(t,1))}e.selectionChanged=!0,e.resortBySelectionNeeded=!0;const o=!!l.isCheckingGroup;e.showSelection?r?(1===s.itemCount()&&e.clearInputWhen.includes("multi_select_single")&&this._setInputText(""),e.sortSelectedItems?o||this._scheduleSync("full"):(null!=e.maxMultiItems&&(e.treatGroupSelectionAsItems?e.selectedItems:e.selectedItems.filter(e=>!e._group)).length>e.maxMultiItems?this._scheduleSync("addOrUpdateMultiItemRestElement"):this._scheduleSync("addMultiItemElement",t),o||this._scheduleSync("render_base"))):(null!=e.maxMultiItems&&(e.treatGroupSelectionAsItems?e.selectedItems:e.selectedItems.filter(e=>!e._group)).length===e.maxMultiItems?this._scheduleSync("removeMultiItemRestElement"):this._scheduleSync("removeMultiItemElement",t),o||this._scheduleSync("render_base")):e.multi&&this._scheduleSync("syncPlaceholder"),this._trigger(r?"addsel":"removesel",{value:i,item:t,isCheckingGroup:l.isCheckingGroup})}break;case"groupcheck":if(!e.multi)return;e.autoSelectTextOnCheck&&e.input&&document.activeElement===e.input&&e.input.setSelectionRange(0,e.input.value.length),l.affectedCount&&this._scheduleSync(e.sortSelectedItems?"full":"render_base"),this._trigger("groupcheck",{value:l.value,item:l.item,affectedCount:l.affectedCount});break;case"select":case"subitems:select":{if(e.multi)return;const t=l.item,s=l.value;if(!this._performSelectWithEvent(t,s))return;if(this[C])return;this.closeList(),("touch"===e.blurOnSingleSelection&&L||"touch"!==e.blurOnSingleSelection&&e.blurOnSingleSelection)&&e.input&&document.activeElement===e.input&&e.input.blur()}break;case"show_subitems":e.sink.add(l.droplist.el,"mousedown.subitems",t);break;case"hide_subitems":e.sink.remove(l.droplist.el,".subitems");break;case"blur":this._handleOnBlur();break;case"search":this._trigger("search",l);break;case"itemschanged":this._trigger("itemschanged",l)}}});e.sink.add(s.el,"mousedown",t),this._registerDropdownEvents()}_handleOnBlur(){const e=this._p;setTimeout(()=>{this[C]||e.disabled||e.readOnly||(this._trigger("search:blur"),this[C]||document.activeElement&&(e.input&&e.input.contains(document.activeElement)||e.dropList&&this.droplistElContains(document.activeElement,!0))||this.closeList())})}_unregisterDropdownEvents(){this._p.sink.remove(null,".dropdown")}_registerDropdownEvents(){const e=this._p;this._unregisterDropdownEvents();const t=e.dropList;if(!t)return;let s=!1,i=null;const l=e.multi||e.searchable?e.input:e.el;e.sink.add(l,"keydown.dropdown",s=>{if(s.currentTarget.readOnly)return;let i=!1,l=e.lastKeyAllowsNonTypeKeys;e.lastKeyAllowsNonTypeKeys=!1;let r=e.input&&e.input.value.length>0;switch(s.key){case h.VALUE_PAGE_UP:case h.VALUE_PAGE_DOWN:case h.VALUE_UP:case h.VALUE_DOWN:case h.VALUE_HOME:case h.VALUE_END:if((s.key===h.VALUE_HOME||s.key===h.VALUE_END)&&r&&!l){t._keydownFreeType(s);break}switch(e.lastKeyAllowsNonTypeKeys=!0,s.preventDefault(),s.key){case h.VALUE_PAGE_UP:t.isVisible()&&t.previousPage(s);break;case h.VALUE_PAGE_DOWN:t.isVisible()&&t.nextPage(s);break;case h.VALUE_UP:t.isVisible()?t.previous(s):this._movePrev();break;case h.VALUE_DOWN:t.isVisible()?t.next(s):this._moveNext();break;case h.VALUE_HOME:t.goToFirst(s);break;case h.VALUE_END:t.goToLast(s)}break;case h.VALUE_SPACE:l&&(e.lastKeyAllowsNonTypeKeys=!0,t.isVisible()&&t.hasFocusedItem()&&(i=!0,e.multi?t.toggleFocusedItem(s):t.triggerItemSelection(null,s),s.preventDefault()));break;case h.VALUE_ENTER:t.isVisible()&&t.hasFocusedItem()&&(i=!0,s.preventDefault(),t.triggerItemSelection(null,s));break;case h.VALUE_TAB:t.isVisible()&&t.hasFocusedItem()&&t.triggerItemSelection(null,s);break;case h.VALUE_ESCAPE:t.isVisible()&&(t.hide(s),s.preventDefault());break;default:t.isVisible()?t._keydownFreeType(s,!1):e.allowTypeToSelect?t._keydownFreeType(s,!0):(this.openList(),setTimeout(()=>{this[C]||t._keydownFreeType(s,!1)}))}i||s.key!==h.VALUE_ENTER&&(s.key!==h.VALUE_SPACE||!e.lastKeyAllowsNonTypeKeys||e.multi||t.hasFocusedItem()||e.disabled||e.readOnly)||(this.toggleList(),s.preventDefault(),s.stopPropagation())}),e.input&&e.sink.add(e.input,"input.dropdown",()=>{e.disabled||e.readOnly||(e.filterTerm=e.input.value.trim(),this._trigger("search:term",e.filterTerm),e.dropList?.setSearchTerm(e.filterTerm,!0))}).add(e.input,"click.dropdown",()=>{e.disabled||e.readOnly||!e.multi&&e.searchable&&this.openList()}).add(e.input,"focus.dropdown",()=>{e.disabled||e.readOnly||(this._trigger("search:focus"),this[C]||(s=!1,this.openList(),s=!0,setTimeout(()=>{s=!1},10)))}).add(e.input,"blur.dropdown",()=>this._handleOnBlur()),e.sink.add(e.el,"mousedown.dropdown",()=>{e.multi||e.searchable||s||e.disabled||e.readOnly||this.toggleList(),s=!1}).add(e.el,"touchstart.dropdown",t=>{if(i)return;if(i=t.changedTouches[0].identifier,this.isDisabled()||this.isReadOnly())return;if((0,o.closestUntil)(t.target,`.${e.baseClassName}__item,.${e.baseClassName}__clear`,e.el))return;let s=()=>{i=null,e.sink.remove(e.el,".dropdown_touchextra")};(e.input||e.el).focus(),e.sink.add(e.el,"touchend.dropdown_touchextra",e=>{if(!Array.prototype.find.call(t.changedTouches,e=>e.identifier===i))return s();e.preventDefault(),s()}).add(e.el,"touchmove.dropdown_touchextra",e=>{e.preventDefault()}).add(e.el,"touchcancel.dropdown_touchextra",s)})}_performSelectWithEvent(e,t){let s={value:t,item:e,cancel:!1};return this._trigger("select:before",s),!s.cancel&&!this[C]&&(this._setSelectedItems([e]),this._trigger("select",{value:t,item:e}),!0)}_performClearWithEvent(e=!1){let t={cancel:!1};return this._trigger("clear:before",t),!t.cancel&&!this[C]&&(this._setSelectedItems([]),e&&this._setInputText(""),this._trigger("clear"),!0)}_movePrev(){const e=this._p;if(this.isMultiEnabled())return;let t=this.getSelectedItems(),s=e.dropList.getFilteredItemCount();if(s+(e.clearable?1:0)>1){let i=t.length>0?e.dropList.filteredItemIndexByItem(t[0])-1:s-1;-1!==i||e.clearable||(i=s-1);let l=-1===i?null:e.dropList.filteredItemAtIndex(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.dropList.getFilteredItemCount();if(s+(e.clearable?1:0)>1){let i=t.length>0?e.dropList.filteredItemIndexByItem(t[0])+1:0;i===s&&(i=e.clearable?-1:0);let l=-1===i?null:e.dropList.filteredItemAtIndex(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.itemsChanged||e.selectionChanged)&&(e.dropList._lastSerializedBox=null),e.itemsChanged){let s=e.items;(e.sortListItems||e.sortListCheckedFirst&&e.multi)&&(s=this._sortItems(s,e.sortListItems,e.sortListCheckedFirst&&e.multi,e.splitListCheckedGroups)),t.setItems(s),t.invokeRefilter(),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=this.getValue(),i=e.dropList.itemIndexByValue(t);e.dropList.setFocusedItemAtIndex(i).setSingleSelectedItemByValue(t),s=e.dropList.hasFocusedItem()}e.selectionChanged=!1}this._repositionDropList(),s&&e.dropList.setFocusedItemAtIndex(e.dropList.getFocusedItemIndex())}_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[C])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"syncPlaceholder":this._syncPlaceholder();break;case"removeMultiItemElement":if(t.showSelection)this._syncPlaceholder();else{const e=t.valueProp,i=s.data[e];let l=t.multiItemEls.findIndex(t=>t[g][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?.[g]?.[t.valueProp]===S&&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[g],e.singleWrapper)}catch(t){console.error(t)}delete e.singleWrapper[g],e.singleWrapper.innerHTML=""}}_removeMultiItemElementByIndex(e){const t=this._p,s=t.multiItemEls;if(s.length>e){const l=s[e],r=l[g];let n=r?.[t.valueProp]===S?t.unrenderRestMultiItem??t.unrenderMultiItem:t.unrenderMultiItem;if(n&&l.childNodes.length>0)try{n(r,l)}catch(i){console.error(i)}(0,a.remove)(l),e===s.length-1?s.pop():s.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(e,t){const s=this._p;let i=e[s.valueProp]===S?s.renderRestMultiItem??s.renderMultiItem:s.renderMultiItem;if(!i||!1===i(e,t)){const i=s.labelProp,l=e[s.multiItemLabelProp]||e[i];t.appendChild((0,o.createElement)("span",{textContent:l}))}}_addMultiItemElement(e){const t=this._p,s=this._renderMultiItem(e);return!!s&&((0,a.before)(t.inputWrapper,s),t.multiItemEls.push(s),!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]:S,[e.labelProp]:i})}_syncClearButton(){const e=this._p,t=e.multiItemLabelProp;e.selectedItems.length>0&&e.selectedItems.some(e=>!1!==e[t])&&e.clearable&&e.showSelection?e.clearButtonWrapper||(e.clearButtonWrapper=(0,o.createElement)(e.multi?"li":"span",{class:`${e.baseClassName}__clear`},e.clearButton=(0,o.createElement)("button")),e.multi?(0,a.append)(e.list,e.clearButtonWrapper):(0,a.append)(e.el,e.clearButtonWrapper),e.el.classList.add(`${e.baseClassName}__has_clear`),e.sink.add(e.clearButton,"click",()=>{this.isDisabled()||this.isReadOnly()||this.clear()})):e.clearButtonWrapper&&(e.sink.remove(e.clearButton,"click"),(0,a.remove)(e.clearButtonWrapper),delete e.clearButtonWrapper,delete e.clearButton,e.el.classList.remove(`${e.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):0===e.selectedItems.length?e.placeholder||"":((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[g]=t[0])}_syncFull(e,t){const s=this._p,i=s.multiItemLabelProp;if(this._renderBase(),this._syncClearButton(),this._syncPlaceholder(),(e=s.multi&&s.showSelection&&(e||s.selectedItems.filter(e=>!1!==e[i]).length!==s.multiItemEls.length))||!s.showSelection||!s.multi)for(;s.multiItemEls.length>0;)this._removeMultiItemElementByIndex(s.multiItemEls.length-1);if(s.multi){if(e){const e=s.selectedItems,t=s.treatGroupSelectionAsItems;if(s.sortSelectedItems){const t=s.labelProp,i=s.multiItemLabelProp,l=s.valueProp,r=s.stickyValues,n=s.sortItemComparator||((e,s)=>{if(null!==r){let t=r.has(e[l]),i=r.has(s[l]);if(t&&!i)return-1;if(!t&&i)return 1}const n=e[i]||e[t],o=s[i]||s[t];return n<o?-1:n>o?1:0});e.sort(n),s.selectedValues=e.map(e=>e[l])}let i=0,l=s.maxMultiItems,r=!1;for(let s=0;s<e.length;s++)if(t||!e[s]._group){if(null!=l&&i===l){r=!0;break}this._addMultiItemElement(e[s])&&i++}r&&this._addMultiItemRestElement()}}else s.multi||this._syncSingleItem();return(0,a.getRootNode)(s.el)!==document||((0,a.toggleClass)(s.el,`${s.baseClassName}__empty_selection`,0===s.selectedValues.length),(0,a.toggleClass)(s.el,`${s.baseClassName}__has_selection`,s.selectedValues.length>0),s.searchable?(s.input&&(s.input.readOnly=s.readOnly),s.el.classList.add(`${s.baseClassName}__searchable`)):(s.input&&(s.input.readOnly=!0),s.el.classList.remove(`${s.baseClassName}__searchable`)),this._resizeInput(),t&&this._updateListItems()),this}_trigger(e,t){const s=this._p;void 0!==s&&(s.on&&s.on(e,...void 0===t?[]:[t]),s.mitt.emit(e,t))}_renderMultiItem(e){const t=this._p,s=t.labelProp,i=e[t.multiItemLabelProp]??e[s];if(!1===i)return null;const l=(0,o.createElement)("span",{class:`${t.baseClassName}__item_remove`,role:"presentation"}),r=(0,o.createElement)("li",{class:`${t.baseClassName}__item`,tabindex:"0",title:i});return"before"===t.multiItemRemovePosition&&r.appendChild(l),this._renderMultiItemContent(e,r),"after"===t.multiItemRemovePosition&&r.appendChild(l),r[g]=e,r}_removeMultiItemFromEvent(e,t){const s=this._p;let i;if(/key/.test(t.type)){const l=t;l.key===h.VALUE_DELETE?i=(0,o.next)(e,`.${s.baseClassName}__item,.${s.baseClassName}__search_wrapper`):l.key===h.VALUE_BACK_SPACE&&(i=(0,o.prev)(e,`.${s.baseClassName}__item,.${s.baseClassName}__search_wrapper`))}else/click|mouse|touch/.test(t.type)&&(i=(0,o.next)(e,`.${s.baseClassName}__item,.${s.baseClassName}__search_wrapper`));const l=e[g],r=l[s.valueProp];if(void 0!==l)if(r===S){let e=(s.treatGroupSelectionAsItems?s.selectedItems:s.selectedItems.filter(e=>!e._group)).slice(s.maxMultiItems),t=[];for(let s of e){let e={value:r,item:s,cancel:!1};this._trigger("removesel:before",e),e.cancel||t.push(s)}if(t.length>0){this._removeMultiItemElementByIndex(s.multiItemEls.length-1);for(let e of t){let t=s.selectedItems.indexOf(e);-1===t&&(t=s.selectedValues.indexOf(r[s.valueProp])),-1!==t&&(s.selectedItems.splice(t,1),s.selectedValues.splice(t,1),s.selectionChanged=!0,s.resortBySelectionNeeded=!0)}}e.length>t.length&&this._addMultiItemRestElement(),t.length>0&&this._scheduleSync("render_list")}else{let e={value:r,item:l,cancel:!1};if(this._trigger("removesel:before",e),e.cancel)return this;this._removeMultiItem(l),this._trigger("removesel",{value:r,item:l})}return i||(i=s.el.querySelector(`.${s.baseClassName}__item, .${s.baseClassName}__search_field`)),k(i,`${s.baseClassName}__search_wrapper`)&&(i=i.querySelector("input")),i&&i.focus(),this}_removeMultiItem(e,t=!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[g]===e),-1===n&&(n=s.multiItemEls.findIndex(e=>e[g][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="",this._trigger("search:term",t.filterTerm),t.dropList?.setSearchTerm("",!0)}_resizeInput(){const e=this._p,t=e.el;if(!t.parentNode||!document.body.contains(t))return this;const s=e.input,i=e.inputBackBuffer;let l=s.value||s.placeholder;(0,a.toggleClass)(t,`${e.baseClassName}__has_input`,!!l),(0,a.toggleClass)(t,`${e.baseClassName}__empty_input`,!l);let r=!1;if(e.multi&&0===e.multiItemEls.length&&e.showSelection){s.style.width="";let i=0,l=0,n=getComputedStyle(e.list||t,"::before");n.content&&"none"!==n.content&&"absolute"!==n.position&&"none"!==n.float&&(i=(0,u.getPseudoElementWidth)(e.list||t,"::before",!0,!0,!0));let o=getComputedStyle(e.list||t,"::after");o.content&&"none"!==o.content&&"absolute"!==o.position&&"none"!==o.float&&(l=(0,u.getPseudoElementWidth)(e.list||t,"::after",!0,!0,!0));let a=(0,u.getElementWidth)(e.list||t);a-=i+l,s.style.width=`${a}px`,r=!0}else{(0,u.setCssProps)(i,(0,u.getCssProps)(s,x)),i.textContent=l,t.appendChild(i);const n=getComputedStyle(s),o=(parseFloat(n.paddingLeft)||0)+(parseFloat(n.paddingRight)||0),c=.75*(parseFloat(n["font-size"])||0)+o,d=(0,u.getElementWidth)(i,!0,!0),h=(0,u.getElementWidth)(s,!0,!0);let m=Math.max(d,c);if(m!==h){(0,u.setElementWidth)(s,m,!0,!0);let t=(parseFloat(n.borderLeftWidth)||0)+(parseFloat(n.borderRightWidth)||0),i=s.scrollWidth+t;if(i>m){let e=i-m;s.style.width=`${parseFloat(s.style.width)+e}px`,m+=e}if(e.singleWrapper&&(e.singleWrapper.style.width="",l)){let s=m-o-t;(0,u.getElementWidth)(e.singleWrapper,!1,!1)<s&&(0,u.setElementWidth)(e.singleWrapper,s,!1,!1)}r=!0}(0,a.remove)(i)}return r&&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(),e.dropList._lastSerializedBox=i),this}_handleInputKeydown(e){const t=this._p,s=e.target;if(e.key===h.VALUE_BACK_SPACE&&e.ctrlKey&&0===s.value.length)this.clear(),e.preventDefault();else if(e.key===h.VALUE_BACK_SPACE&&0===s.value.length){const s=t.multiItemEls[t.multiItemEls.length-1];if(!s)return;const i=s[g],l=i[t.valueProp];if(void 0===l)return;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(e){const t=this._p;if(t.disabled||t.readOnly)return;const s="rtl"===getComputedStyle(t.el).direction;let i;if(e.key===(s?h.VALUE_LEFT:h.VALUE_RIGHT))i=(0,o.next)(e.target,`.${t.baseClassName}__item,.${t.baseClassName}__search_wrapper`),k(i,`${t.baseClassName}__search_wrapper`)&&(i=i.querySelector("input")),i&&i.focus(),e.preventDefault();else if(e.key===(s?h.VALUE_RIGHT:h.VALUE_LEFT))i=(0,o.prev)(e.target,`.${t.baseClassName}__item,.${t.baseClassName}__search_wrapper`),k(i,`${t.baseClassName}__search_wrapper`)&&(i=i.querySelector("input")),i&&i.focus(),e.preventDefault();else if(e.key===h.VALUE_BACK_SPACE&&e.ctrlKey){const s=[];let i=e.target;for(;i;)s.push(i),i=(0,o.prev)(i,`.${t.baseClassName}__item`);for(;s.length;)this._removeMultiItemFromEvent(s.shift(),e);e.preventDefault()}else e.key!==h.VALUE_DELETE&&e.key!==h.VALUE_BACK_SPACE||(this._removeMultiItemFromEvent((0,o.closestUntil)(e.target,`.${t.baseClassName}__item`,t.el),e),e.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(()=>{(0,a.getRootNode)(e.el)!==document&&this.closeList()},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,h=[c],m=!1;const p=new Set(l.selectedValues);let _,g,f;for(g=0,f=e.length;g<f;g++)_=e[g],(_._group&&c.length||m&&!_._group&&!_._child)&&(m=!!_._group,c=[],h.push(c)),c.push(_);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 I=[],b=[];for(let E=0,C=h.length;E<C;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=p.has(e[o]),s=p.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){I.push(d);let e=b.indexOf(d);-1!==e&&b.splice(e,1);continue}e=null;for(let t=0,s=c.length;t<s;t++)if(_=c[t],!_._group){if(!p.has(_[l.valueProp]))break;e||(e=[],c[0]._group&&e.push(c[0])),e.push(_),c.splice(t--,1),s--}if(e&&(I.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)}}}const v=[];v.length=e.length;let y=0;h=I.length?I.concat(b):b;for(let E=0,C=h.length;E<C;E++)for(c=h[E],g=0,f=c.length;g<f;g++)v[y++]=c[g];return v}},exports.SelectBoxDefaultOptions=T;
|
|
8
6
|
//# sourceMappingURL=lib.cjs.min.js.map
|