@keenmate/web-multiselect 2.0.0-rc06 → 2.0.0-rc08
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/README.md +13 -7
- package/custom-elements.json +159 -9
- package/dist/index.d.ts +133 -3
- package/dist/multiselect.js +960 -822
- package/dist/multiselect.umd.js +14 -14
- package/dist/style.css +1 -1
- package/docs/examples.md +22 -1
- package/docs/usage.md +25 -1
- package/package.json +2 -2
- package/src/css/floating.css +61 -1
- package/src/css/options.css +4 -0
- package/src/css/variables.css +32 -3
- package/vscode.html-custom-data.json +6 -1
- package/web-types.json +20 -5
package/dist/multiselect.umd.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
(function(S,k){typeof exports=="object"&&typeof module<"u"?k(exports):typeof define=="function"&&define.amd?define(["exports"],k):(S=typeof globalThis<"u"?globalThis:S||self,k(S.MultiSelect={}))})(this,function(S){"use strict";var $r=Object.defineProperty;var Ys=S=>{throw TypeError(S)};var Vr=(S,k,z)=>k in S?$r(S,k,{enumerable:!0,configurable:!0,writable:!0,value:z}):S[k]=z;var m=(S,k,z)=>Vr(S,typeof k!="symbol"?k+"":k,z),Ut=(S,k,z)=>k.has(S)||Ys("Cannot "+z);var p=(S,k,z)=>(Ut(S,k,"read from private field"),z?z.call(S):k.get(S)),V=(S,k,z)=>k.has(S)?Ys("Cannot add the same private member more than once"):k instanceof WeakSet?k.add(S):k.set(S,z),R=(S,k,z,L)=>(Ut(S,k,"write to private field"),L?L.call(S,z):k.set(S,z),z),x=(S,k,z)=>(Ut(S,k,"access private method"),z);var me,Je,_e,Qe,ke,Ze,kt,Ce,pe,Se,Te,ze,De,$e,Ve,Ct,ae,Ne,I,Js,Qs,Zs,Z,eo,to,Gt,Xt,it,qt,so,J,D,fe,tt,st,ot,Re,He,Oe,_,St,Yt,Jt,oo,io,ro,Tt,Qt,no,ao,lo,Zt,co,ho,es,ts;function k(s,e={}){const t=new Set(s),o=e.shouldNullOnInvalid?null:e.default??null;return{values:s,fromAttribute(i){return i===null?e.default??o:t.has(i)?i:o},validate(i){return typeof i=="string"&&t.has(i)},toAttribute(i){return i==null?null:String(i)}}}function z(s={}){const e=o=>(s.min==null||o>=s.min)&&(s.max==null||o<=s.max),t=s.default;return{fromAttribute(o){if(o===null)return t;const i=Number.parseInt(o,10);return Number.isNaN(i)||!e(i)?t:i},validate(o){return typeof o=="number"&&Number.isInteger(o)&&e(o)},toAttribute(o){return o==null?null:String(o)}}}function L(s={}){const e=s.isNullable===!0,t=s.default??(e?null:""),o=i=>s.shouldTrim?i.trim():i;return{fromAttribute(i){if(i===null)return t;const r=o(i);return!s.isEmptyAllowed&&r===""?t:r},validate(i){return i===null?e:typeof i=="string"&&(s.isEmptyAllowed===!0||i!=="")},toAttribute(i){return i==null?null:String(i)}}}const uo=new Set(["","true","1","yes","on"]),mo=new Set(["false","0","no","off"]);function W(s="presence"){const e=t=>{const o=t.trim().toLowerCase();return uo.has(o)?!0:mo.has(o)?!1:null};return{fromAttribute(t){switch(s){case"presence":return t!==null;case"default-true":return t===null?!0:e(t)??!0;case"default-false":return t===null?!1:e(t)??!1;case"tristate":return t===null?null:e(t)}},validate(t){return s==="tristate"?t===!0||t===!1||t===null:typeof t=="boolean"},toAttribute(t){return s==="presence"?t?"":null:t==null?null:String(t)}}}function po(s={}){const e=s.default;return{fromAttribute(t){if(t===null||t.trim()==="")return e;let o;try{o=JSON.parse(t)}catch{return e}return s.validate&&!s.validate(o)?e:o},validate:s.validate,toAttribute(t){return t==null?null:JSON.stringify(t)}}}function fo(s={}){const e=s.default??[],t=o=>Array.isArray(o)&&(!s.validateItem||o.every(s.validateItem));return{fromAttribute(o){if(o===null||o.trim()==="")return e;let i;try{i=JSON.parse(o)}catch{return e}return t(i)?i:e},validate:t,toAttribute(o){return Array.isArray(o)?JSON.stringify(o):null}}}function go(){return{validate(s){return s==null||typeof s=="function"}}}function bo(s,e,t){const o=s.converter,i=o!=null&&o.fromAttribute?o.fromAttribute(e,t,s.attribute??s.configKey):e??s.default;return{configKey:s.configKey,field:s.field,value:i,on:s.on??"update"}}function vo(s,e){const t=s.converter;return t!=null&&t.validate&&!t.validate(e)?null:{configKey:s.configKey,field:s.field,value:e,on:s.on??"update"}}function yo(){const s=new Set;let e=!1;const t=()=>{e=!1;const o=[...s];s.clear();for(const i of o)i()};return{schedule(o){s.add(o),e||(e=!0,queueMicrotask(t))},flush(){if(s.size===0)return;e=!1;const o=[...s];s.clear();for(const i of o)i()},cancel(){s.clear(),e=!1}}}const ss={pointer:"fine",hasCoarsePointer:!1,canHover:!0,isTouchPrimary:!1,orientation:"landscape",viewportWidth:1024,viewportHeight:768,breakpoint:"desktop",os:"unknown",isApple:!1,isAndroid:!1};let Ot=wo({mobile:640,tablet:1024,desktop:1/0});const Be=new Set;let be=null,rt=[],nt=!1;function wo(s){return Object.entries(s).sort((e,t)=>e[1]-t[1])}function xo(s){for(const[t,o]of Ot)if(s<=o)return t;const e=Ot[Ot.length-1];return e?e[0]:"desktop"}function It(){return typeof window<"u"&&typeof window.matchMedia=="function"}function os(){return typeof navigator<"u"&&(navigator.maxTouchPoints??0)>1}function _o(){var o;if(typeof navigator>"u")return"unknown";const s=navigator.userAgentData,e=(o=s==null?void 0:s.platform)==null?void 0:o.toLowerCase();if(e){if(e.includes("android"))return"android";if(e.includes("ios"))return"ios";if(e.includes("mac"))return os()?"ios":"macos";if(e.includes("windows"))return"windows";if(e.includes("linux"))return"linux"}const t=navigator.userAgent??"";return/android/i.test(t)?"android":/iphone|ipod|ipad/i.test(t)?"ios":/macintosh|mac os x/i.test(t)?os()?"ios":"macos":/windows/i.test(t)?"windows":/linux/i.test(t)?"linux":"unknown"}let ko;function Co(){return ko??(ko=_o())}function Ke(s){return It()&&window.matchMedia(s).matches}function Pt(){if(!It())return{...ss};const s=Ke("(any-pointer: coarse)"),e=Ke("(pointer: coarse)"),t=Ke("(pointer: fine)"),o=Ke("(hover: hover)"),i=e?"coarse":t?"fine":"none",r=window.innerWidth,n=window.innerHeight,a=Co();return{pointer:i,hasCoarsePointer:s,canHover:o,isTouchPrimary:e&&!o,orientation:Ke("(orientation: portrait)")?"portrait":"landscape",viewportWidth:r,viewportHeight:n,breakpoint:xo(r),os:a,isApple:a==="ios"||a==="macos",isAndroid:a==="android"}}function So(s,e){return s.pointer===e.pointer&&s.hasCoarsePointer===e.hasCoarsePointer&&s.canHover===e.canHover&&s.isTouchPrimary===e.isTouchPrimary&&s.orientation===e.orientation&&s.viewportWidth===e.viewportWidth&&s.viewportHeight===e.viewportHeight&&s.breakpoint===e.breakpoint}function Mt(){const s=Pt();if(!(be&&So(be,s))){be=s;for(const e of[...Be])e(s)}}const at=()=>Mt(),is=()=>{if(typeof requestAnimationFrame=="function"){if(nt)return;nt=!0,requestAnimationFrame(()=>{nt=!1,Mt()})}else Mt()};function To(s){typeof s.addEventListener=="function"?s.addEventListener("change",at):typeof s.addListener=="function"&&s.addListener(at)}function Oo(s){typeof s.removeEventListener=="function"?s.removeEventListener("change",at):typeof s.removeListener=="function"&&s.removeListener(at)}function Io(){if(!It()){be={...ss};return}rt=[window.matchMedia("(pointer: coarse)"),window.matchMedia("(pointer: fine)"),window.matchMedia("(any-pointer: coarse)"),window.matchMedia("(hover: hover)"),window.matchMedia("(orientation: portrait)")];for(const s of rt)To(s);typeof window.addEventListener=="function"&&window.addEventListener("resize",is),be=Pt()}function Po(){for(const s of rt)Oo(s);rt=[],typeof window<"u"&&typeof window.removeEventListener=="function"&&window.removeEventListener("resize",is),nt=!1,be=null}function Lt(){return be??Pt()}function Mo(s,e={}){const t=Be.size===0;Be.add(s),t&&Io(),e.immediate!==!1&&s(Lt());let o=!0;return()=>{o&&(o=!1,Be.delete(s),Be.size===0&&Po())}}const Lo=600;function Eo(s){return s.isTouchPrimary?Math.min(s.viewportWidth,s.viewportHeight)<Lo?"mobile":"tablet":"desktop"}const lt=new Map;function Ao(s,e){let t=lt.get(s);t||lt.set(s,t=new Set),t.add(e)}function zo(s,e){var t;(t=lt.get(s))==null||t.delete(e)}function Do(s){return Array.from(lt.get(s)??[])}const rs=new Map;function $o(s,e){rs.set(s.toLowerCase(),e)}function Vo(s){return rs.get(s.toLowerCase())}function No(s,e,t,o={}){return s.dispatchEvent(new CustomEvent(e,{detail:t,bubbles:o.bubbles??!0,composed:o.composed??!0,cancelable:o.cancelable??!1}))}function Ro(s){return s.split(/[-_]/).filter(Boolean).map(e=>e[0].toUpperCase()+e.slice(1)).join("")}function Ho(s){return`on${Ro(s)}`}function Bo(s){return s?s.map(e=>{const t=typeof e=="string"?{name:e}:e,o=t.property===!1?null:t.property??Ho(t.name);return{name:t.name,property:o,bubbles:t.bubbles,composed:t.composed,cancelable:t.cancelable}}):[]}const Ko=typeof HTMLElement<"u"?HTMLElement:class{},ns=new WeakSet;let Fo=0;const Wo={trace(){},debug(){},info(){},warn(){},error(){}},jo=new Proxy({},{get:()=>Wo}),et=class et extends Ko{constructor(){super();V(this,I);V(this,me,{});V(this,Je,new Map);V(this,_e,new Map);V(this,Qe,new Map);V(this,ke,new Map);V(this,Ze,yo());V(this,kt,()=>x(this,I,qt).call(this));V(this,Ce,null);V(this,pe,!1);V(this,Se,[]);V(this,Te,!1);V(this,ze,null);V(this,De,!1);V(this,$e);V(this,Ve);V(this,Ct);V(this,ae);V(this,Ne);const t=this.constructor,o=t.inputs??[],i=Bo(t.events);x(this,I,Zs).call(this,o,i);for(const r of o)p(this,Je).set(r.configKey,r),r.attribute&&p(this,_e).set(r.attribute,r);for(const r of i)p(this,Qe).set(r.name,r);x(this,I,Js).call(this,o),x(this,I,eo).call(this,o),x(this,I,to).call(this,i)}static get observedAttributes(){const t=(this.inputs??[]).filter(o=>o.attribute).map(o=>o.attribute);return t.includes("dir")?t:[...t,"dir"]}attributeChangedCallback(t,o,i){var a;if(p(this,De))return;if(t==="dir"&&!p(this,_e).has("dir")){p(this,Te)&&this.directionChanged(this.isRTL);return}const r=p(this,_e).get(t);if(!r||!p(this,Te)&&((a=p(this,ze))!=null&&a.has(r.configKey)))return;let n;try{n=bo(r,i,this)}catch(l){x(this,I,Z).call(this,`converter for "${r.configKey}" threw parsing attribute ${t}="${i}"; using default`,l),n=x(this,I,Qs).call(this,r)}x(this,I,Xt).call(this,n)}connectedCallback(){Ao(this.localName,this),p(this,Te)||(R(this,Te,!0),R(this,ze,null),R(this,pe,!0)),x(this,I,it).call(this),this.connect(),this.environmentChanged!==et.prototype.environmentChanged&&R(this,$e,Mo(t=>this.environmentChanged(t)))}disconnectedCallback(){var t;zo(this.localName,this),(t=p(this,$e))==null||t.call(this),R(this,$e,void 0),this.disconnect()}setAttributes(t){for(const[o,i]of Object.entries(t)){const r=p(this,Je).get(o)??p(this,_e).get(o);r&&x(this,I,Gt).call(this,r,i)}x(this,I,it).call(this)}batch(t){t(),x(this,I,it).call(this)}flush(){x(this,I,it).call(this)}whenSettled(){return!p(this,Ce)&&!p(this,pe)?Promise.resolve():new Promise(t=>p(this,Se).push(t))}get config(){return p(this,me)}get log(){if(p(this,Ne))return p(this,Ne);const t=Vo(this.localName);if(!t)return jo;const o=p(this,Ct)??R(this,Ct,`${this.localName}#${this.id||++Fo}`);return R(this,Ne,t.forInstance(o,()=>p(this,ae)))}enableLogging(t="debug"){R(this,ae,t)}disableLogging(){R(this,ae,void 0)}get isLoggingEnabled(){return p(this,ae)!=null&&p(this,ae)!=="silent"&&p(this,ae)!==5}reinit(){}update(t){}connect(){}disconnect(){}environmentChanged(t){}get isRTL(){return typeof getComputedStyle=="function"&&getComputedStyle(this).direction==="rtl"}directionChanged(t){}get internals(){if(p(this,Ve))return p(this,Ve);if(typeof this.attachInternals!="function")return null;try{return R(this,Ve,this.attachInternals())}catch{return null}}get form(){var t;return((t=this.internals)==null?void 0:t.form)??null}emit(t,o,i){const r=p(this,Qe).get(t);return No(this,t,o,{bubbles:(i==null?void 0:i.bubbles)??(r==null?void 0:r.bubbles),composed:(i==null?void 0:i.composed)??(r==null?void 0:r.composed),cancelable:(i==null?void 0:i.cancelable)??(r==null?void 0:r.cancelable)})}on(t,o,i){const r=o;return this.addEventListener(t,r,i),()=>this.removeEventListener(t,r,i)}async runHook(t,o,i){const r=p(this,me)[t];if(typeof r!="function")return i.whenUnset;try{return await Promise.resolve(r(o))}catch(n){if(i.onError)return i.onError(n);throw n}}};me=new WeakMap,Je=new WeakMap,_e=new WeakMap,Qe=new WeakMap,ke=new WeakMap,Ze=new WeakMap,kt=new WeakMap,Ce=new WeakMap,pe=new WeakMap,Se=new WeakMap,Te=new WeakMap,ze=new WeakMap,De=new WeakMap,$e=new WeakMap,Ve=new WeakMap,Ct=new WeakMap,ae=new WeakMap,Ne=new WeakMap,I=new WeakSet,Js=function(t){var o;for(const i of t){let r=i.default;if((o=i.converter)!=null&&o.fromAttribute)try{r=i.converter.fromAttribute(null,this,i.attribute??i.configKey)}catch(n){x(this,I,Z).call(this,`converter for "${i.configKey}" threw computing its default; using \`default\``,n),r=i.default}p(this,me)[i.configKey]=r,i.field&&(this[i.field]=r)}},Qs=function(t){return{configKey:t.configKey,field:t.field,value:t.default,on:t.on??"update"}},Zs=function(t,o){var l;const i=this.constructor;if(ns.has(i))return;ns.add(i);const r=new Set,n=new Set;for(const c of t)r.has(c.configKey)&&x(this,I,Z).call(this,`invalid input table: duplicate configKey "${c.configKey}"`),r.add(c.configKey),c.attribute&&(n.has(c.attribute)&&x(this,I,Z).call(this,`invalid input table: duplicate attribute "${c.attribute}"`),n.add(c.attribute)),c.reflect&&!c.attribute&&x(this,I,Z).call(this,`invalid input table: "${c.configKey}" has reflect:true but no attribute to reflect to`),c.reflect&&!((l=c.converter)!=null&&l.toAttribute)&&x(this,I,Z).call(this,`invalid input table: "${c.configKey}" has reflect:true but its converter has no toAttribute`);const a=new Set;for(const c of o)a.has(c.name)&&x(this,I,Z).call(this,`invalid event table: duplicate event "${c.name}"`),a.add(c.name),/^[a-z][a-z0-9-]*$/.test(c.name)||x(this,I,Z).call(this,`invalid event table: event "${c.name}" should be lowercase kebab-case (e.g. "date-select")`),c.property&&r.has(c.property)&&x(this,I,Z).call(this,`invalid event table: event "${c.name}" property "${c.property}" collides with an input configKey`)},Z=function(t,...o){console.warn(`[BlissElement] <${this.localName??"unknown"}> ${t}`,...o)},eo=function(t){for(const o of t){const i=o.configKey,r=Object.prototype.hasOwnProperty.call(this,i),n=r?this[i]:void 0;r&&delete this[i],Object.defineProperty(this,i,{configurable:!0,enumerable:!0,get:()=>p(this,me)[i],set:a=>x(this,I,Gt).call(this,o,a)}),r&&((p(this,ze)??R(this,ze,new Set)).add(i),this[i]=n)}},to=function(t){for(const o of t){const i=o.property;if(!i)continue;const r=o.name,n=Object.prototype.hasOwnProperty.call(this,i),a=n?this[i]:void 0;n&&delete this[i],Object.defineProperty(this,i,{configurable:!0,enumerable:!0,get:()=>p(this,ke).get(r)??null,set:l=>{const c=p(this,ke).get(r);if(c&&this.removeEventListener(r,c),typeof l=="function"){const d=l;p(this,ke).set(r,d),this.addEventListener(r,d)}else p(this,ke).delete(r)}}),n&&(this[i]=a)}},Gt=function(t,o){var r;const i=vo(t,o);if(!i){x(this,I,Z).call(this,`rejected invalid value for property "${t.configKey}"; keeping previous value`,o);return}if(x(this,I,Xt).call(this,i),t.reflect&&t.attribute&&((r=t.converter)!=null&&r.toAttribute)){const n=t.converter.toAttribute(i.value);R(this,De,!0);try{n===null?this.removeAttribute(t.attribute):this.setAttribute(t.attribute,n)}finally{R(this,De,!1)}}},Xt=function(t){p(this,me)[t.configKey]=t.value,t.field&&(this[t.field]=t.value),t.on!=="none"&&(t.on==="reinit"&&R(this,pe,!0),(p(this,Ce)??R(this,Ce,{}))[t.configKey]=t.value,p(this,Ze).schedule(p(this,kt)))},it=function(){p(this,Ze).cancel(),x(this,I,qt).call(this)},qt=function(){if(!this.isConnected)return;const t=p(this,pe),o=p(this,Ce);R(this,pe,!1),R(this,Ce,null),t?this.reinit():o&&Object.keys(o).length>0&&this.update(o),x(this,I,so).call(this)},so=function(){if(p(this,Se).length===0)return;const t=p(this,Se);R(this,Se,[]);for(const o of t)o()},m(et,"inputs"),m(et,"events");let Et=et;function as(s,e,t){typeof customElements>"u"||customElements.get(s)||customElements.define(s,e,t)}function Uo(s){return{enableLogging:e=>s.enableLogging(e),disableLogging:()=>s.disableLogging(),setLogLevel:e=>s.setLogLevel(e),setCategoryLevel:(e,t)=>s.setCategoryLevel(e,t),getCategories:()=>[...s.LOGGING_CATEGORIES]}}function Go(s,e,t){const{config:o,logging:i,shouldAutoDefine:r=!0}=t;i&&$o(s,i);const n={version:()=>o.version,config:o,...i?{logging:Uo(i)}:{},register:()=>as(s,e),getInstances:()=>Do(s)};return typeof window<"u"&&((window.components??(window.components={}))[s]=n),r&&as(s,e),n}const ls=new Map,cs=new WeakMap;let ct;function Xo(s){if(typeof CSSStyleSheet>"u"||!("adoptedStyleSheets"in s))return!1;if(ct===void 0)try{new CSSStyleSheet().replaceSync(""),ct=!0}catch{ct=!1}return ct}function qo(s,...e){if(typeof document>"u")return;let t=cs.get(s);t||cs.set(s,t=new Set);const o=e.filter(r=>r&&!t.has(r));if(o.length===0)return;for(const r of o)t.add(r);if(Xo(s)){const r=o.map(n=>{let a=ls.get(n);return a||(a=new CSSStyleSheet,a.replaceSync(n),ls.set(n,a)),a});s.adoptedStyleSheets=[...s.adoptedStyleSheets,...r];return}const i=s.head??s;for(const r of o){const n=document.createElement("style");n.textContent=r,i.appendChild(n)}}function Yo(s,e={}){const t=e.position??"last",o=s.head??s;let i=null;const r=()=>typeof document>"u"?null:(i||(i=document.createElement("style"),e.className&&(i.className=e.className)),i.parentNode!==o&&(t==="first"&&o.firstChild?o.insertBefore(i,o.firstChild):o.appendChild(i)),i),n=()=>{i==null||i.remove()};return{set(a){if(!a){n();return}const l=r();l&&(l.textContent=a)},clear:n,destroy(){i==null||i.remove(),i=null}}}function ds(s){return s.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Jo(s,e){const t=new Set,o=new RegExp(`var\\(\\s*(${ds(e)}[a-z0-9-]+)`,"gi");let i;for(;i=o.exec(s);)i[1]&&t.add(i[1]);return t}function Qo(s,e){const t=new Set,o=new RegExp(`(${ds(e)}[a-z0-9-]+)\\s*:`,"gi");let i;for(;i=o.exec(s);)i[1]&&t.add(i[1]);return[...t]}function Zo(s,e,t={}){const o=t.minScore??3,i=t.limit??3,r=new Set(s.split("-").filter(Boolean));return[...e].map(n=>({k:n,score:n.split("-").filter(a=>r.has(a)).length})).filter(n=>n.score>=o).sort((n,a)=>a.score-n.score).slice(0,i).map(n=>n.k)}function ei(s,e){if(e.consumed.size===0)return[];const t=[];for(const o of Qo(s,e.prefix))e.consumed.has(o)||t.push({name:o,suggestions:Zo(o,e.consumed,{minScore:e.minScore})});return t}const ti={mobile:"fullscreen",tablet:"floating",desktop:"floating"};function si(s,e,t={}){if(s!=="auto")return s;const o=Eo(e);return t[o]??ti[o]}let Fe=0,dt=null;function oi(){if(typeof document>"u")return()=>{};Fe===0&&(dt=document.body.style.overflow,document.body.style.overflow="hidden"),Fe++;let s=!1;return()=>{s||(s=!0,Fe=Math.max(0,Fe-1),Fe===0&&dt!==null&&(document.body.style.overflow=dt,dt=null))}}function ii(s){const e=typeof window<"u"?window.visualViewport:null;if(!e)return()=>{};let t=!1;const o=()=>{t=!1,s.style.height=`${e.height}px`,s.style.top=`${e.offsetTop}px`},i=()=>{t||(t=!0,typeof requestAnimationFrame=="function"?requestAnimationFrame(o):o())};return e.addEventListener("resize",i),e.addEventListener("scroll",i),i(),()=>{e.removeEventListener("resize",i),e.removeEventListener("scroll",i),s.style.height="",s.style.top=""}}const G={TRACE:0,DEBUG:1,INFO:2,WARN:3,ERROR:4,SILENT:5},hs=["trace","debug","info","warn","error"],ht=()=>{};let ri="km-log";function us(s){const t=console[s];return typeof t=="function"?t.bind(console):ht}function ni(s){if(s==="debug"&&(s="log"),typeof console>"u")return ht;const e=console;return e[s]!==void 0?us(s):e.log!==void 0?us("log"):ht}const ai=s=>ni(s);function We(s){let e=s;const t=G;if(typeof e=="string"&&t[e.toUpperCase()]!==void 0&&(e=t[e.toUpperCase()]),typeof e=="number"&&e>=0&&e<=G.SILENT)return e;throw new TypeError(`setLevel() called with an invalid level: ${String(s)}`)}let ce;const ut={};class ms{constructor(e,t){m(this,"name");m(this,"levels",G);m(this,"methodFactory");m(this,"trace");m(this,"debug");m(this,"info");m(this,"warn");m(this,"error");m(this,"log");m(this,"inheritedLevel");m(this,"defaultLevel",null);m(this,"userLevel",null);this.name=e,this.methodFactory=t,this.inheritedLevel=We(ce?ce.getLevel():"WARN");const o=this.getPersistedLevel();o!=null&&(this.userLevel=We(o)),this.replaceLoggingMethods()}storageKey(){return typeof this.name=="string"?`${ri}:${this.name}`:void 0}persist(e){const t=this.storageKey();if(typeof window>"u"||!t)return;const o=(hs[e]??"silent").toUpperCase();try{window.localStorage[t]=o}catch{}}getPersistedLevel(){const e=this.storageKey();if(typeof window>"u"||!e)return;let t;try{t=window.localStorage[e]}catch{}if(!(t===void 0||G[t]===void 0))return t}clearPersisted(){const e=this.storageKey();if(!(typeof window>"u"||!e))try{window.localStorage.removeItem(e)}catch{}}replaceLoggingMethods(){const e=this.getLevel();hs.forEach((t,o)=>{this[t]=o<e?ht:this.methodFactory(t,e,this.name)}),this.log=this.debug}getLevel(){return this.userLevel!=null?this.userLevel:this.defaultLevel!=null?this.defaultLevel:this.inheritedLevel}setLevel(e,t){this.userLevel=We(e),t!==!1&&this.persist(this.userLevel),this.replaceLoggingMethods()}setDefaultLevel(e){this.defaultLevel=We(e),this.getPersistedLevel()||this.setLevel(e,!1)}resetLevel(){this.userLevel=null,this.clearPersisted(),this.replaceLoggingMethods()}enableAll(e){this.setLevel(G.TRACE,e)}disableAll(e){this.setLevel(G.SILENT,e)}rebuild(){if(ce&&ce!==this&&(this.inheritedLevel=We(ce.getLevel())),this.replaceLoggingMethods(),ce===this)for(const e in ut)ut[e].rebuild()}}ce=new ms(void 0,ai);function li(s){if(typeof s!="string"||s==="")throw new TypeError("You must supply a non-empty name when creating a logger.");let e=ut[s];return e||(e=ut[s]=new ms(s,ce.methodFactory)),e}const ci=["INIT","DATA","UI"],di="debug",ps=["#4c8bf5","#2ea043","#d29922","#a371f7","#db61a2","#e5534b","#3fb0ac","#8a6d3b"],fs=new WeakSet;function hi(s,e,t){if(fs.has(s))return;fs.add(s);const o=s.methodFactory,i=`color:${t};font-weight:bold`;s.methodFactory=(r,n,a)=>{const l=o(r,n,a);return(...c)=>l(`%c[${e}]`,i,...c)},s.setLevel(s.getLevel(),!1)}function ui(s){return typeof s=="number"?s:G[s.toUpperCase()]??G.SILENT}const mi=[["trace",G.TRACE,"debug"],["debug",G.DEBUG,"debug"],["info",G.INFO,"info"],["warn",G.WARN,"warn"],["error",G.ERROR,"error"]];function pi(s,e,t){const o=`color:${s.color};font-weight:bold`,i="color:#888",r={};for(const[n,a,l]of mi)r[n]=(...c)=>{const d=t(),h=Math.min(s.logger.getLevel(),d==null?G.SILENT:ui(d));if(a<h)return;(console[l]??console.log).bind(console)(`%c[${s.label}]%c ${e}`,o,i,...c)};return r}function fi(s,e=ci){const t={},o={};e.forEach((r,n)=>{const a=`${s}:${r}`,l=ps[n%ps.length],c=li(a);hi(c,a,l),t[r]=c,o[r]={label:a,color:l,logger:c}});const i=r=>{for(const n of e)t[n].setLevel(r,!1)};return{loggers:t,LOGGING_CATEGORIES:e,enableLogging(r=di){i(r)},disableLogging(){i("silent")},setLogLevel(r){i(r)},setCategoryLevel(r,n){var a;(a=t[r])==null||a.setLevel(n,!1)},forInstance(r,n){const a={};for(const l of e)a[l]=pi(o[l],r,n);return a}}}const de=Math.min,se=Math.max,mt=Math.round,pt=Math.floor,oe=s=>({x:s,y:s}),gi={left:"right",right:"left",bottom:"top",top:"bottom"};function gs(s,e,t){return se(s,de(e,t))}function Pe(s,e){return typeof s=="function"?s(e):s}function ve(s){return s.split("-")[0]}function Me(s){return s.split("-")[1]}function bs(s){return s==="x"?"y":"x"}function At(s){return s==="y"?"height":"width"}function ie(s){const e=s[0];return e==="t"||e==="b"?"y":"x"}function zt(s){return bs(ie(s))}function bi(s,e,t){t===void 0&&(t=!1);const o=Me(s),i=zt(s),r=At(i);let n=i==="x"?o===(t?"end":"start")?"right":"left":o==="start"?"bottom":"top";return e.reference[r]>e.floating[r]&&(n=ft(n)),[n,ft(n)]}function vi(s){const e=ft(s);return[Dt(s),e,Dt(e)]}function Dt(s){return s.includes("start")?s.replace("start","end"):s.replace("end","start")}const vs=["left","right"],ys=["right","left"],yi=["top","bottom"],wi=["bottom","top"];function xi(s,e,t){switch(s){case"top":case"bottom":return t?e?ys:vs:e?vs:ys;case"left":case"right":return e?yi:wi;default:return[]}}function _i(s,e,t,o){const i=Me(s);let r=xi(ve(s),t==="start",o);return i&&(r=r.map(n=>n+"-"+i),e&&(r=r.concat(r.map(Dt)))),r}function ft(s){const e=ve(s);return gi[e]+s.slice(e.length)}function ki(s){var e,t,o,i;return{top:(e=s.top)!=null?e:0,right:(t=s.right)!=null?t:0,bottom:(o=s.bottom)!=null?o:0,left:(i=s.left)!=null?i:0}}function ws(s){return typeof s!="number"?ki(s):{top:s,right:s,bottom:s,left:s}}function gt(s){const{x:e,y:t,width:o,height:i}=s;return{width:o,height:i,top:t,left:e,right:e+o,bottom:t+i,x:e,y:t}}function xs(s,e,t){let{reference:o,floating:i}=s;const r=ie(e),n=zt(e),a=At(n),l=ve(e),c=r==="y",d=o.x+o.width/2-i.width/2,h=o.y+o.height/2-i.height/2,f=o[a]/2-i[a]/2;let u;switch(l){case"top":u={x:d,y:o.y-i.height};break;case"bottom":u={x:d,y:o.y+o.height};break;case"right":u={x:o.x+o.width,y:h};break;case"left":u={x:o.x-i.width,y:h};break;default:u={x:o.x,y:o.y}}const g=Me(e);return g&&(u[n]+=f*(g==="end"?1:-1)*(t&&c?-1:1)),u}async function Ci(s,e){var t;e===void 0&&(e={});const{x:o,y:i,platform:r,rects:n,elements:a,strategy:l}=s,{boundary:c="clippingAncestors",rootBoundary:d="viewport",elementContext:h="floating",altBoundary:f=!1,padding:u=0}=Pe(e,s),g=ws(u),y=a[f?h==="floating"?"reference":"floating":h],v=gt(await r.getClippingRect({element:(t=await(r.isElement==null?void 0:r.isElement(y)))==null||t?y:y.contextElement||await(r.getDocumentElement==null?void 0:r.getDocumentElement(a.floating)),boundary:c,rootBoundary:d,strategy:l})),w=h==="floating"?{x:o,y:i,width:n.floating.width,height:n.floating.height}:n.reference,C=await(r.getOffsetParent==null?void 0:r.getOffsetParent(a.floating)),E=await(r.isElement==null?void 0:r.isElement(C))&&await(r.getScale==null?void 0:r.getScale(C))||{x:1,y:1},A=gt(r.convertOffsetParentRelativeRectToViewportRelativeRect?await r.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:w,offsetParent:C,strategy:l}):w);return{top:(v.top-A.top+g.top)/E.y,bottom:(A.bottom-v.bottom+g.bottom)/E.y,left:(v.left-A.left+g.left)/E.x,right:(A.right-v.right+g.right)/E.x}}const Si=50,Ti=async(s,e,t)=>{const{placement:o="bottom",strategy:i="absolute",middleware:r=[],platform:n}=t,a=n.detectOverflow?n:{...n,detectOverflow:Ci},l=await(n.isRTL==null?void 0:n.isRTL(e));let c=await n.getElementRects({reference:s,floating:e,strategy:i}),{x:d,y:h}=xs(c,o,l),f=o,u=0;const g={};for(let b=0;b<r.length;b++){const y=r[b];if(!y)continue;const{name:v,fn:w}=y,{x:C,y:E,data:A,reset:H}=await w({x:d,y:h,initialPlacement:o,placement:f,strategy:i,middlewareData:g,rects:c,platform:a,elements:{reference:s,floating:e}});d=C??d,h=E??h,g[v]={...g[v],...A},H&&u<Si&&(u++,typeof H=="object"&&(H.placement&&(f=H.placement),H.rects&&(c=H.rects===!0?await n.getElementRects({reference:s,floating:e,strategy:i}):H.rects),{x:d,y:h}=xs(c,f,l)),b=-1)}return{x:d,y:h,placement:f,strategy:i,middlewareData:g}},Oi=s=>({name:"arrow",options:s,async fn(e){const{x:t,y:o,placement:i,rects:r,platform:n,elements:a,middlewareData:l}=e,{element:c,padding:d=0}=Pe(s,e)||{};if(c==null)return{};const h=ws(d),f={x:t,y:o},u=zt(i),g=At(u),b=await n.getDimensions(c),y=u==="y",v=y?"top":"left",w=y?"bottom":"right",C=y?"clientHeight":"clientWidth",E=r.reference[g]+r.reference[u]-f[u]-r.floating[g],A=f[u]-r.reference[u],H=await(n.getOffsetParent==null?void 0:n.getOffsetParent(c));let K=H?H[C]:0;(!K||!await(n.isElement==null?void 0:n.isElement(H)))&&(K=a.floating[C]||r.floating[g]);const q=E/2-A/2,$=K/2-b[g]/2-1,T=de(h[v],$),P=de(h[w],$),M=K-b[g]-P,B=K/2-b[g]/2+q,O=gs(T,B,M),F=!l.arrow&&Me(i)!=null&&B!==O&&r.reference[g]/2-(B<T?T:P)-b[g]/2<0,le=F?B<T?B-T:B-M:0;return{[u]:f[u]+le,data:{[u]:O,centerOffset:B-O-le,...F&&{alignmentOffset:le}},reset:F}}}),Ii=function(s){return s===void 0&&(s={}),{name:"flip",options:s,async fn(e){var t,o;const{placement:i,middlewareData:r,rects:n,initialPlacement:a,platform:l,elements:c}=e,{mainAxis:d=!0,crossAxis:h=!0,fallbackPlacements:f,fallbackStrategy:u="bestFit",fallbackAxisSideDirection:g="none",flipAlignment:b=!0,...y}=Pe(s,e);if((t=r.arrow)!=null&&t.alignmentOffset)return{};const v=ve(i),w=ie(a),C=ve(a)===a,E=await(l.isRTL==null?void 0:l.isRTL(c.floating)),A=f||(C||!b?[ft(a)]:vi(a)),H=g!=="none";!f&&H&&A.push(..._i(a,b,g,E));const K=[a,...A],q=await l.detectOverflow(e,y),$=[];let T=((o=r.flip)==null?void 0:o.overflows)||[];if(d&&$.push(q[v]),h){const O=bi(i,n,E);$.push(q[O[0]],q[O[1]])}if(T=[...T,{placement:i,overflows:$}],!$.every(O=>O<=0)){var P,M;const O=(((P=r.flip)==null?void 0:P.index)||0)+1,F=K[O];if(F&&(!(h==="alignment"?w!==ie(F):!1)||T.every(Q=>ie(Q.placement)===w?Q.overflows[0]>0:!0)))return{data:{index:O,overflows:T},reset:{placement:F}};let le=(M=T.filter(Ie=>Ie.overflows[0]<=0).sort((Ie,Q)=>Ie.overflows[1]-Q.overflows[1])[0])==null?void 0:M.placement;if(!le)switch(u){case"bestFit":{var B;const Ie=(B=T.filter(Q=>{if(H){const ge=ie(Q.placement);return ge===w||ge==="y"}return!0}).map(Q=>[Q.placement,Q.overflows.filter(ge=>ge>0).reduce((ge,Dr)=>ge+Dr,0)]).sort((Q,ge)=>Q[1]-ge[1])[0])==null?void 0:B[0];Ie&&(le=Ie);break}case"initialPlacement":le=a;break}if(i!==le)return{reset:{placement:le}}}return{}}}},Pi=new Set(["left","top"]);async function Mi(s,e){const{placement:t,platform:o,elements:i}=s,r=await(o.isRTL==null?void 0:o.isRTL(i.floating)),n=ve(t),a=Me(t),l=ie(t)==="y",c=Pi.has(n)?-1:1,d=r&&l?-1:1,h=Pe(e,s);let{mainAxis:f,crossAxis:u,alignmentAxis:g}=typeof h=="number"?{mainAxis:h,crossAxis:0,alignmentAxis:null}:{mainAxis:h.mainAxis||0,crossAxis:h.crossAxis||0,alignmentAxis:h.alignmentAxis};return a&&typeof g=="number"&&(u=a==="end"?g*-1:g),l?{x:u*d,y:f*c}:{x:f*c,y:u*d}}const Li=function(s){return s===void 0&&(s=0),{name:"offset",options:s,async fn(e){var t,o;const{x:i,y:r,placement:n,middlewareData:a}=e,l=await Mi(e,s);return n===((t=a.offset)==null?void 0:t.placement)&&(o=a.arrow)!=null&&o.alignmentOffset?{}:{x:i+l.x,y:r+l.y,data:{...l,placement:n}}}}},Ei=function(s){return s===void 0&&(s={}),{name:"shift",options:s,async fn(e){const{x:t,y:o,placement:i,platform:r}=e,{mainAxis:n=!0,crossAxis:a=!1,limiter:l={fn:w=>{let{x:C,y:E}=w;return{x:C,y:E}}},...c}=Pe(s,e),d={x:t,y:o},h=await r.detectOverflow(e,c),f=ie(i),u=bs(f);let g=d[u],b=d[f];const y=(w,C)=>gs(C+h[w==="y"?"top":"left"],C,C-h[w==="y"?"bottom":"right"]);n&&(g=y(u,g)),a&&(b=y(f,b));const v=l.fn({...e,[u]:g,[f]:b});return{...v,data:{x:v.x-t,y:v.y-o,enabled:{[u]:n,[f]:a}}}}}},Ai=function(s){return s===void 0&&(s={}),{name:"size",options:s,async fn(e){const{placement:t,rects:o,platform:i,elements:r}=e,{apply:n=()=>{},...a}=Pe(s,e),l=await i.detectOverflow(e,a),c=ve(t),d=Me(t),h=ie(t)==="y",{width:f,height:u}=o.floating;let g,b;c==="top"||c==="bottom"?(g=c,b=d===(await(i.isRTL==null?void 0:i.isRTL(r.floating))?"start":"end")?"left":"right"):(b=c,g=d==="end"?"top":"bottom");const y=u-l.top-l.bottom,v=f-l.left-l.right,w=de(u-l[g],y),C=de(f-l[b],v),E=e.middlewareData.shift,A=!E;let H=w,K=C;E!=null&&E.enabled.x&&(K=v),E!=null&&E.enabled.y&&(H=y),A&&!d&&(h?K=f-2*se(l.left,l.right):H=u-2*se(l.top,l.bottom)),await n({...e,availableWidth:K,availableHeight:H});const q=await i.getDimensions(r.floating);return f!==q.width||u!==q.height?{reset:{rects:!0}}:{}}}};function bt(){return typeof window<"u"}function Le(s){return _s(s)?(s.nodeName||"").toLowerCase():"#document"}function X(s){var e;return(s==null||(e=s.ownerDocument)==null?void 0:e.defaultView)||window}function re(s){var e;return(e=(_s(s)?s.ownerDocument:s.document)||window.document)==null?void 0:e.documentElement}function _s(s){return bt()?s instanceof Node||s instanceof X(s).Node:!1}function ee(s){return bt()?s instanceof Element||s instanceof X(s).Element:!1}function he(s){return bt()?s instanceof HTMLElement||s instanceof X(s).HTMLElement:!1}function ks(s){return!bt()||typeof ShadowRoot>"u"?!1:s instanceof ShadowRoot||s instanceof X(s).ShadowRoot}function vt(s){const{overflow:e,overflowX:t,overflowY:o,display:i}=te(s);return/auto|scroll|overlay|hidden|clip/.test(e+o+t)&&i!=="inline"&&i!=="contents"}function zi(s){return/^(table|td|th)$/.test(Le(s))}function yt(s){try{if(s.matches(":popover-open"))return!0}catch{}try{return s.matches(":modal")}catch{return!1}}const Di=/transform|translate|scale|rotate|perspective|filter/,$i=/paint|layout|strict|content/,ye=s=>!!s&&s!=="none";let $t;function Vt(s){const e=ee(s)?te(s):s;return ye(e.transform)||ye(e.translate)||ye(e.scale)||ye(e.rotate)||ye(e.perspective)||!Nt()&&(ye(e.backdropFilter)||ye(e.filter))||Di.test(e.willChange||"")||$i.test(e.contain||"")}function Vi(s){let e=we(s);for(;he(e)&&!je(e);){if(Vt(e))return e;if(yt(e))return null;e=we(e)}return null}function Nt(){return $t==null&&($t=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),$t}function je(s){return/^(html|body|#document)$/.test(Le(s))}function te(s){return X(s).getComputedStyle(s)}function wt(s){return ee(s)?{scrollLeft:s.scrollLeft,scrollTop:s.scrollTop}:{scrollLeft:s.scrollX,scrollTop:s.scrollY}}function we(s){if(Le(s)==="html")return s;const e=s.assignedSlot||s.parentNode||ks(s)&&s.host||re(s);return ks(e)?e.host:e}function Cs(s){const e=we(s);return je(e)?(s.ownerDocument||s).body:he(e)&&vt(e)?e:Cs(e)}function Ue(s,e,t){var o;e===void 0&&(e=[]),t===void 0&&(t=!0);const i=Cs(s),r=i===((o=s.ownerDocument)==null?void 0:o.body),n=X(i);if(r){const a=Rt(n);return e.concat(n,n.visualViewport||[],vt(i)?i:[],a&&t?Ue(a):[])}else return e.concat(i,Ue(i,[],t))}function Rt(s){return s.parent&&Object.getPrototypeOf(s.parent)?s.frameElement:null}function Ss(s){const e=te(s);let t=parseFloat(e.width)||0,o=parseFloat(e.height)||0;const i=he(s),r=i?s.offsetWidth:t,n=i?s.offsetHeight:o,a=mt(t)!==r||mt(o)!==n;return a&&(t=r,o=n),{width:t,height:o,$:a}}function Ht(s){return ee(s)?s:s.contextElement}function Ee(s){const e=Ht(s);if(!he(e))return oe(1);const t=e.getBoundingClientRect(),{width:o,height:i,$:r}=Ss(e);let n=(r?mt(t.width):t.width)/o,a=(r?mt(t.height):t.height)/i;return(!n||!Number.isFinite(n))&&(n=1),(!a||!Number.isFinite(a))&&(a=1),{x:n,y:a}}const Ni=oe(0);function Ts(s){const e=X(s);return!Nt()||!e.visualViewport?Ni:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function Ri(s,e,t){return e===void 0&&(e=!1),!!t&&e&&t===X(s)}function xe(s,e,t,o){e===void 0&&(e=!1),t===void 0&&(t=!1);const i=s.getBoundingClientRect(),r=Ht(s);let n=oe(1);e&&(o?ee(o)&&(n=Ee(o)):n=Ee(s));const a=Ri(r,t,o)?Ts(r):oe(0);let l=(i.left+a.x)/n.x,c=(i.top+a.y)/n.y,d=i.width/n.x,h=i.height/n.y;if(r&&o){const f=X(r),u=ee(o)?X(o):o;let g=f,b=Rt(g);for(;b&&u!==g;){const y=Ee(b),v=b.getBoundingClientRect(),w=te(b),C=v.left+(b.clientLeft+parseFloat(w.paddingLeft))*y.x,E=v.top+(b.clientTop+parseFloat(w.paddingTop))*y.y;l*=y.x,c*=y.y,d*=y.x,h*=y.y,l+=C,c+=E,g=X(b),b=Rt(g)}}return gt({width:d,height:h,x:l,y:c})}function xt(s,e){const t=wt(s).scrollLeft;return e?e.left+t:xe(re(s)).left+t}function Os(s,e){const t=s.getBoundingClientRect(),o=t.left+e.scrollLeft-xt(s,t),i=t.top+e.scrollTop;return{x:o,y:i}}function Hi(s){let{elements:e,rect:t,offsetParent:o,strategy:i}=s;const r=i==="fixed",n=re(o),a=e?yt(e.floating):!1;if(o===n||a&&r)return t;let l={scrollLeft:0,scrollTop:0},c=oe(1);const d=oe(0),h=he(o);if((h||!r)&&((Le(o)!=="body"||vt(n))&&(l=wt(o)),h)){const u=xe(o);c=Ee(o),d.x=u.x+o.clientLeft,d.y=u.y+o.clientTop}const f=n&&!h&&!r?Os(n,l):oe(0);return{width:t.width*c.x,height:t.height*c.y,x:t.x*c.x-l.scrollLeft*c.x+d.x+f.x,y:t.y*c.y-l.scrollTop*c.y+d.y+f.y}}function Bi(s){return s.getClientRects?Array.from(s.getClientRects()):[]}function Ki(s){const e=wt(s),t=s.ownerDocument.body,o=se(s.scrollWidth,s.clientWidth,t.scrollWidth,t.clientWidth),i=se(s.scrollHeight,s.clientHeight,t.scrollHeight,t.clientHeight);let r=-e.scrollLeft+xt(s);const n=-e.scrollTop;return te(t).direction==="rtl"&&(r+=se(s.clientWidth,t.clientWidth)-o),{width:o,height:i,x:r,y:n}}const Fi=25;function Wi(s,e,t){t===void 0&&(t="viewport");const o=t==="layoutViewport",i=X(s),r=re(s),n=i.visualViewport;let a=r.clientWidth,l=r.clientHeight,c=0,d=0;if(n){const f=!Nt()||e==="fixed";o?f||(c=-n.offsetLeft,d=-n.offsetTop):(a=n.width,l=n.height,f&&(c=n.offsetLeft,d=n.offsetTop))}if(xt(r)<=0){const f=r.ownerDocument,u=f.body,g=getComputedStyle(u),b=f.compatMode==="CSS1Compat"&&parseFloat(g.marginLeft)+parseFloat(g.marginRight)||0,y=Math.abs(r.clientWidth-u.clientWidth-b),v=getComputedStyle(r).scrollbarGutter==="stable both-edges"?y/2:y;v<=Fi&&(a-=v)}return{width:a,height:l,x:c,y:d}}function ji(s,e){const t=xe(s,!0,e==="fixed"),o=t.top+s.clientTop,i=t.left+s.clientLeft,r=Ee(s),n=s.clientWidth*r.x,a=s.clientHeight*r.y,l=i*r.x,c=o*r.y;return{width:n,height:a,x:l,y:c}}function Is(s,e,t){let o;if(e==="viewport"||e==="layoutViewport")o=Wi(s,t,e);else if(e==="document")o=Ki(re(s));else if(ee(e))o=ji(e,t);else{const i=Ts(s);o={x:e.x-i.x,y:e.y-i.y,width:e.width,height:e.height}}return gt(o)}function Ui(s,e){const t=e.get(s);if(t)return t;let o=Ue(s,[],!1).filter(a=>ee(a)&&Le(a)!=="body"),i=null;const r=te(s).position==="fixed";let n=r?we(s):s;for(;ee(n)&&!je(n);){const a=te(n),l=Vt(n),c=i?i.position:r?"fixed":"";!l&&(c==="fixed"||c==="absolute"&&a.position==="static")?o=o.filter(h=>h!==n):i=a,n=we(n)}return e.set(s,o),o}function Gi(s){let{element:e,boundary:t,rootBoundary:o,strategy:i}=s;const n=[...t==="clippingAncestors"?yt(e)?[]:Ui(e,this._c):[].concat(t),o],a=Is(e,n[0],i);let l=a.top,c=a.right,d=a.bottom,h=a.left;for(let f=1;f<n.length;f++){const u=Is(e,n[f],i);l=se(u.top,l),c=de(u.right,c),d=de(u.bottom,d),h=se(u.left,h)}return{width:c-h,height:d-l,x:h,y:l}}function Xi(s){const{width:e,height:t}=Ss(s);return{width:e,height:t}}function qi(s,e,t){const o=he(e),i=re(e),r=t==="fixed",n=xe(s,!0,r,e);let a={scrollLeft:0,scrollTop:0};const l=oe(0);if((o||!r)&&((Le(e)!=="body"||vt(i))&&(a=wt(e)),o)){const f=xe(e,!0,r,e);l.x=f.x+e.clientLeft,l.y=f.y+e.clientTop}!o&&i&&(l.x=xt(i));const c=i&&!o&&!r?Os(i,a):oe(0),d=n.left+a.scrollLeft-l.x-c.x,h=n.top+a.scrollTop-l.y-c.y;return{x:d,y:h,width:n.width,height:n.height}}function Bt(s){return te(s).position==="static"}function Ps(s,e){if(!he(s)||te(s).position==="fixed")return null;if(e)return e(s);let t=s.offsetParent;return re(s)===t&&(t=t.ownerDocument.body),t}function Ms(s,e){const t=X(s);if(yt(s))return t;if(!he(s)){let i=we(s);for(;i&&!je(i);){if(ee(i)&&!Bt(i))return i;i=we(i)}return t}let o=Ps(s,e);for(;o&&zi(o)&&Bt(o);)o=Ps(o,e);return o&&je(o)&&Bt(o)&&!Vt(o)?t:o||Vi(s)||t}const Yi=async function(s){const e=this.getOffsetParent||Ms,t=this.getDimensions,o=await t(s.floating);return{reference:qi(s.reference,await e(s.floating),s.strategy),floating:{x:0,y:0,width:o.width,height:o.height}}};function Ji(s){return te(s).direction==="rtl"}const Ls={convertOffsetParentRelativeRectToViewportRelativeRect:Hi,getDocumentElement:re,getClippingRect:Gi,getOffsetParent:Ms,getElementRects:Yi,getClientRects:Bi,getDimensions:Xi,getScale:Ee,isElement:ee,isRTL:Ji};function Es(s,e){return s.x===e.x&&s.y===e.y&&s.width===e.width&&s.height===e.height}function Qi(s,e,t){let o=null,i;const r=re(s);function n(){var d;clearTimeout(i),(d=o)==null||d.disconnect(),o=null}function a(d,h){d===void 0&&(d=!1),h===void 0&&(h=1),n();const f=s.getBoundingClientRect(),{left:u,top:g,width:b,height:y}=f;if(d||e(),!b||!y)return;const v=pt(g),w=pt(r.clientWidth-(u+b)),C=pt(r.clientHeight-(g+y)),E=pt(u),H={rootMargin:-v+"px "+-w+"px "+-C+"px "+-E+"px",threshold:se(0,de(1,h))||1};let K=!0;function q($){const T=$[0].intersectionRatio;if(!Es(f,s.getBoundingClientRect()))return a();if(T!==h){if(!K)return a();T?a(!1,T):i=setTimeout(()=>{a(!1,1e-7)},1e3)}K=!1}try{o=new IntersectionObserver(q,{...H,root:r.ownerDocument})}catch{o=new IntersectionObserver(q,H)}o.observe(s)}const l=X(s),c=()=>a(t);return l.addEventListener("resize",c),a(!0),()=>{l.removeEventListener("resize",c),n()}}function Zi(s,e,t,o){o===void 0&&(o={});const{ancestorScroll:i=!0,ancestorResize:r=!0,elementResize:n=typeof ResizeObserver=="function",layoutShift:a=typeof IntersectionObserver=="function",animationFrame:l=!1}=o,c=Ht(s),d=i||r?[...c?Ue(c):[],...e?Ue(e):[]]:[];d.forEach(v=>{i&&v.addEventListener("scroll",t),r&&v.addEventListener("resize",t)});const h=c&&a?Qi(c,t,r):null;let f=-1,u=null;n&&(u=new ResizeObserver(v=>{let[w]=v;w&&w.target===c&&u&&e&&(u.unobserve(e),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var C;(C=u)==null||C.observe(e)})),t()}),c&&!l&&u.observe(c),e&&u.observe(e));let g,b=l?xe(s):null;l&&y();function y(){const v=xe(s);b&&!Es(b,v)&&t(),b=v,g=requestAnimationFrame(y)}return t(),()=>{var v;d.forEach(w=>{i&&w.removeEventListener("scroll",t),r&&w.removeEventListener("resize",t)}),h==null||h(),(v=u)==null||v.disconnect(),u=null,l&&cancelAnimationFrame(g)}}const er=Li,tr=Ei,sr=Ii,Kt=Ai,or=Oi,ir=(s,e,t)=>{const o=new Map,i=t??{},r={...Ls,...i.platform,_c:o};return Ti(s,e,{...i,platform:r})};function Ft(s){const e=s.parentNode??null;return e instanceof ShadowRoot?e.host:e}function rr(s){if(s.transform!=="none"||s.perspective!=="none"||s.filter!=="none")return!0;const e=s.backdropFilter;return!!(e&&e!=="none"||s.willChange&&/\b(transform|filter|perspective)\b/.test(s.willChange))}function As(s){let e=Ft(s);for(;e&&!(e===document.body||e===document.documentElement);){if(e instanceof Element&&rr(getComputedStyle(e)))return e;e=Ft(e)}return window}function nr(s,e,t){let o=s;for(;o&&!(o===document.body||o===document.documentElement);){if(o instanceof Element){const i=o.getBoundingClientRect();if(Math.abs(i.x-e)<2&&Math.abs(i.y-t)<2)return o}o=Ft(o)}return null}function ar(s){const e=getComputedStyle(s),t=[];e.transform!=="none"&&t.push(`transform: ${e.transform}`),e.perspective!=="none"&&t.push(`perspective: ${e.perspective}`),e.filter!=="none"&&t.push(`filter: ${e.filter}`);const o=e.backdropFilter;o&&o!=="none"&&t.push(`backdrop-filter: ${o}`),e.willChange&&/\b(transform|filter|perspective)\b/.test(e.willChange)&&t.push(`will-change: ${e.willChange}`),e.contain&&/\b(paint|layout|strict|content)\b/.test(e.contain)&&t.push(`contain: ${e.contain}`);const i=e.containerType;return i&&i!=="normal"&&t.push(`container-type: ${i}`),t.join("; ")}function lr(s){const e=s.id?`#${s.id}`:"",t=typeof s.className=="string"&&s.className?"."+s.className.split(/\s+/).filter(Boolean).slice(0,2).join("."):"";return`<${s.tagName.toLowerCase()}${e}${t}>`}function cr(s){const e=s.tolerance??1.5;let t=0,o=0;if(s.offsetParent instanceof Element){const l=s.offsetParent.getBoundingClientRect(),c=getComputedStyle(s.offsetParent);t=l.x+(parseFloat(c.borderLeftWidth)||0),o=l.y+(parseFloat(c.borderTopWidth)||0)}const i=s.panel.getBoundingClientRect(),r=i.x-(t+s.expectedX),n=i.y-(o+s.expectedY);if(Math.abs(r)<e&&Math.abs(n)<e)return null;const a=nr(s.reference,r,n);return{driftX:r,driftY:n,culprit:a,culpritDescription:a?lr(a):"an ancestor element (could not auto-identify)",culpritCss:a?ar(a):""}}function dr(s,e){var i;const t=(i=s.closest)==null?void 0:i.call(s,"[data-theme]"),o=t==null?void 0:t.getAttribute("data-theme");o!=null&&e.setAttribute("data-theme",o)}const hr={top:"bottom",right:"left",bottom:"top",left:"right"};function ur(s,e,t){if(!t)return;const o=e.split("-")[0],i=hr[o];s.style.left=t.x!=null?`${t.x}px`:"",s.style.top=t.y!=null?`${t.y}px`:"",s.style.right="",s.style.bottom="",s.style[i]=`-${s.offsetWidth/2}px`}function zs(s,e){const t=[er(s.offset??4)];if(s.matchWidth){const i=s.matchWidth;t.push(Kt({apply({rects:r,elements:n}){const a=`${r.reference.width}px`;i==="exact"?n.floating.style.width=a:n.floating.style.minWidth=a}}))}e&&t.push(sr({...s.lockPlacement===!0?{fallbackStrategy:"initialPlacement"}:{},...s.flipPadding!=null?{padding:s.flipPadding}:{}}));const o=s.shift??8;if(o!==!1&&t.push(tr({padding:o})),s.maxHeight){const i=typeof s.maxHeight=="object"?s.maxHeight.padding:void 0;t.push(Kt({padding:i,apply({availableHeight:r,elements:n}){n.floating.style.maxHeight=`${Math.max(0,r)}px`}}))}if(s.maxWidth){const i=typeof s.maxWidth=="object"?s.maxWidth.padding:void 0;t.push(Kt({padding:i,apply({availableWidth:r,elements:n}){n.floating.style.maxWidth=`${Math.max(0,r)}px`}}))}return s.arrow&&t.push(or({element:s.arrow.element,padding:s.arrow.padding})),t}function Ge(s,e,t={}){const o=t.strategy??"fixed";t.inheritThemeFrom&&dr(t.inheritThemeFrom,s),s.style.position=o,s.style.left="0",s.style.top="0";let i=t.placement??"bottom-start",r=t.flip??!0,n=zs(t,r);const a=t.lockPlacement==="freeze";let l=!1;const c=!!t.fixedContainingBlock&&!t.platform,d=t.platform??(c?{...Ls,getOffsetParent:()=>As(s)}:void 0),h=()=>{var u;(u=t.beforeCompute)==null||u.call(t),ir(e,s,{placement:i,strategy:o,middleware:n,...d?{platform:d}:{}}).then(({x:g,y:b,placement:y,middlewareData:v})=>{var w,C;if(s.style.left=`${g}px`,s.style.top=`${b}px`,t.arrow&&ur(t.arrow.element,y,v.arrow),a&&!l&&(l=!0,i=y,r=!1,n=zs(t,!1)),(w=t.onPlaced)==null||w.call(t,y),(C=t.onComputed)==null||C.call(t,{x:g,y:b,placement:y}),t.onDrift&&e instanceof Element){const E=c?As(s):window,A=cr({panel:s,reference:e,expectedX:g,expectedY:b,offsetParent:E});A&&t.onDrift(A)}})};let f;return t.autoUpdate??!0?f=Zi(e,s,h,t.autoUpdateOptions):h(),{update:h,destroy(){f==null||f(),f=void 0}}}function mr(s){return typeof s=="number"?{show:s,hide:s}:{show:(s==null?void 0:s.show)??0,hide:(s==null?void 0:s.hide)??0}}function pr(s){const e=s.container??document.body,t=s.placement??"top",o=s.visibleClass??"is-visible",i=mr(s.delay),r=document.createElement("div");r.setAttribute("role","tooltip"),s.cssClass&&(r.className=s.cssClass),typeof s.content=="string"?r.textContent=s.content:r.append(s.content);let n,a=!1,l,c,d;const h={getBoundingClientRect:()=>d??s.trigger.getBoundingClientRect(),contextElement:s.trigger},f=w=>{d=new DOMRect(w.clientX,w.clientY,0,0),n==null||n.update()},u=()=>{l&&clearTimeout(l),c&&clearTimeout(c),l=c=void 0},g=()=>{var C;if(u(),a)return;(C=s.onBeforeShow)==null||C.call(s),a=!0,e.append(r);const w=s.followCursor?h:s.trigger;n=Ge(r,w,{placement:t,strategy:s.strategy,offset:s.offset??8,inheritThemeFrom:s.inheritThemeFrom??s.trigger}),s.followCursor&&s.trigger.addEventListener("mousemove",f),r.classList.add(o)},b=()=>{u(),a&&(a=!1,r.classList.remove(o),s.followCursor&&s.trigger.removeEventListener("mousemove",f),n==null||n.destroy(),n=void 0,r.remove())},y=()=>{u(),i.show>0?l=setTimeout(g,i.show):g()},v=()=>{u(),i.hide>0?c=setTimeout(b,i.hide):b()};return s.trigger.addEventListener("mouseenter",y),s.trigger.addEventListener("mouseleave",v),s.trigger.addEventListener("focusin",y),s.trigger.addEventListener("focusout",v),{element:r,get isVisible(){return a},show:g,hide:b,destroy(){s.trigger.removeEventListener("mouseenter",y),s.trigger.removeEventListener("mouseleave",v),s.trigger.removeEventListener("focusin",y),s.trigger.removeEventListener("focusout",v),b()}}}function fr(s){const e=s.container??document.body;let t,o=!1;const i=s.inheritThemeFrom??(s.reference instanceof HTMLElement?s.reference:void 0);return{get isOpen(){return o},open(){o||(o=!0,e.append(s.panel),t=Ge(s.panel,s.reference,{placement:s.placement??"bottom-start",strategy:s.strategy,offset:s.offset,matchWidth:s.matchWidth,lockPlacement:s.lockPlacement,...s.flip!==void 0?{flip:s.flip}:{},...s.shift!==void 0?{shift:s.shift}:{},...s.autoUpdate!==void 0?{autoUpdate:s.autoUpdate}:{},...s.beforeCompute?{beforeCompute:s.beforeCompute}:{},...s.platform?{platform:s.platform}:{},...i?{inheritThemeFrom:i}:{},...s.onPlaced?{onPlaced:s.onPlaced}:{}}))},close(){o&&(o=!1,t==null||t.destroy(),t=void 0,s.panel.remove())},update(){t==null||t.update()},destroy(){this.close()}}}const Ds=["INIT","DATA","UI","INTERACTION"],ne=fi("MULTISELECT",Ds),Xe=ne.loggers.INIT,j=ne.loggers.DATA,Y=ne.loggers.UI,U=ne.loggers.INTERACTION,gr=Ds.map(s=>`MULTISELECT:${s}`);function br(){ne.enableLogging()}function vr(){ne.disableLogging()}function yr(s){ne.setLogLevel(s)}function wr(s,e){const t=s.includes(":")?s.split(":").pop():s;ne.setCategoryLevel(t,e)}class $s{constructor(e){m(this,"container");m(this,"wrapper");m(this,"viewport");m(this,"itemHeight");m(this,"items");m(this,"renderItem");m(this,"bufferSize");m(this,"onVisibleRangeChange");m(this,"onScroll");m(this,"scrollTop",0);m(this,"viewportHeight",0);m(this,"visibleStart",0);m(this,"visibleEnd",0);m(this,"scrollHandler");m(this,"resizeObserver");this.container=e.container,this.itemHeight=e.itemHeight,this.items=e.items,this.renderItem=e.renderItem,this.bufferSize=e.bufferSize??10,this.onVisibleRangeChange=e.onVisibleRangeChange,this.onScroll=e.onScroll,this.scrollHandler=this.handleScroll.bind(this),this.init()}init(){this.container.innerHTML="",this.wrapper=document.createElement("div"),this.wrapper.style.position="relative",this.wrapper.style.width="100%",this.wrapper.style.height=`${this.items.length*this.itemHeight}px`,this.wrapper.className="ms__virtual-scroll-wrapper",this.viewport=document.createElement("div"),this.viewport.style.position="absolute",this.viewport.style.top="0",this.viewport.style.left="0",this.viewport.style.right="0",this.viewport.style.width="100%",this.viewport.className="ms__virtual-scroll-viewport",this.wrapper.appendChild(this.viewport),this.container.appendChild(this.wrapper),this.container.addEventListener("scroll",this.scrollHandler),typeof ResizeObserver<"u"&&(this.resizeObserver=new ResizeObserver(()=>{this.updateViewportHeight(),this.render()}),this.resizeObserver.observe(this.container)),this.updateViewportHeight(),this.render()}updateViewportHeight(){const e=this.container.clientHeight;e>0&&(this.viewportHeight=e)}handleScroll(){this.scrollTop=this.container.scrollTop,this.onScroll&&this.onScroll(this.scrollTop),this.render()}calculateVisibleRange(){const e=Math.floor(this.scrollTop/this.itemHeight),t=Math.ceil((this.scrollTop+this.viewportHeight)/this.itemHeight),o=Math.max(0,e-this.bufferSize),i=Math.min(this.items.length,t+this.bufferSize);return{start:o,end:i}}render(){const{start:e,end:t}=this.calculateVisibleRange();if(e===this.visibleStart&&t===this.visibleEnd)return;this.visibleStart=e,this.visibleEnd=t;let o="";for(let i=e;i<t;i++){const r=this.items[i],n=this.renderItem(r,i),a=i*this.itemHeight;o+=`<div class="ms__virtual-item" style="position: absolute; top: ${a}px; left: 0; right: 0; height: ${this.itemHeight}px;" data-index="${i}">`,o+=n,o+="</div>"}this.viewport.innerHTML=o,this.onVisibleRangeChange&&this.onVisibleRangeChange(e,t)}setItems(e){const t=e!==this.items||e.length!==this.items.length;this.items=e,this.wrapper.style.height=`${e.length*this.itemHeight}px`,this.updateViewportHeight(),t&&(this.scrollTop=0,this.container.scrollTop=0),this.visibleStart=-1,this.visibleEnd=-1,this.render()}scrollToIndex(e){if(e<0||e>=this.items.length)return;const t=e*this.itemHeight,o=t+this.itemHeight,i=this.container.scrollTop,r=i+this.viewportHeight;t<i?this.container.scrollTop=t:o>r&&(this.container.scrollTop=o-this.viewportHeight)}getVisibleRange(){return{start:this.visibleStart,end:this.visibleEnd}}getItemCount(){return this.items.length}setItemHeight(e){this.itemHeight=e,this.wrapper.style.height=`${this.items.length*e}px`,this.visibleStart=-1,this.visibleEnd=-1,this.render()}setBufferSize(e){this.bufferSize=e,this.visibleStart=-1,this.visibleEnd=-1,this.render()}refresh(){this.visibleStart=-1,this.visibleEnd=-1,this.render()}destroy(){this.container.removeEventListener("scroll",this.scrollHandler),this.resizeObserver&&this.resizeObserver.disconnect(),this.container.innerHTML=""}}function Vs(s){return{treeId:"",id:-1,path:"",pathSegment:"",parentPath:void 0,level:void 0,children:{},hasChildren:!1,isSelectable:!0,data:void 0,...s}}const qe=s=>!s||typeof s=="string"&&s.trim()==="";function xr(s,e="."){if(!s||typeof s!="string")return null;const t=s.lastIndexOf(e);return t===-1?"":s.substring(0,t)}function Ns(s,e,t="."){return qe(e)?s:s.startsWith(e+t)?s.substring(e.length+t.length):s}function Rs(s,e=0,t=1,o="."){return s.split(o).slice(e,e+t).join(o)}function _r(s,e){return s.split(e).length}function ue(s,e){return s[e]}function kr(s={}){const e=s.idMember,t=s.pathMember,o=s.getPathCallback,i=s.parentPathMember,r=s.levelMember,n=s.hasChildrenMember,a=s.isSelectableMember,l=s.getIsSelectableCallback,c=s.treeId||"multiselect-tree",d=s.orderMember,h=s.getDisplayValueCallback,f=qe(i),u=qe(r),g=qe(n),b=qe(a),y="x",v=s.treePathSeparator||".",w=Vs();let C=0,E=null;const A=$=>o?o($):t?ue($,t):void 0,H={treePathSeparator:v,root:w,get tree(){return Object.values(w.children)},get flatNodes(){if(E)return E;const $=[],T=s.isSorted??!1,P=s.sortCallback;function M(B){let O=Object.values(B.children);T&&P&&O.length>0&&(O=P(O));for(const F of O)$.push(F),F.hasChildren&&M(F)}return M(w),E=$,$},insertArray($){$=$||[],w.children={},C=0,E=null;const T=[];let P=$.map((M,B)=>{const O=Vs();O.treeId=c,O.id=e?ue(M,e):void 0;const F=A(M);return F==null||F===""||typeof F!="string"?(T.push(`index ${B}`),null):(O.path=F,(O.id===void 0||O.id===-1)&&(O.id=F),f?O.parentPath=xr(O.path,v):O.parentPath=ue(M,i),O.pathSegment=Rs(Ns(O.path,O.parentPath??"",v),0,1,v),u?O.level=_r(O.path,v):O.level=ue(M,r),g||(O.hasChildren=ue(M,n)),O.data=M,O)}).filter(M=>M!==null);s.isSorted||(s.sortCallback?P=s.sortCallback(P):P=q(P));for(const M of P)K(M.parentPath??"",M);if(l||!b)for(const M of P)if(l)M.isSelectable=l(M)!==!1;else{const B=ue(M.data,a);M.isSelectable=B==null?!0:!!B}T.length>0&&console.warn(`[ltree ${c}] ${T.length} option(s) had an invalid path and were skipped (pathMember="${t}"). Offending: ${T.slice(0,5).join(", ")}`+(T.length>5?", …":""))},getNodeByPath($,T){let P=T||w;if($){const M=$.split(v);for(let B=0;B<M.length;B++){const O=y+M[B];if(!P.children.hasOwnProperty(O))return null;P=P.children[O]}}return P}};function K($,T){const P=H.getNodeByPath($);if(!P)return`Node: ${T.path} - Could not find parent node: ${$}`;u&&(T.level=(P.level||0)+1);const M=y+Rs(Ns(T.path,$,v),0,1,v);return P.children.hasOwnProperty(M)||(P.children[M]=T,g&&!P.hasChildren&&(P.hasChildren=!0),C=Math.max(C,T.level||0)),null}function q($){return $.sort((T,P)=>{const M=T.level||0,B=P.level||0;if(M!==B)return M-B;if(T.parentPath!==P.parentPath)return T.parentPath?P.parentPath?T.parentPath.localeCompare(P.parentPath):1:-1;if(d&&T.data&&P.data){const O=ue(T.data,d)??0,F=ue(P.data,d)??0;if(O!==F)return O-F}return h?h(T).localeCompare(h(P)):T.path.localeCompare(P.path)})}return H}function Hs(s,e){const t=new Map,o=new Map,i=new Set,r=l=>String(e(l.data)),n=l=>{t.set(r(l),l);const c=[];for(const h of Object.values(l.children))c.push(...n(h));let d;return c.length>0?d=c:l.isSelectable!==!1?(d=[r(l)],i.add(l.path)):d=[],o.set(l.path,d),d},a=s.tree;for(const l of a)n(l);return{nodeByValue:t,atomsUnder:o,atomPaths:i,roots:a}}function Wt(s,e,t){const o=s.atomsUnder.get(e.path);if(!o||o.length===0)return"unchecked";let i=0;for(const r of o)t.has(r)&&i++;return i===0?"unchecked":i===o.length?"checked":"indeterminate"}function Ye(s,e){const t=new Set;for(const o of e){const i=s.nodeByValue.get(String(o));if(i)for(const r of s.atomsUnder.get(i.path)??[])t.add(r)}return t}function Cr(s,e,t){const o=s.atomsUnder.get(e.path)??[],i=new Set(t),r=Wt(s,e,t),n=[],a=[];if(r==="checked")for(const l of o)i.delete(l)&&a.push(l);else for(const l of o)i.has(l)||(i.add(l),n.push(l));return{checkedAtoms:i,addedAtoms:n,removedAtoms:a}}function jt(s,e,t,o){const i=a=>String(o(a.data)),r=[],n=a=>{const l=Wt(s,a,e);if(l==="unchecked")return;const c=a.isSelectable!==!1,d=Object.values(a.children);if(t==="leaves"){s.atomPaths.has(a.path)&&l==="checked"&&r.push(i(a));for(const h of d)n(h);return}if(t==="all"){l==="checked"&&c&&r.push(i(a));for(const h of d)n(h);return}if(l==="checked"&&c){r.push(i(a));return}for(const h of d)n(h)};for(const a of s.roots)n(a);return r}class Bs{constructor(e,t={}){m(this,"element");m(this,"instanceId");m(this,"options");m(this,"isOpen",!1);m(this,"selectedValues",new Set);m(this,"selectedOptions",new Map);m(this,"allOptions",[]);m(this,"filteredOptions",[]);m(this,"tree",null);m(this,"treeNodes",[]);m(this,"cascadeIndex",null);m(this,"cascadeCheckedAtoms",new Set);m(this,"hiddenInputs",[]);m(this,"focusedIndex",-1);m(this,"matchingIndices",new Set);m(this,"searchTerm","");m(this,"isLoading",!1);m(this,"searchDebounceTimer");m(this,"searchAbortController");m(this,"showSelectedPopover",!1);m(this,"selectedPopoverPlacement",null);m(this,"dropdownPlacement",null);m(this,"isRTL",!1);m(this,"effectiveBadgesPosition","bottom");m(this,"justClosedViaClick",!1);m(this,"justOpenedViaClick",!1);m(this,"positioningDriftWarned",!1);m(this,"presentationMode","floating");m(this,"fullscreenHeader",null);m(this,"fullscreenSearchInput",null);m(this,"fullscreenSearchClear",null);m(this,"fullscreenNav",null);m(this,"fullscreenNavCount",null);m(this,"fullscreenNavPrev",null);m(this,"fullscreenNavNext",null);m(this,"bodyScrollUnlock",null);m(this,"overflowXClamp",null);m(this,"keyboardInsetCleanup",null);m(this,"overlayHistoryActive",!1);m(this,"onOverlayPopstate",()=>this.handleOverlayPopstate());m(this,"dropdownCleanup",null);m(this,"hintCleanup",null);m(this,"selectedPopoverCleanup",null);m(this,"tooltips",new Map);m(this,"labelRevealTrigger",null);m(this,"labelRevealPanel",null);m(this,"labelRevealPopover",null);m(this,"messageEl",null);m(this,"messageCleanup",null);m(this,"messageTimer",null);m(this,"onDropdownScroll",()=>{this.hideOptionTooltips(),this.hideLabelReveal()});m(this,"virtualScroll",null);m(this,"optionsContainer",null);m(this,"selectedPopoverVirtualScroll",null);m(this,"selectedPopoverContainer",null);m(this,"input");m(this,"dropdown");m(this,"dropdownInner");m(this,"badgesContainer");m(this,"counter");m(this,"hint");m(this,"selectedPopover");m(this,"documentKeydownHandler",null);m(this,"documentClickHandler",null);this.element=e,this.instanceId=`MS-${Math.random().toString(36).slice(2,11)}`,this.options={searchHint:e.dataset.searchHint||"",searchPlaceholder:e.dataset.searchPlaceholder||"Search...",selectPlaceholder:e.dataset.selectPlaceholder||"Pick an option...",noDataPlaceholder:e.dataset.noDataPlaceholder||void 0,dropdownMinWidth:e.dataset.dropdownMinWidth||void 0,dropdownMaxWidth:e.dataset.dropdownMaxWidth||void 0,badgesDisplayMode:e.dataset.badgesDisplayMode||"badges",badgesPosition:e.dataset.badgesPosition||"bottom",badgesThresholdMode:e.dataset.badgesThresholdMode||"count",maxHeight:e.dataset.maxHeight||"20rem",emptyMessage:e.dataset.emptyMessage||"No results found",loadingMessage:e.dataset.loadingMessage||"Loading...",searchInputMode:e.dataset.searchInputMode||"normal",searchMode:e.dataset.searchMode||"filter",badgesThreshold:e.dataset.badgesThreshold?parseInt(e.dataset.badgesThreshold):void 0,minSearchLength:parseInt(e.dataset.minSearchLength||"0")||0,searchDebounce:parseInt(e.dataset.searchDebounce||"0")||0,isMultipleEnabled:e.dataset.multiple!=="false",isGroupsAllowed:e.dataset.allowGroups!=="false",isCheckboxesShown:e.dataset.showCheckboxes!=="false",isActionsSticky:e.dataset.stickyActions!=="false",isCloseOnSelect:e.dataset.closeOnSelect==="true",isPlacementLocked:e.dataset.lockPlacement!=="false",isSearchEnabled:e.dataset.enableSearch!=="false",isAddNewAllowed:e.dataset.allowAddNew==="true",isCounterShown:e.dataset.showCounter==="true",isKeepOptionsOnSearch:e.dataset.keepOptionsOnSearch!=="false",shouldKeepSearchOnClose:e.dataset.keepSearchOnClose!=="false",options:[],container:void 0,...t},this.init()}extractField(e,t){if(Array.isArray(e)&&e.length===2){if(t.tupleSkip)return typeof t.fallback=="function"?t.fallback():t.fallback;if(t.tupleIndex!==void 0){const i=e[t.tupleIndex];return t.transform?t.transform(i):i}}if(t.member&&e[t.member]!==void 0){const i=e[t.member];return t.transform?t.transform(i):i}return t.callback?t.callback(e):typeof t.fallback=="function"?t.fallback():t.fallback}getItemValue(e){return this.extractField(e,{tupleIndex:0,member:this.options.valueMember,callback:this.options.getValueCallback,fallback:"[N/A]"})}getItemDisplayValue(e){return this.extractField(e,{tupleIndex:1,member:this.options.displayValueMember,callback:this.options.getDisplayValueCallback,transform:String,fallback:"[N/A]"})}getItemBadgeDisplayValue(e){if(this.options.getBadgeDisplayCallback)return this.options.getBadgeDisplayCallback(e);if(this.options.isBadgeFullTitleShown){const t=this.getItemFullTitle(e);if(t)return t}return this.getItemDisplayValue(e)}getItemFullTitle(e){return this.extractField(e,{tupleSkip:!0,member:this.options.fullTitleMember,callback:this.options.getFullTitleCallback,transform:String,fallback:void 0})}getItemSearchValue(e){return this.extractField(e,{member:this.options.searchValueMember,callback:this.options.getSearchValueCallback,transform:String,fallback:()=>this.getItemDisplayValue(e)})}getItemIcon(e){return this.extractField(e,{tupleSkip:!0,member:this.options.iconMember,callback:this.options.getIconCallback,transform:String,fallback:void 0})}getItemSubtitle(e){return this.extractField(e,{tupleSkip:!0,member:this.options.subtitleMember,callback:this.options.getSubtitleCallback,transform:String,fallback:void 0})}getItemGroup(e){return this.extractField(e,{tupleSkip:!0,member:this.options.groupMember,callback:this.options.getGroupCallback,transform:String,fallback:void 0})}getItemDisabled(e){return this.extractField(e,{tupleSkip:!0,member:this.options.disabledMember,callback:this.options.getDisabledCallback,transform:Boolean,fallback:!1})}isIndexSelectable(e){if(!this.isTreeMode())return!0;const t=this.treeNodes[e];return t?t.isSelectable!==!1:!0}isOptionSelectable(e){if(!this.isTreeMode())return!0;const t=this.filteredOptions.indexOf(e);if(t>=0)return this.isIndexSelectable(t);const o=String(this.getItemValue(e)),i=this.treeNodes.find(r=>String(this.getItemValue(r.data))===o);return i?i.isSelectable!==!1:!0}init(){this.parseOptions(),this.buildHTML(),this.attachEvents(),this.parseInitialSelection(),Xe.debug(`Initialized [${this.instanceId}] with options:`,{placeholder:this.options.searchPlaceholder,totalOptions:this.allOptions.length,isCloseOnSelect:this.options.isCloseOnSelect,dataAttribute:this.element.dataset.closeOnSelect})}parseOptions(){const e=this.element.dataset.options;if(e)try{this.allOptions=JSON.parse(e)}catch(t){j.error(`[${this.instanceId}] Failed to parse data-options:`,t),this.allOptions=[]}else this.options.options&&(this.allOptions=this.options.options);this.filteredOptions=[...this.allOptions],this.isTreeMode()&&this.buildTree()}isTreeMode(){return this.options.isTreeEnabled===!1?!1:!!(this.options.isTreeEnabled||this.options.pathMember||this.options.getPathCallback)}buildTree(){this.tree=kr({idMember:this.options.valueMember,pathMember:this.options.pathMember,getPathCallback:this.options.getPathCallback,parentPathMember:this.options.parentPathMember,levelMember:this.options.levelMember,hasChildrenMember:this.options.hasChildrenMember,isSelectableMember:this.options.isSelectableMember,getIsSelectableCallback:this.options.getIsSelectableCallback,treePathSeparator:this.options.treePathSeparator,treeId:this.instanceId,getDisplayValueCallback:e=>this.getItemDisplayValue(e.data)}),this.tree.insertArray(this.allOptions),this.cascadeIndex=this.isCascadeMode()?Hs(this.tree,e=>String(this.getItemValue(e))):null,this.rebuildTreeVisible()}isCascadeMode(){return this.isTreeMode()&&this.options.isMultipleEnabled!==!1&&this.options.checkboxMode==="cascade"}cascadePolicy(){return this.options.cascadeSelectPolicy??"rolled-up"}refreshCascadeAtoms(){this.isCascadeMode()&&this.cascadeIndex&&(this.cascadeCheckedAtoms=Ye(this.cascadeIndex,this.selectedValues))}toggleTreeCascade(e){const t=this.cascadeIndex,o=Ye(t,this.selectedValues),{checkedAtoms:i}=Cr(t,e,o);this.commitCascadeAtoms(i)}commitCascadeAtoms(e){var l;const t=this.cascadeIndex,o=jt(t,e,this.cascadePolicy(),c=>String(this.getItemValue(c))),i=new Set(o),r=[],n=[];for(const[c,d]of this.selectedOptions)i.has(c)||n.push(d);const a=new Map;for(const c of o){const h=((l=t.nodeByValue.get(c))==null?void 0:l.data)??this.selectedOptions.get(c);h!==void 0&&(a.set(c,h),this.selectedValues.has(c)||r.push(h))}this.selectedValues=i,this.selectedOptions=a,this.cascadeCheckedAtoms=e,this.commit({added:r,removed:n})}counterSelection(){if(this.isCascadeMode()&&this.cascadeIndex){const e=jt(this.cascadeIndex,this.cascadeCheckedAtoms,"rolled-up",o=>String(this.getItemValue(o))),t=[];for(const o of e){const i=this.cascadeIndex.nodeByValue.get(o),r=(i==null?void 0:i.data)??this.selectedOptions.get(o);r!==void 0&&t.push(r)}return t}return Array.from(this.selectedOptions.values())}buildCounterTooltip(e){const o=e.slice(0,12).map(i=>this.getItemBadgeDisplayValue(i));return e.length>12&&o.push(`…and ${e.length-12} more`),o.join(`
|
|
2
|
-
`)}rebuildTreeVisible(){if(!this.tree){this.treeNodes=[];return}const e=this.tree.flatNodes,t=this.options.isSearchEnabled?(this.searchTerm||"").trim().toLowerCase():"";let o;if(!t)o=e;else{const i=this.tree.treePathSeparator,r=new Set;for(const n of e)if(this.getItemSearchValue(n.data).toLowerCase().includes(t)){const l=n.path.split(i);for(let c=1;c<=l.length;c++)r.add(l.slice(0,c).join(i))}o=e.filter(n=>r.has(n.path))}this.treeNodes=o,this.filteredOptions=o.map(i=>i.data)}resetVisibleToAll(){this.isTreeMode()?this.rebuildTreeVisible():this.filteredOptions=[...this.allOptions]}rebuildTreeVisibleFromMatches(e){if(!this.tree){this.treeNodes=[],this.filteredOptions=[];return}const t=this.tree.flatNodes,o=this.tree.treePathSeparator,i=new Set((e||[]).map(a=>String(this.getItemValue(a)))),r=new Set;for(const a of t)if(i.has(String(this.getItemValue(a.data)))){const l=a.path.split(o);for(let c=1;c<=l.length;c++)r.add(l.slice(0,c).join(o))}const n=t.filter(a=>r.has(a.path));this.treeNodes=n,this.filteredOptions=n.map(a=>a.data)}rebuildTreeVisibleForNavigate(){if(this.matchingIndices.clear(),!this.tree)return this.treeNodes=[],this.filteredOptions=[],-1;const e=this.tree.flatNodes;this.treeNodes=e,this.filteredOptions=e.map(i=>i.data);const t=(this.searchTerm||"").trim().toLowerCase();if(!t)return-1;let o=-1;return e.forEach((i,r)=>{this.getItemSearchValue(i.data).toLowerCase().includes(t)&&(this.matchingIndices.add(r),o===-1&&(o=r))}),o}detectRTL(){const e=this.element.getRootNode(),t=e instanceof ShadowRoot?e.host:this.element,o=t.getAttribute("dir")==="rtl",i=t.closest('[dir="rtl"]')!==null;this.isRTL=o||i,Xe.debug(`[${this.instanceId}] RTL Debug:`,{isShadowRoot:e instanceof ShadowRoot,elementDir:t.getAttribute("dir"),hasElementDir:o,hasAncestorDir:i,isRTL:this.isRTL}),this.effectiveBadgesPosition=this.options.badgesPosition||"bottom",this.isRTL&&(this.effectiveBadgesPosition==="left"?this.effectiveBadgesPosition="right":this.effectiveBadgesPosition==="right"&&(this.effectiveBadgesPosition="left"))}refreshDirection(){if(!this.element)return;const e=this.isRTL;this.detectRTL(),this.element.classList.toggle("ms--rtl",this.isRTL);const t=this.isRTL?"rtl":"ltr";this.dropdown&&(this.dropdown.dir=t),this.hint&&(this.hint.dir=t),this.selectedPopover&&(this.selectedPopover.dir=t),e!==this.isRTL&&this.renderBadges()}buildHTML(){const e=this.options.container||document.body;this.detectRTL(),this.element.classList.add("ms"),this.isRTL&&(this.element.classList.add("ms--rtl"),Xe.debug(`[${this.instanceId}] Added ms--rtl class to element`)),(!this.options.isCheckboxesShown||!this.options.isMultipleEnabled)&&this.element.classList.add("ms--no-checkboxes");const t=document.createElement("div");t.className="ms__input-wrapper",this.input=document.createElement("input"),this.input.type="text",this.input.className="ms__input",this.input.placeholder=this.getPlaceholderText(),this.input.autocomplete="off",this.options.searchInputMode==="readonly"?this.input.readOnly=!0:this.options.searchInputMode==="hidden"&&(this.input.style.display="none");const o=document.createElement("span");o.className="ms__toggle",o.innerHTML="▼",this.counter=document.createElement("span"),this.counter.className="ms__counter",this.counter.style.display="none",t.appendChild(this.input),t.appendChild(this.counter),t.appendChild(o),this.badgesContainer=document.createElement("div"),this.badgesContainer.className="ms__badges";const i=document.createElement("div");i.className="ms__wrapper",(this.effectiveBadgesPosition==="left"||this.effectiveBadgesPosition==="right")&&i.classList.add("ms__wrapper--inline"),i.appendChild(t),i.appendChild(this.badgesContainer),this.element.appendChild(i);const r=this.isRTL?"rtl":null;this.dropdown=document.createElement("div"),this.dropdown.className="ms__dropdown",r&&(this.dropdown.dir=r),this.dropdownInner=document.createElement("div"),this.dropdownInner.className="ms__dropdown-inner",this.dropdown.appendChild(this.dropdownInner),e.appendChild(this.dropdown),this.options.searchHint&&(this.hint=document.createElement("div"),this.hint.className="ms__hint",r&&(this.hint.dir=r),this.hint.textContent=this.options.searchHint,e.appendChild(this.hint)),this.selectedPopover=document.createElement("div"),this.selectedPopover.className="ms__selected-popover",r&&(this.selectedPopover.dir=r),e.appendChild(this.selectedPopover),this.renderDropdown()}shouldUseVirtualScroll(){if(!this.options.isVirtualScrollEnabled||this.options.isGroupsAllowed&&this.hasGroups())return!1;const e=this.options.virtualScrollThreshold??100;return this.filteredOptions.length>=e}hasGroups(){return this.filteredOptions.some(e=>{const t=this.getItemGroup(e);return t&&t.trim()!==""})}renderDropdown(e){var a;if(this.destroyAllActionButtonTooltips(),this.hideLabelReveal(),this.refreshCascadeAtoms(),this.shouldUseVirtualScroll()){this.dropdown.classList.add("ms__dropdown--virtual"),this.renderDropdownVirtual();return}this.dropdown.classList.remove("ms__dropdown--virtual"),this.virtualScroll&&(this.virtualScroll.destroy(),this.virtualScroll=null,this.optionsContainer=null);let t="";if(this.isLoading){t+='<div class="ms__loader">',t+='<div class="pa-loader pa-loader--sm"></div>',t+=`<div class="ms__loading-text">${this.options.loadingMessage}</div>`,t+="</div>",this.dropdownInner.innerHTML=t;return}const o=this.renderActionsHTML(),i=this.options.actionsPosition==="bottom";if(i||(t+=o),this.options.isVirtualScrollEnabled){const l=this.scaledOptionHeight();t+=`<div class="ms__options ms__options--fixed-height" style="--ms-option-height: ${l}px;">`}else t+='<div class="ms__options">';if(this.filteredOptions.length===0)t+=`<div class="ms__empty">${this.options.emptyMessage}</div>`;else if(this.isTreeMode())this.treeNodes.forEach((l,c)=>{t+=this.renderTreeNode(l,c)});else if(this.options.isGroupsAllowed){const l=this.groupOptions(this.filteredOptions),c=new Map;this.filteredOptions.forEach((d,h)=>c.set(d,h)),Object.keys(l).forEach(d=>{if(t+='<div class="ms__group">',d!=="__ungrouped__")if(this.options.renderGroupLabelContentCallback){const h=this.options.renderGroupLabelContentCallback(d);if(h instanceof HTMLElement){const f=document.createElement("div");f.className="ms__group-label",f.appendChild(h),t+=f.outerHTML}else t+=`<div class="ms__group-label">${h}</div>`}else t+=`<div class="ms__group-label">${d}</div>`;l[d].forEach(h=>{t+=this.renderOption(h,c.get(h)??-1)}),t+="</div>"})}else this.filteredOptions.forEach((l,c)=>{t+=this.renderOption(l,c)});t+="</div>",i&&(t+=o);let r=0,n=0;if(e!=null&&e.preserveScroll&&(r=this.dropdownInner.scrollTop,n=((a=this.dropdownInner.querySelector(".ms__options"))==null?void 0:a.scrollTop)??0),this.dropdownInner.innerHTML=t,e!=null&&e.preserveScroll){this.dropdownInner.scrollTop=r;const l=this.dropdownInner.querySelector(".ms__options");l&&(l.scrollTop=n)}this.attachActionButtonTooltips(),this.attachOptionTooltips(),this.markTruncatedOptions()}renderDropdownVirtual(){if(this.destroyAllActionButtonTooltips(),!this.virtualScroll){let o="";const i=this.renderActionsHTML(),r=this.options.actionsPosition==="bottom";r||(o+=i),o+='<div class="ms__options ms__options--virtual" style="overflow-y: auto; position: relative;"></div>',r&&(o+=i),this.dropdownInner.innerHTML=o,this.optionsContainer=this.dropdownInner.querySelector(".ms__options")}if(this.applyVirtualOptionsSizing(this.optionsContainer),this.filteredOptions.length===0){this.virtualScroll&&(this.virtualScroll.destroy(),this.virtualScroll=null),this.optionsContainer.innerHTML=`<div class="ms__empty">${this.options.emptyMessage}</div>`;return}const e=this.scaledOptionHeight(),t=this.options.virtualScrollBuffer??10;requestAnimationFrame(()=>{this.optionsContainer&&(this.virtualScroll?(this.virtualScroll.setItemHeight(e),this.virtualScroll.setItems(this.filteredOptions)):this.virtualScroll=new $s({container:this.optionsContainer,itemHeight:e,items:this.filteredOptions,renderItem:(o,i)=>this.isTreeMode()?this.renderTreeNode(this.treeNodes[i],i):this.renderOption(o,i),bufferSize:t,onVisibleRangeChange:()=>{this.attachOptionTooltips(),this.markTruncatedOptions()}}),this.attachActionButtonTooltips())})}getBuiltInActionDisabled(e){return e==="select-all"?!this.filteredOptions.some(t=>!this.getItemDisabled(t)&&!this.selectedValues.has(String(this.getItemValue(t)))):e==="clear-all"?this.selectedValues.size===0:!1}renderActionsHTML(){const e=this.options.actionButtons;if(!this.options.isMultipleEnabled||!e||e.length===0)return"";const t=this.options.actionsPosition==="bottom"?"bottom":"top",o=this.options.actionsAlign??"stretch",i=` ms__actions--${t}`,r=this.options.isActionsSticky?" ms__actions--sticky":"",n=this.options.actionsLayout==="wrap"?" ms__actions--wrap":"",a=` ms__actions--align-${o}`,l=new Map;if(e.forEach((d,h)=>{if(!(d.getIsVisibleCallback?d.getIsVisibleCallback(this):d.isVisible??!0))return;let u;d.getIsDisabledCallback?u=d.getIsDisabledCallback(this):d.isDisabled!==void 0?u=d.isDisabled:u=this.getBuiltInActionDisabled(d.action);const g=u?" disabled":"",b=d.getTextCallback?d.getTextCallback(this):d.text;let y="";if(d.getClassCallback){const C=d.getClassCallback(this);y=Array.isArray(C)?` ${C.join(" ")}`:C?` ${C}`:""}else d.cssClass&&(y=` ${d.cssClass}`);const v=Math.max(1,Math.floor(d.row??1)),w=`<button type="button"${g} class="ms__action-btn${y}" data-action="${d.action}" data-button-index="${h}">${b}</button>`;l.has(v)||l.set(v,[]),l.get(v).push(w)}),l.size===0)return"";const c=Array.from(l.keys()).sort((d,h)=>d-h).map(d=>`<div class="ms__actions-row" data-row="${d}">${l.get(d).join("")}</div>`).join("");return`<div class="ms__actions${i}${r}${n}${a}">${c}</div>`}renderOption(e,t){const o=this.getItemValue(e),i=this.getItemDisplayValue(e),r=this.getItemIcon(e),n=this.getItemSubtitle(e),a=this.getItemDisabled(e),l=this.selectedValues.has(String(o)),c=t===this.focusedIndex,d=this.matchingIndices.has(t),h=["ms__option"];l&&h.push("ms__option--selected"),c&&h.push("ms__option--focused"),d&&h.push("ms__option--matched"),a&&h.push("ms__option--disabled");const f=this.options.checkboxAlign&&this.options.checkboxAlign!=="center"?` data-checkbox-align="${this.options.checkboxAlign}"`:"";let u=`<div class="${h.join(" ")}" data-value="${o}" data-index="${t}"${f}>`;if(this.options.isCheckboxesShown&&this.options.isMultipleEnabled&&(u+=`<input type="checkbox" class="ms__checkbox" ${l?"checked":""} ${a?"disabled":""}>`),u+='<div class="ms__option-content">',this.options.renderOptionContentCallback){const g={index:t,isSelected:l,isFocused:c,isMatched:d,isDisabled:a,isTreeNode:!1},b=this.options.renderOptionContentCallback(e,g);typeof b=="string"?u+=b:u+=b.outerHTML}else r&&(u+=`<span class="ms__option-icon">${r}</span>`),u+='<div class="ms__option-text">',u+=`<div class="ms__option-title">${this.highlightMatch(i,this.searchTerm)}</div>`,n&&(u+=`<div class="ms__option-subtitle">${n}</div>`),u+="</div>";return u+=this.renderOptionInfoButton(),u+="</div>",u+="</div>",u}renderOptionInfoButton(){return this.presentationMode!=="fullscreen"?"":'<button type="button" class="ms__option-info" tabindex="-1" aria-label="Show full label"></button>'}renderTreeNode(e,t){const o=e.data,i=this.getItemValue(o),r=this.getItemDisplayValue(o),n=this.getItemIcon(o),a=this.getItemSubtitle(o),l=this.getItemDisabled(o),c=this.isCascadeMode()&&this.cascadeIndex,d=c?Wt(this.cascadeIndex,e,this.cascadeCheckedAtoms):null,h=c?d==="checked":this.selectedValues.has(String(i)),f=d==="indeterminate",u=t===this.focusedIndex,g=this.matchingIndices.has(t),b=e.isSelectable!==!1,y=e.level??1,v=Math.max(0,y-1),w=["ms__option","ms__option--tree"];w.push(e.hasChildren?"ms__option--tree-branch":"ms__option--tree-leaf"),h&&w.push("ms__option--selected"),f&&w.push("ms__option--indeterminate"),u&&w.push("ms__option--focused"),g&&w.push("ms__option--matched"),l&&w.push("ms__option--disabled"),b||w.push("ms__option--tree-unselectable");const C=this.options.checkboxAlign&&this.options.checkboxAlign!=="center"?` data-checkbox-align="${this.options.checkboxAlign}"`:"",E=b?"":' data-selectable="false"';let A=`<div class="${w.join(" ")}" data-value="${i}" data-index="${t}" data-path="${e.path}" data-level="${y}" style="--ms-tree-depth: ${v};"${C}${E}>`;if(this.options.isCheckboxesShown&&this.options.isMultipleEnabled&&b&&(A+=`<input type="checkbox" class="${f?"ms__checkbox ms__checkbox--indeterminate":"ms__checkbox"}" ${h?"checked":""}${f?' aria-checked="mixed"':""} ${l?"disabled":""}>`),A+='<div class="ms__option-content">',this.options.renderOptionContentCallback){const H={index:t,isSelected:h,isFocused:u,isMatched:g,isDisabled:l,isTreeNode:!0,isBranch:e.hasChildren,isLeaf:!e.hasChildren,childCount:Object.keys(e.children).length,level:y,depth:v,path:e.path,isSelectable:b,isIndeterminate:f},K=this.options.renderOptionContentCallback(o,H);A+=typeof K=="string"?K:K.outerHTML}else n&&(A+=`<span class="ms__option-icon">${n}</span>`),A+='<div class="ms__option-text">',A+=`<div class="ms__option-title">${this.highlightMatch(r,this.searchTerm)}</div>`,a&&(A+=`<div class="ms__option-subtitle">${a}</div>`),A+="</div>";return A+=this.renderOptionInfoButton(),A+="</div>",A+="</div>",A}highlightMatch(e,t){if(!t)return e;const o=new RegExp(`(${t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")})`,"gi");return e.replace(o,"<mark>$1</mark>")}groupOptions(e){const t={};return e.forEach(o=>{const i=this.getItemGroup(o)||"__ungrouped__";t[i]||(t[i]=[]),t[i].push(o)}),t}get isSearchUsable(){return!!this.options.isSearchEnabled&&this.options.searchInputMode!=="readonly"&&this.options.searchInputMode!=="hidden"}getPlaceholderText(){return this.options.noDataPlaceholder&&this.allOptions.length===0?this.options.noDataPlaceholder:this.isSearchUsable?this.options.searchPlaceholder:this.options.selectPlaceholder||this.options.searchPlaceholder}renderBadges(){this.destroyAllBadgeTooltips();const e=Array.from(this.selectedOptions.values()),t=this.selectedValues.size;if(!this.options.isMultipleEnabled){this.badgesContainer.innerHTML="",this.counter.style.display="none";let r;e[0]&&(this.options.renderSelectedContentCallback?r=this.options.renderSelectedContentCallback(e[0]):r=this.getItemDisplayValue(e[0])),!this.isOpen&&t>0&&e.length>0?this.input.value=r:this.isOpen||(this.input.value="");return}let o=this.options.badgesDisplayMode;if(this.options.badgesThreshold!==null&&t>this.options.badgesThreshold&&o!=="none"&&(o=this.options.badgesThresholdMode||"count"),!this.isOpen)if(t>0&&o==="count"){const r=this.options.getCounterCallback?this.options.getCounterCallback(t):`${t} selected`;this.input.placeholder=r}else this.input.placeholder=this.getPlaceholderText();if(this.options.isCounterShown&&t>0){const r=this.counterSelection(),n=r.length;this.counter.textContent=`[${n}]`,this.counter.title=this.buildCounterTooltip(r),this.counter.style.display=n>0?"":"none"}else this.counter.title="",this.counter.style.display="none";if(o==="none"){this.badgesContainer.innerHTML="";return}if(o==="badges")this.badgesContainer.className=`ms__badges ms__badges--${this.effectiveBadgesPosition}`,this.badgesContainer.innerHTML=e.map(r=>this.renderBadgeHTML(r,{displayMode:"badges",isInPopover:!1})).join("");else if(o==="partial"){this.badgesContainer.className=`ms__badges ms__badges--${this.effectiveBadgesPosition}`;const r=this.options.badgesMaxVisible||3,n=e.slice(0,r),a=t-r,l=n.map(d=>this.renderBadgeHTML(d,{displayMode:"partial",isInPopover:!1})).join("");let c="";a>0&&(c=`
|
|
1
|
+
(function(S,k){typeof exports=="object"&&typeof module<"u"?k(exports):typeof define=="function"&&define.amd?define(["exports"],k):(S=typeof globalThis<"u"?globalThis:S||self,k(S.MultiSelect={}))})(this,function(S){"use strict";var Dr=Object.defineProperty;var Js=S=>{throw TypeError(S)};var $r=(S,k,z)=>k in S?Dr(S,k,{enumerable:!0,configurable:!0,writable:!0,value:z}):S[k]=z;var u=(S,k,z)=>$r(S,typeof k!="symbol"?k+"":k,z),Gt=(S,k,z)=>k.has(S)||Js("Cannot "+z);var p=(S,k,z)=>(Gt(S,k,"read from private field"),z?z.call(S):k.get(S)),$=(S,k,z)=>k.has(S)?Js("Cannot add the same private member more than once"):k instanceof WeakSet?k.add(S):k.set(S,z),R=(S,k,z,L)=>(Gt(S,k,"write to private field"),L?L.call(S,z):k.set(S,z),z),x=(S,k,z)=>(Gt(S,k,"access private method"),z);var me,Je,_e,Qe,ke,Ze,kt,Ce,pe,Se,Te,ze,Ne,Ve,De,Ct,ae,$e,I,Qs,Zs,eo,Z,to,so,Xt,qt,it,Yt,oo,J,V,fe,tt,st,ot,Re,He,Oe,_,St,Jt,Qt,io,ro,no,Tt,Zt,ao,lo,co,es,ho,uo,ts,ss;function k(s,e={}){const t=new Set(s),o=e.shouldNullOnInvalid?null:e.default??null;return{values:s,fromAttribute(i){return i===null?e.default??o:t.has(i)?i:o},validate(i){return typeof i=="string"&&t.has(i)},toAttribute(i){return i==null?null:String(i)}}}function z(s={}){const e=o=>(s.min==null||o>=s.min)&&(s.max==null||o<=s.max),t=s.default;return{fromAttribute(o){if(o===null)return t;const i=Number.parseInt(o,10);return Number.isNaN(i)||!e(i)?t:i},validate(o){return typeof o=="number"&&Number.isInteger(o)&&e(o)},toAttribute(o){return o==null?null:String(o)}}}function L(s={}){const e=s.isNullable===!0,t=s.default??(e?null:""),o=i=>s.shouldTrim?i.trim():i;return{fromAttribute(i){if(i===null)return t;const r=o(i);return!s.isEmptyAllowed&&r===""?t:r},validate(i){return i===null?e:typeof i=="string"&&(s.isEmptyAllowed===!0||i!=="")},toAttribute(i){return i==null?null:String(i)}}}const mo=new Set(["","true","1","yes","on"]),po=new Set(["false","0","no","off"]);function F(s="presence"){const e=t=>{const o=t.trim().toLowerCase();return mo.has(o)?!0:po.has(o)?!1:null};return{fromAttribute(t){switch(s){case"presence":return t!==null;case"default-true":return t===null?!0:e(t)??!0;case"default-false":return t===null?!1:e(t)??!1;case"tristate":return t===null?null:e(t)}},validate(t){return s==="tristate"?t===!0||t===!1||t===null:typeof t=="boolean"},toAttribute(t){return s==="presence"?t?"":null:t==null?null:String(t)}}}function fo(s={}){const e=s.default;return{fromAttribute(t){if(t===null||t.trim()==="")return e;let o;try{o=JSON.parse(t)}catch{return e}return s.validate&&!s.validate(o)?e:o},validate:s.validate,toAttribute(t){return t==null?null:JSON.stringify(t)}}}function go(s={}){const e=s.default??[],t=o=>Array.isArray(o)&&(!s.validateItem||o.every(s.validateItem));return{fromAttribute(o){if(o===null||o.trim()==="")return e;let i;try{i=JSON.parse(o)}catch{return e}return t(i)?i:e},validate:t,toAttribute(o){return Array.isArray(o)?JSON.stringify(o):null}}}function bo(){return{validate(s){return s==null||typeof s=="function"}}}function vo(s,e,t){const o=s.converter,i=o!=null&&o.fromAttribute?o.fromAttribute(e,t,s.attribute??s.configKey):e??s.default;return{configKey:s.configKey,field:s.field,value:i,on:s.on??"update"}}function yo(s,e){const t=s.converter;return t!=null&&t.validate&&!t.validate(e)?null:{configKey:s.configKey,field:s.field,value:e,on:s.on??"update"}}function wo(){const s=new Set;let e=!1;const t=()=>{e=!1;const o=[...s];s.clear();for(const i of o)i()};return{schedule(o){s.add(o),e||(e=!0,queueMicrotask(t))},flush(){if(s.size===0)return;e=!1;const o=[...s];s.clear();for(const i of o)i()},cancel(){s.clear(),e=!1}}}const os={pointer:"fine",hasCoarsePointer:!1,canHover:!0,isTouchPrimary:!1,orientation:"landscape",viewportWidth:1024,viewportHeight:768,breakpoint:"desktop",os:"unknown",isApple:!1,isAndroid:!1};let Ot=xo({mobile:640,tablet:1024,desktop:1/0});const Be=new Set;let be=null,rt=[],nt=!1;function xo(s){return Object.entries(s).sort((e,t)=>e[1]-t[1])}function _o(s){for(const[t,o]of Ot)if(s<=o)return t;const e=Ot[Ot.length-1];return e?e[0]:"desktop"}function It(){return typeof window<"u"&&typeof window.matchMedia=="function"}function is(){return typeof navigator<"u"&&(navigator.maxTouchPoints??0)>1}function ko(){var o;if(typeof navigator>"u")return"unknown";const s=navigator.userAgentData,e=(o=s==null?void 0:s.platform)==null?void 0:o.toLowerCase();if(e){if(e.includes("android"))return"android";if(e.includes("ios"))return"ios";if(e.includes("mac"))return is()?"ios":"macos";if(e.includes("windows"))return"windows";if(e.includes("linux"))return"linux"}const t=navigator.userAgent??"";return/android/i.test(t)?"android":/iphone|ipod|ipad/i.test(t)?"ios":/macintosh|mac os x/i.test(t)?is()?"ios":"macos":/windows/i.test(t)?"windows":/linux/i.test(t)?"linux":"unknown"}let Co;function So(){return Co??(Co=ko())}function Ke(s){return It()&&window.matchMedia(s).matches}function Pt(){if(!It())return{...os};const s=Ke("(any-pointer: coarse)"),e=Ke("(pointer: coarse)"),t=Ke("(pointer: fine)"),o=Ke("(hover: hover)"),i=e?"coarse":t?"fine":"none",r=window.innerWidth,n=window.innerHeight,a=So();return{pointer:i,hasCoarsePointer:s,canHover:o,isTouchPrimary:e&&!o,orientation:Ke("(orientation: portrait)")?"portrait":"landscape",viewportWidth:r,viewportHeight:n,breakpoint:_o(r),os:a,isApple:a==="ios"||a==="macos",isAndroid:a==="android"}}function To(s,e){return s.pointer===e.pointer&&s.hasCoarsePointer===e.hasCoarsePointer&&s.canHover===e.canHover&&s.isTouchPrimary===e.isTouchPrimary&&s.orientation===e.orientation&&s.viewportWidth===e.viewportWidth&&s.viewportHeight===e.viewportHeight&&s.breakpoint===e.breakpoint}function Mt(){const s=Pt();if(!(be&&To(be,s))){be=s;for(const e of[...Be])e(s)}}const at=()=>Mt(),rs=()=>{if(typeof requestAnimationFrame=="function"){if(nt)return;nt=!0,requestAnimationFrame(()=>{nt=!1,Mt()})}else Mt()};function Oo(s){typeof s.addEventListener=="function"?s.addEventListener("change",at):typeof s.addListener=="function"&&s.addListener(at)}function Io(s){typeof s.removeEventListener=="function"?s.removeEventListener("change",at):typeof s.removeListener=="function"&&s.removeListener(at)}function Po(){if(!It()){be={...os};return}rt=[window.matchMedia("(pointer: coarse)"),window.matchMedia("(pointer: fine)"),window.matchMedia("(any-pointer: coarse)"),window.matchMedia("(hover: hover)"),window.matchMedia("(orientation: portrait)")];for(const s of rt)Oo(s);typeof window.addEventListener=="function"&&window.addEventListener("resize",rs),be=Pt()}function Mo(){for(const s of rt)Io(s);rt=[],typeof window<"u"&&typeof window.removeEventListener=="function"&&window.removeEventListener("resize",rs),nt=!1,be=null}function Lt(){return be??Pt()}function Lo(s,e={}){const t=Be.size===0;Be.add(s),t&&Po(),e.immediate!==!1&&s(Lt());let o=!0;return()=>{o&&(o=!1,Be.delete(s),Be.size===0&&Mo())}}const Eo=600;function Ao(s){return s.isTouchPrimary?Math.min(s.viewportWidth,s.viewportHeight)<Eo?"mobile":"tablet":"desktop"}const lt=new Map;function zo(s,e){let t=lt.get(s);t||lt.set(s,t=new Set),t.add(e)}function No(s,e){var t;(t=lt.get(s))==null||t.delete(e)}function Vo(s){return Array.from(lt.get(s)??[])}const ns=new Map;function Do(s,e){ns.set(s.toLowerCase(),e)}function $o(s){return ns.get(s.toLowerCase())}function Ro(s,e,t,o={}){return s.dispatchEvent(new CustomEvent(e,{detail:t,bubbles:o.bubbles??!0,composed:o.composed??!0,cancelable:o.cancelable??!1}))}function Ho(s){return s.split(/[-_]/).filter(Boolean).map(e=>e[0].toUpperCase()+e.slice(1)).join("")}function Bo(s){return`on${Ho(s)}`}function Ko(s){return s?s.map(e=>{const t=typeof e=="string"?{name:e}:e,o=t.property===!1?null:t.property??Bo(t.name);return{name:t.name,property:o,bubbles:t.bubbles,composed:t.composed,cancelable:t.cancelable}}):[]}const Fo=typeof HTMLElement<"u"?HTMLElement:class{},as=new WeakSet;let Wo=0;const jo={trace(){},debug(){},info(){},warn(){},error(){}},Uo=new Proxy({},{get:()=>jo}),et=class et extends Fo{constructor(){super();$(this,I);$(this,me,{});$(this,Je,new Map);$(this,_e,new Map);$(this,Qe,new Map);$(this,ke,new Map);$(this,Ze,wo());$(this,kt,()=>x(this,I,Yt).call(this));$(this,Ce,null);$(this,pe,!1);$(this,Se,[]);$(this,Te,!1);$(this,ze,null);$(this,Ne,!1);$(this,Ve);$(this,De);$(this,Ct);$(this,ae);$(this,$e);const t=this.constructor,o=t.inputs??[],i=Ko(t.events);x(this,I,eo).call(this,o,i);for(const r of o)p(this,Je).set(r.configKey,r),r.attribute&&p(this,_e).set(r.attribute,r);for(const r of i)p(this,Qe).set(r.name,r);x(this,I,Qs).call(this,o),x(this,I,to).call(this,o),x(this,I,so).call(this,i)}static get observedAttributes(){const t=(this.inputs??[]).filter(o=>o.attribute).map(o=>o.attribute);return t.includes("dir")?t:[...t,"dir"]}attributeChangedCallback(t,o,i){var a;if(p(this,Ne))return;if(t==="dir"&&!p(this,_e).has("dir")){p(this,Te)&&this.directionChanged(this.isRTL);return}const r=p(this,_e).get(t);if(!r||!p(this,Te)&&((a=p(this,ze))!=null&&a.has(r.configKey)))return;let n;try{n=vo(r,i,this)}catch(l){x(this,I,Z).call(this,`converter for "${r.configKey}" threw parsing attribute ${t}="${i}"; using default`,l),n=x(this,I,Zs).call(this,r)}x(this,I,qt).call(this,n)}connectedCallback(){zo(this.localName,this),p(this,Te)||(R(this,Te,!0),R(this,ze,null),R(this,pe,!0)),x(this,I,it).call(this),this.connect(),this.environmentChanged!==et.prototype.environmentChanged&&R(this,Ve,Lo(t=>this.environmentChanged(t)))}disconnectedCallback(){var t;No(this.localName,this),(t=p(this,Ve))==null||t.call(this),R(this,Ve,void 0),this.disconnect()}setAttributes(t){for(const[o,i]of Object.entries(t)){const r=p(this,Je).get(o)??p(this,_e).get(o);r&&x(this,I,Xt).call(this,r,i)}x(this,I,it).call(this)}batch(t){t(),x(this,I,it).call(this)}flush(){x(this,I,it).call(this)}whenSettled(){return!p(this,Ce)&&!p(this,pe)?Promise.resolve():new Promise(t=>p(this,Se).push(t))}get config(){return p(this,me)}get log(){if(p(this,$e))return p(this,$e);const t=$o(this.localName);if(!t)return Uo;const o=p(this,Ct)??R(this,Ct,`${this.localName}#${this.id||++Wo}`);return R(this,$e,t.forInstance(o,()=>p(this,ae)))}enableLogging(t="debug"){R(this,ae,t)}disableLogging(){R(this,ae,void 0)}get isLoggingEnabled(){return p(this,ae)!=null&&p(this,ae)!=="silent"&&p(this,ae)!==5}reinit(){}update(t){}connect(){}disconnect(){}environmentChanged(t){}get isRTL(){return typeof getComputedStyle=="function"&&getComputedStyle(this).direction==="rtl"}directionChanged(t){}get internals(){if(p(this,De))return p(this,De);if(typeof this.attachInternals!="function")return null;try{return R(this,De,this.attachInternals())}catch{return null}}get form(){var t;return((t=this.internals)==null?void 0:t.form)??null}emit(t,o,i){const r=p(this,Qe).get(t);return Ro(this,t,o,{bubbles:(i==null?void 0:i.bubbles)??(r==null?void 0:r.bubbles),composed:(i==null?void 0:i.composed)??(r==null?void 0:r.composed),cancelable:(i==null?void 0:i.cancelable)??(r==null?void 0:r.cancelable)})}on(t,o,i){const r=o;return this.addEventListener(t,r,i),()=>this.removeEventListener(t,r,i)}async runHook(t,o,i){const r=p(this,me)[t];if(typeof r!="function")return i.whenUnset;try{return await Promise.resolve(r(o))}catch(n){if(i.onError)return i.onError(n);throw n}}};me=new WeakMap,Je=new WeakMap,_e=new WeakMap,Qe=new WeakMap,ke=new WeakMap,Ze=new WeakMap,kt=new WeakMap,Ce=new WeakMap,pe=new WeakMap,Se=new WeakMap,Te=new WeakMap,ze=new WeakMap,Ne=new WeakMap,Ve=new WeakMap,De=new WeakMap,Ct=new WeakMap,ae=new WeakMap,$e=new WeakMap,I=new WeakSet,Qs=function(t){var o;for(const i of t){let r=i.default;if((o=i.converter)!=null&&o.fromAttribute)try{r=i.converter.fromAttribute(null,this,i.attribute??i.configKey)}catch(n){x(this,I,Z).call(this,`converter for "${i.configKey}" threw computing its default; using \`default\``,n),r=i.default}p(this,me)[i.configKey]=r,i.field&&(this[i.field]=r)}},Zs=function(t){return{configKey:t.configKey,field:t.field,value:t.default,on:t.on??"update"}},eo=function(t,o){var l;const i=this.constructor;if(as.has(i))return;as.add(i);const r=new Set,n=new Set;for(const c of t)r.has(c.configKey)&&x(this,I,Z).call(this,`invalid input table: duplicate configKey "${c.configKey}"`),r.add(c.configKey),c.attribute&&(n.has(c.attribute)&&x(this,I,Z).call(this,`invalid input table: duplicate attribute "${c.attribute}"`),n.add(c.attribute)),c.reflect&&!c.attribute&&x(this,I,Z).call(this,`invalid input table: "${c.configKey}" has reflect:true but no attribute to reflect to`),c.reflect&&!((l=c.converter)!=null&&l.toAttribute)&&x(this,I,Z).call(this,`invalid input table: "${c.configKey}" has reflect:true but its converter has no toAttribute`);const a=new Set;for(const c of o)a.has(c.name)&&x(this,I,Z).call(this,`invalid event table: duplicate event "${c.name}"`),a.add(c.name),/^[a-z][a-z0-9-]*$/.test(c.name)||x(this,I,Z).call(this,`invalid event table: event "${c.name}" should be lowercase kebab-case (e.g. "date-select")`),c.property&&r.has(c.property)&&x(this,I,Z).call(this,`invalid event table: event "${c.name}" property "${c.property}" collides with an input configKey`)},Z=function(t,...o){console.warn(`[BlissElement] <${this.localName??"unknown"}> ${t}`,...o)},to=function(t){for(const o of t){const i=o.configKey,r=Object.prototype.hasOwnProperty.call(this,i),n=r?this[i]:void 0;r&&delete this[i],Object.defineProperty(this,i,{configurable:!0,enumerable:!0,get:()=>p(this,me)[i],set:a=>x(this,I,Xt).call(this,o,a)}),r&&((p(this,ze)??R(this,ze,new Set)).add(i),this[i]=n)}},so=function(t){for(const o of t){const i=o.property;if(!i)continue;const r=o.name,n=Object.prototype.hasOwnProperty.call(this,i),a=n?this[i]:void 0;n&&delete this[i],Object.defineProperty(this,i,{configurable:!0,enumerable:!0,get:()=>p(this,ke).get(r)??null,set:l=>{const c=p(this,ke).get(r);if(c&&this.removeEventListener(r,c),typeof l=="function"){const d=l;p(this,ke).set(r,d),this.addEventListener(r,d)}else p(this,ke).delete(r)}}),n&&(this[i]=a)}},Xt=function(t,o){var r;const i=yo(t,o);if(!i){x(this,I,Z).call(this,`rejected invalid value for property "${t.configKey}"; keeping previous value`,o);return}if(x(this,I,qt).call(this,i),t.reflect&&t.attribute&&((r=t.converter)!=null&&r.toAttribute)){const n=t.converter.toAttribute(i.value);R(this,Ne,!0);try{n===null?this.removeAttribute(t.attribute):this.setAttribute(t.attribute,n)}finally{R(this,Ne,!1)}}},qt=function(t){p(this,me)[t.configKey]=t.value,t.field&&(this[t.field]=t.value),t.on!=="none"&&(t.on==="reinit"&&R(this,pe,!0),(p(this,Ce)??R(this,Ce,{}))[t.configKey]=t.value,p(this,Ze).schedule(p(this,kt)))},it=function(){p(this,Ze).cancel(),x(this,I,Yt).call(this)},Yt=function(){if(!this.isConnected)return;const t=p(this,pe),o=p(this,Ce);R(this,pe,!1),R(this,Ce,null),t?this.reinit():o&&Object.keys(o).length>0&&this.update(o),x(this,I,oo).call(this)},oo=function(){if(p(this,Se).length===0)return;const t=p(this,Se);R(this,Se,[]);for(const o of t)o()},u(et,"inputs"),u(et,"events");let Et=et;function ls(s,e,t){typeof customElements>"u"||customElements.get(s)||customElements.define(s,e,t)}function Go(s){return{enableLogging:e=>s.enableLogging(e),disableLogging:()=>s.disableLogging(),setLogLevel:e=>s.setLogLevel(e),setCategoryLevel:(e,t)=>s.setCategoryLevel(e,t),getCategories:()=>[...s.LOGGING_CATEGORIES]}}function Xo(s,e,t){const{config:o,logging:i,shouldAutoDefine:r=!0}=t;i&&Do(s,i);const n={version:()=>o.version,config:o,...i?{logging:Go(i)}:{},register:()=>ls(s,e),getInstances:()=>Vo(s)};return typeof window<"u"&&((window.components??(window.components={}))[s]=n),r&&ls(s,e),n}const cs=new Map,ds=new WeakMap;let ct;function qo(s){if(typeof CSSStyleSheet>"u"||!("adoptedStyleSheets"in s))return!1;if(ct===void 0)try{new CSSStyleSheet().replaceSync(""),ct=!0}catch{ct=!1}return ct}function Yo(s,...e){if(typeof document>"u")return;let t=ds.get(s);t||ds.set(s,t=new Set);const o=e.filter(r=>r&&!t.has(r));if(o.length===0)return;for(const r of o)t.add(r);if(qo(s)){const r=o.map(n=>{let a=cs.get(n);return a||(a=new CSSStyleSheet,a.replaceSync(n),cs.set(n,a)),a});s.adoptedStyleSheets=[...s.adoptedStyleSheets,...r];return}const i=s.head??s;for(const r of o){const n=document.createElement("style");n.textContent=r,i.appendChild(n)}}function Jo(s,e={}){const t=e.position??"last",o=s.head??s;let i=null;const r=()=>typeof document>"u"?null:(i||(i=document.createElement("style"),e.className&&(i.className=e.className)),i.parentNode!==o&&(t==="first"&&o.firstChild?o.insertBefore(i,o.firstChild):o.appendChild(i)),i),n=()=>{i==null||i.remove()};return{set(a){if(!a){n();return}const l=r();l&&(l.textContent=a)},clear:n,destroy(){i==null||i.remove(),i=null}}}function hs(s){return s.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Qo(s,e){const t=new Set,o=new RegExp(`var\\(\\s*(${hs(e)}[a-z0-9-]+)`,"gi");let i;for(;i=o.exec(s);)i[1]&&t.add(i[1]);return t}function Zo(s,e){const t=new Set,o=new RegExp(`(${hs(e)}[a-z0-9-]+)\\s*:`,"gi");let i;for(;i=o.exec(s);)i[1]&&t.add(i[1]);return[...t]}function ei(s,e,t={}){const o=t.minScore??3,i=t.limit??3,r=new Set(s.split("-").filter(Boolean));return[...e].map(n=>({k:n,score:n.split("-").filter(a=>r.has(a)).length})).filter(n=>n.score>=o).sort((n,a)=>a.score-n.score).slice(0,i).map(n=>n.k)}function ti(s,e){if(e.consumed.size===0)return[];const t=[];for(const o of Zo(s,e.prefix))e.consumed.has(o)||t.push({name:o,suggestions:ei(o,e.consumed,{minScore:e.minScore})});return t}const si={mobile:"fullscreen",tablet:"floating",desktop:"floating"};function oi(s,e,t={}){if(s!=="auto")return s;const o=Ao(e);return t[o]??si[o]}function At(s){return{presentation:s,isFullscreen:s==="fullscreen",isModal:s==="modal"}}let Fe=0,dt=null;function ii(){if(typeof document>"u")return()=>{};Fe===0&&(dt=document.body.style.overflow,document.body.style.overflow="hidden"),Fe++;let s=!1;return()=>{s||(s=!0,Fe=Math.max(0,Fe-1),Fe===0&&dt!==null&&(document.body.style.overflow=dt,dt=null))}}function ri(s){const e=typeof window<"u"?window.visualViewport:null;if(!e)return()=>{};let t=!1;const o=()=>{t=!1,s.style.height=`${e.height}px`,s.style.top=`${e.offsetTop}px`},i=()=>{t||(t=!0,typeof requestAnimationFrame=="function"?requestAnimationFrame(o):o())};return e.addEventListener("resize",i),e.addEventListener("scroll",i),i(),()=>{e.removeEventListener("resize",i),e.removeEventListener("scroll",i),s.style.height="",s.style.top=""}}const G={TRACE:0,DEBUG:1,INFO:2,WARN:3,ERROR:4,SILENT:5},us=["trace","debug","info","warn","error"],ht=()=>{};let ni="km-log";function ms(s){const t=console[s];return typeof t=="function"?t.bind(console):ht}function ai(s){if(s==="debug"&&(s="log"),typeof console>"u")return ht;const e=console;return e[s]!==void 0?ms(s):e.log!==void 0?ms("log"):ht}const li=s=>ai(s);function We(s){let e=s;const t=G;if(typeof e=="string"&&t[e.toUpperCase()]!==void 0&&(e=t[e.toUpperCase()]),typeof e=="number"&&e>=0&&e<=G.SILENT)return e;throw new TypeError(`setLevel() called with an invalid level: ${String(s)}`)}let ce;const ut={};class ps{constructor(e,t){u(this,"name");u(this,"levels",G);u(this,"methodFactory");u(this,"trace");u(this,"debug");u(this,"info");u(this,"warn");u(this,"error");u(this,"log");u(this,"inheritedLevel");u(this,"defaultLevel",null);u(this,"userLevel",null);this.name=e,this.methodFactory=t,this.inheritedLevel=We(ce?ce.getLevel():"WARN");const o=this.getPersistedLevel();o!=null&&(this.userLevel=We(o)),this.replaceLoggingMethods()}storageKey(){return typeof this.name=="string"?`${ni}:${this.name}`:void 0}persist(e){const t=this.storageKey();if(typeof window>"u"||!t)return;const o=(us[e]??"silent").toUpperCase();try{window.localStorage[t]=o}catch{}}getPersistedLevel(){const e=this.storageKey();if(typeof window>"u"||!e)return;let t;try{t=window.localStorage[e]}catch{}if(!(t===void 0||G[t]===void 0))return t}clearPersisted(){const e=this.storageKey();if(!(typeof window>"u"||!e))try{window.localStorage.removeItem(e)}catch{}}replaceLoggingMethods(){const e=this.getLevel();us.forEach((t,o)=>{this[t]=o<e?ht:this.methodFactory(t,e,this.name)}),this.log=this.debug}getLevel(){return this.userLevel!=null?this.userLevel:this.defaultLevel!=null?this.defaultLevel:this.inheritedLevel}setLevel(e,t){this.userLevel=We(e),t!==!1&&this.persist(this.userLevel),this.replaceLoggingMethods()}setDefaultLevel(e){this.defaultLevel=We(e),this.getPersistedLevel()||this.setLevel(e,!1)}resetLevel(){this.userLevel=null,this.clearPersisted(),this.replaceLoggingMethods()}enableAll(e){this.setLevel(G.TRACE,e)}disableAll(e){this.setLevel(G.SILENT,e)}rebuild(){if(ce&&ce!==this&&(this.inheritedLevel=We(ce.getLevel())),this.replaceLoggingMethods(),ce===this)for(const e in ut)ut[e].rebuild()}}ce=new ps(void 0,li);function ci(s){if(typeof s!="string"||s==="")throw new TypeError("You must supply a non-empty name when creating a logger.");let e=ut[s];return e||(e=ut[s]=new ps(s,ce.methodFactory)),e}const di=["INIT","DATA","UI"],hi="debug",fs=["#4c8bf5","#2ea043","#d29922","#a371f7","#db61a2","#e5534b","#3fb0ac","#8a6d3b"],gs=new WeakSet;function ui(s,e,t){if(gs.has(s))return;gs.add(s);const o=s.methodFactory,i=`color:${t};font-weight:bold`;s.methodFactory=(r,n,a)=>{const l=o(r,n,a);return(...c)=>l(`%c[${e}]`,i,...c)},s.setLevel(s.getLevel(),!1)}function mi(s){return typeof s=="number"?s:G[s.toUpperCase()]??G.SILENT}const pi=[["trace",G.TRACE,"debug"],["debug",G.DEBUG,"debug"],["info",G.INFO,"info"],["warn",G.WARN,"warn"],["error",G.ERROR,"error"]];function fi(s,e,t){const o=`color:${s.color};font-weight:bold`,i="color:#888",r={};for(const[n,a,l]of pi)r[n]=(...c)=>{const d=t(),h=Math.min(s.logger.getLevel(),d==null?G.SILENT:mi(d));if(a<h)return;(console[l]??console.log).bind(console)(`%c[${s.label}]%c ${e}`,o,i,...c)};return r}function gi(s,e=di){const t={},o={};e.forEach((r,n)=>{const a=`${s}:${r}`,l=fs[n%fs.length],c=ci(a);ui(c,a,l),t[r]=c,o[r]={label:a,color:l,logger:c}});const i=r=>{for(const n of e)t[n].setLevel(r,!1)};return{loggers:t,LOGGING_CATEGORIES:e,enableLogging(r=hi){i(r)},disableLogging(){i("silent")},setLogLevel(r){i(r)},setCategoryLevel(r,n){var a;(a=t[r])==null||a.setLevel(n,!1)},forInstance(r,n){const a={};for(const l of e)a[l]=fi(o[l],r,n);return a}}}const de=Math.min,se=Math.max,mt=Math.round,pt=Math.floor,oe=s=>({x:s,y:s}),bi={left:"right",right:"left",bottom:"top",top:"bottom"};function bs(s,e,t){return se(s,de(e,t))}function Pe(s,e){return typeof s=="function"?s(e):s}function ve(s){return s.split("-")[0]}function Me(s){return s.split("-")[1]}function vs(s){return s==="x"?"y":"x"}function zt(s){return s==="y"?"height":"width"}function ie(s){const e=s[0];return e==="t"||e==="b"?"y":"x"}function Nt(s){return vs(ie(s))}function vi(s,e,t){t===void 0&&(t=!1);const o=Me(s),i=Nt(s),r=zt(i);let n=i==="x"?o===(t?"end":"start")?"right":"left":o==="start"?"bottom":"top";return e.reference[r]>e.floating[r]&&(n=ft(n)),[n,ft(n)]}function yi(s){const e=ft(s);return[Vt(s),e,Vt(e)]}function Vt(s){return s.includes("start")?s.replace("start","end"):s.replace("end","start")}const ys=["left","right"],ws=["right","left"],wi=["top","bottom"],xi=["bottom","top"];function _i(s,e,t){switch(s){case"top":case"bottom":return t?e?ws:ys:e?ys:ws;case"left":case"right":return e?wi:xi;default:return[]}}function ki(s,e,t,o){const i=Me(s);let r=_i(ve(s),t==="start",o);return i&&(r=r.map(n=>n+"-"+i),e&&(r=r.concat(r.map(Vt)))),r}function ft(s){const e=ve(s);return bi[e]+s.slice(e.length)}function Ci(s){var e,t,o,i;return{top:(e=s.top)!=null?e:0,right:(t=s.right)!=null?t:0,bottom:(o=s.bottom)!=null?o:0,left:(i=s.left)!=null?i:0}}function xs(s){return typeof s!="number"?Ci(s):{top:s,right:s,bottom:s,left:s}}function gt(s){const{x:e,y:t,width:o,height:i}=s;return{width:o,height:i,top:t,left:e,right:e+o,bottom:t+i,x:e,y:t}}function _s(s,e,t){let{reference:o,floating:i}=s;const r=ie(e),n=Nt(e),a=zt(n),l=ve(e),c=r==="y",d=o.x+o.width/2-i.width/2,h=o.y+o.height/2-i.height/2,f=o[a]/2-i[a]/2;let m;switch(l){case"top":m={x:d,y:o.y-i.height};break;case"bottom":m={x:d,y:o.y+o.height};break;case"right":m={x:o.x+o.width,y:h};break;case"left":m={x:o.x-i.width,y:h};break;default:m={x:o.x,y:o.y}}const g=Me(e);return g&&(m[n]+=f*(g==="end"?1:-1)*(t&&c?-1:1)),m}async function Si(s,e){var t;e===void 0&&(e={});const{x:o,y:i,platform:r,rects:n,elements:a,strategy:l}=s,{boundary:c="clippingAncestors",rootBoundary:d="viewport",elementContext:h="floating",altBoundary:f=!1,padding:m=0}=Pe(e,s),g=xs(m),y=a[f?h==="floating"?"reference":"floating":h],v=gt(await r.getClippingRect({element:(t=await(r.isElement==null?void 0:r.isElement(y)))==null||t?y:y.contextElement||await(r.getDocumentElement==null?void 0:r.getDocumentElement(a.floating)),boundary:c,rootBoundary:d,strategy:l})),w=h==="floating"?{x:o,y:i,width:n.floating.width,height:n.floating.height}:n.reference,C=await(r.getOffsetParent==null?void 0:r.getOffsetParent(a.floating)),E=await(r.isElement==null?void 0:r.isElement(C))&&await(r.getScale==null?void 0:r.getScale(C))||{x:1,y:1},A=gt(r.convertOffsetParentRelativeRectToViewportRelativeRect?await r.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:w,offsetParent:C,strategy:l}):w);return{top:(v.top-A.top+g.top)/E.y,bottom:(A.bottom-v.bottom+g.bottom)/E.y,left:(v.left-A.left+g.left)/E.x,right:(A.right-v.right+g.right)/E.x}}const Ti=50,Oi=async(s,e,t)=>{const{placement:o="bottom",strategy:i="absolute",middleware:r=[],platform:n}=t,a=n.detectOverflow?n:{...n,detectOverflow:Si},l=await(n.isRTL==null?void 0:n.isRTL(e));let c=await n.getElementRects({reference:s,floating:e,strategy:i}),{x:d,y:h}=_s(c,o,l),f=o,m=0;const g={};for(let b=0;b<r.length;b++){const y=r[b];if(!y)continue;const{name:v,fn:w}=y,{x:C,y:E,data:A,reset:H}=await w({x:d,y:h,initialPlacement:o,placement:f,strategy:i,middlewareData:g,rects:c,platform:a,elements:{reference:s,floating:e}});d=C??d,h=E??h,g[v]={...g[v],...A},H&&m<Ti&&(m++,typeof H=="object"&&(H.placement&&(f=H.placement),H.rects&&(c=H.rects===!0?await n.getElementRects({reference:s,floating:e,strategy:i}):H.rects),{x:d,y:h}=_s(c,f,l)),b=-1)}return{x:d,y:h,placement:f,strategy:i,middlewareData:g}},Ii=s=>({name:"arrow",options:s,async fn(e){const{x:t,y:o,placement:i,rects:r,platform:n,elements:a,middlewareData:l}=e,{element:c,padding:d=0}=Pe(s,e)||{};if(c==null)return{};const h=xs(d),f={x:t,y:o},m=Nt(i),g=zt(m),b=await n.getDimensions(c),y=m==="y",v=y?"top":"left",w=y?"bottom":"right",C=y?"clientHeight":"clientWidth",E=r.reference[g]+r.reference[m]-f[m]-r.floating[g],A=f[m]-r.reference[m],H=await(n.getOffsetParent==null?void 0:n.getOffsetParent(c));let K=H?H[C]:0;(!K||!await(n.isElement==null?void 0:n.isElement(H)))&&(K=a.floating[C]||r.floating[g]);const q=E/2-A/2,D=K/2-b[g]/2-1,T=de(h[v],D),P=de(h[w],D),M=K-b[g]-P,B=K/2-b[g]/2+q,O=bs(T,B,M),W=!l.arrow&&Me(i)!=null&&B!==O&&r.reference[g]/2-(B<T?T:P)-b[g]/2<0,le=W?B<T?B-T:B-M:0;return{[m]:f[m]+le,data:{[m]:O,centerOffset:B-O-le,...W&&{alignmentOffset:le}},reset:W}}}),Pi=function(s){return s===void 0&&(s={}),{name:"flip",options:s,async fn(e){var t,o;const{placement:i,middlewareData:r,rects:n,initialPlacement:a,platform:l,elements:c}=e,{mainAxis:d=!0,crossAxis:h=!0,fallbackPlacements:f,fallbackStrategy:m="bestFit",fallbackAxisSideDirection:g="none",flipAlignment:b=!0,...y}=Pe(s,e);if((t=r.arrow)!=null&&t.alignmentOffset)return{};const v=ve(i),w=ie(a),C=ve(a)===a,E=await(l.isRTL==null?void 0:l.isRTL(c.floating)),A=f||(C||!b?[ft(a)]:yi(a)),H=g!=="none";!f&&H&&A.push(...ki(a,b,g,E));const K=[a,...A],q=await l.detectOverflow(e,y),D=[];let T=((o=r.flip)==null?void 0:o.overflows)||[];if(d&&D.push(q[v]),h){const O=vi(i,n,E);D.push(q[O[0]],q[O[1]])}if(T=[...T,{placement:i,overflows:D}],!D.every(O=>O<=0)){var P,M;const O=(((P=r.flip)==null?void 0:P.index)||0)+1,W=K[O];if(W&&(!(h==="alignment"?w!==ie(W):!1)||T.every(Q=>ie(Q.placement)===w?Q.overflows[0]>0:!0)))return{data:{index:O,overflows:T},reset:{placement:W}};let le=(M=T.filter(Ie=>Ie.overflows[0]<=0).sort((Ie,Q)=>Ie.overflows[1]-Q.overflows[1])[0])==null?void 0:M.placement;if(!le)switch(m){case"bestFit":{var B;const Ie=(B=T.filter(Q=>{if(H){const ge=ie(Q.placement);return ge===w||ge==="y"}return!0}).map(Q=>[Q.placement,Q.overflows.filter(ge=>ge>0).reduce((ge,Vr)=>ge+Vr,0)]).sort((Q,ge)=>Q[1]-ge[1])[0])==null?void 0:B[0];Ie&&(le=Ie);break}case"initialPlacement":le=a;break}if(i!==le)return{reset:{placement:le}}}return{}}}},Mi=new Set(["left","top"]);async function Li(s,e){const{placement:t,platform:o,elements:i}=s,r=await(o.isRTL==null?void 0:o.isRTL(i.floating)),n=ve(t),a=Me(t),l=ie(t)==="y",c=Mi.has(n)?-1:1,d=r&&l?-1:1,h=Pe(e,s);let{mainAxis:f,crossAxis:m,alignmentAxis:g}=typeof h=="number"?{mainAxis:h,crossAxis:0,alignmentAxis:null}:{mainAxis:h.mainAxis||0,crossAxis:h.crossAxis||0,alignmentAxis:h.alignmentAxis};return a&&typeof g=="number"&&(m=a==="end"?g*-1:g),l?{x:m*d,y:f*c}:{x:f*c,y:m*d}}const Ei=function(s){return s===void 0&&(s=0),{name:"offset",options:s,async fn(e){var t,o;const{x:i,y:r,placement:n,middlewareData:a}=e,l=await Li(e,s);return n===((t=a.offset)==null?void 0:t.placement)&&(o=a.arrow)!=null&&o.alignmentOffset?{}:{x:i+l.x,y:r+l.y,data:{...l,placement:n}}}}},Ai=function(s){return s===void 0&&(s={}),{name:"shift",options:s,async fn(e){const{x:t,y:o,placement:i,platform:r}=e,{mainAxis:n=!0,crossAxis:a=!1,limiter:l={fn:w=>{let{x:C,y:E}=w;return{x:C,y:E}}},...c}=Pe(s,e),d={x:t,y:o},h=await r.detectOverflow(e,c),f=ie(i),m=vs(f);let g=d[m],b=d[f];const y=(w,C)=>bs(C+h[w==="y"?"top":"left"],C,C-h[w==="y"?"bottom":"right"]);n&&(g=y(m,g)),a&&(b=y(f,b));const v=l.fn({...e,[m]:g,[f]:b});return{...v,data:{x:v.x-t,y:v.y-o,enabled:{[m]:n,[f]:a}}}}}},zi=function(s){return s===void 0&&(s={}),{name:"size",options:s,async fn(e){const{placement:t,rects:o,platform:i,elements:r}=e,{apply:n=()=>{},...a}=Pe(s,e),l=await i.detectOverflow(e,a),c=ve(t),d=Me(t),h=ie(t)==="y",{width:f,height:m}=o.floating;let g,b;c==="top"||c==="bottom"?(g=c,b=d===(await(i.isRTL==null?void 0:i.isRTL(r.floating))?"start":"end")?"left":"right"):(b=c,g=d==="end"?"top":"bottom");const y=m-l.top-l.bottom,v=f-l.left-l.right,w=de(m-l[g],y),C=de(f-l[b],v),E=e.middlewareData.shift,A=!E;let H=w,K=C;E!=null&&E.enabled.x&&(K=v),E!=null&&E.enabled.y&&(H=y),A&&!d&&(h?K=f-2*se(l.left,l.right):H=m-2*se(l.top,l.bottom)),await n({...e,availableWidth:K,availableHeight:H});const q=await i.getDimensions(r.floating);return f!==q.width||m!==q.height?{reset:{rects:!0}}:{}}}};function bt(){return typeof window<"u"}function Le(s){return ks(s)?(s.nodeName||"").toLowerCase():"#document"}function X(s){var e;return(s==null||(e=s.ownerDocument)==null?void 0:e.defaultView)||window}function re(s){var e;return(e=(ks(s)?s.ownerDocument:s.document)||window.document)==null?void 0:e.documentElement}function ks(s){return bt()?s instanceof Node||s instanceof X(s).Node:!1}function ee(s){return bt()?s instanceof Element||s instanceof X(s).Element:!1}function he(s){return bt()?s instanceof HTMLElement||s instanceof X(s).HTMLElement:!1}function Cs(s){return!bt()||typeof ShadowRoot>"u"?!1:s instanceof ShadowRoot||s instanceof X(s).ShadowRoot}function vt(s){const{overflow:e,overflowX:t,overflowY:o,display:i}=te(s);return/auto|scroll|overlay|hidden|clip/.test(e+o+t)&&i!=="inline"&&i!=="contents"}function Ni(s){return/^(table|td|th)$/.test(Le(s))}function yt(s){try{if(s.matches(":popover-open"))return!0}catch{}try{return s.matches(":modal")}catch{return!1}}const Vi=/transform|translate|scale|rotate|perspective|filter/,Di=/paint|layout|strict|content/,ye=s=>!!s&&s!=="none";let Dt;function $t(s){const e=ee(s)?te(s):s;return ye(e.transform)||ye(e.translate)||ye(e.scale)||ye(e.rotate)||ye(e.perspective)||!Rt()&&(ye(e.backdropFilter)||ye(e.filter))||Vi.test(e.willChange||"")||Di.test(e.contain||"")}function $i(s){let e=we(s);for(;he(e)&&!je(e);){if($t(e))return e;if(yt(e))return null;e=we(e)}return null}function Rt(){return Dt==null&&(Dt=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),Dt}function je(s){return/^(html|body|#document)$/.test(Le(s))}function te(s){return X(s).getComputedStyle(s)}function wt(s){return ee(s)?{scrollLeft:s.scrollLeft,scrollTop:s.scrollTop}:{scrollLeft:s.scrollX,scrollTop:s.scrollY}}function we(s){if(Le(s)==="html")return s;const e=s.assignedSlot||s.parentNode||Cs(s)&&s.host||re(s);return Cs(e)?e.host:e}function Ss(s){const e=we(s);return je(e)?(s.ownerDocument||s).body:he(e)&&vt(e)?e:Ss(e)}function Ue(s,e,t){var o;e===void 0&&(e=[]),t===void 0&&(t=!0);const i=Ss(s),r=i===((o=s.ownerDocument)==null?void 0:o.body),n=X(i);if(r){const a=Ht(n);return e.concat(n,n.visualViewport||[],vt(i)?i:[],a&&t?Ue(a):[])}else return e.concat(i,Ue(i,[],t))}function Ht(s){return s.parent&&Object.getPrototypeOf(s.parent)?s.frameElement:null}function Ts(s){const e=te(s);let t=parseFloat(e.width)||0,o=parseFloat(e.height)||0;const i=he(s),r=i?s.offsetWidth:t,n=i?s.offsetHeight:o,a=mt(t)!==r||mt(o)!==n;return a&&(t=r,o=n),{width:t,height:o,$:a}}function Bt(s){return ee(s)?s:s.contextElement}function Ee(s){const e=Bt(s);if(!he(e))return oe(1);const t=e.getBoundingClientRect(),{width:o,height:i,$:r}=Ts(e);let n=(r?mt(t.width):t.width)/o,a=(r?mt(t.height):t.height)/i;return(!n||!Number.isFinite(n))&&(n=1),(!a||!Number.isFinite(a))&&(a=1),{x:n,y:a}}const Ri=oe(0);function Os(s){const e=X(s);return!Rt()||!e.visualViewport?Ri:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function Hi(s,e,t){return e===void 0&&(e=!1),!!t&&e&&t===X(s)}function xe(s,e,t,o){e===void 0&&(e=!1),t===void 0&&(t=!1);const i=s.getBoundingClientRect(),r=Bt(s);let n=oe(1);e&&(o?ee(o)&&(n=Ee(o)):n=Ee(s));const a=Hi(r,t,o)?Os(r):oe(0);let l=(i.left+a.x)/n.x,c=(i.top+a.y)/n.y,d=i.width/n.x,h=i.height/n.y;if(r&&o){const f=X(r),m=ee(o)?X(o):o;let g=f,b=Ht(g);for(;b&&m!==g;){const y=Ee(b),v=b.getBoundingClientRect(),w=te(b),C=v.left+(b.clientLeft+parseFloat(w.paddingLeft))*y.x,E=v.top+(b.clientTop+parseFloat(w.paddingTop))*y.y;l*=y.x,c*=y.y,d*=y.x,h*=y.y,l+=C,c+=E,g=X(b),b=Ht(g)}}return gt({width:d,height:h,x:l,y:c})}function xt(s,e){const t=wt(s).scrollLeft;return e?e.left+t:xe(re(s)).left+t}function Is(s,e){const t=s.getBoundingClientRect(),o=t.left+e.scrollLeft-xt(s,t),i=t.top+e.scrollTop;return{x:o,y:i}}function Bi(s){let{elements:e,rect:t,offsetParent:o,strategy:i}=s;const r=i==="fixed",n=re(o),a=e?yt(e.floating):!1;if(o===n||a&&r)return t;let l={scrollLeft:0,scrollTop:0},c=oe(1);const d=oe(0),h=he(o);if((h||!r)&&((Le(o)!=="body"||vt(n))&&(l=wt(o)),h)){const m=xe(o);c=Ee(o),d.x=m.x+o.clientLeft,d.y=m.y+o.clientTop}const f=n&&!h&&!r?Is(n,l):oe(0);return{width:t.width*c.x,height:t.height*c.y,x:t.x*c.x-l.scrollLeft*c.x+d.x+f.x,y:t.y*c.y-l.scrollTop*c.y+d.y+f.y}}function Ki(s){return s.getClientRects?Array.from(s.getClientRects()):[]}function Fi(s){const e=wt(s),t=s.ownerDocument.body,o=se(s.scrollWidth,s.clientWidth,t.scrollWidth,t.clientWidth),i=se(s.scrollHeight,s.clientHeight,t.scrollHeight,t.clientHeight);let r=-e.scrollLeft+xt(s);const n=-e.scrollTop;return te(t).direction==="rtl"&&(r+=se(s.clientWidth,t.clientWidth)-o),{width:o,height:i,x:r,y:n}}const Wi=25;function ji(s,e,t){t===void 0&&(t="viewport");const o=t==="layoutViewport",i=X(s),r=re(s),n=i.visualViewport;let a=r.clientWidth,l=r.clientHeight,c=0,d=0;if(n){const f=!Rt()||e==="fixed";o?f||(c=-n.offsetLeft,d=-n.offsetTop):(a=n.width,l=n.height,f&&(c=n.offsetLeft,d=n.offsetTop))}if(xt(r)<=0){const f=r.ownerDocument,m=f.body,g=getComputedStyle(m),b=f.compatMode==="CSS1Compat"&&parseFloat(g.marginLeft)+parseFloat(g.marginRight)||0,y=Math.abs(r.clientWidth-m.clientWidth-b),v=getComputedStyle(r).scrollbarGutter==="stable both-edges"?y/2:y;v<=Wi&&(a-=v)}return{width:a,height:l,x:c,y:d}}function Ui(s,e){const t=xe(s,!0,e==="fixed"),o=t.top+s.clientTop,i=t.left+s.clientLeft,r=Ee(s),n=s.clientWidth*r.x,a=s.clientHeight*r.y,l=i*r.x,c=o*r.y;return{width:n,height:a,x:l,y:c}}function Ps(s,e,t){let o;if(e==="viewport"||e==="layoutViewport")o=ji(s,t,e);else if(e==="document")o=Fi(re(s));else if(ee(e))o=Ui(e,t);else{const i=Os(s);o={x:e.x-i.x,y:e.y-i.y,width:e.width,height:e.height}}return gt(o)}function Gi(s,e){const t=e.get(s);if(t)return t;let o=Ue(s,[],!1).filter(a=>ee(a)&&Le(a)!=="body"),i=null;const r=te(s).position==="fixed";let n=r?we(s):s;for(;ee(n)&&!je(n);){const a=te(n),l=$t(n),c=i?i.position:r?"fixed":"";!l&&(c==="fixed"||c==="absolute"&&a.position==="static")?o=o.filter(h=>h!==n):i=a,n=we(n)}return e.set(s,o),o}function Xi(s){let{element:e,boundary:t,rootBoundary:o,strategy:i}=s;const n=[...t==="clippingAncestors"?yt(e)?[]:Gi(e,this._c):[].concat(t),o],a=Ps(e,n[0],i);let l=a.top,c=a.right,d=a.bottom,h=a.left;for(let f=1;f<n.length;f++){const m=Ps(e,n[f],i);l=se(m.top,l),c=de(m.right,c),d=de(m.bottom,d),h=se(m.left,h)}return{width:c-h,height:d-l,x:h,y:l}}function qi(s){const{width:e,height:t}=Ts(s);return{width:e,height:t}}function Yi(s,e,t){const o=he(e),i=re(e),r=t==="fixed",n=xe(s,!0,r,e);let a={scrollLeft:0,scrollTop:0};const l=oe(0);if((o||!r)&&((Le(e)!=="body"||vt(i))&&(a=wt(e)),o)){const f=xe(e,!0,r,e);l.x=f.x+e.clientLeft,l.y=f.y+e.clientTop}!o&&i&&(l.x=xt(i));const c=i&&!o&&!r?Is(i,a):oe(0),d=n.left+a.scrollLeft-l.x-c.x,h=n.top+a.scrollTop-l.y-c.y;return{x:d,y:h,width:n.width,height:n.height}}function Kt(s){return te(s).position==="static"}function Ms(s,e){if(!he(s)||te(s).position==="fixed")return null;if(e)return e(s);let t=s.offsetParent;return re(s)===t&&(t=t.ownerDocument.body),t}function Ls(s,e){const t=X(s);if(yt(s))return t;if(!he(s)){let i=we(s);for(;i&&!je(i);){if(ee(i)&&!Kt(i))return i;i=we(i)}return t}let o=Ms(s,e);for(;o&&Ni(o)&&Kt(o);)o=Ms(o,e);return o&&je(o)&&Kt(o)&&!$t(o)?t:o||$i(s)||t}const Ji=async function(s){const e=this.getOffsetParent||Ls,t=this.getDimensions,o=await t(s.floating);return{reference:Yi(s.reference,await e(s.floating),s.strategy),floating:{x:0,y:0,width:o.width,height:o.height}}};function Qi(s){return te(s).direction==="rtl"}const Es={convertOffsetParentRelativeRectToViewportRelativeRect:Bi,getDocumentElement:re,getClippingRect:Xi,getOffsetParent:Ls,getElementRects:Ji,getClientRects:Ki,getDimensions:qi,getScale:Ee,isElement:ee,isRTL:Qi};function As(s,e){return s.x===e.x&&s.y===e.y&&s.width===e.width&&s.height===e.height}function Zi(s,e,t){let o=null,i;const r=re(s);function n(){var d;clearTimeout(i),(d=o)==null||d.disconnect(),o=null}function a(d,h){d===void 0&&(d=!1),h===void 0&&(h=1),n();const f=s.getBoundingClientRect(),{left:m,top:g,width:b,height:y}=f;if(d||e(),!b||!y)return;const v=pt(g),w=pt(r.clientWidth-(m+b)),C=pt(r.clientHeight-(g+y)),E=pt(m),H={rootMargin:-v+"px "+-w+"px "+-C+"px "+-E+"px",threshold:se(0,de(1,h))||1};let K=!0;function q(D){const T=D[0].intersectionRatio;if(!As(f,s.getBoundingClientRect()))return a();if(T!==h){if(!K)return a();T?a(!1,T):i=setTimeout(()=>{a(!1,1e-7)},1e3)}K=!1}try{o=new IntersectionObserver(q,{...H,root:r.ownerDocument})}catch{o=new IntersectionObserver(q,H)}o.observe(s)}const l=X(s),c=()=>a(t);return l.addEventListener("resize",c),a(!0),()=>{l.removeEventListener("resize",c),n()}}function er(s,e,t,o){o===void 0&&(o={});const{ancestorScroll:i=!0,ancestorResize:r=!0,elementResize:n=typeof ResizeObserver=="function",layoutShift:a=typeof IntersectionObserver=="function",animationFrame:l=!1}=o,c=Bt(s),d=i||r?[...c?Ue(c):[],...e?Ue(e):[]]:[];d.forEach(v=>{i&&v.addEventListener("scroll",t),r&&v.addEventListener("resize",t)});const h=c&&a?Zi(c,t,r):null;let f=-1,m=null;n&&(m=new ResizeObserver(v=>{let[w]=v;w&&w.target===c&&m&&e&&(m.unobserve(e),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var C;(C=m)==null||C.observe(e)})),t()}),c&&!l&&m.observe(c),e&&m.observe(e));let g,b=l?xe(s):null;l&&y();function y(){const v=xe(s);b&&!As(b,v)&&t(),b=v,g=requestAnimationFrame(y)}return t(),()=>{var v;d.forEach(w=>{i&&w.removeEventListener("scroll",t),r&&w.removeEventListener("resize",t)}),h==null||h(),(v=m)==null||v.disconnect(),m=null,l&&cancelAnimationFrame(g)}}const tr=Ei,sr=Ai,or=Pi,Ft=zi,ir=Ii,rr=(s,e,t)=>{const o=new Map,i=t??{},r={...Es,...i.platform,_c:o};return Oi(s,e,{...i,platform:r})};function Wt(s){const e=s.parentNode??null;return e instanceof ShadowRoot?e.host:e}function nr(s){if(s.transform!=="none"||s.perspective!=="none"||s.filter!=="none")return!0;const e=s.backdropFilter;return!!(e&&e!=="none"||s.willChange&&/\b(transform|filter|perspective)\b/.test(s.willChange))}function zs(s){let e=Wt(s);for(;e&&!(e===document.body||e===document.documentElement);){if(e instanceof Element&&nr(getComputedStyle(e)))return e;e=Wt(e)}return window}function ar(s,e,t){let o=s;for(;o&&!(o===document.body||o===document.documentElement);){if(o instanceof Element){const i=o.getBoundingClientRect();if(Math.abs(i.x-e)<2&&Math.abs(i.y-t)<2)return o}o=Wt(o)}return null}function lr(s){const e=getComputedStyle(s),t=[];e.transform!=="none"&&t.push(`transform: ${e.transform}`),e.perspective!=="none"&&t.push(`perspective: ${e.perspective}`),e.filter!=="none"&&t.push(`filter: ${e.filter}`);const o=e.backdropFilter;o&&o!=="none"&&t.push(`backdrop-filter: ${o}`),e.willChange&&/\b(transform|filter|perspective)\b/.test(e.willChange)&&t.push(`will-change: ${e.willChange}`),e.contain&&/\b(paint|layout|strict|content)\b/.test(e.contain)&&t.push(`contain: ${e.contain}`);const i=e.containerType;return i&&i!=="normal"&&t.push(`container-type: ${i}`),t.join("; ")}function cr(s){const e=s.id?`#${s.id}`:"",t=typeof s.className=="string"&&s.className?"."+s.className.split(/\s+/).filter(Boolean).slice(0,2).join("."):"";return`<${s.tagName.toLowerCase()}${e}${t}>`}function dr(s){const e=s.tolerance??1.5;let t=0,o=0;if(s.offsetParent instanceof Element){const l=s.offsetParent.getBoundingClientRect(),c=getComputedStyle(s.offsetParent);t=l.x+(parseFloat(c.borderLeftWidth)||0),o=l.y+(parseFloat(c.borderTopWidth)||0)}const i=s.panel.getBoundingClientRect(),r=i.x-(t+s.expectedX),n=i.y-(o+s.expectedY);if(Math.abs(r)<e&&Math.abs(n)<e)return null;const a=ar(s.reference,r,n);return{driftX:r,driftY:n,culprit:a,culpritDescription:a?cr(a):"an ancestor element (could not auto-identify)",culpritCss:a?lr(a):""}}function hr(s,e){var i;const t=(i=s.closest)==null?void 0:i.call(s,"[data-theme]"),o=t==null?void 0:t.getAttribute("data-theme");o!=null&&e.setAttribute("data-theme",o)}const ur={top:"bottom",right:"left",bottom:"top",left:"right"};function mr(s,e,t){if(!t)return;const o=e.split("-")[0],i=ur[o];s.style.left=t.x!=null?`${t.x}px`:"",s.style.top=t.y!=null?`${t.y}px`:"",s.style.right="",s.style.bottom="",s.style[i]=`-${s.offsetWidth/2}px`}function Ns(s,e){const t=[tr(s.offset??4)];if(s.matchWidth){const i=s.matchWidth;t.push(Ft({apply({rects:r,elements:n}){const a=`${r.reference.width}px`;i==="exact"?n.floating.style.width=a:n.floating.style.minWidth=a}}))}e&&t.push(or({...s.lockPlacement===!0?{fallbackStrategy:"initialPlacement"}:{},...s.flipPadding!=null?{padding:s.flipPadding}:{}}));const o=s.shift??8;if(o!==!1&&t.push(sr({padding:o})),s.maxHeight){const i=typeof s.maxHeight=="object"?s.maxHeight.padding:void 0;t.push(Ft({padding:i,apply({availableHeight:r,elements:n}){n.floating.style.maxHeight=`${Math.max(0,r)}px`}}))}if(s.maxWidth){const i=typeof s.maxWidth=="object"?s.maxWidth.padding:void 0;t.push(Ft({padding:i,apply({availableWidth:r,elements:n}){n.floating.style.maxWidth=`${Math.max(0,r)}px`}}))}return s.arrow&&t.push(ir({element:s.arrow.element,padding:s.arrow.padding})),t}function Ge(s,e,t={}){const o=t.strategy??"fixed";t.inheritThemeFrom&&hr(t.inheritThemeFrom,s),s.style.position=o,s.style.left="0",s.style.top="0";let i=t.placement??"bottom-start",r=t.flip??!0,n=Ns(t,r);const a=t.lockPlacement==="freeze";let l=!1;const c=!!t.fixedContainingBlock&&!t.platform,d=t.platform??(c?{...Es,getOffsetParent:()=>zs(s)}:void 0),h=()=>{var m;(m=t.beforeCompute)==null||m.call(t),rr(e,s,{placement:i,strategy:o,middleware:n,...d?{platform:d}:{}}).then(({x:g,y:b,placement:y,middlewareData:v})=>{var w,C;if(s.style.left=`${g}px`,s.style.top=`${b}px`,t.arrow&&mr(t.arrow.element,y,v.arrow),a&&!l&&(l=!0,i=y,r=!1,n=Ns(t,!1)),(w=t.onPlaced)==null||w.call(t,y),(C=t.onComputed)==null||C.call(t,{x:g,y:b,placement:y}),t.onDrift&&e instanceof Element){const E=c?zs(s):window,A=dr({panel:s,reference:e,expectedX:g,expectedY:b,offsetParent:E});A&&t.onDrift(A)}})};let f;return t.autoUpdate??!0?f=er(e,s,h,t.autoUpdateOptions):h(),{update:h,destroy(){f==null||f(),f=void 0}}}function pr(s){return typeof s=="number"?{show:s,hide:s}:{show:(s==null?void 0:s.show)??0,hide:(s==null?void 0:s.hide)??0}}function fr(s){const e=s.container??document.body,t=s.placement??"top",o=s.visibleClass??"is-visible",i=pr(s.delay),r=document.createElement("div");r.setAttribute("role","tooltip"),s.cssClass&&(r.className=s.cssClass),typeof s.content=="string"?r.textContent=s.content:r.append(s.content);let n,a=!1,l,c,d;const h={getBoundingClientRect:()=>d??s.trigger.getBoundingClientRect(),contextElement:s.trigger},f=w=>{d=new DOMRect(w.clientX,w.clientY,0,0),n==null||n.update()},m=()=>{l&&clearTimeout(l),c&&clearTimeout(c),l=c=void 0},g=()=>{var C;if(m(),a)return;(C=s.onBeforeShow)==null||C.call(s),a=!0,e.append(r);const w=s.followCursor?h:s.trigger;n=Ge(r,w,{placement:t,strategy:s.strategy,offset:s.offset??8,inheritThemeFrom:s.inheritThemeFrom??s.trigger}),s.followCursor&&s.trigger.addEventListener("mousemove",f),r.classList.add(o)},b=()=>{m(),a&&(a=!1,r.classList.remove(o),s.followCursor&&s.trigger.removeEventListener("mousemove",f),n==null||n.destroy(),n=void 0,r.remove())},y=()=>{m(),i.show>0?l=setTimeout(g,i.show):g()},v=()=>{m(),i.hide>0?c=setTimeout(b,i.hide):b()};return s.trigger.addEventListener("mouseenter",y),s.trigger.addEventListener("mouseleave",v),s.trigger.addEventListener("focusin",y),s.trigger.addEventListener("focusout",v),{element:r,get isVisible(){return a},show:g,hide:b,destroy(){s.trigger.removeEventListener("mouseenter",y),s.trigger.removeEventListener("mouseleave",v),s.trigger.removeEventListener("focusin",y),s.trigger.removeEventListener("focusout",v),b()}}}function gr(s){const e=s.container??document.body;let t,o=!1;const i=s.inheritThemeFrom??(s.reference instanceof HTMLElement?s.reference:void 0);return{get isOpen(){return o},open(){o||(o=!0,e.append(s.panel),t=Ge(s.panel,s.reference,{placement:s.placement??"bottom-start",strategy:s.strategy,offset:s.offset,matchWidth:s.matchWidth,lockPlacement:s.lockPlacement,...s.flip!==void 0?{flip:s.flip}:{},...s.shift!==void 0?{shift:s.shift}:{},...s.autoUpdate!==void 0?{autoUpdate:s.autoUpdate}:{},...s.beforeCompute?{beforeCompute:s.beforeCompute}:{},...s.platform?{platform:s.platform}:{},...i?{inheritThemeFrom:i}:{},...s.onPlaced?{onPlaced:s.onPlaced}:{}}))},close(){o&&(o=!1,t==null||t.destroy(),t=void 0,s.panel.remove())},update(){t==null||t.update()},destroy(){this.close()}}}const Vs=["INIT","DATA","UI","INTERACTION"],ne=gi("MULTISELECT",Vs),Xe=ne.loggers.INIT,j=ne.loggers.DATA,Y=ne.loggers.UI,U=ne.loggers.INTERACTION,br=Vs.map(s=>`MULTISELECT:${s}`);function vr(){ne.enableLogging()}function yr(){ne.disableLogging()}function wr(s){ne.setLogLevel(s)}function xr(s,e){const t=s.includes(":")?s.split(":").pop():s;ne.setCategoryLevel(t,e)}class Ds{constructor(e){u(this,"container");u(this,"wrapper");u(this,"viewport");u(this,"itemHeight");u(this,"items");u(this,"renderItem");u(this,"bufferSize");u(this,"onVisibleRangeChange");u(this,"onScroll");u(this,"scrollTop",0);u(this,"viewportHeight",0);u(this,"visibleStart",0);u(this,"visibleEnd",0);u(this,"scrollHandler");u(this,"resizeObserver");this.container=e.container,this.itemHeight=e.itemHeight,this.items=e.items,this.renderItem=e.renderItem,this.bufferSize=e.bufferSize??10,this.onVisibleRangeChange=e.onVisibleRangeChange,this.onScroll=e.onScroll,this.scrollHandler=this.handleScroll.bind(this),this.init()}init(){this.container.innerHTML="",this.wrapper=document.createElement("div"),this.wrapper.style.position="relative",this.wrapper.style.width="100%",this.wrapper.style.height=`${this.items.length*this.itemHeight}px`,this.wrapper.className="ms__virtual-scroll-wrapper",this.viewport=document.createElement("div"),this.viewport.style.position="absolute",this.viewport.style.top="0",this.viewport.style.left="0",this.viewport.style.right="0",this.viewport.style.width="100%",this.viewport.className="ms__virtual-scroll-viewport",this.wrapper.appendChild(this.viewport),this.container.appendChild(this.wrapper),this.container.addEventListener("scroll",this.scrollHandler),typeof ResizeObserver<"u"&&(this.resizeObserver=new ResizeObserver(()=>{this.updateViewportHeight(),this.render()}),this.resizeObserver.observe(this.container)),this.updateViewportHeight(),this.render()}updateViewportHeight(){const e=this.container.clientHeight;e>0&&(this.viewportHeight=e)}handleScroll(){this.scrollTop=this.container.scrollTop,this.onScroll&&this.onScroll(this.scrollTop),this.render()}calculateVisibleRange(){const e=Math.floor(this.scrollTop/this.itemHeight),t=Math.ceil((this.scrollTop+this.viewportHeight)/this.itemHeight),o=Math.max(0,e-this.bufferSize),i=Math.min(this.items.length,t+this.bufferSize);return{start:o,end:i}}render(){const{start:e,end:t}=this.calculateVisibleRange();if(e===this.visibleStart&&t===this.visibleEnd)return;this.visibleStart=e,this.visibleEnd=t;let o="";for(let i=e;i<t;i++){const r=this.items[i],n=this.renderItem(r,i),a=i*this.itemHeight;o+=`<div class="ms__virtual-item" style="position: absolute; top: ${a}px; left: 0; right: 0; height: ${this.itemHeight}px;" data-index="${i}">`,o+=n,o+="</div>"}this.viewport.innerHTML=o,this.onVisibleRangeChange&&this.onVisibleRangeChange(e,t)}setItems(e){const t=e!==this.items||e.length!==this.items.length;this.items=e,this.wrapper.style.height=`${e.length*this.itemHeight}px`,this.updateViewportHeight(),t&&(this.scrollTop=0,this.container.scrollTop=0),this.visibleStart=-1,this.visibleEnd=-1,this.render()}scrollToIndex(e){if(e<0||e>=this.items.length)return;const t=e*this.itemHeight,o=t+this.itemHeight,i=this.container.scrollTop,r=i+this.viewportHeight;t<i?this.container.scrollTop=t:o>r&&(this.container.scrollTop=o-this.viewportHeight)}getVisibleRange(){return{start:this.visibleStart,end:this.visibleEnd}}getItemCount(){return this.items.length}setItemHeight(e){this.itemHeight=e,this.wrapper.style.height=`${this.items.length*e}px`,this.visibleStart=-1,this.visibleEnd=-1,this.render()}setBufferSize(e){this.bufferSize=e,this.visibleStart=-1,this.visibleEnd=-1,this.render()}refresh(){this.visibleStart=-1,this.visibleEnd=-1,this.render()}destroy(){this.container.removeEventListener("scroll",this.scrollHandler),this.resizeObserver&&this.resizeObserver.disconnect(),this.container.innerHTML=""}}function $s(s){return{treeId:"",id:-1,path:"",pathSegment:"",parentPath:void 0,level:void 0,children:{},hasChildren:!1,isSelectable:!0,data:void 0,...s}}const qe=s=>!s||typeof s=="string"&&s.trim()==="";function _r(s,e="."){if(!s||typeof s!="string")return null;const t=s.lastIndexOf(e);return t===-1?"":s.substring(0,t)}function Rs(s,e,t="."){return qe(e)?s:s.startsWith(e+t)?s.substring(e.length+t.length):s}function Hs(s,e=0,t=1,o="."){return s.split(o).slice(e,e+t).join(o)}function kr(s,e){return s.split(e).length}function ue(s,e){return s[e]}function Cr(s={}){const e=s.idMember,t=s.pathMember,o=s.getPathCallback,i=s.parentPathMember,r=s.levelMember,n=s.hasChildrenMember,a=s.isSelectableMember,l=s.getIsSelectableCallback,c=s.treeId||"multiselect-tree",d=s.orderMember,h=s.getDisplayValueCallback,f=qe(i),m=qe(r),g=qe(n),b=qe(a),y="x",v=s.treePathSeparator||".",w=$s();let C=0,E=null;const A=D=>o?o(D):t?ue(D,t):void 0,H={treePathSeparator:v,root:w,get tree(){return Object.values(w.children)},get flatNodes(){if(E)return E;const D=[],T=s.isSorted??!1,P=s.sortCallback;function M(B){let O=Object.values(B.children);T&&P&&O.length>0&&(O=P(O));for(const W of O)D.push(W),W.hasChildren&&M(W)}return M(w),E=D,D},insertArray(D){D=D||[],w.children={},C=0,E=null;const T=[];let P=D.map((M,B)=>{const O=$s();O.treeId=c,O.id=e?ue(M,e):void 0;const W=A(M);return W==null||W===""||typeof W!="string"?(T.push(`index ${B}`),null):(O.path=W,(O.id===void 0||O.id===-1)&&(O.id=W),f?O.parentPath=_r(O.path,v):O.parentPath=ue(M,i),O.pathSegment=Hs(Rs(O.path,O.parentPath??"",v),0,1,v),m?O.level=kr(O.path,v):O.level=ue(M,r),g||(O.hasChildren=ue(M,n)),O.data=M,O)}).filter(M=>M!==null);s.isSorted||(s.sortCallback?P=s.sortCallback(P):P=q(P));for(const M of P)K(M.parentPath??"",M);if(l||!b)for(const M of P)if(l)M.isSelectable=l(M)!==!1;else{const B=ue(M.data,a);M.isSelectable=B==null?!0:!!B}T.length>0&&console.warn(`[ltree ${c}] ${T.length} option(s) had an invalid path and were skipped (pathMember="${t}"). Offending: ${T.slice(0,5).join(", ")}`+(T.length>5?", …":""))},getNodeByPath(D,T){let P=T||w;if(D){const M=D.split(v);for(let B=0;B<M.length;B++){const O=y+M[B];if(!P.children.hasOwnProperty(O))return null;P=P.children[O]}}return P}};function K(D,T){const P=H.getNodeByPath(D);if(!P)return`Node: ${T.path} - Could not find parent node: ${D}`;m&&(T.level=(P.level||0)+1);const M=y+Hs(Rs(T.path,D,v),0,1,v);return P.children.hasOwnProperty(M)||(P.children[M]=T,g&&!P.hasChildren&&(P.hasChildren=!0),C=Math.max(C,T.level||0)),null}function q(D){return D.sort((T,P)=>{const M=T.level||0,B=P.level||0;if(M!==B)return M-B;if(T.parentPath!==P.parentPath)return T.parentPath?P.parentPath?T.parentPath.localeCompare(P.parentPath):1:-1;if(d&&T.data&&P.data){const O=ue(T.data,d)??0,W=ue(P.data,d)??0;if(O!==W)return O-W}return h?h(T).localeCompare(h(P)):T.path.localeCompare(P.path)})}return H}function Bs(s,e){const t=new Map,o=new Map,i=new Set,r=l=>String(e(l.data)),n=l=>{t.set(r(l),l);const c=[];for(const h of Object.values(l.children))c.push(...n(h));let d;return c.length>0?d=c:l.isSelectable!==!1?(d=[r(l)],i.add(l.path)):d=[],o.set(l.path,d),d},a=s.tree;for(const l of a)n(l);return{nodeByValue:t,atomsUnder:o,atomPaths:i,roots:a}}function jt(s,e,t){const o=s.atomsUnder.get(e.path);if(!o||o.length===0)return"unchecked";let i=0;for(const r of o)t.has(r)&&i++;return i===0?"unchecked":i===o.length?"checked":"indeterminate"}function Ye(s,e){const t=new Set;for(const o of e){const i=s.nodeByValue.get(String(o));if(i)for(const r of s.atomsUnder.get(i.path)??[])t.add(r)}return t}function Sr(s,e,t){const o=s.atomsUnder.get(e.path)??[],i=new Set(t),r=jt(s,e,t),n=[],a=[];if(r==="checked")for(const l of o)i.delete(l)&&a.push(l);else for(const l of o)i.has(l)||(i.add(l),n.push(l));return{checkedAtoms:i,addedAtoms:n,removedAtoms:a}}function Ut(s,e,t,o){const i=a=>String(o(a.data)),r=[],n=a=>{const l=jt(s,a,e);if(l==="unchecked")return;const c=a.isSelectable!==!1,d=Object.values(a.children);if(t==="leaves"){s.atomPaths.has(a.path)&&l==="checked"&&r.push(i(a));for(const h of d)n(h);return}if(t==="all"){l==="checked"&&c&&r.push(i(a));for(const h of d)n(h);return}if(l==="checked"&&c){r.push(i(a));return}for(const h of d)n(h)};for(const a of s.roots)n(a);return r}class Ks{constructor(e,t={}){u(this,"element");u(this,"instanceId");u(this,"options");u(this,"isOpen",!1);u(this,"selectedValues",new Set);u(this,"selectedOptions",new Map);u(this,"allOptions",[]);u(this,"filteredOptions",[]);u(this,"tree",null);u(this,"treeNodes",[]);u(this,"cascadeIndex",null);u(this,"cascadeCheckedAtoms",new Set);u(this,"hiddenInputs",[]);u(this,"focusedIndex",-1);u(this,"keyboardController",null);u(this,"matchingIndices",new Set);u(this,"searchTerm","");u(this,"isLoading",!1);u(this,"searchDebounceTimer");u(this,"searchAbortController");u(this,"showSelectedPopover",!1);u(this,"selectedPopoverPlacement",null);u(this,"dropdownPlacement",null);u(this,"isRTL",!1);u(this,"effectiveBadgesPosition","bottom");u(this,"justClosedViaClick",!1);u(this,"justOpenedViaClick",!1);u(this,"positioningDriftWarned",!1);u(this,"presentationMode","floating");u(this,"fullscreenHeader",null);u(this,"fullscreenSearchInput",null);u(this,"fullscreenSearchClear",null);u(this,"fullscreenModeToggle",null);u(this,"fullscreenNav",null);u(this,"fullscreenNavCount",null);u(this,"fullscreenNavPrev",null);u(this,"fullscreenNavNext",null);u(this,"bodyScrollUnlock",null);u(this,"overflowXClamp",null);u(this,"keyboardInsetCleanup",null);u(this,"overlayHistoryActive",!1);u(this,"onOverlayPopstate",()=>this.handleOverlayPopstate());u(this,"dropdownCleanup",null);u(this,"hintCleanup",null);u(this,"selectedPopoverCleanup",null);u(this,"tooltips",new Map);u(this,"labelRevealTrigger",null);u(this,"labelRevealPanel",null);u(this,"labelRevealPopover",null);u(this,"messageEl",null);u(this,"messageCleanup",null);u(this,"messageTimer",null);u(this,"onDropdownScroll",()=>{this.hideOptionTooltips(),this.hideLabelReveal()});u(this,"virtualScroll",null);u(this,"optionsContainer",null);u(this,"selectedPopoverVirtualScroll",null);u(this,"selectedPopoverContainer",null);u(this,"input");u(this,"dropdown");u(this,"dropdownInner");u(this,"badgesContainer");u(this,"counter");u(this,"hint");u(this,"selectedPopover");u(this,"documentKeydownHandler",null);u(this,"documentClickHandler",null);this.element=e,this.instanceId=`MS-${Math.random().toString(36).slice(2,11)}`,this.options={searchHint:e.dataset.searchHint||"",searchPlaceholder:e.dataset.searchPlaceholder||void 0,selectPlaceholder:e.dataset.selectPlaceholder||"Pick an option...",noDataPlaceholder:e.dataset.noDataPlaceholder||void 0,dropdownMinWidth:e.dataset.dropdownMinWidth||void 0,dropdownMaxWidth:e.dataset.dropdownMaxWidth||void 0,badgesDisplayMode:e.dataset.badgesDisplayMode||"badges",badgesPosition:e.dataset.badgesPosition||"bottom",badgesThresholdMode:e.dataset.badgesThresholdMode||"count",maxHeight:e.dataset.maxHeight||"20rem",emptyMessage:e.dataset.emptyMessage||"No results found",loadingMessage:e.dataset.loadingMessage||"Loading...",searchInputMode:e.dataset.searchInputMode||"normal",searchMode:e.dataset.searchMode||"filter",badgesThreshold:e.dataset.badgesThreshold?parseInt(e.dataset.badgesThreshold):void 0,minSearchLength:parseInt(e.dataset.minSearchLength||"0")||0,searchDebounce:parseInt(e.dataset.searchDebounce||"0")||0,isMultipleEnabled:e.dataset.multiple!=="false",isGroupsAllowed:e.dataset.allowGroups!=="false",isCheckboxesShown:e.dataset.showCheckboxes!=="false",isActionsSticky:e.dataset.stickyActions!=="false",isCloseOnSelect:e.dataset.closeOnSelect==="true",isPlacementLocked:e.dataset.lockPlacement!=="false",isSearchEnabled:e.dataset.enableSearch!=="false",isAddNewAllowed:e.dataset.allowAddNew==="true",isCounterShown:e.dataset.showCounter==="true",isSearchModeToggleShown:e.dataset.showSearchModeToggle==="true",isKeepOptionsOnSearch:e.dataset.keepOptionsOnSearch!=="false",shouldKeepSearchOnClose:e.dataset.keepSearchOnClose!=="false",options:[],container:void 0,...t},this.init()}extractField(e,t){if(Array.isArray(e)&&e.length===2){if(t.tupleSkip)return typeof t.fallback=="function"?t.fallback():t.fallback;if(t.tupleIndex!==void 0){const i=e[t.tupleIndex];return t.transform?t.transform(i):i}}if(t.member&&e[t.member]!==void 0){const i=e[t.member];return t.transform?t.transform(i):i}return t.callback?t.callback(e):typeof t.fallback=="function"?t.fallback():t.fallback}getItemValue(e){return this.extractField(e,{tupleIndex:0,member:this.options.valueMember,callback:this.options.getValueCallback,fallback:"[N/A]"})}getItemDisplayValue(e){return this.extractField(e,{tupleIndex:1,member:this.options.displayValueMember,callback:this.options.getDisplayValueCallback,transform:String,fallback:"[N/A]"})}getItemBadgeDisplayValue(e){if(this.options.getBadgeDisplayCallback)return this.options.getBadgeDisplayCallback(e);if(this.options.isBadgeFullTitleShown){const t=this.getItemFullTitle(e);if(t)return t}return this.getItemDisplayValue(e)}getItemFullTitle(e){return this.extractField(e,{tupleSkip:!0,member:this.options.fullTitleMember,callback:this.options.getFullTitleCallback,transform:String,fallback:void 0})}getItemSearchValue(e){return this.extractField(e,{member:this.options.searchValueMember,callback:this.options.getSearchValueCallback,transform:String,fallback:()=>this.getItemDisplayValue(e)})}getItemIcon(e){return this.extractField(e,{tupleSkip:!0,member:this.options.iconMember,callback:this.options.getIconCallback,transform:String,fallback:void 0})}getItemSubtitle(e){return this.extractField(e,{tupleSkip:!0,member:this.options.subtitleMember,callback:this.options.getSubtitleCallback,transform:String,fallback:void 0})}getItemGroup(e){return this.extractField(e,{tupleSkip:!0,member:this.options.groupMember,callback:this.options.getGroupCallback,transform:String,fallback:void 0})}getItemDisabled(e){return this.extractField(e,{tupleSkip:!0,member:this.options.disabledMember,callback:this.options.getDisabledCallback,transform:Boolean,fallback:!1})}isIndexSelectable(e){if(!this.isTreeMode())return!0;const t=this.treeNodes[e];return t?t.isSelectable!==!1:!0}isOptionSelectable(e){if(!this.isTreeMode())return!0;const t=this.filteredOptions.indexOf(e);if(t>=0)return this.isIndexSelectable(t);const o=String(this.getItemValue(e)),i=this.treeNodes.find(r=>String(this.getItemValue(r.data))===o);return i?i.isSelectable!==!1:!0}init(){this.parseOptions(),this.buildHTML(),this.attachEvents(),this.parseInitialSelection(),Xe.debug(`Initialized [${this.instanceId}] with options:`,{placeholder:this.options.searchPlaceholder,totalOptions:this.allOptions.length,isCloseOnSelect:this.options.isCloseOnSelect,dataAttribute:this.element.dataset.closeOnSelect})}parseOptions(){const e=this.element.dataset.options;if(e)try{this.allOptions=JSON.parse(e)}catch(t){j.error(`[${this.instanceId}] Failed to parse data-options:`,t),this.allOptions=[]}else this.options.options&&(this.allOptions=this.options.options);this.filteredOptions=[...this.allOptions],this.isTreeMode()&&this.buildTree()}isTreeMode(){return this.options.isTreeEnabled===!1?!1:!!(this.options.isTreeEnabled||this.options.pathMember||this.options.getPathCallback)}buildTree(){this.tree=Cr({idMember:this.options.valueMember,pathMember:this.options.pathMember,getPathCallback:this.options.getPathCallback,parentPathMember:this.options.parentPathMember,levelMember:this.options.levelMember,hasChildrenMember:this.options.hasChildrenMember,isSelectableMember:this.options.isSelectableMember,getIsSelectableCallback:this.options.getIsSelectableCallback,treePathSeparator:this.options.treePathSeparator,treeId:this.instanceId,getDisplayValueCallback:e=>this.getItemDisplayValue(e.data)}),this.tree.insertArray(this.allOptions),this.cascadeIndex=this.isCascadeMode()?Bs(this.tree,e=>String(this.getItemValue(e))):null,this.rebuildTreeVisible()}isCascadeMode(){return this.isTreeMode()&&this.options.isMultipleEnabled!==!1&&this.options.checkboxMode==="cascade"}cascadePolicy(){return this.options.cascadeSelectPolicy??"rolled-up"}refreshCascadeAtoms(){this.isCascadeMode()&&this.cascadeIndex&&(this.cascadeCheckedAtoms=Ye(this.cascadeIndex,this.selectedValues))}toggleTreeCascade(e){const t=this.cascadeIndex,o=Ye(t,this.selectedValues),{checkedAtoms:i}=Sr(t,e,o);this.commitCascadeAtoms(i)}commitCascadeAtoms(e){var l;const t=this.cascadeIndex,o=Ut(t,e,this.cascadePolicy(),c=>String(this.getItemValue(c))),i=new Set(o),r=[],n=[];for(const[c,d]of this.selectedOptions)i.has(c)||n.push(d);const a=new Map;for(const c of o){const h=((l=t.nodeByValue.get(c))==null?void 0:l.data)??this.selectedOptions.get(c);h!==void 0&&(a.set(c,h),this.selectedValues.has(c)||r.push(h))}this.selectedValues=i,this.selectedOptions=a,this.cascadeCheckedAtoms=e,this.commit({added:r,removed:n})}counterSelection(){if(this.isCascadeMode()&&this.cascadeIndex){const e=Ut(this.cascadeIndex,this.cascadeCheckedAtoms,"rolled-up",o=>String(this.getItemValue(o))),t=[];for(const o of e){const i=this.cascadeIndex.nodeByValue.get(o),r=(i==null?void 0:i.data)??this.selectedOptions.get(o);r!==void 0&&t.push(r)}return t}return Array.from(this.selectedOptions.values())}buildCounterTooltip(e){const o=e.slice(0,12).map(i=>this.getItemBadgeDisplayValue(i));return e.length>12&&o.push(`…and ${e.length-12} more`),o.join(`
|
|
2
|
+
`)}rebuildTreeVisible(){if(!this.tree){this.treeNodes=[];return}const e=this.tree.flatNodes,t=this.options.isSearchEnabled?(this.searchTerm||"").trim().toLowerCase():"";let o;if(!t)o=e;else{const i=this.tree.treePathSeparator,r=new Set;for(const n of e)if(this.getItemSearchValue(n.data).toLowerCase().includes(t)){const l=n.path.split(i);for(let c=1;c<=l.length;c++)r.add(l.slice(0,c).join(i))}o=e.filter(n=>r.has(n.path))}this.treeNodes=o,this.filteredOptions=o.map(i=>i.data)}resetVisibleToAll(){this.isTreeMode()?this.rebuildTreeVisible():this.filteredOptions=[...this.allOptions]}rebuildTreeVisibleFromMatches(e){if(!this.tree){this.treeNodes=[],this.filteredOptions=[];return}const t=this.tree.flatNodes,o=this.tree.treePathSeparator,i=new Set((e||[]).map(a=>String(this.getItemValue(a)))),r=new Set;for(const a of t)if(i.has(String(this.getItemValue(a.data)))){const l=a.path.split(o);for(let c=1;c<=l.length;c++)r.add(l.slice(0,c).join(o))}const n=t.filter(a=>r.has(a.path));this.treeNodes=n,this.filteredOptions=n.map(a=>a.data)}rebuildTreeVisibleForNavigate(){if(this.matchingIndices.clear(),!this.tree)return this.treeNodes=[],this.filteredOptions=[],-1;const e=this.tree.flatNodes;this.treeNodes=e,this.filteredOptions=e.map(i=>i.data);const t=(this.searchTerm||"").trim().toLowerCase();if(!t)return-1;let o=-1;return e.forEach((i,r)=>{this.getItemSearchValue(i.data).toLowerCase().includes(t)&&(this.matchingIndices.add(r),o===-1&&(o=r))}),o}detectRTL(){const e=this.element.getRootNode(),t=e instanceof ShadowRoot?e.host:this.element,o=t.getAttribute("dir")==="rtl",i=t.closest('[dir="rtl"]')!==null;this.isRTL=o||i,Xe.debug(`[${this.instanceId}] RTL Debug:`,{isShadowRoot:e instanceof ShadowRoot,elementDir:t.getAttribute("dir"),hasElementDir:o,hasAncestorDir:i,isRTL:this.isRTL}),this.effectiveBadgesPosition=this.options.badgesPosition||"bottom",this.isRTL&&(this.effectiveBadgesPosition==="left"?this.effectiveBadgesPosition="right":this.effectiveBadgesPosition==="right"&&(this.effectiveBadgesPosition="left"))}refreshDirection(){if(!this.element)return;const e=this.isRTL;this.detectRTL(),this.element.classList.toggle("ms--rtl",this.isRTL);const t=this.isRTL?"rtl":"ltr";this.dropdown&&(this.dropdown.dir=t),this.hint&&(this.hint.dir=t),this.selectedPopover&&(this.selectedPopover.dir=t),e!==this.isRTL&&this.renderBadges()}buildHTML(){const e=this.options.container||document.body;this.detectRTL(),this.element.classList.add("ms"),this.isRTL&&(this.element.classList.add("ms--rtl"),Xe.debug(`[${this.instanceId}] Added ms--rtl class to element`)),(!this.options.isCheckboxesShown||!this.options.isMultipleEnabled)&&this.element.classList.add("ms--no-checkboxes");const t=document.createElement("div");t.className="ms__input-wrapper",this.input=document.createElement("input"),this.input.type="text",this.input.className="ms__input",this.input.placeholder=this.getPlaceholderText(),this.input.autocomplete="off",this.options.searchInputMode==="readonly"?this.input.readOnly=!0:this.options.searchInputMode==="hidden"&&(this.input.style.display="none");const o=document.createElement("span");o.className="ms__toggle",o.innerHTML="▼",this.counter=document.createElement("span"),this.counter.className="ms__counter",this.counter.style.display="none",t.appendChild(this.input),t.appendChild(this.counter),t.appendChild(o),this.badgesContainer=document.createElement("div"),this.badgesContainer.className="ms__badges";const i=document.createElement("div");i.className="ms__wrapper",(this.effectiveBadgesPosition==="left"||this.effectiveBadgesPosition==="right")&&i.classList.add("ms__wrapper--inline"),i.appendChild(t),i.appendChild(this.badgesContainer),this.element.appendChild(i);const r=this.isRTL?"rtl":null;this.dropdown=document.createElement("div"),this.dropdown.className="ms__dropdown",r&&(this.dropdown.dir=r),this.dropdownInner=document.createElement("div"),this.dropdownInner.className="ms__dropdown-inner",this.dropdown.appendChild(this.dropdownInner),e.appendChild(this.dropdown),this.options.searchHint&&(this.hint=document.createElement("div"),this.hint.className="ms__hint",r&&(this.hint.dir=r),this.hint.textContent=this.options.searchHint,e.appendChild(this.hint)),this.selectedPopover=document.createElement("div"),this.selectedPopover.className="ms__selected-popover",r&&(this.selectedPopover.dir=r),e.appendChild(this.selectedPopover),this.renderDropdown()}shouldUseVirtualScroll(){if(!this.options.isVirtualScrollEnabled||this.options.isGroupsAllowed&&this.hasGroups())return!1;const e=this.options.virtualScrollThreshold??100;return this.filteredOptions.length>=e}hasGroups(){return this.filteredOptions.some(e=>{const t=this.getItemGroup(e);return t&&t.trim()!==""})}renderDropdown(e){var a;if(this.destroyAllActionButtonTooltips(),this.hideLabelReveal(),this.refreshCascadeAtoms(),this.shouldUseVirtualScroll()){this.dropdown.classList.add("ms__dropdown--virtual"),this.renderDropdownVirtual();return}this.dropdown.classList.remove("ms__dropdown--virtual"),this.virtualScroll&&(this.virtualScroll.destroy(),this.virtualScroll=null,this.optionsContainer=null);let t="";if(this.isLoading){t+='<div class="ms__loader">',t+='<div class="pa-loader pa-loader--sm"></div>',t+=`<div class="ms__loading-text">${this.options.loadingMessage}</div>`,t+="</div>",this.dropdownInner.innerHTML=t;return}const o=this.renderActionsHTML(),i=this.options.actionsPosition==="bottom";if(i||(t+=o),this.options.isVirtualScrollEnabled){const l=this.scaledOptionHeight();t+=`<div class="ms__options ms__options--fixed-height" style="--ms-option-height: ${l}px;">`}else t+='<div class="ms__options">';if(this.filteredOptions.length===0)t+=`<div class="ms__empty">${this.options.emptyMessage}</div>`;else if(this.isTreeMode())this.treeNodes.forEach((l,c)=>{t+=this.renderTreeNode(l,c)});else if(this.options.isGroupsAllowed){const l=this.groupOptions(this.filteredOptions),c=new Map;this.filteredOptions.forEach((d,h)=>c.set(d,h)),Object.keys(l).forEach(d=>{if(t+='<div class="ms__group">',d!=="__ungrouped__")if(this.options.renderGroupLabelContentCallback){const h=this.options.renderGroupLabelContentCallback(d);if(h instanceof HTMLElement){const f=document.createElement("div");f.className="ms__group-label",f.appendChild(h),t+=f.outerHTML}else t+=`<div class="ms__group-label">${h}</div>`}else t+=`<div class="ms__group-label">${d}</div>`;l[d].forEach(h=>{t+=this.renderOption(h,c.get(h)??-1)}),t+="</div>"})}else this.filteredOptions.forEach((l,c)=>{t+=this.renderOption(l,c)});t+="</div>",i&&(t+=o);let r=0,n=0;if(e!=null&&e.preserveScroll&&(r=this.dropdownInner.scrollTop,n=((a=this.dropdownInner.querySelector(".ms__options"))==null?void 0:a.scrollTop)??0),this.dropdownInner.innerHTML=t,e!=null&&e.preserveScroll){this.dropdownInner.scrollTop=r;const l=this.dropdownInner.querySelector(".ms__options");l&&(l.scrollTop=n)}this.attachActionButtonTooltips(),this.attachOptionTooltips(),this.markTruncatedOptions()}renderDropdownVirtual(){if(this.destroyAllActionButtonTooltips(),!this.virtualScroll){let o="";const i=this.renderActionsHTML(),r=this.options.actionsPosition==="bottom";r||(o+=i),o+='<div class="ms__options ms__options--virtual" style="overflow-y: auto; position: relative;"></div>',r&&(o+=i),this.dropdownInner.innerHTML=o,this.optionsContainer=this.dropdownInner.querySelector(".ms__options")}if(this.applyVirtualOptionsSizing(this.optionsContainer),this.filteredOptions.length===0){this.virtualScroll&&(this.virtualScroll.destroy(),this.virtualScroll=null),this.optionsContainer.innerHTML=`<div class="ms__empty">${this.options.emptyMessage}</div>`;return}const e=this.scaledOptionHeight(),t=this.options.virtualScrollBuffer??10;requestAnimationFrame(()=>{this.optionsContainer&&(this.virtualScroll?(this.virtualScroll.setItemHeight(e),this.virtualScroll.setItems(this.filteredOptions)):this.virtualScroll=new Ds({container:this.optionsContainer,itemHeight:e,items:this.filteredOptions,renderItem:(o,i)=>this.isTreeMode()?this.renderTreeNode(this.treeNodes[i],i):this.renderOption(o,i),bufferSize:t,onVisibleRangeChange:()=>{this.attachOptionTooltips(),this.markTruncatedOptions()}}),this.attachActionButtonTooltips())})}getBuiltInActionDisabled(e){return e==="select-all"?!this.filteredOptions.some(t=>!this.getItemDisabled(t)&&!this.selectedValues.has(String(this.getItemValue(t)))):e==="clear-all"?this.selectedValues.size===0:!1}renderActionsHTML(){const e=this.options.actionButtons;if(!this.options.isMultipleEnabled||!e||e.length===0)return"";const t=this.options.actionsPosition==="bottom"?"bottom":"top",o=this.options.actionsAlign??"stretch",i=` ms__actions--${t}`,r=this.options.isActionsSticky?" ms__actions--sticky":"",n=this.options.actionsLayout==="wrap"?" ms__actions--wrap":"",a=` ms__actions--align-${o}`,l=new Map;if(e.forEach((d,h)=>{if(!(d.getIsVisibleCallback?d.getIsVisibleCallback(this):d.isVisible??!0))return;let m;d.getIsDisabledCallback?m=d.getIsDisabledCallback(this):d.isDisabled!==void 0?m=d.isDisabled:m=this.getBuiltInActionDisabled(d.action);const g=m?" disabled":"",b=d.getTextCallback?d.getTextCallback(this):d.text;let y="";if(d.getClassCallback){const C=d.getClassCallback(this);y=Array.isArray(C)?` ${C.join(" ")}`:C?` ${C}`:""}else d.cssClass&&(y=` ${d.cssClass}`);const v=Math.max(1,Math.floor(d.row??1)),w=`<button type="button"${g} class="ms__action-btn${y}" data-action="${d.action}" data-button-index="${h}">${b}</button>`;l.has(v)||l.set(v,[]),l.get(v).push(w)}),l.size===0)return"";const c=Array.from(l.keys()).sort((d,h)=>d-h).map(d=>`<div class="ms__actions-row" data-row="${d}">${l.get(d).join("")}</div>`).join("");return`<div class="ms__actions${i}${r}${n}${a}">${c}</div>`}renderOption(e,t){const o=this.getItemValue(e),i=this.getItemDisplayValue(e),r=this.getItemIcon(e),n=this.getItemSubtitle(e),a=this.getItemDisabled(e),l=this.selectedValues.has(String(o)),c=t===this.focusedIndex,d=this.matchingIndices.has(t),h=["ms__option"];l&&h.push("ms__option--selected"),c&&h.push("ms__option--focused"),d&&h.push("ms__option--matched"),a&&h.push("ms__option--disabled");const f=this.options.checkboxAlign&&this.options.checkboxAlign!=="center"?` data-checkbox-align="${this.options.checkboxAlign}"`:"";let m=`<div class="${h.join(" ")}" data-value="${o}" data-index="${t}"${f}>`;if(this.options.isCheckboxesShown&&this.options.isMultipleEnabled&&(m+=`<input type="checkbox" class="ms__checkbox" ${l?"checked":""} ${a?"disabled":""}>`),m+='<div class="ms__option-content">',this.options.renderOptionContentCallback){const g={index:t,isSelected:l,isFocused:c,isMatched:d,isDisabled:a,...At(this.presentationMode),isTreeNode:!1},b=this.options.renderOptionContentCallback(e,g);typeof b=="string"?m+=b:m+=b.outerHTML}else r&&(m+=`<span class="ms__option-icon">${r}</span>`),m+='<div class="ms__option-text">',m+=`<div class="ms__option-title">${this.highlightMatch(i,this.searchTerm)}</div>`,n&&(m+=`<div class="ms__option-subtitle">${n}</div>`),m+="</div>";return m+=this.renderOptionInfoButton(),m+="</div>",m+="</div>",m}renderOptionInfoButton(){return this.presentationMode!=="fullscreen"?"":'<button type="button" class="ms__option-info" tabindex="-1" aria-label="Show full label"></button>'}renderTreeNode(e,t){const o=e.data,i=this.getItemValue(o),r=this.getItemDisplayValue(o),n=this.getItemIcon(o),a=this.getItemSubtitle(o),l=this.getItemDisabled(o),c=this.isCascadeMode()&&this.cascadeIndex,d=c?jt(this.cascadeIndex,e,this.cascadeCheckedAtoms):null,h=c?d==="checked":this.selectedValues.has(String(i)),f=d==="indeterminate",m=t===this.focusedIndex,g=this.matchingIndices.has(t),b=e.isSelectable!==!1,y=e.level??1,v=Math.max(0,y-1),w=["ms__option","ms__option--tree"];w.push(e.hasChildren?"ms__option--tree-branch":"ms__option--tree-leaf"),h&&w.push("ms__option--selected"),f&&w.push("ms__option--indeterminate"),m&&w.push("ms__option--focused"),g&&w.push("ms__option--matched"),l&&w.push("ms__option--disabled"),b||w.push("ms__option--tree-unselectable");const C=this.options.checkboxAlign&&this.options.checkboxAlign!=="center"?` data-checkbox-align="${this.options.checkboxAlign}"`:"",E=b?"":' data-selectable="false"';let A=`<div class="${w.join(" ")}" data-value="${i}" data-index="${t}" data-path="${e.path}" data-level="${y}" style="--ms-tree-depth: ${v};"${C}${E}>`;if(this.options.isCheckboxesShown&&this.options.isMultipleEnabled&&b&&(A+=`<input type="checkbox" class="${f?"ms__checkbox ms__checkbox--indeterminate":"ms__checkbox"}" ${h?"checked":""}${f?' aria-checked="mixed"':""} ${l?"disabled":""}>`),A+='<div class="ms__option-content">',this.options.renderOptionContentCallback){const H={index:t,isSelected:h,isFocused:m,isMatched:g,isDisabled:l,...At(this.presentationMode),isTreeNode:!0,isBranch:e.hasChildren,isLeaf:!e.hasChildren,childCount:Object.keys(e.children).length,level:y,depth:v,path:e.path,isSelectable:b,isIndeterminate:f},K=this.options.renderOptionContentCallback(o,H);A+=typeof K=="string"?K:K.outerHTML}else n&&(A+=`<span class="ms__option-icon">${n}</span>`),A+='<div class="ms__option-text">',A+=`<div class="ms__option-title">${this.highlightMatch(r,this.searchTerm)}</div>`,a&&(A+=`<div class="ms__option-subtitle">${a}</div>`),A+="</div>";return A+=this.renderOptionInfoButton(),A+="</div>",A+="</div>",A}highlightMatch(e,t){if(!t)return e;const o=new RegExp(`(${t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")})`,"gi");return e.replace(o,"<mark>$1</mark>")}groupOptions(e){const t={};return e.forEach(o=>{const i=this.getItemGroup(o)||"__ungrouped__";t[i]||(t[i]=[]),t[i].push(o)}),t}get isSearchUsable(){return!!this.options.isSearchEnabled&&this.options.searchInputMode!=="readonly"&&this.options.searchInputMode!=="hidden"}getPlaceholderText(){return this.options.noDataPlaceholder&&this.allOptions.length===0?this.options.noDataPlaceholder:this.isSearchUsable?this.getSearchPlaceholder():this.options.selectPlaceholder||this.getSearchPlaceholder()}getSearchPlaceholder(){return this.options.searchPlaceholder?this.options.searchPlaceholder:this.options.isSearchModeToggleShown?(this.options.searchMode||"filter")==="navigate"?"Search…":"Filter…":"Search..."}refreshSearchPlaceholder(){const e=this.getPlaceholderText();this.input&&(this.input.placeholder=e),this.fullscreenSearchInput&&(this.fullscreenSearchInput.placeholder=e)}renderBadges(){this.destroyAllBadgeTooltips();const e=Array.from(this.selectedOptions.values()),t=this.selectedValues.size;if(!this.options.isMultipleEnabled){this.badgesContainer.innerHTML="",this.counter.style.display="none";let r;e[0]&&(this.options.renderSelectedContentCallback?r=this.options.renderSelectedContentCallback(e[0]):r=this.getItemDisplayValue(e[0])),!this.isOpen&&t>0&&e.length>0?this.input.value=r:this.isOpen||(this.input.value="");return}let o=this.options.badgesDisplayMode;if(this.options.badgesThreshold!==null&&t>this.options.badgesThreshold&&o!=="none"&&(o=this.options.badgesThresholdMode||"count"),!this.isOpen)if(t>0&&o==="count"){const r=this.options.getCounterCallback?this.options.getCounterCallback(t):`${t} selected`;this.input.placeholder=r}else this.input.placeholder=this.getPlaceholderText();if(this.options.isCounterShown&&t>0){const r=this.counterSelection(),n=r.length;this.counter.textContent=`[${n}]`,this.counter.title=this.buildCounterTooltip(r),this.counter.style.display=n>0?"":"none"}else this.counter.title="",this.counter.style.display="none";if(o==="none"){this.badgesContainer.innerHTML="";return}if(o==="badges")this.badgesContainer.className=`ms__badges ms__badges--${this.effectiveBadgesPosition}`,this.badgesContainer.innerHTML=e.map(r=>this.renderBadgeHTML(r,{displayMode:"badges",isInPopover:!1})).join("");else if(o==="partial"){this.badgesContainer.className=`ms__badges ms__badges--${this.effectiveBadgesPosition}`;const r=this.options.badgesMaxVisible||3,n=e.slice(0,r),a=t-r,l=n.map(d=>this.renderBadgeHTML(d,{displayMode:"partial",isInPopover:!1})).join("");let c="";a>0&&(c=`
|
|
3
3
|
<div class="ms__badge ms__badge--counter ms__badge--more" data-action="show-selected">
|
|
4
4
|
<span class="ms__badge-text">${this.options.getCounterCallback?this.options.getCounterCallback(t,a):`+${a} more`}</span>
|
|
5
5
|
<button type="button" class="ms__badge-remove" data-action="remove-hidden" aria-label="Remove ${a} hidden items"></button>
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
<span class="ms__badge-text">${r}</span>
|
|
15
15
|
<button type="button" class="ms__badge-remove" data-action="clear-count" aria-label="Clear all selections"></button>
|
|
16
16
|
</div>
|
|
17
|
-
`}else this.badgesContainer.innerHTML="";this.attachBadgeTooltips()}attachEvents(){this.input.addEventListener("mousedown",e=>{e.stopPropagation(),this.isOpen?(this.justClosedViaClick=!0,this.close(),setTimeout(()=>{this.justClosedViaClick=!1},0)):(this.presentationMode==="fullscreen"&&e.preventDefault(),this.justOpenedViaClick=!0,this.open(),setTimeout(()=>{this.justOpenedViaClick=!1},0))}),this.input.addEventListener("focus",()=>{!this.isOpen&&!this.justClosedViaClick&&this.open()}),this.input.addEventListener("input",e=>{const t=e.target.value;this.options.isSearchEnabled&&!this.isOpen&&this.open(),this.handleSearch(t)}),this.input.addEventListener("keydown",e=>this.handleKeydown(e)),this.documentClickHandler=e=>this.handleClickOutside(e),setTimeout(()=>{document.addEventListener("click",this.documentClickHandler)},0),this.documentKeydownHandler=e=>{e.key==="Escape"&&this.showSelectedPopover&&(e.preventDefault(),this.hideSelectedPopover())},document.addEventListener("keydown",this.documentKeydownHandler),this.dropdown.addEventListener("mousedown",e=>{if(this.presentationMode!=="fullscreen")return;e.target.closest(".ms__option")&&e.preventDefault()}),this.dropdown.addEventListener("touchmove",e=>{var t;this.presentationMode==="fullscreen"&&e.target.closest(".ms__options")&&((t=this.fullscreenSearchInput)==null||t.blur())},{passive:!0}),this.dropdown.addEventListener("click",e=>this.handleDropdownClick(e)),this.dropdownInner.addEventListener("wheel",e=>{if(this.virtualScroll)return;const t=e.currentTarget,o=t.scrollTop===0,i=t.scrollTop+t.clientHeight>=t.scrollHeight;(e.deltaY<0&&o||e.deltaY>0&&i)&&e.preventDefault(),e.stopPropagation()},{passive:!1}),this.badgesContainer.addEventListener("mousedown",e=>{e.target.closest('[data-action="show-selected"]')&&!this.showSelectedPopover&&e.stopPropagation()}),this.badgesContainer.addEventListener("click",e=>this.handleBadgeClick(e)),this.counter.addEventListener("mousedown",e=>{this.showSelectedPopover||e.stopPropagation()}),this.counter.addEventListener("click",e=>{e.stopPropagation(),this.toggleSelectedPopover()}),this.selectedPopover.addEventListener("click",e=>this.handleSelectedPopoverClick(e))}async handleSearch(e){if(this.searchTerm=e,!this.options.isSearchEnabled)return;let t=e;if(this.options.beforeSearchCallback){const o=this.options.beforeSearchCallback(e);if(o===null){j.debug(`[${this.instanceId}] beforeSearchCallback blocked search for term:`,e),this.abortInFlightSearch(),this.matchingIndices.clear(),this.isTreeMode()?(this.searchTerm="",this.rebuildTreeVisible()):this.filteredOptions=[...this.allOptions],this.renderDropdown();return}t=o,t!==e&&j.debug(`[${this.instanceId}] beforeSearchCallback transformed: "${e}" -> "${t}"`)}if(this.options.searchCallback){if(t.length<this.options.minSearchLength){this.abortInFlightSearch(),this.isLoading=!1,this.options.isKeepOptionsOnSearch?(this.isTreeMode()?this.rebuildTreeVisibleFromMatches(this.allOptions):this.filteredOptions=[...this.allOptions],j.debug(`[${this.instanceId}] Search term below minimum, showing ${this.allOptions.length} initial options`)):(this.filteredOptions=[],this.isTreeMode()&&(this.treeNodes=[])),this.matchingIndices.clear(),this.renderDropdown();return}this.searchDebounceTimer&&(clearTimeout(this.searchDebounceTimer),this.searchDebounceTimer=void 0);const o=this.options.searchDebounce||0;o>0?this.searchDebounceTimer=setTimeout(()=>{this.searchDebounceTimer=void 0,this.searchTerm===e&&this.performAsyncSearch(e,t)},o):await this.performAsyncSearch(e,t)}else{if(this.isTreeMode()){if((this.options.searchMode||"filter")==="navigate"){const o=this.rebuildTreeVisibleForNavigate();this.searchTerm.trim()?o>=0&&(this.focusedIndex=o):this.focusedIndex=this.filteredOptions.length>0?0:-1,this.renderDropdown(),this.focusedIndex>=0&&this.scrollToFocused(),this.updateFullscreenNav();return}this.rebuildTreeVisible(),this.matchingIndices.clear(),this.focusedIndex=this.filteredOptions.length>0?0:-1,this.renderDropdown();return}if(!t)this.filteredOptions=[...this.allOptions],this.matchingIndices.clear(),this.focusedIndex=this.filteredOptions.length>0?0:-1;else{const o=this.options.searchMode||"filter",i=t.toLowerCase();if(o==="filter")this.filteredOptions=this.allOptions.filter(r=>this.getItemSearchValue(r).toLowerCase().includes(i)),this.matchingIndices.clear(),this.focusedIndex=this.filteredOptions.length>0?0:-1,j.debug(`[${this.instanceId}] Filter mode: ${this.filteredOptions.length} matches for "${t}"`);else{this.filteredOptions=[...this.allOptions],this.matchingIndices.clear();let r=-1;this.allOptions.forEach((n,a)=>{this.getItemSearchValue(n).toLowerCase().includes(i)&&(this.matchingIndices.add(a),r===-1&&(r=a))}),r>=0?(this.focusedIndex=r,j.debug(`[${this.instanceId}] Navigate mode: ${this.matchingIndices.size} matches, jumped to index ${r}`)):j.debug(`[${this.instanceId}] Navigate mode: No matches found, keeping previous focus`)}}this.renderDropdown(),this.options.searchMode==="navigate"&&this.focusedIndex>=0&&this.scrollToFocused(),this.updateFullscreenNav()}}abortInFlightSearch(){this.searchAbortController&&(this.searchAbortController.abort(),this.searchAbortController=void 0)}async performAsyncSearch(e,t){this.abortInFlightSearch();const o=new AbortController;this.searchAbortController=o,this.isLoading=!0,this.renderDropdown(),j.debug(`[${this.instanceId}] Loading data for search term:`,t);try{const i=await this.options.searchCallback(t,o.signal);if(o.signal.aborted||this.searchTerm!==e)return;const r=i||[];this.isTreeMode()?this.rebuildTreeVisibleFromMatches(r):this.filteredOptions=[...r],this.isLoading=!1,this.matchingIndices.clear(),this.focusedIndex=this.options.isSearchEnabled&&this.filteredOptions.length>0?0:-1,this.renderDropdown(),j.debug(`[${this.instanceId}] Loaded ${r.length} results`)}catch(i){if(o.signal.aborted)return;j.error(`[${this.instanceId}] Error loading data:`,i),this.isLoading=!1,this.options.isKeepOptionsOnSearch?this.isTreeMode()?this.rebuildTreeVisibleFromMatches(this.allOptions):this.filteredOptions=[...this.allOptions]:(this.filteredOptions=[],this.isTreeMode()&&(this.treeNodes=[])),this.matchingIndices.clear(),this.renderDropdown()}finally{this.searchAbortController===o&&(this.searchAbortController=void 0)}}handleKeydown(e){var t;if(!this.isOpen){(e.key==="Enter"||e.key==="ArrowDown")&&(e.preventDefault(),this.open());return}if(!this.options.isSearchEnabled){const o=e.key.length===1||e.key==="Backspace"||e.key==="Delete",i=["ArrowUp","ArrowDown","PageUp","PageDown","Home","End","Enter","Escape","Tab"].includes(e.key);if(o&&!i){e.preventDefault();return}}switch(e.key){case"ArrowDown":e.preventDefault(),e.ctrlKey||e.metaKey?this.focusNextMatch():this.focusNext();break;case"ArrowUp":e.preventDefault(),e.ctrlKey||e.metaKey?this.focusPreviousMatch():this.focusPrevious();break;case"Enter":e.preventDefault(),this.focusedIndex>=0?this.toggleOption(this.filteredOptions[this.focusedIndex]):this.options.isAddNewAllowed&&this.options.addNewCallback&&this.input.value.trim()&&this.handleAddNew(this.input.value.trim()),this.presentationMode==="fullscreen"&&((t=this.fullscreenSearchInput)==null||t.blur());break;case"Escape":e.preventDefault(),this.showSelectedPopover?this.hideSelectedPopover():this.input.value?(this.input.value="",this.searchTerm="",this.resetVisibleToAll(),this.matchingIndices.clear(),this.focusedIndex=-1,this.renderDropdown()):this.close();break;case"Tab":this.close();break;case"PageUp":e.preventDefault(),this.focusPageUp();break;case"PageDown":e.preventDefault(),this.focusPageDown();break;case"Home":e.preventDefault(),this.focusFirst();break;case"End":e.preventDefault(),this.focusLast();break}}handleDropdownClick(e){var r,n;U.debug(`[${this.instanceId}] Dropdown clicked`,{target:e.target.className}),e.stopPropagation();const t=e.target.closest(".ms__option-info");if(t){e.preventDefault(),this.toggleLabelReveal(t);return}this.hideLabelReveal();const o=e.target.closest("[data-action]");if(o){e.preventDefault();const a=o.dataset.action;if(U.debug(`[${this.instanceId}] Action button clicked:`,a),a==="select-all")this.selectAll();else if(a==="clear-all")this.clearAll();else if(a==="custom"){const l=parseInt(o.dataset.buttonIndex||"-1"),c=(r=this.options.actionButtons)==null?void 0:r[l];c!=null&&c.onClick&&c.onClick(this)}return}const i=e.target.closest(".ms__option");if(i&&!i.classList.contains("ms__option--disabled")){e.preventDefault();const a=i.dataset.value,l=this.filteredOptions.findIndex(c=>String(this.getItemValue(c))===a);U.debug(`[${this.instanceId}] Option clicked:`,{value:a,optionIndex:l,closeOnSelect:this.options.isCloseOnSelect,placeholder:this.options.searchPlaceholder}),l>=0&&(this.focusedIndex=l,this.toggleOption(this.filteredOptions[l]),this.isOpen&&this.presentationMode!=="fullscreen"?this.input.focus():this.presentationMode==="fullscreen"&&((n=this.fullscreenSearchInput)==null||n.blur()))}}handleBadgeClick(e){if(e.target.closest('[data-action="clear-count"]')){e.preventDefault(),e.stopPropagation(),U.debug(`[${this.instanceId}] Clear count button clicked`),this.clearAll();return}if(e.target.closest('[data-action="show-selected"]')){e.preventDefault(),e.stopPropagation(),this.toggleSelectedPopover();return}const i=e.target.closest(".ms__badge-remove");if(i){if(e.preventDefault(),e.stopPropagation(),i.dataset.action==="remove-hidden"){U.debug(`[${this.instanceId}] Remove hidden items button clicked`);const l=this.options.badgesMaxVisible||3;Array.from(this.selectedOptions.values()).slice(l).forEach(h=>this.interactiveDeselect(h));return}const n=i.dataset.value,a=this.selectedOptions.get(n);a&&this.interactiveDeselect(a);return}if(e.target.closest(".ms__badge--more")&&!e.target.closest(".ms__badge-remove")){e.preventDefault(),e.stopPropagation(),U.debug(`[${this.instanceId}] '+X more' badge clicked, showing popover`),this.toggleSelectedPopover();return}}handleClickOutside(e){var i;const t=e.composedPath();if(this.showSelectedPopover&&!t.some(n=>n instanceof Node&&(this.selectedPopover.contains(n)||this.counter.contains(n)||n.closest&&n.closest('[data-action="show-selected"]')))){Y.debug(`[${this.instanceId}] Closing selected popover due to click outside`),this.hideSelectedPopover();return}if(!this.isOpen||this.justOpenedViaClick)return;const o=t.some(r=>r instanceof Node&&(this.element.contains(r)||this.dropdown.contains(r)||this.hint&&this.hint.contains(r)));U.debug(`[${this.instanceId}] handleClickOutside`,{target:e.target.className,targetTag:e.target.tagName,clickedInside:o,pathLength:t.length,firstInPath:(i=t[0])==null?void 0:i.tagName,elementContains:t.some(r=>r instanceof Node&&this.element.contains(r)),dropdownContains:t.some(r=>r instanceof Node&&this.dropdown.contains(r)),isConnected:this.dropdown.isConnected}),o||(U.warn(`[${this.instanceId}] Closing dropdown due to click outside`),this.close())}focusBy(e,t=1){const o=this.filteredOptions.length;if(o===0)return;const i=e(this.focusedIndex,o);if(i<0)return;const r=this.resolveSelectableIndex(i,t,o);r<0||(this.focusedIndex=r,this.renderDropdown(),this.scrollToFocused(),this.updateFullscreenNav())}resolveSelectableIndex(e,t,o){if(!this.isTreeMode())return e;let i=e;for(;i>=0&&i<o&&!this.isIndexSelectable(i);)i+=t;if(i<0||i>=o)for(i=e-t;i>=0&&i<o&&!this.isIndexSelectable(i);)i-=t;return i>=0&&i<o?i:-1}focusNext(){this.focusBy((e,t)=>Math.min(t-1,e+1),1)}focusPrevious(){this.focusBy(e=>Math.max(0,e-1),-1)}focusFirst(){this.focusBy(()=>0,1)}focusLast(){this.focusBy((e,t)=>t-1,-1)}focusPageUp(){this.focusBy(e=>Math.max(0,e-10),-1)}focusPageDown(){this.focusBy((e,t)=>Math.min(t-1,e+10),1)}focusNextMatch(){if(this.matchingIndices.size===0)return;const e=Array.from(this.matchingIndices).sort((i,r)=>i-r),t=e.findIndex(i=>i===this.focusedIndex),o=(t+1)%e.length;this.focusBy(()=>e[o]),U.debug(`[${this.instanceId}] Jumped to next match: index ${this.focusedIndex} (${t+1} of ${e.length})`)}focusPreviousMatch(){if(this.matchingIndices.size===0)return;const e=Array.from(this.matchingIndices).sort((i,r)=>i-r),t=e.findIndex(i=>i===this.focusedIndex),o=t<=0?e.length-1:t-1;this.focusBy(()=>e[o]),U.debug(`[${this.instanceId}] Jumped to previous match: index ${this.focusedIndex} (${t+1} of ${e.length})`)}scrollToFocused(){if(this.virtualScroll&&this.focusedIndex>=0){this.virtualScroll.scrollToIndex(this.focusedIndex);return}const e=this.dropdown.querySelector(".ms__option--focused");e&&(this.presentationMode==="fullscreen"?e.scrollIntoView({block:"center",behavior:"auto"}):e.scrollIntoView({block:"nearest",behavior:"smooth"}))}toggleOption(e){if(this.getItemDisabled(e)){U.debug(`[${this.instanceId}] toggleOption ignored — option is disabled`);return}if(!this.isOptionSelectable(e)){U.debug(`[${this.instanceId}] toggleOption ignored — node is not selectable`);return}const t=this.getItemValue(e),o=String(t);if(U.debug(`[${this.instanceId}] toggleOption called`,{value:t,multiple:this.options.isMultipleEnabled}),this.isCascadeMode()&&this.cascadeIndex){const n=this.cascadeIndex.nodeByValue.get(o);if(n){this.toggleTreeCascade(n),this.options.isCloseOnSelect&&this.close();return}}(this.selectedValues.has(o)?this.interactiveDeselect(e):this.interactiveSelect(e))&&(this.options.isMultipleEnabled?this.options.isCloseOnSelect&&this.close():this.close())}interactiveSelect(e){var o,i;const t=(i=(o=this.options).beforeSelectCallback)==null?void 0:i.call(o,e,this.getSelected());return t===!1||typeof t=="string"?(typeof t=="string"&&this.showMessage(t,{variant:"warning"}),U.debug(`[${this.instanceId}] Selection blocked by beforeSelectCallback`),!1):(this.options.isMultipleEnabled||(this.selectedValues.clear(),this.selectedOptions.clear()),this.selectOption(e),!0)}interactiveDeselect(e){var o,i;const t=(i=(o=this.options).beforeDeselectCallback)==null?void 0:i.call(o,e,this.getSelected());return t===!1||typeof t=="string"?(typeof t=="string"&&this.showMessage(t,{variant:"warning"}),U.debug(`[${this.instanceId}] Deselection blocked by beforeDeselectCallback`),!1):(this.deselectOption(e),!0)}async handleAddNew(e){if(this.options.addNewCallback)try{j.debug(`[${this.instanceId}] Adding new option:`,e);const t=await this.options.addNewCallback(e);this.allOptions.push(t),this.filteredOptions.push(t),this.selectOption(t),this.input.value="",this.renderDropdown(),this.renderBadges(),this.options.isCloseOnSelect&&this.close()}catch(t){j.error(`[${this.instanceId}] Error adding new option:`,t)}}selectOption(e){const t=this.getItemValue(e),o=String(t);this.selectedValues.add(o),this.selectedOptions.set(o,e),this.commit({added:[e]})}deselectOption(e){const t=this.getItemValue(e),o=String(t);if(this.isCascadeMode()&&this.cascadeIndex){const i=this.cascadeIndex.nodeByValue.get(o);if(i){const r=this.cascadeIndex.atomsUnder.get(i.path)??[],n=new Set(Ye(this.cascadeIndex,this.selectedValues));for(const a of r)n.delete(a);this.commitCascadeAtoms(n);return}}this.selectedValues.delete(o),this.selectedOptions.delete(o),this.commit({removed:[e]})}selectAll(){if(this.isCascadeMode()&&this.cascadeIndex){const t=this.cascadeIndex,o=new Set(Ye(t,this.selectedValues));for(const i of this.treeNodes)t.atomPaths.has(i.path)&&(this.getItemDisabled(i.data)||o.add(String(this.getItemValue(i.data))));this.commitCascadeAtoms(o);return}const e=[];this.filteredOptions.forEach((t,o)=>{if(this.getItemDisabled(t)||!this.isIndexSelectable(o))return;const i=String(this.getItemValue(t));this.selectedValues.has(i)||(this.selectedValues.add(i),this.selectedOptions.set(i,t),e.push(t))}),this.commit({added:e})}clearAll(){const e=Array.from(this.selectedOptions.values());this.selectedValues.clear(),this.selectedOptions.clear(),this.commit({removed:e})}commit(e){this.renderDropdown({preserveScroll:!0}),this.renderBadges(),this.updateHiddenInput();const t=e.added??[],o=e.removed??[];this.options.onSelect&&t.forEach(i=>this.options.onSelect(i)),this.options.onDeselect&&o.forEach(i=>this.options.onDeselect(i)),(t.length>0||o.length>0)&&this.options.onChange&&this.options.onChange(this.getSelected())}open(){Y.debug(`[${this.instanceId}] open() called`,{isOpen:this.isOpen}),!this.isOpen&&(this.hideMessage(),this.isOpen=!0,this.element.classList.add("ms--open"),this.dropdown.classList.add("ms__dropdown--visible"),Y.info(`[${this.instanceId}] Dropdown opened`),this.input.placeholder=this.getPlaceholderText(),!this.options.isMultipleEnabled&&this.options.isSearchEnabled&&(this.input.value=this.searchTerm),this.options.searchCallback&&this.options.isKeepOptionsOnSearch&&!this.searchTerm&&(this.filteredOptions=[...this.allOptions],Y.debug(`[${this.instanceId}] Showing ${this.allOptions.length} initial options on open`)),this.presentationMode==="fullscreen"&&this.enterFullscreen(),this.renderDropdown(),this.presentationMode!=="fullscreen"&&this.positionDropdown(),this.dropdown.addEventListener("scroll",this.onDropdownScroll,!0),this.hint&&this.presentationMode==="floating"&&(this.hint.classList.add("ms__hint--visible"),this.positionHint()))}close(){Y.debug(`[${this.instanceId}] close() called`,{isOpen:this.isOpen}),this.isOpen&&(this.isOpen=!1,this.element.classList.remove("ms--open"),this.dropdown.classList.remove("ms__dropdown--visible"),this.hint&&this.hint.classList.remove("ms__hint--visible"),this.options.shouldKeepSearchOnClose||(this.searchTerm="",(this.options.isMultipleEnabled||this.options.isSearchEnabled)&&(this.input.value=""),this.resetVisibleToAll()),this.focusedIndex=-1,this.dropdown.removeEventListener("scroll",this.onDropdownScroll,!0),this.destroyAllOptionTooltips(),this.hideLabelReveal(),this.hideMessage(),this.renderBadges(),this.dropdownCleanup&&(this.dropdownCleanup(),this.dropdownCleanup=null),this.hintCleanup&&(this.hintCleanup(),this.hintCleanup=null),this.exitFullscreen(),this.dropdownPlacement=null,Y.debug(`[${this.instanceId}] Dropdown closed`))}anchorFloatingPanel(e,t){var r;const o=((r=t.isLocked)==null?void 0:r.call(t))??!0,i=Ge(e,this.input,{strategy:"fixed",placement:"bottom-start",offset:4,shift:8,lockPlacement:o?"freeze":!1,fixedContainingBlock:!0,maxWidth:{padding:8},onDrift:n=>this.warnDrift(n),beforeCompute:()=>{(this.options.hostElement??this.element).style.setProperty("--ms-input-current-width",`${this.input.offsetWidth}px`),this.options.dropdownMinWidth&&(e.style.minWidth=this.options.dropdownMinWidth)},onPlaced:n=>{var a;if(t.getPlacement()||t.setPlacement(n),t.applyMaxWidth&&this.options.dropdownMaxWidth){const l=e.style.maxWidth;e.style.maxWidth=l?`min(${this.options.dropdownMaxWidth}, ${l})`:this.options.dropdownMaxWidth}(a=t.afterPosition)==null||a.call(t)}});return()=>i.destroy()}warnDrift(e){this.positioningDriftWarned||(this.positioningDriftWarned=!0,console.warn(`[@keenmate/web-multiselect] Dropdown panel rendered ${e.driftX.toFixed(0)}px / ${e.driftY.toFixed(0)}px away from where the library positioned it. Most likely culprit: ${e.culpritDescription}`+(e.culpritCss?` (has ${e.culpritCss})`:"")+".\nAn ancestor of <web-multiselect> establishes a fixed-positioning containing block that the library's heuristic doesn't recognize. Fix on your side: replace the property with `transform: translateZ(0)` on that ancestor, OR move the trigger out of that ancestor's subtree. If neither is acceptable, please file an issue at https://github.com/keenmate/web-multiselect/issues with the ancestor's computed CSS."))}positionDropdown(){this.presentationMode!=="fullscreen"&&(this.dropdownCleanup=this.anchorFloatingPanel(this.dropdown,{getPlacement:()=>this.dropdownPlacement,setPlacement:e=>{this.dropdownPlacement=e,Y.debug(`[${this.instanceId}] Locked dropdown placement:`,e)},isLocked:()=>!!this.options.isPlacementLocked,applyMaxWidth:!0,afterPosition:()=>{this.hint&&this.isOpen&&this.positionHint()}}))}setPresentation(e){e!==this.presentationMode&&(this.presentationMode=e,this.isOpen?e==="fullscreen"?(this.dropdownCleanup&&(this.dropdownCleanup(),this.dropdownCleanup=null),this.hintCleanup&&(this.hintCleanup(),this.hintCleanup=null),this.hint&&this.hint.classList.remove("ms__hint--visible"),this.dropdownPlacement=null,this.enterFullscreen(),this.renderDropdown()):(this.exitFullscreen(),this.renderDropdown(),this.positionDropdown(),this.hint&&(this.hint.classList.add("ms__hint--visible"),this.positionHint())):this.showSelectedPopover&&(e==="fullscreen"?(this.selectedPopoverCleanup&&(this.selectedPopoverCleanup(),this.selectedPopoverCleanup=null),this.selectedPopoverPlacement=null,this.clearFloatingInlineGeometry(this.selectedPopover),this.selectedPopover.classList.add("ms__selected-popover--fullscreen"),this.lockBodyScroll()):(this.selectedPopover.classList.remove("ms__selected-popover--fullscreen"),this.unlockBodyScroll(),this.positionSelectedPopover())))}lockBodyScroll(){this.bodyScrollUnlock||(this.bodyScrollUnlock=oi())}unlockBodyScroll(){this.bodyScrollUnlock&&(this.bodyScrollUnlock(),this.bodyScrollUnlock=null)}clampDocumentOverflowX(){if(this.overflowXClamp||typeof document>"u")return;const e=document.documentElement;this.overflowXClamp={html:e.style.overflowX},e.style.overflowX="hidden"}releaseDocumentOverflowX(){!this.overflowXClamp||typeof document>"u"||(document.documentElement.style.overflowX=this.overflowXClamp.html,this.overflowXClamp=null)}observeKeyboardInset(){this.keyboardInsetCleanup=ii(this.dropdown)}unobserveKeyboardInset(){this.keyboardInsetCleanup&&(this.keyboardInsetCleanup(),this.keyboardInsetCleanup=null)}fullscreenScale(){if(this.presentationMode!=="fullscreen"||typeof getComputedStyle!="function")return 1;const e=this.options.hostElement??this.element,t=getComputedStyle(e),o=parseFloat(t.getPropertyValue("--ms-rem"))||10;return(parseFloat(t.getPropertyValue("--ms-fullscreen-rem"))||o*1.2)/o}scaledOptionHeight(){return Math.round((this.options.optionHeight??50)*this.fullscreenScale())}applyVirtualOptionsSizing(e){if(e.style.setProperty("--ms-option-height",`${this.scaledOptionHeight()}px`),this.presentationMode==="fullscreen")e.style.flex="1 1 0",e.style.minHeight="0",e.style.height="",e.style.maxHeight="";else{const t=this.options.maxHeight||"20rem";e.style.flex="",e.style.minHeight="",e.style.height=t,e.style.maxHeight=t}}scaledBadgeHeight(){const e=this.options.badgeHeight??36;return this.presentationMode!=="fullscreen"?e:Math.round(e*this.fullscreenScale()*1.2)}clearFloatingInlineGeometry(e){e.style.position="",e.style.left="",e.style.top="",e.style.right="",e.style.bottom="",e.style.transform="",e.style.maxWidth="",e.style.minWidth="",e.style.width=""}enterFullscreen(){var e;this.clearFloatingInlineGeometry(this.dropdown),this.dropdown.classList.add("ms__dropdown--fullscreen"),this.buildFullscreenHeader(),this.lockBodyScroll(),this.clampDocumentOverflowX(),this.pushOverlayHistory(),this.observeKeyboardInset(),this.fullscreenSearchInput&&(this.fullscreenSearchInput.value=this.searchTerm),this.updateFullscreenSearchClear(),this.options.fullscreenAutofocus?(e=this.fullscreenSearchInput)==null||e.focus():this.input.blur()}exitFullscreen(){this.unobserveKeyboardInset(),this.popOverlayHistory(),this.dropdown.classList.remove("ms__dropdown--fullscreen"),this.fullscreenHeader&&(this.fullscreenHeader.remove(),this.fullscreenHeader=null,this.fullscreenSearchInput=null,this.fullscreenSearchClear=null,this.fullscreenNav=null,this.fullscreenNavCount=null,this.fullscreenNavPrev=null,this.fullscreenNavNext=null),this.unlockBodyScroll(),this.releaseDocumentOverflowX()}pushOverlayHistory(){this.overlayHistoryActive||typeof history>"u"||typeof window>"u"||(this.overlayHistoryActive=!0,history.pushState({msOverlay:this.instanceId},""),window.addEventListener("popstate",this.onOverlayPopstate))}handleOverlayPopstate(){this.overlayHistoryActive&&(this.overlayHistoryActive=!1,window.removeEventListener("popstate",this.onOverlayPopstate),this.isOpen?this.close():this.showSelectedPopover&&this.hideSelectedPopover())}popOverlayHistory(){this.overlayHistoryActive&&(this.overlayHistoryActive=!1,window.removeEventListener("popstate",this.onOverlayPopstate),history.back())}buildFullscreenHeader(){if(this.fullscreenHeader)return;const e=document.createElement("div");if(e.className="ms__fullscreen-header",this.options.isSearchEnabled&&this.options.searchInputMode!=="hidden"){const o=document.createElement("div");o.className="ms__fullscreen-search-wrapper";const i=document.createElement("input");if(i.type="text",i.className="ms__fullscreen-search",i.placeholder=this.getPlaceholderText(),i.autocomplete="off",this.options.searchInputMode==="readonly"&&(i.readOnly=!0),i.addEventListener("input",r=>{const n=r.target.value;this.input.value=n,this.handleSearch(n),this.updateFullscreenSearchClear()}),i.addEventListener("keydown",r=>this.handleKeydown(r)),o.appendChild(i),this.fullscreenSearchInput=i,this.options.searchInputMode!=="readonly"){const r=document.createElement("button");r.type="button",r.className="ms__fullscreen-search-clear",r.setAttribute("aria-label","Clear search"),r.addEventListener("mousedown",n=>n.preventDefault()),r.addEventListener("click",()=>this.clearFullscreenSearch()),o.appendChild(r),this.fullscreenSearchClear=r}e.appendChild(o)}const t=document.createElement("button");if(t.type="button",t.className="ms__fullscreen-close",t.setAttribute("aria-label","Close"),t.addEventListener("click",()=>this.close()),e.appendChild(t),this.options.isSearchEnabled&&(this.options.searchMode||"filter")==="navigate"){const o=document.createElement("div");o.className="ms__fullscreen-nav";const i=document.createElement("span");i.className="ms__fullscreen-nav-count",o.appendChild(i);const r=document.createElement("div");r.className="ms__fullscreen-nav-controls";const n=document.createElement("button");n.type="button",n.className="ms__fullscreen-nav-btn ms__fullscreen-nav-btn--prev",n.setAttribute("aria-label","Previous match"),n.addEventListener("click",()=>this.focusPreviousMatch());const a=document.createElement("button");a.type="button",a.className="ms__fullscreen-nav-btn ms__fullscreen-nav-btn--next",a.setAttribute("aria-label","Next match"),a.addEventListener("click",()=>this.focusNextMatch()),r.appendChild(n),r.appendChild(a),o.appendChild(r),e.appendChild(o),this.fullscreenNav=o,this.fullscreenNavCount=i,this.fullscreenNavPrev=n,this.fullscreenNavNext=a}this.dropdown.insertBefore(e,this.dropdownInner),this.fullscreenHeader=e,this.updateFullscreenNav(),this.updateFullscreenSearchClear()}updateFullscreenNav(){if(!this.fullscreenNav)return;const e=this.matchingIndices.size,t=!!this.searchTerm;if(this.fullscreenNav.style.display=t?"":"none",this.fullscreenNavCount)if(e===0)this.fullscreenNavCount.textContent=this.options.emptyMessage||"No matches";else{const r=Array.from(this.matchingIndices).sort((n,a)=>n-a).indexOf(this.focusedIndex);this.fullscreenNavCount.textContent=r>=0?`${r+1} of ${e}`:`${e} match${e===1?"":"es"}`}const o=e===0;this.fullscreenNavPrev&&(this.fullscreenNavPrev.disabled=o),this.fullscreenNavNext&&(this.fullscreenNavNext.disabled=o)}updateFullscreenSearchClear(){if(!this.fullscreenSearchClear)return;const e=!!(this.fullscreenSearchInput&&this.fullscreenSearchInput.value);this.fullscreenSearchClear.style.display=e?"":"none"}clearFullscreenSearch(){var e;this.fullscreenSearchInput&&(this.fullscreenSearchInput.value=""),this.input.value="",this.handleSearch(""),this.updateFullscreenSearchClear(),(e=this.fullscreenSearchInput)==null||e.focus()}positionHint(){if(!this.hint)return;this.hintCleanup&&this.hintCleanup();let e="top-start";this.dropdownPlacement&&(this.dropdownPlacement.startsWith("bottom")?e=this.dropdownPlacement.replace("bottom","top"):this.dropdownPlacement.startsWith("top")&&(e=this.dropdownPlacement.replace("top","bottom")));const t=Ge(this.hint,this.input,{strategy:"fixed",placement:e,offset:4,shift:8,flip:!1});this.hintCleanup=()=>t.destroy()}parseInitialSelection(){const e=this.element.dataset.initialValues;if(e)try{JSON.parse(e).forEach(o=>{this.selectedValues.add(String(o))}),this.reconcileSelectedOptions(),this.renderBadges()}catch(t){j.error(`[${this.instanceId}] Failed to parse initial values:`,t)}}reconcileSelectedOptions(){this.selectedValues.size===0||this.allOptions.length===0||this.selectedValues.forEach(e=>{if(this.selectedOptions.has(e))return;const t=this.allOptions.find(o=>String(this.getItemValue(o))===e);t&&this.selectedOptions.set(e,t)})}toggleSelectedPopover(){this.showSelectedPopover?this.hideSelectedPopover():this.showPopover()}showPopover(){Y.debug(`[${this.instanceId}] showPopover() called`),this.isOpen&&this.close(),this.hideMessage(),this.showSelectedPopover=!0,this.renderSelectedPopover(),this.selectedPopover.classList.add("ms__selected-popover--visible");const e=this.options.virtualScrollThreshold??100;this.selectedValues.size>=e&&this.selectedPopover.classList.add("ms__selected-popover--virtual"),this.presentationMode==="fullscreen"?(this.selectedPopover.classList.add("ms__selected-popover--fullscreen"),this.lockBodyScroll(),this.clampDocumentOverflowX(),this.pushOverlayHistory()):this.positionSelectedPopover()}hideSelectedPopover(){var e;Y.debug(`[${this.instanceId}] hideSelectedPopover() called`),this.showSelectedPopover=!1,this.selectedPopover.classList.remove("ms__selected-popover--visible"),this.selectedPopover.classList.remove("ms__selected-popover--virtual"),this.selectedPopover.classList.remove("ms__selected-popover--fullscreen"),this.unlockBodyScroll(),this.releaseDocumentOverflowX(),this.popOverlayHistory(),this.hideMessage(),this.selectedPopoverPlacement=null,this.selectedPopoverVirtualScroll&&(this.selectedPopoverVirtualScroll.destroy(),this.selectedPopoverVirtualScroll=null,this.selectedPopoverContainer=null),this.selectedPopoverCleanup&&(this.selectedPopoverCleanup(),this.selectedPopoverCleanup=null);for(const t of Array.from(this.tooltips.keys()))t.startsWith("popover-")&&((e=this.tooltips.get(t))==null||e.destroy(),this.tooltips.delete(t))}renderSelectedPopover(){const e=Array.from(this.selectedOptions.values()),t=this.selectedValues.size,o=this.options.virtualScrollThreshold??100;if(t>=o){this.renderSelectedPopoverVirtual(e,t);return}this.selectedPopover.innerHTML=`
|
|
17
|
+
`}else this.badgesContainer.innerHTML="";this.attachBadgeTooltips()}attachEvents(){this.input.addEventListener("mousedown",e=>{e.stopPropagation(),this.isOpen?(this.justClosedViaClick=!0,this.close(),setTimeout(()=>{this.justClosedViaClick=!1},0)):(this.presentationMode==="fullscreen"&&e.preventDefault(),this.justOpenedViaClick=!0,this.open(),setTimeout(()=>{this.justOpenedViaClick=!1},0))}),this.input.addEventListener("focus",()=>{!this.isOpen&&!this.justClosedViaClick&&this.open()}),this.input.addEventListener("input",e=>{const t=e.target.value;this.options.isSearchEnabled&&!this.isOpen&&this.open(),this.handleSearch(t)}),this.input.addEventListener("keydown",e=>this.handleKeydown(e)),this.documentClickHandler=e=>this.handleClickOutside(e),setTimeout(()=>{document.addEventListener("click",this.documentClickHandler)},0),this.documentKeydownHandler=e=>{e.key==="Escape"&&this.showSelectedPopover&&(e.preventDefault(),this.hideSelectedPopover())},document.addEventListener("keydown",this.documentKeydownHandler),this.dropdown.addEventListener("mousedown",e=>{if(this.presentationMode!=="fullscreen")return;e.target.closest(".ms__option")&&e.preventDefault()}),this.dropdown.addEventListener("touchmove",e=>{var t;this.presentationMode==="fullscreen"&&e.target.closest(".ms__options")&&((t=this.fullscreenSearchInput)==null||t.blur())},{passive:!0}),this.dropdown.addEventListener("click",e=>this.handleDropdownClick(e)),this.dropdownInner.addEventListener("wheel",e=>{if(this.virtualScroll)return;const t=e.currentTarget,o=t.scrollTop===0,i=t.scrollTop+t.clientHeight>=t.scrollHeight;(e.deltaY<0&&o||e.deltaY>0&&i)&&e.preventDefault(),e.stopPropagation()},{passive:!1}),this.badgesContainer.addEventListener("mousedown",e=>{e.target.closest('[data-action="show-selected"]')&&!this.showSelectedPopover&&e.stopPropagation()}),this.badgesContainer.addEventListener("click",e=>this.handleBadgeClick(e)),this.counter.addEventListener("mousedown",e=>{this.showSelectedPopover||e.stopPropagation()}),this.counter.addEventListener("click",e=>{e.stopPropagation(),this.toggleSelectedPopover()}),this.selectedPopover.addEventListener("click",e=>this.handleSelectedPopoverClick(e))}async handleSearch(e){if(this.searchTerm=e,!this.options.isSearchEnabled)return;let t=e;if(this.options.beforeSearchCallback){const o=this.options.beforeSearchCallback(e);if(o===null){j.debug(`[${this.instanceId}] beforeSearchCallback blocked search for term:`,e),this.abortInFlightSearch(),this.matchingIndices.clear(),this.isTreeMode()?(this.searchTerm="",this.rebuildTreeVisible()):this.filteredOptions=[...this.allOptions],this.renderDropdown();return}t=o,t!==e&&j.debug(`[${this.instanceId}] beforeSearchCallback transformed: "${e}" -> "${t}"`)}if(this.options.searchCallback){if(t.length<this.options.minSearchLength){this.abortInFlightSearch(),this.isLoading=!1,this.options.isKeepOptionsOnSearch?(this.isTreeMode()?this.rebuildTreeVisibleFromMatches(this.allOptions):this.filteredOptions=[...this.allOptions],j.debug(`[${this.instanceId}] Search term below minimum, showing ${this.allOptions.length} initial options`)):(this.filteredOptions=[],this.isTreeMode()&&(this.treeNodes=[])),this.matchingIndices.clear(),this.renderDropdown();return}this.searchDebounceTimer&&(clearTimeout(this.searchDebounceTimer),this.searchDebounceTimer=void 0);const o=this.options.searchDebounce||0;o>0?this.searchDebounceTimer=setTimeout(()=>{this.searchDebounceTimer=void 0,this.searchTerm===e&&this.performAsyncSearch(e,t)},o):await this.performAsyncSearch(e,t)}else{if(this.isTreeMode()){if((this.options.searchMode||"filter")==="navigate"){const o=this.rebuildTreeVisibleForNavigate();this.searchTerm.trim()?o>=0&&(this.focusedIndex=o):this.focusedIndex=-1,this.renderDropdown(),this.focusedIndex>=0&&this.scrollToFocused(),this.updateFullscreenNav();return}this.rebuildTreeVisible(),this.matchingIndices.clear(),this.focusedIndex=this.searchTerm.trim()&&this.filteredOptions.length>0?0:-1,this.renderDropdown();return}if(!t)this.filteredOptions=[...this.allOptions],this.matchingIndices.clear(),this.focusedIndex=-1;else{const o=this.options.searchMode||"filter",i=t.toLowerCase();if(o==="filter")this.filteredOptions=this.allOptions.filter(r=>this.getItemSearchValue(r).toLowerCase().includes(i)),this.matchingIndices.clear(),this.focusedIndex=this.filteredOptions.length>0?0:-1,j.debug(`[${this.instanceId}] Filter mode: ${this.filteredOptions.length} matches for "${t}"`);else{this.filteredOptions=[...this.allOptions],this.matchingIndices.clear();let r=-1;this.allOptions.forEach((n,a)=>{this.getItemSearchValue(n).toLowerCase().includes(i)&&(this.matchingIndices.add(a),r===-1&&(r=a))}),r>=0?(this.focusedIndex=r,j.debug(`[${this.instanceId}] Navigate mode: ${this.matchingIndices.size} matches, jumped to index ${r}`)):j.debug(`[${this.instanceId}] Navigate mode: No matches found, keeping previous focus`)}}this.renderDropdown(),this.options.searchMode==="navigate"&&this.focusedIndex>=0&&this.scrollToFocused(),this.updateFullscreenNav()}}abortInFlightSearch(){this.searchAbortController&&(this.searchAbortController.abort(),this.searchAbortController=void 0)}async performAsyncSearch(e,t){this.abortInFlightSearch();const o=new AbortController;this.searchAbortController=o,this.isLoading=!0,this.renderDropdown(),j.debug(`[${this.instanceId}] Loading data for search term:`,t);try{const i=await this.options.searchCallback(t,o.signal);if(o.signal.aborted||this.searchTerm!==e)return;const r=i||[];this.isTreeMode()?this.rebuildTreeVisibleFromMatches(r):this.filteredOptions=[...r],this.isLoading=!1,this.matchingIndices.clear(),this.focusedIndex=this.options.isSearchEnabled&&this.filteredOptions.length>0?0:-1,this.renderDropdown(),j.debug(`[${this.instanceId}] Loaded ${r.length} results`)}catch(i){if(o.signal.aborted)return;j.error(`[${this.instanceId}] Error loading data:`,i),this.isLoading=!1,this.options.isKeepOptionsOnSearch?this.isTreeMode()?this.rebuildTreeVisibleFromMatches(this.allOptions):this.filteredOptions=[...this.allOptions]:(this.filteredOptions=[],this.isTreeMode()&&(this.treeNodes=[])),this.matchingIndices.clear(),this.renderDropdown()}finally{this.searchAbortController===o&&(this.searchAbortController=void 0)}}handleKeydown(e){var t;if(!(this.options.keydownCallback&&this.options.keydownCallback({event:e,key:e.key,isOpen:this.isOpen,presentation:this.presentationMode,searchTerm:this.searchTerm,focusedIndex:this.focusedIndex,focusedOption:(this.focusedIndex>=0?this.filteredOptions[this.focusedIndex]:null)??null,filteredOptions:this.filteredOptions,selectedValues:[...this.selectedValues],controller:this.getKeyboardController()})===!0)){if(!this.isOpen){(e.key==="Enter"||e.key==="ArrowDown")&&(e.preventDefault(),this.open());return}if(!this.options.isSearchEnabled){const o=e.key.length===1||e.key==="Backspace"||e.key==="Delete",i=["ArrowUp","ArrowDown","PageUp","PageDown","Home","End","Enter","Escape","Tab"].includes(e.key);if(o&&!i){e.preventDefault();return}}switch(e.key){case"ArrowDown":e.preventDefault(),e.ctrlKey||e.metaKey?this.focusNextMatch():this.focusNext();break;case"ArrowUp":e.preventDefault(),e.ctrlKey||e.metaKey?this.focusPreviousMatch():this.focusPrevious();break;case"Enter":e.preventDefault(),this.focusedIndex>=0?this.toggleOption(this.filteredOptions[this.focusedIndex]):this.options.isAddNewAllowed&&this.options.addNewCallback&&this.input.value.trim()&&this.handleAddNew(this.input.value.trim()),this.presentationMode==="fullscreen"&&((t=this.fullscreenSearchInput)==null||t.blur());break;case"Escape":e.preventDefault(),this.showSelectedPopover?this.hideSelectedPopover():this.input.value?this.clearSearch():this.close();break;case"Tab":this.close();break;case"PageUp":e.preventDefault(),this.focusPageUp();break;case"PageDown":e.preventDefault(),this.focusPageDown();break;case"Home":case"End":{const o=e.target instanceof HTMLInputElement?e.target:null;let i;if(!o)i=!0;else if(o.selectionStart!==o.selectionEnd)i=!1;else{const r=o.selectionStart??0;i=e.key==="Home"?r===0:r===o.value.length}i&&(e.preventDefault(),e.key==="Home"?this.focusFirst():this.focusLast());break}}}}handleDropdownClick(e){var r,n;U.debug(`[${this.instanceId}] Dropdown clicked`,{target:e.target.className}),e.stopPropagation();const t=e.target.closest(".ms__option-info");if(t){e.preventDefault(),this.toggleLabelReveal(t);return}this.hideLabelReveal();const o=e.target.closest("[data-action]");if(o){e.preventDefault();const a=o.dataset.action;if(U.debug(`[${this.instanceId}] Action button clicked:`,a),a==="select-all")this.selectAll();else if(a==="clear-all")this.clearAll();else if(a==="custom"){const l=parseInt(o.dataset.buttonIndex||"-1"),c=(r=this.options.actionButtons)==null?void 0:r[l];c!=null&&c.onClick&&c.onClick(this)}return}const i=e.target.closest(".ms__option");if(i&&!i.classList.contains("ms__option--disabled")){e.preventDefault();const a=i.dataset.value,l=this.filteredOptions.findIndex(c=>String(this.getItemValue(c))===a);U.debug(`[${this.instanceId}] Option clicked:`,{value:a,optionIndex:l,closeOnSelect:this.options.isCloseOnSelect,placeholder:this.options.searchPlaceholder}),l>=0&&(this.focusedIndex=l,this.toggleOption(this.filteredOptions[l]),this.isOpen&&this.presentationMode!=="fullscreen"?this.input.focus():this.presentationMode==="fullscreen"&&((n=this.fullscreenSearchInput)==null||n.blur()))}}handleBadgeClick(e){if(e.target.closest('[data-action="clear-count"]')){e.preventDefault(),e.stopPropagation(),U.debug(`[${this.instanceId}] Clear count button clicked`),this.clearAll();return}if(e.target.closest('[data-action="show-selected"]')){e.preventDefault(),e.stopPropagation(),this.toggleSelectedPopover();return}const i=e.target.closest(".ms__badge-remove");if(i){if(e.preventDefault(),e.stopPropagation(),i.dataset.action==="remove-hidden"){U.debug(`[${this.instanceId}] Remove hidden items button clicked`);const l=this.options.badgesMaxVisible||3;Array.from(this.selectedOptions.values()).slice(l).forEach(h=>this.interactiveDeselect(h));return}const n=i.dataset.value,a=this.selectedOptions.get(n);a&&this.interactiveDeselect(a);return}if(e.target.closest(".ms__badge--more")&&!e.target.closest(".ms__badge-remove")){e.preventDefault(),e.stopPropagation(),U.debug(`[${this.instanceId}] '+X more' badge clicked, showing popover`),this.toggleSelectedPopover();return}}handleClickOutside(e){var i;const t=e.composedPath();if(this.showSelectedPopover&&!t.some(n=>n instanceof Node&&(this.selectedPopover.contains(n)||this.counter.contains(n)||n.closest&&n.closest('[data-action="show-selected"]')))){Y.debug(`[${this.instanceId}] Closing selected popover due to click outside`),this.hideSelectedPopover();return}if(!this.isOpen||this.justOpenedViaClick)return;const o=t.some(r=>r instanceof Node&&(this.element.contains(r)||this.dropdown.contains(r)||this.hint&&this.hint.contains(r)));U.debug(`[${this.instanceId}] handleClickOutside`,{target:e.target.className,targetTag:e.target.tagName,clickedInside:o,pathLength:t.length,firstInPath:(i=t[0])==null?void 0:i.tagName,elementContains:t.some(r=>r instanceof Node&&this.element.contains(r)),dropdownContains:t.some(r=>r instanceof Node&&this.dropdown.contains(r)),isConnected:this.dropdown.isConnected}),o||(U.warn(`[${this.instanceId}] Closing dropdown due to click outside`),this.close())}focusBy(e,t=1){const o=this.filteredOptions.length;if(o===0)return;const i=e(this.focusedIndex,o);if(i<0)return;const r=this.resolveSelectableIndex(i,t,o);r<0||(this.focusedIndex=r,this.renderDropdown(),this.scrollToFocused(),this.updateFullscreenNav())}resolveSelectableIndex(e,t,o){if(!this.isTreeMode())return e;let i=e;for(;i>=0&&i<o&&!this.isIndexSelectable(i);)i+=t;if(i<0||i>=o)for(i=e-t;i>=0&&i<o&&!this.isIndexSelectable(i);)i-=t;return i>=0&&i<o?i:-1}focusNext(){this.focusBy((e,t)=>Math.min(t-1,e+1),1)}focusPrevious(){this.focusBy(e=>Math.max(0,e-1),-1)}focusFirst(){this.focusBy(()=>0,1)}focusLast(){this.focusBy((e,t)=>t-1,-1)}focusPageUp(){this.focusBy(e=>Math.max(0,e-10),-1)}focusPageDown(){this.focusBy((e,t)=>Math.min(t-1,e+10),1)}focusNextMatch(){if(this.matchingIndices.size===0)return;const e=Array.from(this.matchingIndices).sort((i,r)=>i-r),t=e.findIndex(i=>i===this.focusedIndex),o=(t+1)%e.length;this.focusBy(()=>e[o]),U.debug(`[${this.instanceId}] Jumped to next match: index ${this.focusedIndex} (${t+1} of ${e.length})`)}focusPreviousMatch(){if(this.matchingIndices.size===0)return;const e=Array.from(this.matchingIndices).sort((i,r)=>i-r),t=e.findIndex(i=>i===this.focusedIndex),o=t<=0?e.length-1:t-1;this.focusBy(()=>e[o]),U.debug(`[${this.instanceId}] Jumped to previous match: index ${this.focusedIndex} (${t+1} of ${e.length})`)}getKeyboardController(){return this.keyboardController?this.keyboardController:(this.keyboardController={focusNext:()=>this.focusNext(),focusPrevious:()=>this.focusPrevious(),focusFirst:()=>this.focusFirst(),focusLast:()=>this.focusLast(),focusPageUp:()=>this.focusPageUp(),focusPageDown:()=>this.focusPageDown(),focusNextMatch:()=>this.focusNextMatch(),focusPreviousMatch:()=>this.focusPreviousMatch(),focusIndex:e=>this.focusBy(()=>e,1),toggleFocused:()=>{this.focusedIndex>=0&&this.toggleOption(this.filteredOptions[this.focusedIndex])},toggleValue:e=>{const t=this.allOptions.find(o=>String(this.getItemValue(o))===String(e));t&&this.toggleOption(t)},selectValue:e=>{if(this.selectedValues.has(String(e)))return;const t=this.allOptions.find(o=>String(this.getItemValue(o))===String(e));t&&this.toggleOption(t)},deselectValue:e=>{if(!this.selectedValues.has(String(e)))return;const t=this.selectedOptions.get(String(e))??this.allOptions.find(o=>String(this.getItemValue(o))===String(e));t&&this.toggleOption(t)},open:()=>this.open(),close:()=>this.close(),setSearch:e=>{this.input.value=e,this.fullscreenSearchInput&&(this.fullscreenSearchInput.value=e),this.handleSearch(e)},clearSearch:()=>this.clearSearch()},this.keyboardController)}clearSearch(){this.input.value="",this.fullscreenSearchInput&&(this.fullscreenSearchInput.value=""),this.searchTerm="",this.resetVisibleToAll(),this.matchingIndices.clear(),this.focusedIndex=-1,this.renderDropdown(),this.updateFullscreenNav(),this.updateFullscreenSearchClear()}scrollToFocused(){if(this.virtualScroll&&this.focusedIndex>=0){this.virtualScroll.scrollToIndex(this.focusedIndex);return}const e=this.dropdown.querySelector(".ms__option--focused");e&&(this.presentationMode==="fullscreen"?e.scrollIntoView({block:"center",behavior:"auto"}):e.scrollIntoView({block:"nearest",behavior:"smooth"}))}toggleOption(e){if(this.getItemDisabled(e)){U.debug(`[${this.instanceId}] toggleOption ignored — option is disabled`);return}if(!this.isOptionSelectable(e)){U.debug(`[${this.instanceId}] toggleOption ignored — node is not selectable`);return}const t=this.getItemValue(e),o=String(t);if(U.debug(`[${this.instanceId}] toggleOption called`,{value:t,multiple:this.options.isMultipleEnabled}),this.isCascadeMode()&&this.cascadeIndex){const n=this.cascadeIndex.nodeByValue.get(o);if(n){this.toggleTreeCascade(n),this.options.isCloseOnSelect&&this.close();return}}(this.selectedValues.has(o)?this.interactiveDeselect(e):this.interactiveSelect(e))&&(this.options.isMultipleEnabled?this.options.isCloseOnSelect&&this.close():this.close())}interactiveSelect(e){var o,i;const t=(i=(o=this.options).beforeSelectCallback)==null?void 0:i.call(o,e,this.getSelected());return t===!1||typeof t=="string"?(typeof t=="string"&&this.showMessage(t,{variant:"warning"}),U.debug(`[${this.instanceId}] Selection blocked by beforeSelectCallback`),!1):(this.options.isMultipleEnabled||(this.selectedValues.clear(),this.selectedOptions.clear()),this.selectOption(e),!0)}interactiveDeselect(e){var o,i;const t=(i=(o=this.options).beforeDeselectCallback)==null?void 0:i.call(o,e,this.getSelected());return t===!1||typeof t=="string"?(typeof t=="string"&&this.showMessage(t,{variant:"warning"}),U.debug(`[${this.instanceId}] Deselection blocked by beforeDeselectCallback`),!1):(this.deselectOption(e),!0)}async handleAddNew(e){if(this.options.addNewCallback)try{j.debug(`[${this.instanceId}] Adding new option:`,e);const t=await this.options.addNewCallback(e);this.allOptions.push(t),this.filteredOptions.push(t),this.selectOption(t),this.input.value="",this.renderDropdown(),this.renderBadges(),this.options.isCloseOnSelect&&this.close()}catch(t){j.error(`[${this.instanceId}] Error adding new option:`,t)}}selectOption(e){const t=this.getItemValue(e),o=String(t);this.selectedValues.add(o),this.selectedOptions.set(o,e),this.commit({added:[e]})}deselectOption(e){const t=this.getItemValue(e),o=String(t);if(this.isCascadeMode()&&this.cascadeIndex){const i=this.cascadeIndex.nodeByValue.get(o);if(i){const r=this.cascadeIndex.atomsUnder.get(i.path)??[],n=new Set(Ye(this.cascadeIndex,this.selectedValues));for(const a of r)n.delete(a);this.commitCascadeAtoms(n);return}}this.selectedValues.delete(o),this.selectedOptions.delete(o),this.commit({removed:[e]})}selectAll(){if(this.isCascadeMode()&&this.cascadeIndex){const t=this.cascadeIndex,o=new Set(Ye(t,this.selectedValues));for(const i of this.treeNodes)t.atomPaths.has(i.path)&&(this.getItemDisabled(i.data)||o.add(String(this.getItemValue(i.data))));this.commitCascadeAtoms(o);return}const e=[];this.filteredOptions.forEach((t,o)=>{if(this.getItemDisabled(t)||!this.isIndexSelectable(o))return;const i=String(this.getItemValue(t));this.selectedValues.has(i)||(this.selectedValues.add(i),this.selectedOptions.set(i,t),e.push(t))}),this.commit({added:e})}clearAll(){const e=Array.from(this.selectedOptions.values());this.selectedValues.clear(),this.selectedOptions.clear(),this.commit({removed:e})}commit(e){this.renderDropdown({preserveScroll:!0}),this.renderBadges(),this.updateHiddenInput();const t=e.added??[],o=e.removed??[];this.options.onSelect&&t.forEach(i=>this.options.onSelect(i)),this.options.onDeselect&&o.forEach(i=>this.options.onDeselect(i)),(t.length>0||o.length>0)&&this.options.onChange&&this.options.onChange(this.getSelected())}open(){Y.debug(`[${this.instanceId}] open() called`,{isOpen:this.isOpen}),!this.isOpen&&(this.hideMessage(),this.isOpen=!0,this.element.classList.add("ms--open"),this.dropdown.classList.add("ms__dropdown--visible"),Y.info(`[${this.instanceId}] Dropdown opened`),this.input.placeholder=this.getPlaceholderText(),!this.options.isMultipleEnabled&&this.options.isSearchEnabled&&(this.input.value=this.searchTerm),this.options.searchCallback&&this.options.isKeepOptionsOnSearch&&!this.searchTerm&&(this.filteredOptions=[...this.allOptions],Y.debug(`[${this.instanceId}] Showing ${this.allOptions.length} initial options on open`)),this.presentationMode==="fullscreen"&&this.enterFullscreen(),this.renderDropdown(),this.presentationMode!=="fullscreen"&&this.positionDropdown(),this.dropdown.addEventListener("scroll",this.onDropdownScroll,!0),this.hint&&this.presentationMode==="floating"&&(this.hint.classList.add("ms__hint--visible"),this.positionHint()))}close(){Y.debug(`[${this.instanceId}] close() called`,{isOpen:this.isOpen}),this.isOpen&&(this.isOpen=!1,this.element.classList.remove("ms--open"),this.dropdown.classList.remove("ms__dropdown--visible"),this.hint&&this.hint.classList.remove("ms__hint--visible"),this.options.shouldKeepSearchOnClose||(this.searchTerm="",(this.options.isMultipleEnabled||this.options.isSearchEnabled)&&(this.input.value=""),this.resetVisibleToAll()),this.focusedIndex=-1,this.dropdown.removeEventListener("scroll",this.onDropdownScroll,!0),this.destroyAllOptionTooltips(),this.hideLabelReveal(),this.hideMessage(),this.renderBadges(),this.dropdownCleanup&&(this.dropdownCleanup(),this.dropdownCleanup=null),this.hintCleanup&&(this.hintCleanup(),this.hintCleanup=null),this.exitFullscreen(),this.dropdownPlacement=null,Y.debug(`[${this.instanceId}] Dropdown closed`))}anchorFloatingPanel(e,t){var r;const o=((r=t.isLocked)==null?void 0:r.call(t))??!0,i=Ge(e,this.input,{strategy:"fixed",placement:"bottom-start",offset:4,shift:8,lockPlacement:o?"freeze":!1,fixedContainingBlock:!0,maxWidth:{padding:8},onDrift:n=>this.warnDrift(n),beforeCompute:()=>{(this.options.hostElement??this.element).style.setProperty("--ms-input-current-width",`${this.input.offsetWidth}px`),this.options.dropdownMinWidth&&(e.style.minWidth=this.options.dropdownMinWidth)},onPlaced:n=>{var a;if(t.getPlacement()||t.setPlacement(n),t.applyMaxWidth&&this.options.dropdownMaxWidth){const l=e.style.maxWidth;e.style.maxWidth=l?`min(${this.options.dropdownMaxWidth}, ${l})`:this.options.dropdownMaxWidth}(a=t.afterPosition)==null||a.call(t)}});return()=>i.destroy()}warnDrift(e){this.positioningDriftWarned||(this.positioningDriftWarned=!0,console.warn(`[@keenmate/web-multiselect] Dropdown panel rendered ${e.driftX.toFixed(0)}px / ${e.driftY.toFixed(0)}px away from where the library positioned it. Most likely culprit: ${e.culpritDescription}`+(e.culpritCss?` (has ${e.culpritCss})`:"")+".\nAn ancestor of <web-multiselect> establishes a fixed-positioning containing block that the library's heuristic doesn't recognize. Fix on your side: replace the property with `transform: translateZ(0)` on that ancestor, OR move the trigger out of that ancestor's subtree. If neither is acceptable, please file an issue at https://github.com/keenmate/web-multiselect/issues with the ancestor's computed CSS."))}positionDropdown(){this.presentationMode!=="fullscreen"&&(this.dropdownCleanup=this.anchorFloatingPanel(this.dropdown,{getPlacement:()=>this.dropdownPlacement,setPlacement:e=>{this.dropdownPlacement=e,Y.debug(`[${this.instanceId}] Locked dropdown placement:`,e)},isLocked:()=>!!this.options.isPlacementLocked,applyMaxWidth:!0,afterPosition:()=>{this.hint&&this.isOpen&&this.positionHint()}}))}setPresentation(e){e!==this.presentationMode&&(this.presentationMode=e,this.isOpen?e==="fullscreen"?(this.dropdownCleanup&&(this.dropdownCleanup(),this.dropdownCleanup=null),this.hintCleanup&&(this.hintCleanup(),this.hintCleanup=null),this.hint&&this.hint.classList.remove("ms__hint--visible"),this.dropdownPlacement=null,this.enterFullscreen(),this.renderDropdown()):(this.exitFullscreen(),this.renderDropdown(),this.positionDropdown(),this.hint&&(this.hint.classList.add("ms__hint--visible"),this.positionHint())):this.showSelectedPopover&&(e==="fullscreen"?(this.selectedPopoverCleanup&&(this.selectedPopoverCleanup(),this.selectedPopoverCleanup=null),this.selectedPopoverPlacement=null,this.clearFloatingInlineGeometry(this.selectedPopover),this.selectedPopover.classList.add("ms__selected-popover--fullscreen"),this.lockBodyScroll()):(this.selectedPopover.classList.remove("ms__selected-popover--fullscreen"),this.unlockBodyScroll(),this.positionSelectedPopover())))}lockBodyScroll(){this.bodyScrollUnlock||(this.bodyScrollUnlock=ii())}unlockBodyScroll(){this.bodyScrollUnlock&&(this.bodyScrollUnlock(),this.bodyScrollUnlock=null)}clampDocumentOverflowX(){if(this.overflowXClamp||typeof document>"u")return;const e=document.documentElement;this.overflowXClamp={html:e.style.overflowX},e.style.overflowX="hidden"}releaseDocumentOverflowX(){!this.overflowXClamp||typeof document>"u"||(document.documentElement.style.overflowX=this.overflowXClamp.html,this.overflowXClamp=null)}observeKeyboardInset(){this.keyboardInsetCleanup=ri(this.dropdown)}unobserveKeyboardInset(){this.keyboardInsetCleanup&&(this.keyboardInsetCleanup(),this.keyboardInsetCleanup=null)}fullscreenScale(){if(this.presentationMode!=="fullscreen"||typeof getComputedStyle!="function")return 1;const e=this.options.hostElement??this.element,t=getComputedStyle(e),o=parseFloat(t.getPropertyValue("--ms-rem"))||10;return(parseFloat(t.getPropertyValue("--ms-fullscreen-rem"))||o*1.2)/o}scaledOptionHeight(){return Math.round((this.options.optionHeight??50)*this.fullscreenScale())}applyVirtualOptionsSizing(e){if(e.style.setProperty("--ms-option-height",`${this.scaledOptionHeight()}px`),this.presentationMode==="fullscreen")e.style.flex="1 1 0",e.style.minHeight="0",e.style.height="",e.style.maxHeight="";else{const t=this.options.maxHeight||"20rem";e.style.flex="",e.style.minHeight="",e.style.height=t,e.style.maxHeight=t}}scaledBadgeHeight(){const e=this.options.badgeHeight??36;return this.presentationMode!=="fullscreen"?e:Math.round(e*this.fullscreenScale()*1.2)}clearFloatingInlineGeometry(e){e.style.position="",e.style.left="",e.style.top="",e.style.right="",e.style.bottom="",e.style.transform="",e.style.maxWidth="",e.style.minWidth="",e.style.width=""}enterFullscreen(){var e;this.clearFloatingInlineGeometry(this.dropdown),this.dropdown.classList.add("ms__dropdown--fullscreen"),this.buildFullscreenHeader(),this.lockBodyScroll(),this.clampDocumentOverflowX(),this.pushOverlayHistory(),this.observeKeyboardInset(),this.fullscreenSearchInput&&(this.fullscreenSearchInput.value=this.searchTerm),this.updateFullscreenSearchClear(),this.options.fullscreenAutofocus?(e=this.fullscreenSearchInput)==null||e.focus():this.input.blur()}exitFullscreen(){this.unobserveKeyboardInset(),this.popOverlayHistory(),this.dropdown.classList.remove("ms__dropdown--fullscreen"),this.fullscreenHeader&&(this.fullscreenHeader.remove(),this.fullscreenHeader=null,this.fullscreenSearchInput=null,this.fullscreenSearchClear=null,this.fullscreenModeToggle=null,this.fullscreenNav=null,this.fullscreenNavCount=null,this.fullscreenNavPrev=null,this.fullscreenNavNext=null),this.unlockBodyScroll(),this.releaseDocumentOverflowX()}pushOverlayHistory(){this.overlayHistoryActive||typeof history>"u"||typeof window>"u"||(this.overlayHistoryActive=!0,history.pushState({msOverlay:this.instanceId},""),window.addEventListener("popstate",this.onOverlayPopstate))}handleOverlayPopstate(){this.overlayHistoryActive&&(this.overlayHistoryActive=!1,window.removeEventListener("popstate",this.onOverlayPopstate),this.isOpen?this.close():this.showSelectedPopover&&this.hideSelectedPopover())}popOverlayHistory(){this.overlayHistoryActive&&(this.overlayHistoryActive=!1,window.removeEventListener("popstate",this.onOverlayPopstate),history.back())}buildFullscreenHeader(){if(this.fullscreenHeader)return;const e=document.createElement("div");if(e.className="ms__fullscreen-header",this.options.isSearchEnabled&&this.options.searchInputMode!=="hidden"){const o=document.createElement("div");if(o.className="ms__fullscreen-search-wrapper",this.options.isSearchModeToggleShown){const r=document.createElement("button");r.type="button",r.className="ms__fullscreen-mode-toggle",r.addEventListener("mousedown",n=>n.preventDefault()),r.addEventListener("click",()=>this.toggleSearchModeLive()),o.appendChild(r),this.fullscreenModeToggle=r}const i=document.createElement("input");if(i.type="text",i.className="ms__fullscreen-search",i.placeholder=this.getPlaceholderText(),i.autocomplete="off",this.options.searchInputMode==="readonly"&&(i.readOnly=!0),i.addEventListener("input",r=>{const n=r.target.value;this.input.value=n,this.handleSearch(n),this.updateFullscreenSearchClear()}),i.addEventListener("keydown",r=>this.handleKeydown(r)),o.appendChild(i),this.fullscreenSearchInput=i,this.options.searchInputMode!=="readonly"){const r=document.createElement("button");r.type="button",r.className="ms__fullscreen-search-clear",r.setAttribute("aria-label","Clear search"),r.addEventListener("mousedown",n=>n.preventDefault()),r.addEventListener("click",()=>this.clearFullscreenSearch()),o.appendChild(r),this.fullscreenSearchClear=r}e.appendChild(o)}const t=document.createElement("button");t.type="button",t.className="ms__fullscreen-close",t.setAttribute("aria-label","Close"),t.addEventListener("click",()=>this.close()),e.appendChild(t),this.dropdown.insertBefore(e,this.dropdownInner),this.fullscreenHeader=e,this.options.isSearchEnabled&&(this.options.searchMode||"filter")==="navigate"&&this.ensureFullscreenNav(),this.updateFullscreenModeToggle(),this.updateFullscreenNav(),this.updateFullscreenSearchClear()}ensureFullscreenNav(){if(this.fullscreenNav||!this.fullscreenHeader)return;const e=document.createElement("div");e.className="ms__fullscreen-nav";const t=document.createElement("span");t.className="ms__fullscreen-nav-count",e.appendChild(t);const o=document.createElement("div");o.className="ms__fullscreen-nav-controls";const i=document.createElement("button");i.type="button",i.className="ms__fullscreen-nav-btn ms__fullscreen-nav-btn--prev",i.setAttribute("aria-label","Previous match"),i.addEventListener("click",()=>this.focusPreviousMatch());const r=document.createElement("button");r.type="button",r.className="ms__fullscreen-nav-btn ms__fullscreen-nav-btn--next",r.setAttribute("aria-label","Next match"),r.addEventListener("click",()=>this.focusNextMatch()),o.appendChild(i),o.appendChild(r),e.appendChild(o),this.fullscreenHeader.appendChild(e),this.fullscreenNav=e,this.fullscreenNavCount=t,this.fullscreenNavPrev=i,this.fullscreenNavNext=r}removeFullscreenNav(){this.fullscreenNav&&(this.fullscreenNav.remove(),this.fullscreenNav=null,this.fullscreenNavCount=null,this.fullscreenNavPrev=null,this.fullscreenNavNext=null)}toggleSearchModeLive(){const e=(this.options.searchMode||"filter")==="navigate"?"filter":"navigate";this.setSearchModeLive(e)}setSearchModeLive(e){var t;(this.options.searchMode||"filter")!==e&&(this.options.searchMode=e,e==="navigate"?this.ensureFullscreenNav():this.removeFullscreenNav(),this.updateFullscreenModeToggle(),this.refreshSearchPlaceholder(),this.handleSearch(this.searchTerm),(t=this.fullscreenSearchInput)==null||t.focus())}updateFullscreenModeToggle(){if(!this.fullscreenModeToggle)return;const e=this.options.searchMode||"filter";this.fullscreenModeToggle.dataset.mode=e;const t=e==="navigate"?"filter":"navigate";this.fullscreenModeToggle.setAttribute("aria-label",`Switch to ${t} mode`),this.fullscreenModeToggle.setAttribute("title",`Switch to ${t} mode`),this.fullscreenModeToggle.setAttribute("aria-pressed",String(e==="navigate"))}updateFullscreenNav(){if(!this.fullscreenNav)return;const e=this.matchingIndices.size,t=!!this.searchTerm;if(this.fullscreenNav.style.display=t?"":"none",this.fullscreenNavCount)if(e===0)this.fullscreenNavCount.textContent=this.options.emptyMessage||"No matches";else{const r=Array.from(this.matchingIndices).sort((n,a)=>n-a).indexOf(this.focusedIndex);this.fullscreenNavCount.textContent=r>=0?`${r+1} of ${e}`:`${e} match${e===1?"":"es"}`}const o=e===0;this.fullscreenNavPrev&&(this.fullscreenNavPrev.disabled=o),this.fullscreenNavNext&&(this.fullscreenNavNext.disabled=o)}updateFullscreenSearchClear(){if(!this.fullscreenSearchClear)return;const e=!!(this.fullscreenSearchInput&&this.fullscreenSearchInput.value);this.fullscreenSearchClear.style.display=e?"":"none"}clearFullscreenSearch(){var e;this.fullscreenSearchInput&&(this.fullscreenSearchInput.value=""),this.input.value="",this.handleSearch(""),this.updateFullscreenSearchClear(),(e=this.fullscreenSearchInput)==null||e.focus()}positionHint(){if(!this.hint)return;this.hintCleanup&&this.hintCleanup();let e="top-start";this.dropdownPlacement&&(this.dropdownPlacement.startsWith("bottom")?e=this.dropdownPlacement.replace("bottom","top"):this.dropdownPlacement.startsWith("top")&&(e=this.dropdownPlacement.replace("top","bottom")));const t=Ge(this.hint,this.input,{strategy:"fixed",placement:e,offset:4,shift:8,flip:!1});this.hintCleanup=()=>t.destroy()}parseInitialSelection(){const e=this.element.dataset.initialValues;if(e)try{JSON.parse(e).forEach(o=>{this.selectedValues.add(String(o))}),this.reconcileSelectedOptions(),this.renderBadges()}catch(t){j.error(`[${this.instanceId}] Failed to parse initial values:`,t)}}reconcileSelectedOptions(){this.selectedValues.size===0||this.allOptions.length===0||this.selectedValues.forEach(e=>{if(this.selectedOptions.has(e))return;const t=this.allOptions.find(o=>String(this.getItemValue(o))===e);t&&this.selectedOptions.set(e,t)})}toggleSelectedPopover(){this.showSelectedPopover?this.hideSelectedPopover():this.showPopover()}showPopover(){Y.debug(`[${this.instanceId}] showPopover() called`),this.isOpen&&this.close(),this.hideMessage(),this.showSelectedPopover=!0,this.renderSelectedPopover(),this.selectedPopover.classList.add("ms__selected-popover--visible");const e=this.options.virtualScrollThreshold??100;this.selectedValues.size>=e&&this.selectedPopover.classList.add("ms__selected-popover--virtual"),this.presentationMode==="fullscreen"?(this.selectedPopover.classList.add("ms__selected-popover--fullscreen"),this.lockBodyScroll(),this.clampDocumentOverflowX(),this.pushOverlayHistory()):this.positionSelectedPopover()}hideSelectedPopover(){var e;Y.debug(`[${this.instanceId}] hideSelectedPopover() called`),this.showSelectedPopover=!1,this.selectedPopover.classList.remove("ms__selected-popover--visible"),this.selectedPopover.classList.remove("ms__selected-popover--virtual"),this.selectedPopover.classList.remove("ms__selected-popover--fullscreen"),this.unlockBodyScroll(),this.releaseDocumentOverflowX(),this.popOverlayHistory(),this.hideMessage(),this.selectedPopoverPlacement=null,this.selectedPopoverVirtualScroll&&(this.selectedPopoverVirtualScroll.destroy(),this.selectedPopoverVirtualScroll=null,this.selectedPopoverContainer=null),this.selectedPopoverCleanup&&(this.selectedPopoverCleanup(),this.selectedPopoverCleanup=null);for(const t of Array.from(this.tooltips.keys()))t.startsWith("popover-")&&((e=this.tooltips.get(t))==null||e.destroy(),this.tooltips.delete(t))}renderSelectedPopover(){const e=Array.from(this.selectedOptions.values()),t=this.selectedValues.size,o=this.options.virtualScrollThreshold??100;if(t>=o){this.renderSelectedPopoverVirtual(e,t);return}this.selectedPopover.innerHTML=`
|
|
18
18
|
<div class="ms__selected-popover-header">
|
|
19
19
|
<span>Selected Items (${t})</span>
|
|
20
20
|
<button type="button" class="ms__selected-popover-close" aria-label="Close"></button>
|
|
@@ -28,17 +28,17 @@
|
|
|
28
28
|
<button type="button" class="ms__selected-popover-close" aria-label="Close"></button>
|
|
29
29
|
</div>
|
|
30
30
|
<div class="ms__selected-popover-body ms__selected-popover-body--virtual" style="${l} overflow-y: auto; position: relative; --ms-badge-height-virtual: ${a}px;"></div>
|
|
31
|
-
`;this.selectedPopover.innerHTML=c,this.selectedPopoverContainer=this.selectedPopover.querySelector(".ms__selected-popover-body")}if(!this.selectedPopoverContainer)return;const o=this.scaledBadgeHeight(),i=Math.round(4*this.fullscreenScale()),r=o+i,n=this.options.virtualScrollBuffer??10;requestAnimationFrame(()=>{this.selectedPopoverContainer&&(this.selectedPopoverVirtualScroll?this.selectedPopoverVirtualScroll.setItems(e):this.selectedPopoverVirtualScroll=new
|
|
32
|
-
<div class="${
|
|
33
|
-
<span class="ms__badge-text">${
|
|
34
|
-
<button type="button" class="ms__badge-remove" data-value="${o}" aria-label="Remove ${
|
|
31
|
+
`;this.selectedPopover.innerHTML=c,this.selectedPopoverContainer=this.selectedPopover.querySelector(".ms__selected-popover-body")}if(!this.selectedPopoverContainer)return;const o=this.scaledBadgeHeight(),i=Math.round(4*this.fullscreenScale()),r=o+i,n=this.options.virtualScrollBuffer??10;requestAnimationFrame(()=>{this.selectedPopoverContainer&&(this.selectedPopoverVirtualScroll?this.selectedPopoverVirtualScroll.setItems(e):this.selectedPopoverVirtualScroll=new Ds({container:this.selectedPopoverContainer,itemHeight:r,items:e,renderItem:a=>this.renderBadgeHTML(a,{displayMode:this.options.badgesDisplayMode||"badges",isInPopover:!0}),bufferSize:n,onVisibleRangeChange:()=>{this.attachBadgeTooltips(this.selectedPopoverContainer)}}))})}renderBadgeHTML(e,t){const o=this.getItemValue(e),i={...t,...At(this.presentationMode)};let r;const n=t.isInPopover?this.options.renderSelectedItemContentCallback:void 0;if(n){const d=n(e);r=typeof d=="string"?d:d.outerHTML}else if(this.options.renderBadgeContentCallback){const d=this.options.renderBadgeContentCallback(e,i);r=typeof d=="string"?d:d.outerHTML}else r=this.getItemBadgeDisplayValue(e);const a=t.isInPopover?this.options.getSelectedItemClassCallback||this.options.getBadgeClassCallback:this.options.getBadgeClassCallback;let l="ms__badge";if(a){const d=a(e),h=Array.isArray(d)?d:[d];l+=" "+h.filter(f=>f).join(" ")}const c=this.getItemBadgeDisplayValue(e);return`
|
|
32
|
+
<div class="${l}">
|
|
33
|
+
<span class="ms__badge-text">${r}</span>
|
|
34
|
+
<button type="button" class="ms__badge-remove" data-value="${o}" aria-label="Remove ${c}"></button>
|
|
35
35
|
</div>
|
|
36
|
-
`}handleSelectedPopoverClick(e){if(e.stopPropagation(),e.target.closest(".ms__selected-popover-close")){e.preventDefault(),this.hideSelectedPopover();return}const o=e.target.closest(".ms__badge-remove");if(o){e.preventDefault();const i=o.dataset.value,r=this.selectedOptions.get(i);r&&this.interactiveDeselect(r)&&(this.renderSelectedPopover(),this.selectedValues.size===0&&this.hideSelectedPopover())}}positionSelectedPopover(){this.presentationMode!=="fullscreen"&&(this.selectedPopoverCleanup=this.anchorFloatingPanel(this.selectedPopover,{getPlacement:()=>this.selectedPopoverPlacement,setPlacement:e=>{this.selectedPopoverPlacement=e,Y.debug(`[${this.instanceId}] Locked popover placement:`,e)}}))}updateHiddenInput(){if(!this.options.formFieldId)return;this.hiddenInputs.forEach(i=>i.remove()),this.hiddenInputs=[];const e=this.options.valueFormat||"json",t=Array.from(this.selectedOptions.values()).map(i=>this.getItemValue(i)),o=this.options.hostElement||this.element;if(e==="array")t.forEach(i=>{const r=document.createElement("input");r.type="hidden",r.name=`${this.options.formFieldId}[]`,r.value=String(i),o.appendChild(r),this.hiddenInputs.push(r)});else{const i=document.createElement("input");i.type="hidden",i.name=this.options.formFieldId,i.id=this.options.formFieldId,i.value=this.getFormValue(),o.appendChild(i),this.hiddenInputs.push(i)}}getFormValue(){const e=Array.from(this.selectedOptions.values()).map(o=>this.getItemValue(o));return this.options.getValueFormatCallback?this.options.getValueFormatCallback(e):(this.options.valueFormat||"json")==="csv"?e.join(","):JSON.stringify(e)}getSelected(){return Array.from(this.selectedOptions.values())}setSelected(e,t={}){this.selectedValues=new Set(e.map(o=>String(o))),this.selectedOptions.clear(),e.forEach(o=>{const i=String(o),r=this.allOptions.find(n=>String(this.getItemValue(n))===i);r&&this.selectedOptions.set(i,r)}),this.renderDropdown(),this.renderBadges(),this.updateHiddenInput(),t.notify&&this.options.onChange&&this.options.onChange(this.getSelected())}updateOptions(e){var n;const t=!!this.hint,o="searchHint"in e?!!e.searchHint:t;if(t!==o)return!1;Object.assign(this.options,e);const i="pathMember"in e||"getPathCallback"in e||"parentPathMember"in e||"levelMember"in e||"hasChildrenMember"in e||"treePathSeparator"in e||"isTreeEnabled"in e||"isSelectableMember"in e||"getIsSelectableCallback"in e;if("options"in e&&e.options!==void 0?(this.allOptions=e.options,this.reconcileSelectedOptions(),this.isTreeMode()?this.buildTree():this.filteredOptions=this.searchTerm?this.filteredOptions:[...this.allOptions]):i&&(this.isTreeMode()?this.buildTree():this.filteredOptions=this.searchTerm?this.filteredOptions:[...this.allOptions]),("checkboxMode"in e||"cascadeSelectPolicy"in e)&&!i&&!("options"in e)&&this.isTreeMode()&&(this.cascadeIndex=this.isCascadeMode()?
|
|
37
|
-
${o}`:t}buildRemoveButtonTooltipText(e,t){return t&&this.options.getRemoveButtonTooltipCallback?this.options.getRemoveButtonTooltipCallback(t):this.options.removeButtonTooltipText?this.options.removeButtonTooltipText.replace("{0}",e):`Remove ${e}`}attachBadgeTooltips(e){if(!this.options.isBadgeTooltipsEnabled)return;const t=!!e,o=e||this.badgesContainer,i=t?"popover-":"";if(o.querySelectorAll(".ms__badge:not(.ms__badge--more)").forEach(n=>{const a=n.querySelector(".ms__badge-remove");if(!a)return;const l=a.dataset.value,c=this.selectedOptions.get(l);if(!c)return;const d=`${i}${l}`,h=`${i}${l}-remove`,f=n.querySelector(".ms__badge-text");f&&this.spawnTooltip({id:d,trigger:f,content:this.buildBadgeTooltipContent(c)});const
|
|
38
|
-
${o}`:t}attachOptionTooltips(){if(this.destroyAllOptionTooltips(),!this.options.isOptionTooltipsEnabled)return;this.dropdown.querySelectorAll(".ms__option").forEach(t=>{const o=t,i=parseInt(o.dataset.index??"-1",10);if(i<0)return;const r=this.filteredOptions[i];if(!r)return;const n=this.buildOptionTooltipContent(r);n&&this.spawnTooltip({id:`option-${i}`,trigger:o,content:n,placement:this.options.optionTooltipPlacement??"top-start",offsetDistance:this.options.optionTooltipOffset??this.options.badgeTooltipOffset??8,showDelay:this.options.optionTooltipDelay??this.options.badgeTooltipDelay??100,cssClass:"ms__option-tooltip",visibleClass:"ms__option-tooltip--visible",followCursor:this.options.isOptionTooltipFollowCursor})})}markTruncatedOptions(){if(this.presentationMode!=="fullscreen")return;this.dropdown.querySelectorAll(".ms__option").forEach(t=>{const o=t,i=o.querySelector(".ms__option-title"),r=!!i&&i.scrollWidth>i.clientWidth+1;o.classList.toggle("ms__option--truncated",r)})}toggleLabelReveal(e){var d;if(this.labelRevealPopover&&this.labelRevealTrigger===e){this.hideLabelReveal();return}this.hideLabelReveal();const t=e.closest(".ms__option");if(!t)return;const o=parseInt(t.dataset.index??"-1",10);if(o<0)return;const i=this.isTreeMode()?(d=this.treeNodes[o])==null?void 0:d.data:this.filteredOptions[o];if(!i)return;const r=this.buildOptionTooltipContent(i);if(!r)return;const n=document.createElement("div");n.className="ms__option-tooltip ms__option-tooltip--fullscreen",typeof r=="string"?n.textContent=r:n.appendChild(r);const a=this.element.getRootNode(),l=a instanceof ShadowRoot?a:null,c=this.options.container??l??document.body;this.labelRevealTrigger=e,this.labelRevealPanel=n,this.labelRevealPopover=
|
|
39
|
-
`;function
|
|
40
|
-
`:e==="\\t"?" ":e==="\\r"?"\r":"\\")}function Tr(s){let e;try{e=JSON.parse(s)}catch(t){return{options:[],error:`data-options is not valid JSON: ${t.message}`}}return Array.isArray(e)?{options:e}:{options:[],error:"data-options JSON must be an array"}}function Or(s,e,t){return{options:s.split(t).flatMap(i=>i.split(e)).map(i=>i.trim()).filter(i=>i.length>0).map(i=>[i,i])}}function Ir(s,e,t){const o=Pr(s,e,t).filter(n=>!(n.length===1&&n[0].trim()===""));if(o.length<2)return{options:[],error:"data-options CSV needs a header row and at least one data row"};const i=o[0].map(n=>n.trim());return{options:o.slice(1).map(n=>{const a={};return i.forEach((l,c)=>{a[l]=(n[c]??"").trim()}),a})}}function Pr(s,e,t){const o=[];let i=[],r="",n=!1;for(let a=0;a<s.length;){const l=s[a];if(n){l==='"'?s[a+1]==='"'?(r+='"',a+=2):(n=!1,a+=1):(r+=l,a+=1);continue}l==='"'?(n=!0,a+=1):s.startsWith(e,a)?(i.push(r),r="",a+=e.length):s.startsWith(t,a)?(i.push(r),o.push(i),i=[],r="",a+=t.length):(l==="\r"||(r+=l),a+=1)}return i.push(r),o.push(i),o}const Gs=`@layer variables,component,overrides;@layer variables{:host{display:block;--ms-rem: 10px;font-family:var(--ms-font-family, var(--base-font-family, inherit));--ms-accent-color: var(--base-accent-color, #3b82f6);--ms-accent-color-hover: var(--base-accent-color-hover, #2563eb);--ms-accent-color-active: var(--base-accent-color-active, #1d4ed8);--ms-accent-color-light: var(--base-accent-color-light, light-dark(#eff6ff, #1e3a5f));--ms-accent-color-light-hover: var(--base-accent-color-light-hover, light-dark(#e0f2fe, #264a73));--ms-text-color-1: var(--base-text-color-1, light-dark(#111827, #f5f5f5));--ms-text-color-2: var(--base-text-color-2, light-dark(#353b47, #d4d4d4));--ms-text-color-3: var(--base-text-color-3, light-dark(#6b7280, #a3a3a3));--ms-text-color-4: var(--base-text-color-4, light-dark(#a0a3a9, #737373));--ms-text-color-on-accent: var(--base-text-color-on-accent, #ffffff);--ms-text-primary: var(--ms-text-color-1);--ms-text-secondary: var(--ms-text-color-3);--ms-primary-bg: var(--base-hover-bg, color-mix(in srgb, var(--ms-text-color-1) 8%, var(--base-main-bg, light-dark(#ffffff, #1a1a1a))));--ms-primary-bg-hover: var(--base-active-bg, color-mix(in srgb, var(--ms-text-color-1) 14%, var(--base-main-bg, light-dark(#ffffff, #1a1a1a))));--ms-border-color: var(--base-border-color, light-dark(#e5e7eb, #3a3a3a));--ms-border: var(--base-border, 1px solid var(--ms-border-color));--ms-input-bg: var(--base-input-bg, light-dark(#ffffff, #1a1a1a));--ms-input-color: var(--base-input-color, var(--ms-text-color-1));--ms-input-border: var(--base-input-border, 1px solid var(--ms-border-color));--ms-input-border-hover: var(--base-input-border-hover, 1px solid var(--ms-accent-color));--ms-input-border-focus: var(--base-input-border-focus, 1px solid var(--ms-accent-color));--ms-input-placeholder-color: var(--base-input-placeholder-color, var(--ms-text-color-4));--ms-input-bg-disabled: var(--base-input-bg-disabled, rgba(107, 114, 128, .05));--ms-toggle-icon-color: var(--ms-text-color-3);--ms-toggle-icon-color-open: var(--ms-text-color-3);--ms-counter-badge-bg: var(--ms-accent-color);--ms-counter-badge-bg-hover: var(--ms-accent-color-hover);--ms-counter-badge-color: var(--ms-text-color-on-accent);--ms-hint-bg: var(--base-main-bg, light-dark(#ffffff, #1a1a1a));--ms-hint-color: var(--ms-text-color-4);--ms-hint-border-color: var(--ms-border-color);--ms-dropdown-bg: var(--base-dropdown-bg, var(--base-elevated-bg, light-dark(#ffffff, #1a1a1a)));--ms-dropdown-text-color: var(--ms-text-color-1);--ms-dropdown-border-color: var(--ms-border-color);--ms-dropdown-box-shadow-semantic: var(--base-dropdown-box-shadow, 0 20px 25px -5px rgb(0 0 0 / .1), 0 8px 10px -6px rgb(0 0 0 / .1));--ms-actions-bg: var(--base-main-bg, light-dark(#ffffff, #1a1a1a));--ms-actions-border-color: var(--ms-border-color);--ms-action-button-bg: transparent;--ms-action-button-bg-hover: var(--ms-primary-bg);--ms-action-button-border-color: var(--ms-border-color);--ms-action-button-border-color-hover: var(--ms-accent-color);--ms-action-button-color: var(--ms-text-color-1);--ms-group-border-color: var(--ms-border-color);--ms-option-text-color: var(--ms-text-color-1);--ms-option-bg: transparent;--ms-option-bg-hover: var(--ms-primary-bg);--ms-option-color-hover: inherit;--ms-option-bg-focused: var(--ms-primary-bg);--ms-option-color-focused: inherit;--ms-option-outline-color-focused: var(--ms-accent-color);--ms-option-bg-selected: color-mix(in srgb, var(--ms-accent-color) 10%, transparent);--ms-option-bg-matched: color-mix(in srgb, var(--ms-accent-color) 8%, transparent);--ms-option-color-matched: inherit;--ms-option-border-matched-color: color-mix(in srgb, var(--ms-accent-color) 40%, transparent);--ms-option-title-color: var(--ms-text-color-1);--ms-option-subtitle-color: var(--ms-text-color-3);--ms-option-mark-bg: color-mix(in srgb, var(--ms-accent-color) 20%, transparent);--ms-option-mark-color: inherit;--ms-loading-color: var(--ms-text-color-3);--ms-badge-bg: var(--ms-accent-color-light);--ms-badge-bg-hover: var(--base-hover-bg, var(--ms-accent-color-light-hover));--ms-badge-bg-active: var(--ms-accent-color-light-hover);--ms-badge-text-bg-hover: var(--base-hover-bg, var(--ms-accent-color-light-hover));--ms-badge-text-color-hover: var(--ms-badge-text-color);--ms-badge-counter-border-color: var(--ms-border-color);--ms-badge-counter-text-bg: var(--ms-primary-bg-hover);--ms-badge-counter-text-color: var(--ms-text-color-1);--ms-badge-counter-remove-bg: var(--ms-text-color-3);--ms-badge-counter-remove-bg-hover: var(--ms-text-color-1);--ms-badge-counter-remove-color: var(--ms-text-color-on-accent);--ms-counter-wrapper-border-color: var(--ms-border-color);--ms-count-clear-bg-hover: var(--ms-accent-color);--ms-tooltip-bg: var(--base-tooltip-bg, var(--base-inverse-bg, light-dark(#333333, #f5f5f5)));--ms-tooltip-text-color: var(--base-tooltip-text-color, light-dark(#ffffff, #1a1a1a));--ms-selected-popover-bg: var(--base-dropdown-bg, var(--base-elevated-bg, light-dark(#ffffff, #1a1a1a)));--ms-selected-popover-border-color: var(--ms-border-color);--ms-selected-popover-header-border-color: var(--ms-border-color);--ms-selected-popover-close-bg-hover: var(--ms-accent-color);--ms-input-padding: calc(.8 * var(--ms-rem)) calc(1.2 * var(--ms-rem));--ms-input-padding-right: calc(4 * var(--ms-rem));--ms-input-padding-h: calc(1.2 * var(--ms-rem));--ms-input-height: calc(var(--base-input-size-md-height, 3.5) * var(--ms-rem));--ms-input-font-size: calc(var(--base-font-size-sm, 1.4) * var(--ms-rem));--ms-input-border-width: 1px;--ms-input-border-radius: var(--ms-border-radius-md);--ms-input-text: var(--ms-text-color-1);--ms-input-bg-disabled: rgba(107, 114, 128, .05);--ms-toggle-right: calc(1.2 * var(--ms-rem));--ms-toggle-color: var(--ms-text-color-3);--ms-transform-center-y: translateY(-50%);--ms-transform-rotate-180: 180deg;--ms-counter-offset: calc(3.2 * var(--ms-rem));--ms-counter-padding: calc(.2 * var(--ms-rem)) calc(.4 * var(--ms-rem));--ms-counter-bg: var(--ms-accent-color);--ms-counter-color: var(--ms-text-color-on-accent);--ms-counter-font-size: calc(var(--base-font-size-xs, 1.2) * var(--ms-rem));--ms-counter-font-weight: var(--base-font-weight-semibold, 600);--ms-counter-border-radius: var(--ms-border-radius-sm);--ms-counter-bg-hover: var(--ms-accent-color-hover);--ms-transform-scale-hover: 1.1;--ms-hint-padding: calc(.8 * var(--ms-rem)) calc(1.2 * var(--ms-rem));--ms-hint-border: 1px solid var(--ms-hint-border-color);--ms-hint-border-radius: var(--ms-border-radius-lg);--ms-hint-box-shadow: 0 4px 6px -1px rgb(0 0 0 / .1), 0 2px 4px -2px rgb(0 0 0 / .1);--ms-hint-font-size: calc(var(--base-font-size-xs, 1.2) * var(--ms-rem));--ms-dropdown-border: var(--base-dropdown-border, 1px solid var(--ms-dropdown-border-color));--ms-dropdown-border-radius: var(--ms-border-radius-lg);--ms-dropdown-box-shadow: 0 20px 25px -5px rgb(0 0 0 / .1), 0 8px 10px -6px rgb(0 0 0 / .1);--ms-input-current-width: auto;--ms-dropdown-width: var(--ms-input-current-width);--ms-options-max-height: calc(32 * var(--ms-rem));--ms-option-color: var(--ms-text-color-1);--ms-z-index-dropdown: 9999;--ms-z-index-sticky: 1;--ms-z-index-fullscreen: 10001;--ms-z-index-fullscreen-tooltip: 10002;--ms-fullscreen-rem: 12px;--ms-fullscreen-bg: var(--ms-dropdown-bg);--ms-fullscreen-text-color: var(--ms-dropdown-text-color);--ms-fullscreen-header-bg: var(--ms-dropdown-bg);--ms-fullscreen-header-border: 1px solid var(--ms-dropdown-border-color);--ms-fullscreen-header-gap: calc(.8 * var(--ms-fullscreen-rem));--ms-fullscreen-header-padding-v: calc(.8 * var(--ms-fullscreen-rem));--ms-fullscreen-header-padding-h: calc(1.2 * var(--ms-fullscreen-rem));--ms-fullscreen-header-padding: var(--ms-fullscreen-header-padding-v) var(--ms-fullscreen-header-padding-h);--ms-fullscreen-header-min-height: calc(5.6 * var(--ms-fullscreen-rem));--ms-fullscreen-title-font-size: calc(1.7 * var(--ms-fullscreen-rem));--ms-fullscreen-title-font-weight: var(--base-font-weight-semibold, 600);--ms-fullscreen-search-border: var(--ms-input-border);--ms-fullscreen-search-border-radius: var(--ms-input-border-radius);--ms-fullscreen-search-padding: calc(.8 * var(--ms-fullscreen-rem)) calc(1.2 * var(--ms-fullscreen-rem));--ms-fullscreen-search-font-size: calc(1.6 * var(--ms-fullscreen-rem));--ms-fullscreen-search-clear-size: calc(2.8 * var(--ms-fullscreen-rem));--ms-fullscreen-search-clear-icon-size: calc(1.4 * var(--ms-fullscreen-rem));--ms-fullscreen-search-clear-inset: calc(.4 * var(--ms-fullscreen-rem));--ms-fullscreen-search-clear-gutter: calc(3.4 * var(--ms-fullscreen-rem));--ms-fullscreen-search-clear-color: var(--ms-text-muted-color, var(--ms-dropdown-text-color));--ms-fullscreen-search-clear-bg-hover: var(--ms-option-bg-matched, transparent);--ms-fullscreen-close-size: calc(3.6 * var(--ms-fullscreen-rem));--ms-fullscreen-close-icon-size: calc(1.6 * var(--ms-fullscreen-rem));--ms-fullscreen-close-color: var(--ms-dropdown-text-color);--ms-fullscreen-close-bg: transparent;--ms-fullscreen-close-border: none;--ms-fullscreen-close-border-radius: 50%;--ms-fullscreen-close-bg-hover: var(--ms-option-bg-matched, transparent);--ms-fullscreen-close-edge-nudge: calc(.8 * var(--ms-fullscreen-rem));--ms-fullscreen-info-size: calc(2.8 * var(--ms-fullscreen-rem));--ms-fullscreen-info-icon-size: calc(1.8 * var(--ms-fullscreen-rem));--ms-fullscreen-info-color: var(--ms-accent-color);--ms-fullscreen-info-bg-hover: var(--ms-option-bg-matched, transparent);--ms-fullscreen-nav-gap: calc(.6 * var(--ms-fullscreen-rem));--ms-fullscreen-nav-padding-top: calc(.6 * var(--ms-fullscreen-rem));--ms-fullscreen-nav-count-font-size: calc(1.3 * var(--ms-fullscreen-rem));--ms-fullscreen-nav-count-color: var(--ms-text-muted-color, var(--ms-dropdown-text-color));--ms-fullscreen-nav-btn-size: calc(3.2 * var(--ms-fullscreen-rem));--ms-fullscreen-nav-btn-icon-size: calc(1.6 * var(--ms-fullscreen-rem));--ms-fullscreen-nav-btn-color: var(--ms-dropdown-text-color);--ms-fullscreen-nav-btn-bg: var(--ms-option-bg-matched, transparent);--ms-fullscreen-nav-btn-bg-hover: var(--ms-accent-color-light, var(--ms-option-bg-matched, transparent));--ms-icon-chevron: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path d='M5 15l7-7 7 7' stroke='black' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round' fill='none'/></svg>");--ms-icon-info: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><circle cx='12' cy='12' r='9' fill='none' stroke='black' stroke-width='2'/><circle cx='12' cy='7.5' r='1.3' fill='black'/><path d='M12 11v6' stroke='black' stroke-width='2' stroke-linecap='round' fill='none'/></svg>");--ms-fullscreen-tree-base-indent: calc(.7 * var(--ms-fullscreen-rem));--ms-fullscreen-tree-indent: calc(1.2 * var(--ms-fullscreen-rem));--ms-actions-gap: calc(.4 * var(--ms-rem));--ms-actions-padding: calc(.8 * var(--ms-rem));--ms-actions-border-bottom: 1px solid var(--ms-actions-border-color);--ms-action-btn-padding: calc(.4 * var(--ms-rem)) calc(.8 * var(--ms-rem));--ms-action-btn-font-size: calc(var(--base-font-size-xs, 1.2) * var(--ms-rem));--ms-action-btn-border: var(--ms-border);--ms-action-btn-border-radius: var(--ms-border-radius-sm);--ms-action-btn-bg: transparent;--ms-action-btn-color: inherit;--ms-action-btn-bg-hover: var(--ms-primary-bg);--ms-action-btn-border-color-hover: var(--ms-accent-color);--ms-transform-scale-active: .98;--ms-options-padding: 0;--ms-group-border-top: 1px solid var(--ms-group-border-color);--ms-group-margin-top: calc(.4 * var(--ms-rem));--ms-group-padding-top: calc(.4 * var(--ms-rem));--ms-group-label-padding: calc(.4 * var(--ms-rem)) calc(1.2 * var(--ms-rem));--ms-group-label-font-size: calc(var(--base-font-size-xs, 1.2) * var(--ms-rem));--ms-group-label-font-weight: var(--base-font-weight-semibold, 600);--ms-group-label-color: var(--ms-text-color-3);--ms-group-label-transform: uppercase;--ms-group-label-letter-spacing: .05em;--ms-option-gap: calc(.8 * var(--ms-rem));--ms-option-padding: calc(.8 * var(--ms-rem)) calc(1.2 * var(--ms-rem));--ms-option-padding-h: calc(1.2 * var(--ms-rem));--ms-option-min-height: auto;--ms-option-outline-focused: 2px solid var(--ms-option-outline-color-focused);--ms-option-focus-outline-offset: -2px;--ms-option-border-matched: 3px solid var(--ms-option-border-matched-color);--ms-option-bg-focused-hover: var(--ms-primary-bg);--ms-option-bg-matched-hover: color-mix(in srgb, var(--ms-accent-color) 12%, transparent);--ms-option-bg-selected-focused: color-mix(in srgb, var(--ms-accent-color) 15%, transparent);--ms-option-bg-selected-matched: color-mix(in srgb, var(--ms-accent-color) 15%, transparent);--ms-option-disabled-bg: var(--base-disabled-bg, transparent);--ms-option-bg-disabled-selected: color-mix(in srgb, var(--ms-accent-color) 10%, transparent);--ms-disabled-opacity: .5;--ms-option-content-gap: calc(.8 * var(--ms-rem));--ms-option-icon-size: calc(2 * var(--ms-rem));--ms-option-icon-font-size: calc(var(--base-font-size-base, 1.6) * var(--ms-rem));--ms-option-title-font-size: calc(var(--base-font-size-sm, 1.4) * var(--ms-rem));--ms-option-mark-font-weight: var(--base-font-weight-semibold, 600);--ms-option-title-white-space: normal;--ms-option-title-overflow: visible;--ms-option-title-text-overflow: clip;--ms-option-subtitle-margin-top: calc(.4 * var(--ms-rem));--ms-option-subtitle-font-size: calc(var(--base-font-size-xs, 1.2) * var(--ms-rem));--ms-option-subtitle-line-height: var(--base-line-height-tight, 1.25);--ms-checkbox-margin-top: calc(.2 * var(--ms-rem));--ms-checkbox-margin-right: 0;--ms-checkbox-margin-bottom: 0;--ms-checkbox-margin-left: 0;--ms-checkbox-size: calc(1.6 * var(--ms-rem));--ms-checkbox-scale: 1;--ms-checkbox-align: center;--ms-checkbox-bg: var(--ms-input-bg);--ms-checkbox-border-width: 1px;--ms-checkbox-border-color: var(--base-checkbox-border-color, #8f8f8f);--ms-checkbox-border: var(--ms-checkbox-border-width) solid var(--ms-checkbox-border-color);--ms-checkbox-border-radius: calc(.3 * var(--ms-rem));--ms-checkbox-checkmark-thickness: 2.5px;--ms-checkbox-checked-bg: var(--ms-accent-color);--ms-checkbox-checked-border: var(--ms-checkbox-border-width) solid var(--ms-accent-color);--ms-checkbox-checkmark-color: var(--ms-text-color-on-accent);--ms-checkbox-hover-border-color: var(--ms-accent-color);--ms-checkbox-disabled-bg: var(--ms-primary-bg);--ms-checkbox-disabled-border: var(--ms-checkbox-border-width) solid var(--ms-border-color);--ms-checkbox-checked-bg-hover: var(--ms-accent-color-hover);--ms-checkbox-checked-border-color-hover: var(--ms-accent-color-hover);--ms-state-min-height: calc(8 * var(--ms-rem));--ms-empty-padding: calc(1.6 * var(--ms-rem)) calc(1.2 * var(--ms-rem));--ms-empty-font-size: calc(var(--base-font-size-sm, 1.4) * var(--ms-rem));--ms-empty-color: var(--ms-text-color-3);--ms-loader-padding: calc(1.6 * var(--ms-rem)) calc(1.2 * var(--ms-rem));--ms-loader-gap: calc(.8 * var(--ms-rem));--ms-loading-text-font-size: calc(var(--base-font-size-sm, 1.4) * var(--ms-rem));--ms-loading-text-color: var(--ms-text-color-3);--ms-badges-gap: calc(.8 * var(--ms-rem));--ms-badges-margin-bottom: calc(.8 * var(--ms-rem));--ms-badges-margin-top: calc(.8 * var(--ms-rem));--ms-badges-margin-left: calc(.4 * var(--ms-rem));--ms-badges-margin-right: calc(.4 * var(--ms-rem));--ms-inline-align: center;--ms-badge-gap: calc(.8 * var(--ms-rem));--ms-badge-height: calc(2.7 * var(--ms-rem));--ms-badge-font-size: calc(var(--base-font-size-xs, 1.2) * var(--ms-rem));--ms-badge-font-weight: var(--base-font-weight-semibold, 600);--ms-badge-border-radius: var(--ms-border-radius-sm);--ms-order-first: -1;--ms-badge-text-padding: 0 calc(.8 * var(--ms-rem));--ms-badge-text-bg: var(--ms-accent-color-light);--ms-badge-text-color: var(--ms-accent-color);--ms-badge-text-border: none;--ms-badge-remove-width: calc(2.7 * var(--ms-rem));--ms-badge-remove-bg: var(--ms-accent-color);--ms-badge-remove-color: var(--ms-text-color-on-accent);--ms-badge-remove-border: none;--ms-badge-remove-font-size: calc(var(--base-font-size-xs, 1.2) * var(--ms-rem));--ms-badge-remove-bg-hover: var(--ms-accent-color-hover);--ms-badge-remove-box-shadow-focus: 0 0 0 2px color-mix(in srgb, var(--ms-accent-color) 50%, transparent);--ms-badge-remove-icon-size: calc(1 * var(--ms-rem));--ms-icon-remove: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path d='M6 6L18 18M18 6L6 18' stroke='black' stroke-width='2.5' stroke-linecap='round' fill='none'/></svg>");--ms-icon-search-clear: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='m13.5 8.5-5 5'/><path d='m8.5 8.5 5 5'/><circle cx='11' cy='11' r='8'/><path d='m21 21-4.3-4.3'/></svg>");--ms-badge-counter-bg: transparent;--ms-badge-counter-border: 1px solid var(--ms-badge-counter-border-color);--ms-badge-counter-border-radius: var(--ms-border-radius-sm);--ms-more-badge-bg: var(--ms-accent-color-light);--ms-more-badge-hover-bg: var(--ms-badge-bg-hover);--ms-more-badge-active-bg: var(--ms-accent-color-light-hover);--ms-count-display-margin-bottom: calc(.8 * var(--ms-rem));--ms-count-display-margin-top: calc(.8 * var(--ms-rem));--ms-count-display-margin-left: calc(.8 * var(--ms-rem));--ms-count-display-margin-right: calc(.8 * var(--ms-rem));--ms-counter-wrapper-bg: transparent;--ms-counter-wrapper-border: var(--ms-border);--ms-counter-wrapper-border-radius: var(--ms-border-radius-sm);--ms-counter-wrapper-padding: calc(.4 * var(--ms-rem)) calc(.8 * var(--ms-rem));--ms-counter-wrapper-gap: calc(.4 * var(--ms-rem));--ms-counter-wrapper-bg-hover: var(--ms-primary-bg);--ms-counter-wrapper-border-color-hover: var(--ms-accent-color);--ms-count-text-bg: transparent;--ms-count-text-border: none;--ms-count-text-font-size: calc(var(--base-font-size-sm, 1.4) * var(--ms-rem));--ms-count-text-color: var(--ms-text-color-1);--ms-count-clear-size: calc(1.6 * var(--ms-rem));--ms-count-clear-bg: transparent;--ms-count-clear-color: var(--ms-text-color-3);--ms-count-clear-font-size: calc(var(--base-font-size-lg, 1.8) * var(--ms-rem));--ms-count-clear-border-radius: var(--ms-border-radius-sm);--ms-count-clear-bg-hover: color-mix(in srgb, var(--ms-accent-color) 20%, transparent);--ms-count-clear-color-hover: var(--ms-accent-color);--ms-count-clear-icon-size: calc(1.4 * var(--ms-rem));--ms-icon-clear: var(--ms-icon-remove);--ms-tooltip-color: var(--ms-tooltip-text-color);--ms-tooltip-padding: calc(.8 * var(--ms-rem)) calc(1.2 * var(--ms-rem));--ms-tooltip-border-radius: var(--ms-border-radius-lg);--ms-tooltip-font-size: calc(var(--base-font-size-sm, 1.4) * var(--ms-rem));--ms-tooltip-max-width: calc(32 * var(--ms-rem));--ms-tooltip-shadow: 0 2px 8px rgba(0, 0, 0, .15);--ms-tooltip-z-index: 10000;--ms-option-tooltip-bg: var(--ms-tooltip-bg);--ms-option-tooltip-text-color: var(--ms-tooltip-text-color);--ms-option-tooltip-padding: var(--ms-tooltip-padding);--ms-option-tooltip-border-radius: var(--ms-tooltip-border-radius);--ms-option-tooltip-font-size: var(--ms-tooltip-font-size);--ms-option-tooltip-max-width: var(--ms-tooltip-max-width);--ms-option-tooltip-shadow: var(--ms-tooltip-shadow);--ms-option-tooltip-z-index: var(--ms-tooltip-z-index);--ms-message-bg: var(--ms-message-info-bg);--ms-message-color: var(--ms-message-info-color);--ms-message-border: 1px solid transparent;--ms-message-border-radius: var(--ms-border-radius-lg);--ms-message-padding: calc(1 * var(--ms-rem)) calc(1.4 * var(--ms-rem));--ms-message-font-size: calc(var(--base-font-size-sm, 1.4) * var(--ms-rem));--ms-message-font-weight: var(--base-font-weight-medium, 500);--ms-message-max-width: calc(40 * var(--ms-rem));--ms-message-shadow: 0 4px 16px rgb(0 0 0 / .18);--ms-message-fullscreen-offset: calc(2.4 * var(--ms-fullscreen-rem));--ms-message-z-index: var(--ms-z-index-fullscreen-tooltip);--ms-message-info-bg: var(--ms-tooltip-bg);--ms-message-info-color: var(--ms-tooltip-text-color);--ms-message-warning-bg: var(--base-warning-bg, #f59e0b);--ms-message-warning-color: var(--base-warning-color, #1a1a1a);--ms-message-error-bg: var(--base-danger-bg, #ef4444);--ms-message-error-color: var(--base-danger-color, #ffffff);--ms-message-success-bg: var(--base-success-bg, #10b981);--ms-message-success-color: var(--base-success-color, #ffffff);--ms-z-index-popover: 10000;--ms-selected-popover-width: calc(32 * var(--ms-rem));--ms-selected-popover-max-height: calc(32 * var(--ms-rem));--ms-selected-popover-border: 1px solid var(--ms-selected-popover-border-color);--ms-selected-popover-border-radius: var(--ms-border-radius-lg);--ms-selected-popover-box-shadow: 0 20px 25px -5px rgb(0 0 0 / .1), 0 8px 10px -6px rgb(0 0 0 / .1);--ms-selected-popover-header-padding: calc(.8 * var(--ms-rem)) calc(1.2 * var(--ms-rem));--ms-selected-popover-header-bg: color-mix(in srgb, var(--ms-accent-color) 10%, transparent);--ms-selected-popover-header-border-bottom: 1px solid var(--ms-selected-popover-header-border-color);--ms-selected-popover-header-font-size: calc(var(--base-font-size-sm, 1.4) * var(--ms-rem));--ms-selected-popover-header-font-weight: var(--base-font-weight-semibold, 600);--ms-selected-popover-header-color: var(--ms-text-color-1);--ms-popover-close-size: calc(2.4 * var(--ms-rem));--ms-selected-popover-close-bg: transparent;--ms-selected-popover-close-color: var(--ms-text-color-3);--ms-selected-popover-close-font-size: calc(var(--base-font-size-xl, 2) * var(--ms-rem));--ms-selected-popover-close-border-radius: var(--ms-border-radius-sm);--ms-selected-popover-close-bg-hover: color-mix(in srgb, var(--ms-accent-color) 20%, transparent);--ms-selected-popover-close-color-hover: var(--ms-accent-color);--ms-selected-popover-close-icon-size: calc(1.4 * var(--ms-rem));--ms-selected-popover-body-gap: calc(.4 * var(--ms-rem));--ms-selected-popover-body-padding: calc(.8 * var(--ms-rem));--ms-selected-popover-body-max-height: calc(28.8 * var(--ms-rem));--ms-font-size-2xs: calc(var(--base-font-size-2xs, 1) * var(--ms-rem));--ms-font-size-xs: calc(var(--base-font-size-xs, 1.2) * var(--ms-rem));--ms-font-size-sm: calc(var(--base-font-size-sm, 1.4) * var(--ms-rem));--ms-font-size-base: calc(var(--base-font-size-base, 1.6) * var(--ms-rem));--ms-font-size-lg: calc(var(--base-font-size-lg, 1.8) * var(--ms-rem));--ms-font-weight-normal: var(--base-font-weight-normal, 400);--ms-font-weight-medium: var(--base-font-weight-medium, 500);--ms-font-weight-semibold: var(--base-font-weight-semibold, 600);--ms-line-height-none: 1;--ms-line-height-tight: var(--base-line-height-tight, 1.25);--ms-line-height-normal: var(--base-line-height-normal, 1.5);--ms-line-height-relaxed: var(--base-line-height-relaxed, 1.75);--ms-border-radius-sm: calc(var(--base-border-radius-sm, .4) * var(--ms-rem));--ms-border-radius-md: calc(var(--base-border-radius-md, .6) * var(--ms-rem));--ms-border-radius-lg: calc(var(--base-border-radius-lg, .8) * var(--ms-rem));--ms-border-radius: var(--ms-border-radius-md);--ms-spacing-xs: calc(.4 * var(--ms-rem));--ms-spacing-sm: calc(.8 * var(--ms-rem));--ms-spacing-md: calc(1.2 * var(--ms-rem));--ms-spacing-lg: calc(1.6 * var(--ms-rem));--ms-transition-fast: .15s;--ms-transition-normal: .2s;--ms-easing-snappy: cubic-bezier(.4, 0, .2, 1);--ms-placeholder-opacity: .6;--ms-disabled-input-opacity: .6;--ms-scrollbar-width: 8px;--ms-scrollbar-track-bg: transparent;--ms-scrollbar-thumb-bg: var(--ms-border-color);--ms-scrollbar-thumb-bg-hover: var(--ms-text-color-3);--ms-scrollbar-thumb-border-radius: 4px;--ms-debug-bg: var(--base-elevated-bg, light-dark(#f9fafb, #2b2b2b));--ms-debug-border-color: var(--ms-border-color);--ms-debug-text-color: var(--ms-text-color-1);--ms-debug-border-radius: var(--ms-border-radius-md);--ms-debug-summary-color: var(--ms-accent-color);--ms-debug-summary-bg-hover: var(--ms-primary-bg);--ms-debug-summary-outline-color: var(--ms-accent-color);--ms-debug-summary-border-radius: var(--ms-border-radius-sm);--ms-debug-stats-bg: var(--base-main-bg, light-dark(#ffffff, #1a1a1a));--ms-debug-stats-border-radius: var(--ms-border-radius-sm);--ms-debug-bullet-color: var(--ms-accent-color)}}@layer component{web-multiselect:not(:defined){display:block;min-height:calc(3.5 * var(--ms-rem));color:transparent!important;background:transparent}:host{-webkit-tap-highlight-color:transparent}.ms__wrapper{display:flex;flex-direction:column;align-items:stretch}.ms__wrapper--inline{flex-direction:row;align-items:var(--ms-inline-align, center)}.ms{position:relative;width:100%}}@layer component{.ms__input-wrapper{position:relative;display:flex;align-items:center}.ms__input{box-sizing:border-box;width:100%;font-family:inherit;height:var(--ms-input-height);padding:var(--ms-input-padding);padding-inline-end:var(--ms-input-padding-right);font-size:var(--ms-input-font-size);border:var(--ms-input-border);border-radius:var(--ms-input-border-radius);background:var(--ms-input-bg);color:var(--ms-input-color);cursor:pointer;transition:border var(--ms-transition-fast) var(--ms-easing-snappy)}.ms__input:hover:not(:focus):not(:disabled){border:var(--ms-input-border-hover)}.ms__input:focus{outline:none;border:var(--ms-input-border-focus)}.ms__input::placeholder{color:var(--ms-input-placeholder-color);opacity:0;transition:opacity var(--ms-transition-fast) var(--ms-easing-snappy)}:host([data-ready]) .ms__input::placeholder{opacity:var(--ms-placeholder-opacity)}.ms__toggle{position:absolute;inset-inline-end:var(--ms-toggle-right);top:50%;transform:var(--ms-transform-center-y);pointer-events:none;color:var(--ms-toggle-icon-color);transition:transform var(--ms-transition-fast) var(--ms-easing-snappy)}.ms--open .ms__toggle{transform:var(--ms-transform-center-y) rotate(var(--ms-transform-rotate-180));color:var(--ms-toggle-icon-color-open)}.ms__counter{position:absolute;inset-inline-end:var(--ms-counter-offset);top:50%;transform:var(--ms-transform-center-y);padding:var(--ms-counter-padding);background:var(--ms-counter-badge-bg);color:var(--ms-counter-badge-color);font-size:var(--ms-counter-font-size);font-weight:var(--ms-counter-font-weight);border-radius:var(--ms-counter-border-radius);cursor:pointer;transition:all var(--ms-transition-fast) var(--ms-easing-snappy)}.ms__counter:hover{background:var(--ms-counter-badge-bg-hover);transform:var(--ms-transform-center-y) scale(var(--ms-transform-scale-hover))}.ms__actions{display:flex;flex-direction:column;gap:var(--ms-actions-gap);padding:var(--ms-actions-padding)}.ms__actions--top{border-bottom:var(--ms-actions-border-bottom)}.ms__actions--bottom{flex-direction:column-reverse;border-top:var(--ms-actions-border-bottom)}.ms__actions-row{display:flex;flex-wrap:nowrap;gap:var(--ms-actions-gap)}.ms__actions--wrap .ms__actions-row{flex-wrap:wrap}.ms__actions--sticky{position:sticky;z-index:var(--ms-z-index-sticky);background:var(--ms-actions-bg)}.ms__actions--sticky.ms__actions--top{top:0}.ms__actions--sticky.ms__actions--bottom{bottom:0}.ms__actions--align-stretch .ms__action-btn{flex:1}.ms__actions--align-left .ms__actions-row{justify-content:flex-start}.ms__actions--align-right .ms__actions-row{justify-content:flex-end}.ms__actions--align-center .ms__actions-row{justify-content:center}.ms__actions--align-space-between .ms__actions-row{justify-content:space-between}.ms__action-btn{font-family:inherit;padding:var(--ms-action-btn-padding);font-size:var(--ms-action-btn-font-size);border:var(--ms-action-btn-border);border-radius:var(--ms-action-btn-border-radius);background:var(--ms-action-button-bg);color:var(--ms-action-button-color);cursor:pointer;transition:all var(--ms-transition-fast) var(--ms-easing-snappy)}@media (hover: hover){.ms__action-btn:hover{background:var(--ms-action-button-bg-hover);border-color:var(--ms-action-button-border-color-hover)}}.ms__action-btn:active{transform:scale(var(--ms-transform-scale-active))}.ms__action-btn:disabled,.ms__action-btn[disabled]{opacity:var(--ms-disabled-opacity);cursor:not-allowed;pointer-events:none}}@layer component{.ms__hint{display:none;position:fixed;z-index:var(--ms-z-index-popover);padding:var(--ms-hint-padding);background:var(--ms-hint-bg);border:var(--ms-hint-border);border-radius:var(--ms-hint-border-radius);box-shadow:var(--ms-hint-box-shadow);font-size:var(--ms-hint-font-size);color:var(--ms-hint-color);line-height:var(--ms-line-height-relaxed);max-width:100%}.ms__hint--visible{display:block}.ms__dropdown{display:none;position:fixed;font-family:inherit;z-index:var(--ms-z-index-dropdown);background:var(--ms-dropdown-bg);border:var(--ms-dropdown-border);border-radius:var(--ms-dropdown-border-radius);box-shadow:var(--ms-dropdown-box-shadow);width:var(--ms-dropdown-width);max-height:var(--ms-options-max-height);overflow:hidden;color:var(--ms-dropdown-text-color)}.ms__dropdown--visible{display:flex;flex-direction:column}.ms__dropdown--fullscreen,.ms__selected-popover--fullscreen{--ms-rem: var(--ms-fullscreen-rem);--ms-option-padding: calc(.8 * var(--ms-rem)) calc(1.2 * var(--ms-rem));--ms-option-gap: calc(.8 * var(--ms-rem));--ms-option-title-font-size: calc(var(--base-font-size-sm, 1.4) * var(--ms-rem));--ms-option-subtitle-font-size: calc(var(--base-font-size-xs, 1.2) * var(--ms-rem));--ms-option-icon-font-size: calc(var(--base-font-size-base, 1.6) * var(--ms-rem));--ms-checkbox-size: calc(1.6 * var(--ms-rem));--ms-group-label-font-size: calc(var(--base-font-size-xs, 1.2) * var(--ms-rem));--ms-group-label-padding: calc(.4 * var(--ms-rem)) calc(1.2 * var(--ms-rem));--ms-tree-base-indent: var(--ms-fullscreen-tree-base-indent);--ms-tree-indent: var(--ms-fullscreen-tree-indent)}.ms__selected-popover--fullscreen{--ms-badge-gap: calc(.8 * var(--ms-rem));--ms-badge-height: calc(4.2 * var(--ms-rem));--ms-badge-font-size: calc(var(--base-font-size-sm, 1.4) * var(--ms-rem));--ms-badge-text-padding: 0 calc(1.2 * var(--ms-rem));--ms-badge-remove-width: calc(3.6 * var(--ms-rem));--ms-badge-remove-icon-size: calc(1.2 * var(--ms-rem));--ms-badge-remove-font-size: calc(var(--base-font-size-sm, 1.4) * var(--ms-rem))}.ms__dropdown--fullscreen{--ms-actions-gap: calc(.4 * var(--ms-rem));--ms-actions-padding: calc(.8 * var(--ms-rem));--ms-action-btn-padding: calc(.6 * var(--ms-rem)) calc(1.2 * var(--ms-rem));--ms-action-btn-font-size: calc(var(--base-font-size-sm, 1.4) * var(--ms-rem))}.ms__dropdown--fullscreen{position:fixed;top:0;inset-inline-start:0;width:100vw;max-width:100vw;height:100dvh;max-height:100dvh;border:none;border-radius:0;background:var(--ms-fullscreen-bg);color:var(--ms-fullscreen-text-color);z-index:var(--ms-z-index-fullscreen);box-sizing:border-box;padding-top:env(safe-area-inset-top);padding-right:env(safe-area-inset-right);padding-bottom:env(safe-area-inset-bottom);padding-left:env(safe-area-inset-left)}.ms__dropdown--fullscreen .ms__dropdown-inner{display:flex;flex-direction:column;flex:1;min-height:0;max-height:none;overflow:hidden}.ms__dropdown--fullscreen .ms__options{flex:1 1 0;min-height:0;height:auto;max-height:none;overflow-y:auto;padding-bottom:var(--ms-option-gap)}.ms__dropdown--fullscreen .ms__actions{flex:0 0 auto}.ms__fullscreen-header,.ms__selected-popover--fullscreen .ms__selected-popover-header{flex:0 0 auto;display:flex;align-items:center;flex-wrap:wrap;gap:var(--ms-fullscreen-header-gap);min-height:var(--ms-fullscreen-header-min-height);padding:var(--ms-fullscreen-header-padding);background:var(--ms-fullscreen-header-bg);border-bottom:var(--ms-fullscreen-header-border)}.ms__fullscreen-nav{flex:0 0 100%;display:flex;align-items:center;justify-content:space-between;gap:var(--ms-fullscreen-nav-gap);padding-top:var(--ms-fullscreen-nav-padding-top)}.ms__fullscreen-nav-count{font-size:var(--ms-fullscreen-nav-count-font-size);color:var(--ms-fullscreen-nav-count-color)}.ms__fullscreen-nav-controls{display:flex;align-items:center;gap:var(--ms-fullscreen-nav-gap)}.ms__fullscreen-nav-btn{flex:0 0 auto;display:inline-flex;align-items:center;justify-content:center;width:var(--ms-fullscreen-nav-btn-size);height:var(--ms-fullscreen-nav-btn-size);padding:0;color:var(--ms-fullscreen-nav-btn-color);background:var(--ms-fullscreen-nav-btn-bg);border:none;border-radius:50%;cursor:pointer}.ms__fullscreen-nav-btn:hover:not(:disabled){background:var(--ms-fullscreen-nav-btn-bg-hover)}.ms__fullscreen-nav-btn:disabled{opacity:.4;cursor:default}.ms__fullscreen-nav-btn:before{content:"";display:block;width:var(--ms-fullscreen-nav-btn-icon-size);height:var(--ms-fullscreen-nav-btn-icon-size);background-color:currentColor;-webkit-mask:var(--ms-icon-chevron) center / contain no-repeat;mask:var(--ms-icon-chevron) center / contain no-repeat}.ms__fullscreen-nav-btn--next:before{transform:scaleY(-1)}.ms__fullscreen-header>.ms__fullscreen-search-wrapper,.ms__selected-popover--fullscreen .ms__selected-popover-header>span{flex:1 1 auto;min-width:0}.ms__fullscreen-search-wrapper{position:relative;display:flex}.ms__selected-popover--fullscreen .ms__selected-popover-header{font-size:var(--ms-fullscreen-title-font-size);font-weight:var(--ms-fullscreen-title-font-weight);color:var(--ms-fullscreen-text-color)}.ms__fullscreen-search{flex:1 1 auto;min-width:0;font-family:inherit;font-size:var(--ms-fullscreen-search-font-size);color:inherit;background:transparent;border:var(--ms-fullscreen-search-border);border-radius:var(--ms-fullscreen-search-border-radius);padding:var(--ms-fullscreen-search-padding);padding-inline-end:var(--ms-fullscreen-search-clear-gutter)}.ms__fullscreen-search:focus{outline:none;border:var(--ms-input-border-focus)}.ms__fullscreen-search-clear{position:absolute;inset-inline-end:var(--ms-fullscreen-search-clear-inset);top:50%;transform:translateY(-50%);display:inline-flex;align-items:center;justify-content:center;width:var(--ms-fullscreen-search-clear-size);height:var(--ms-fullscreen-search-clear-size);padding:0;color:var(--ms-fullscreen-search-clear-color);background:transparent;border:none;border-radius:50%;cursor:pointer}.ms__fullscreen-search-clear:hover{background:var(--ms-fullscreen-search-clear-bg-hover)}.ms__fullscreen-search-clear:before{content:"";display:block;width:var(--ms-fullscreen-search-clear-icon-size);height:var(--ms-fullscreen-search-clear-icon-size);background-color:currentColor;-webkit-mask:var(--ms-icon-search-clear) center / contain no-repeat;mask:var(--ms-icon-search-clear) center / contain no-repeat}.ms__fullscreen-close,.ms__selected-popover--fullscreen .ms__selected-popover-close{flex:0 0 auto;position:relative;box-sizing:border-box;display:inline-flex;align-items:center;justify-content:center;width:var(--ms-fullscreen-close-size);height:var(--ms-fullscreen-close-size);margin-inline-end:calc(-1 * var(--ms-fullscreen-close-edge-nudge));padding:0;color:var(--ms-fullscreen-close-color);background:var(--ms-fullscreen-close-bg);border:var(--ms-fullscreen-close-border);border-radius:var(--ms-fullscreen-close-border-radius);cursor:pointer}.ms__fullscreen-close:after,.ms__selected-popover--fullscreen .ms__selected-popover-close:after{content:"";position:absolute;inset-block-start:calc(-1 * var(--ms-fullscreen-close-size));inset-block-end:calc(-1 * var(--ms-fullscreen-header-padding-v));inset-inline-end:calc(-1 * var(--ms-fullscreen-header-padding-h));inset-inline-start:calc(-1 * var(--ms-fullscreen-header-gap))}.ms__fullscreen-close:hover,.ms__selected-popover--fullscreen .ms__selected-popover-close:hover{background:var(--ms-fullscreen-close-bg-hover);color:var(--ms-fullscreen-close-color)}.ms__fullscreen-close:before,.ms__selected-popover--fullscreen .ms__selected-popover-close:before{content:"";display:block;width:var(--ms-fullscreen-close-icon-size);height:var(--ms-fullscreen-close-icon-size);background-color:currentColor;-webkit-mask:var(--ms-icon-remove) center / contain no-repeat;mask:var(--ms-icon-remove) center / contain no-repeat}.ms__dropdown--fullscreen .ms__option-info{flex:0 0 auto;display:none;align-items:center;justify-content:center;width:var(--ms-fullscreen-info-size);height:var(--ms-fullscreen-info-size);margin-inline-start:var(--ms-option-gap);padding:0;color:var(--ms-fullscreen-info-color);background:transparent;border:none;border-radius:50%;cursor:pointer}.ms__dropdown--fullscreen .ms__option--truncated .ms__option-info{display:inline-flex}@media (hover: hover){.ms__dropdown--fullscreen .ms__option-info:hover{background:var(--ms-fullscreen-info-bg-hover)}}.ms__dropdown--fullscreen .ms__option-info:before{content:"";display:block;width:var(--ms-fullscreen-info-icon-size);height:var(--ms-fullscreen-info-icon-size);background-color:currentColor;-webkit-mask:var(--ms-icon-info) center / contain no-repeat;mask:var(--ms-icon-info) center / contain no-repeat}.ms__dropdown-inner{flex:1;overflow-y:auto;overscroll-behavior:contain;touch-action:pan-y;-webkit-overflow-scrolling:touch;scrollbar-width:thin;scrollbar-color:var(--ms-scrollbar-thumb-bg) var(--ms-scrollbar-track-bg)}.ms__dropdown-inner::-webkit-scrollbar{width:var(--ms-scrollbar-width)}.ms__dropdown-inner::-webkit-scrollbar-track{background:var(--ms-scrollbar-track-bg)}.ms__dropdown-inner::-webkit-scrollbar-thumb{background:var(--ms-scrollbar-thumb-bg);border-radius:var(--ms-scrollbar-thumb-border-radius)}.ms__dropdown-inner::-webkit-scrollbar-thumb:hover{background:var(--ms-scrollbar-thumb-bg-hover)}.ms__dropdown--virtual{max-height:none}.ms__dropdown--virtual .ms__dropdown-inner{overflow-y:visible}.ms__badge-tooltip{position:fixed;z-index:var(--ms-tooltip-z-index);opacity:0;visibility:hidden;transition:opacity var(--ms-transition-normal) ease,visibility var(--ms-transition-normal) ease;background:var(--ms-tooltip-bg);color:var(--ms-tooltip-text-color);padding:var(--ms-tooltip-padding);border-radius:var(--ms-tooltip-border-radius);font-size:var(--ms-tooltip-font-size);line-height:var(--ms-line-height-relaxed);max-width:var(--ms-tooltip-max-width);word-wrap:break-word;white-space:pre-wrap;box-shadow:var(--ms-tooltip-shadow);pointer-events:none}.ms__badge-tooltip--visible{opacity:1;visibility:visible}.ms__option-tooltip{position:fixed;z-index:var(--ms-option-tooltip-z-index);opacity:0;visibility:hidden;transition:opacity var(--ms-transition-normal) ease,visibility var(--ms-transition-normal) ease;background:var(--ms-option-tooltip-bg);color:var(--ms-option-tooltip-text-color);padding:var(--ms-option-tooltip-padding);border-radius:var(--ms-option-tooltip-border-radius);font-size:var(--ms-option-tooltip-font-size);line-height:var(--ms-line-height-relaxed);max-width:var(--ms-option-tooltip-max-width);word-wrap:break-word;white-space:pre-wrap;box-shadow:var(--ms-option-tooltip-shadow);pointer-events:none}.ms__option-tooltip--visible{opacity:1;visibility:visible}.ms__option-tooltip--fullscreen{z-index:var(--ms-z-index-fullscreen-tooltip)}.ms__message{position:fixed;z-index:var(--ms-message-z-index);box-sizing:border-box;max-width:var(--ms-message-max-width);padding:var(--ms-message-padding);font-family:inherit;font-size:var(--ms-message-font-size);font-weight:var(--ms-message-font-weight);line-height:var(--ms-line-height-normal);color:var(--ms-message-color);background:var(--ms-message-bg);border:var(--ms-message-border);border-radius:var(--ms-message-border-radius);box-shadow:var(--ms-message-shadow);cursor:pointer;opacity:0;transition:opacity var(--ms-transition-normal) ease;-webkit-tap-highlight-color:transparent}.ms__message--visible{opacity:1}.ms__message--info{background:var(--ms-message-info-bg);color:var(--ms-message-info-color)}.ms__message--warning{background:var(--ms-message-warning-bg);color:var(--ms-message-warning-color)}.ms__message--error{background:var(--ms-message-error-bg);color:var(--ms-message-error-color)}.ms__message--success{background:var(--ms-message-success-bg);color:var(--ms-message-success-color)}.ms__message--fullscreen{left:50%;right:auto;bottom:calc(var(--ms-message-fullscreen-offset) + env(safe-area-inset-bottom));transform:translate(-50%);max-width:min(var(--ms-message-max-width),calc(100vw - 4 * var(--ms-fullscreen-rem)));padding:calc(1 * var(--ms-fullscreen-rem)) calc(1.4 * var(--ms-fullscreen-rem));font-size:calc(var(--base-font-size-sm, 1.4) * var(--ms-fullscreen-rem))}.ms__selected-popover{display:none;position:fixed;z-index:var(--ms-z-index-popover);background:var(--ms-selected-popover-bg);border:var(--ms-selected-popover-border);border-radius:var(--ms-selected-popover-border-radius);box-shadow:var(--ms-selected-popover-box-shadow);width:var(--ms-selected-popover-width);max-height:var(--ms-selected-popover-max-height);overflow:hidden}.ms__selected-popover--visible{display:flex;flex-direction:column}.ms__selected-popover--virtual{display:block;overflow:visible;max-height:none}.ms__selected-popover--fullscreen{position:fixed;top:0;right:0;bottom:0;left:0;display:flex;flex-direction:column;width:100vw;max-width:100vw;height:100dvh;max-height:100dvh;border:none;border-radius:0;overflow:hidden;background:var(--ms-fullscreen-bg);color:var(--ms-fullscreen-text-color);z-index:var(--ms-z-index-fullscreen);box-sizing:border-box;padding-top:env(safe-area-inset-top);padding-right:env(safe-area-inset-right);padding-bottom:env(safe-area-inset-bottom);padding-left:env(safe-area-inset-left)}.ms__selected-popover--fullscreen .ms__selected-popover-body{flex:1 1 0;min-height:0;max-height:none}.ms__selected-popover-header{display:flex;align-items:center;justify-content:space-between;padding:var(--ms-selected-popover-header-padding);background:var(--ms-selected-popover-header-bg);border-bottom:var(--ms-selected-popover-header-border-bottom);font-size:var(--ms-selected-popover-header-font-size);font-weight:var(--ms-selected-popover-header-font-weight);color:var(--ms-selected-popover-header-color)}.ms__selected-popover-close{display:flex;align-items:center;justify-content:center;width:var(--ms-popover-close-size);height:var(--ms-popover-close-size);padding:0;border:none;background:var(--ms-selected-popover-close-bg);color:var(--ms-selected-popover-close-color);font-size:var(--ms-selected-popover-close-font-size);line-height:var(--ms-line-height-none);cursor:pointer;border-radius:var(--ms-selected-popover-close-border-radius);transition:all var(--ms-transition-fast) var(--ms-easing-snappy)}.ms__selected-popover-close:hover{background:var(--ms-selected-popover-close-bg-hover);color:var(--ms-selected-popover-close-color-hover)}.ms__selected-popover-close:before{content:"";display:block;width:var(--ms-selected-popover-close-icon-size);height:var(--ms-selected-popover-close-icon-size);background-color:currentColor;-webkit-mask:var(--ms-icon-remove) center / contain no-repeat;mask:var(--ms-icon-remove) center / contain no-repeat}.ms__selected-popover-body{display:flex;flex-direction:column;gap:var(--ms-selected-popover-body-gap);padding:var(--ms-selected-popover-body-padding);overflow-y:auto;max-height:var(--ms-selected-popover-body-max-height);scrollbar-width:thin;scrollbar-color:var(--ms-scrollbar-thumb-bg) var(--ms-scrollbar-track-bg)}.ms__selected-popover-body::-webkit-scrollbar{width:var(--ms-scrollbar-width)}.ms__selected-popover-body::-webkit-scrollbar-track{background:var(--ms-scrollbar-track-bg)}.ms__selected-popover-body::-webkit-scrollbar-thumb{background:var(--ms-scrollbar-thumb-bg);border-radius:var(--ms-scrollbar-thumb-border-radius)}.ms__selected-popover-body::-webkit-scrollbar-thumb:hover{background:var(--ms-scrollbar-thumb-bg-hover)}.ms__selected-popover-body .ms__badge{width:100%;min-height:fit-content;line-height:var(--ms-line-height-relaxed);flex-shrink:0}.ms__selected-popover-body .ms__badge-text{flex:1;min-width:0;white-space:normal;word-wrap:break-word}.ms__selected-popover-body--virtual{display:block;max-height:none;padding:0}.ms__selected-popover-body--virtual .ms__badge{height:var(--ms-badge-height-virtual, 36px);min-height:var(--ms-badge-height-virtual, 36px);max-height:var(--ms-badge-height-virtual, 36px);margin-bottom:var(--ms-selected-popover-body-gap);overflow:hidden;box-sizing:border-box}.ms__selected-popover-body--virtual .ms__badge-text{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}}@layer component{.ms--disabled .ms__input{opacity:var(--ms-disabled-input-opacity);cursor:not-allowed;background:var(--ms-input-bg-disabled)}.ms--disabled .ms__toggle{opacity:var(--ms-disabled-input-opacity)}.ms--no-checkboxes .ms__option{gap:0;padding-inline-start:var(--ms-option-padding-h)}.ms--no-checkboxes .ms__option-content{padding-inline-start:0}}@layer component;@layer component{.ms__badges{display:flex;flex-wrap:wrap;gap:var(--ms-badges-gap);padding:0}.ms__badges:empty{display:none}.ms__badges--bottom{margin-top:var(--ms-badges-margin-bottom)}.ms__badges--top{margin-bottom:var(--ms-badges-margin-top);order:var(--ms-order-first)}.ms__badges--left{order:var(--ms-order-first);margin-right:var(--ms-badges-margin-left);justify-content:flex-end}.ms__badges--right{margin-left:var(--ms-badges-margin-right);justify-content:flex-start}.ms__badge{display:inline-flex;align-items:center;height:var(--ms-badge-height);font-size:var(--ms-badge-font-size);font-weight:var(--ms-badge-font-weight);line-height:var(--ms-line-height-none);border-radius:var(--ms-badge-border-radius);overflow:hidden;max-width:100%}.ms__badge-text{display:flex;align-items:center;box-sizing:border-box;height:100%;padding:var(--ms-badge-text-padding);background:var(--ms-badge-text-bg);color:var(--ms-badge-text-color);border:var(--ms-badge-text-border);border-inline-end:none;border-start-start-radius:var(--ms-badge-border-radius);border-end-start-radius:var(--ms-badge-border-radius);border-start-end-radius:0;border-end-end-radius:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;transition:background-color var(--ms-transition-normal) ease,color var(--ms-transition-normal) ease}.ms__badge:hover .ms__badge-text{background:var(--ms-badge-text-bg-hover, var(--ms-badge-text-bg));color:var(--ms-badge-text-color-hover, var(--ms-badge-text-color))}.ms__badge-remove{display:flex;align-items:center;justify-content:center;box-sizing:border-box;font-family:inherit;width:var(--ms-badge-remove-width);height:100%;flex-shrink:0;background:var(--ms-badge-remove-bg);color:var(--ms-badge-remove-color);border:var(--ms-badge-remove-border);border-inline-start:none;border-start-end-radius:var(--ms-badge-border-radius);border-end-end-radius:var(--ms-badge-border-radius);border-start-start-radius:0;border-end-start-radius:0;cursor:pointer;transition:background-color var(--ms-transition-normal) ease;font-size:var(--ms-badge-remove-font-size)}.ms__badge-remove:hover{background:var(--ms-badge-remove-bg-hover)}.ms__badge-remove:focus{outline:none}.ms__badge-remove:focus-visible{outline:none;box-shadow:var(--ms-badge-remove-box-shadow-focus)}.ms__badge-remove:before{content:"";display:block;width:var(--ms-badge-remove-icon-size);height:var(--ms-badge-remove-icon-size);background-color:currentColor;-webkit-mask:var(--ms-icon-remove) center / contain no-repeat;mask:var(--ms-icon-remove) center / contain no-repeat}.ms__badge--counter{cursor:pointer}.ms__badge--counter .ms__badge-text{background:var(--ms-badge-counter-text-bg);color:var(--ms-badge-counter-text-color);border:var(--ms-badge-counter-border);border-inline-end:none}.ms__badge--counter .ms__badge-remove{background:var(--ms-badge-counter-remove-bg);color:var(--ms-badge-counter-remove-color);border:var(--ms-badge-counter-border);border-inline-start:none}.ms__badge--counter .ms__badge-remove:hover{background:var(--ms-badge-counter-remove-bg-hover)}.ms__badge--more,.ms__badge[data-action=show-selected]{cursor:pointer}}@layer component{.ms__count-display{display:flex;align-items:center}.ms__count-display:empty{display:none}.ms__count-display--bottom{margin-top:var(--ms-count-display-margin-bottom)}.ms__count-display--top{margin-bottom:var(--ms-count-display-margin-top);order:var(--ms-order-first)}.ms__count-display--left{order:var(--ms-order-first);margin-right:var(--ms-count-display-margin-left);justify-content:flex-start}.ms__count-display--right{margin-left:var(--ms-count-display-margin-right);justify-content:flex-end}.ms__counter-wrapper{display:inline-flex;align-items:center;gap:var(--ms-counter-wrapper-gap);background:var(--ms-counter-wrapper-bg);border:var(--ms-counter-wrapper-border);border-radius:var(--ms-counter-wrapper-border-radius);padding:var(--ms-counter-wrapper-padding);transition:all var(--ms-transition-fast) var(--ms-easing-snappy)}.ms__counter-wrapper:hover{background:var(--ms-counter-wrapper-bg-hover);border-color:var(--ms-counter-wrapper-border-color-hover)}.ms__count-text{display:inline-flex;align-items:center;background:var(--ms-count-text-bg);border:var(--ms-count-text-border);padding:0;font-size:var(--ms-count-text-font-size);color:var(--ms-count-text-color);cursor:pointer;transition:color var(--ms-transition-fast) var(--ms-easing-snappy)}.ms__count-clear{flex-shrink:0;display:flex;align-items:center;justify-content:center;width:var(--ms-count-clear-size);height:var(--ms-count-clear-size);padding:0;border:none;background:var(--ms-count-clear-bg);color:var(--ms-count-clear-color);font-size:var(--ms-count-clear-font-size);line-height:var(--ms-line-height-none);cursor:pointer;border-radius:var(--ms-count-clear-border-radius);transition:all var(--ms-transition-fast) var(--ms-easing-snappy)}.ms__count-clear:hover{background:var(--ms-count-clear-bg-hover);color:var(--ms-count-clear-color-hover)}.ms__count-clear:before{content:"";display:block;width:var(--ms-count-clear-icon-size);height:var(--ms-count-clear-icon-size);background-color:currentColor;-webkit-mask:var(--ms-icon-clear) center / contain no-repeat;mask:var(--ms-icon-clear) center / contain no-repeat}}@layer component{.ms__debug-info{margin-top:calc(.4 * var(--ms-rem));padding:calc(.4 * var(--ms-rem));background-color:var(--ms-debug-bg);border:1px solid var(--ms-debug-border-color);border-radius:var(--ms-debug-border-radius);font-size:calc(1.2 * var(--ms-rem));color:var(--ms-debug-text-color)}.ms__debug-info details summary{cursor:pointer;font-weight:600;color:var(--ms-debug-summary-color);-webkit-user-select:none;user-select:none;padding:calc(.4 * var(--ms-rem));border-radius:var(--ms-debug-summary-border-radius)}.ms__debug-info details summary:hover{background-color:var(--ms-debug-summary-bg-hover)}.ms__debug-info details summary:focus{outline:2px solid var(--ms-debug-summary-outline-color);outline-offset:2px}.ms__debug-info .ms__debug-stats{display:flex;flex-direction:column;gap:calc(.4 * var(--ms-rem));margin-top:calc(.4 * var(--ms-rem));padding:calc(.4 * var(--ms-rem));background-color:var(--ms-debug-stats-bg);border-radius:var(--ms-debug-stats-border-radius)}.ms__debug-info .ms__debug-stats span{display:flex;justify-content:space-between;padding:2px 4px;font-family:monospace;font-size:calc(1 * var(--ms-rem))}.ms__debug-info .ms__debug-stats span:before{content:"•";margin-inline-end:calc(.4 * var(--ms-rem));color:var(--ms-debug-bullet-color)}}@layer component{.ms__options{padding:var(--ms-options-padding);scrollbar-width:thin;scrollbar-color:var(--ms-scrollbar-thumb-bg) var(--ms-scrollbar-track-bg)}.ms__options::-webkit-scrollbar{width:var(--ms-scrollbar-width)}.ms__options::-webkit-scrollbar-track{background:var(--ms-scrollbar-track-bg)}.ms__options::-webkit-scrollbar-thumb{background:var(--ms-scrollbar-thumb-bg);border-radius:var(--ms-scrollbar-thumb-border-radius)}.ms__options::-webkit-scrollbar-thumb:hover{background:var(--ms-scrollbar-thumb-bg-hover)}.ms__options--virtual .ms__option,.ms__options--fixed-height .ms__option{height:var(--ms-option-height, 50px);min-height:var(--ms-option-height, 50px);max-height:var(--ms-option-height, 50px);overflow:hidden;box-sizing:border-box}.ms__group+.ms__group{border-top:var(--ms-group-border-top);margin-top:var(--ms-group-margin-top);padding-top:var(--ms-group-padding-top)}.ms__group-label{padding:var(--ms-group-label-padding);font-size:var(--ms-group-label-font-size);font-weight:var(--ms-group-label-font-weight);color:var(--ms-group-label-color);text-transform:var(--ms-group-label-transform);letter-spacing:var(--ms-group-label-letter-spacing)}.ms__option{display:flex;align-items:var(--ms-checkbox-align, center);gap:var(--ms-option-gap);padding:var(--ms-option-padding);position:relative;min-height:var(--ms-option-min-height, auto);color:var(--ms-option-text-color);background:var(--ms-option-bg);cursor:pointer;user-select:none;-webkit-user-select:none}@media (hover: hover){.ms__option:hover{background:var(--ms-option-bg-hover);color:var(--ms-option-color-hover, inherit)}}.ms__option--focused{background:var(--ms-option-bg-focused);color:var(--ms-option-color-focused, inherit);outline:var(--ms-option-outline-focused);outline-offset:var(--ms-option-focus-outline-offset)}.ms__option--matched{background:var(--ms-option-bg-matched);color:var(--ms-option-color-matched, inherit)}.ms__option--matched:before{content:"";position:absolute;inset-block:0;inset-inline-start:0;border-inline-start:var(--ms-option-border-matched);pointer-events:none}.ms__option--selected{background:var(--ms-option-bg-selected)}@media (hover: hover){.ms__option--selected:hover{background:var(--ms-option-bg-selected-hover, var(--ms-option-bg-selected))}}.ms__option--disabled{opacity:var(--ms-disabled-opacity);cursor:not-allowed;background:var(--ms-option-disabled-bg)}.ms__option--disabled:hover{background:var(--ms-option-disabled-bg)}@media (hover: hover){.ms__option--focused:hover{background:var(--ms-option-bg-focused-hover);color:var(--ms-option-color-focused-hover, var(--ms-option-color-focused, var(--ms-option-text-color)))}}.ms__option--matched:hover{background:var(--ms-option-bg-matched-hover);color:var(--ms-option-color-matched-hover, var(--ms-option-color-matched, var(--ms-option-text-color)))}.ms__option--selected.ms__option--focused{background:var(--ms-option-bg-selected-focused);outline:var(--ms-option-outline-focused);outline-offset:var(--ms-option-focus-outline-offset)}.ms__option--selected.ms__option--matched{background:var(--ms-option-bg-selected-matched)}.ms__option--disabled.ms__option--selected{background:var(--ms-option-bg-disabled-selected)}.ms__option--disabled.ms__option--focused{outline:none}.ms__option[data-checkbox-align=top]{--ms-checkbox-align: flex-start}.ms__option[data-checkbox-align=bottom]{--ms-checkbox-align: flex-end}.ms__checkbox{appearance:none;-webkit-appearance:none;-moz-appearance:none;flex-shrink:0;position:relative;margin-top:var(--ms-checkbox-margin-top);margin-inline-end:var(--ms-checkbox-margin-right);margin-bottom:var(--ms-checkbox-margin-bottom);margin-inline-start:var(--ms-checkbox-margin-left);width:var(--ms-checkbox-size);height:var(--ms-checkbox-size);transform:scale(var(--ms-checkbox-scale));transform-origin:top left;cursor:pointer;background:var(--ms-checkbox-bg);border:var(--ms-checkbox-border);border-radius:var(--ms-checkbox-border-radius);transition:background-color .15s ease,border-color .15s ease}.ms__checkbox:after{content:"";position:absolute;display:none;left:50%;top:40%;width:30%;height:55%;transform:translate(-50%,-50%) rotate(45deg);border:solid var(--ms-checkbox-checkmark-color);border-width:0 var(--ms-checkbox-checkmark-thickness, 2px) var(--ms-checkbox-checkmark-thickness, 2px) 0}.ms__checkbox:hover:not(:disabled){border-color:var(--ms-checkbox-hover-border-color)}.ms__checkbox:checked{background:var(--ms-checkbox-checked-bg);border:var(--ms-checkbox-checked-border)}.ms__checkbox:checked:after{display:block}.ms__checkbox--indeterminate{background:var(--ms-checkbox-checked-bg);border:var(--ms-checkbox-checked-border)}.ms__checkbox--indeterminate:after{display:block;top:50%;left:50%;width:55%;height:0;transform:translate(-50%,-50%);border:none;border-bottom:var(--ms-checkbox-checkmark-thickness, 2px) solid var(--ms-checkbox-checkmark-color)}.ms__checkbox--indeterminate:hover:not(:disabled){background:var(--ms-checkbox-checked-bg-hover);border-color:var(--ms-checkbox-checked-border-color-hover)}.ms__checkbox:checked:hover:not(:disabled){background:var(--ms-checkbox-checked-bg-hover);border-color:var(--ms-checkbox-checked-border-color-hover)}.ms__checkbox:focus-visible{outline:2px solid var(--ms-checkbox-checked-bg);outline-offset:2px}.ms__checkbox:disabled{cursor:not-allowed;background:var(--ms-checkbox-disabled-bg);border:var(--ms-checkbox-disabled-border);opacity:.6}.ms__checkbox:disabled:checked{background:var(--ms-checkbox-disabled-bg)}.ms__option--disabled .ms__checkbox{cursor:not-allowed}.ms__option-content{flex:1;display:flex;align-items:center;gap:var(--ms-option-content-gap);min-width:0}.ms__option-icon{flex-shrink:0;width:var(--ms-option-icon-size);height:var(--ms-option-icon-size);display:flex;align-items:center;justify-content:center;font-size:var(--ms-option-icon-font-size)}.ms__option-icon svg{width:100%;height:100%;fill:currentColor}.ms__option-text{flex:1;min-width:0}.ms__option-title{font-size:var(--ms-option-title-font-size);color:var(--ms-option-title-color);line-height:var(--ms-line-height-relaxed);white-space:var(--ms-option-title-white-space, normal);overflow:var(--ms-option-title-overflow, visible);text-overflow:var(--ms-option-title-text-overflow, clip)}@media (hover: hover){.ms__option:hover .ms__option-title{color:var(--ms-option-title-color-hover, var(--ms-option-title-color))}}.ms__option--selected .ms__option-title{color:var(--ms-option-title-color-selected, var(--ms-option-title-color))}@media (hover: hover){.ms__option--selected:hover .ms__option-title{color:var(--ms-option-title-color-selected-hover, var(--ms-option-title-color-selected, var(--ms-option-title-color)))}}.ms__option-title mark{background:var(--ms-option-mark-bg);color:var(--ms-option-mark-color);font-weight:var(--ms-option-mark-font-weight)}.ms__option-subtitle{margin-top:var(--ms-option-subtitle-margin-top);font-size:var(--ms-option-subtitle-font-size);color:var(--ms-option-subtitle-color);line-height:var(--ms-option-subtitle-line-height)}@media (hover: hover){.ms__option:hover .ms__option-subtitle{color:var(--ms-option-subtitle-color-hover, var(--ms-option-subtitle-color))}}.ms__option--selected .ms__option-subtitle{color:var(--ms-option-subtitle-color-selected, var(--ms-option-subtitle-color))}@media (hover: hover){.ms__option--selected:hover .ms__option-subtitle{color:var(--ms-option-subtitle-color-selected-hover, var(--ms-option-subtitle-color-selected, var(--ms-option-subtitle-color)))}}.ms__empty{display:flex;align-items:center;justify-content:center;min-height:var(--ms-state-min-height);padding:var(--ms-empty-padding);text-align:center;font-size:var(--ms-empty-font-size);color:var(--ms-empty-color)}.ms__loader{display:flex;flex-direction:column;align-items:center;justify-content:center;min-height:var(--ms-state-min-height);padding:var(--ms-loader-padding);gap:var(--ms-loader-gap)}.ms__loading-text{font-size:var(--ms-loading-text-font-size);color:var(--ms-loading-color)}}@layer component{.ms--rtl .ms__badges{direction:rtl}.ms--rtl .ms__badges--right{margin-left:0;margin-right:var(--ms-badges-margin-right)}.ms--rtl .ms__badges--left{margin-right:0;margin-left:var(--ms-badges-margin-left)}.ms--rtl .ms__count-display{direction:rtl}.ms--rtl .ms__count-display--right{margin-left:0;margin-right:var(--ms-count-display-margin-right)}.ms--rtl .ms__count-display--left{margin-right:0;margin-left:var(--ms-count-display-margin-left)}}@layer component{.ms__option--tree{padding-inline-start:calc(var(--ms-tree-base-indent, .75rem) + var(--ms-tree-depth, 0) * var(--ms-tree-indent, 1.25rem))}.ms__option--tree-unselectable{cursor:default}.ms__option--tree-unselectable:hover{background:transparent}}@layer overrides{:host-context([data-theme="dark"]),:host-context([data-bs-theme="dark"]),:host-context(.dark){color-scheme:dark}:host-context([data-theme="light"]),:host-context([data-bs-theme="light"]),:host-context(.light){color-scheme:light}:host([data-theme="dark"]){color-scheme:dark}:host([data-theme="light"]){color-scheme:light}}`,Xs=["top","top-start","top-end","bottom","bottom-start","bottom-end","left","left-start","left-end","right","right-start","right-end"],N=()=>go(),Mr=[{configKey:"searchHint",attribute:"search-hint",converter:L({isNullable:!0}),on:"update",description:"Small hint text shown beneath the search input."},{configKey:"searchPlaceholder",attribute:"search-placeholder",converter:L({default:"Search..."}),on:"update",description:"Placeholder text for the search input."},{configKey:"selectPlaceholder",attribute:"select-placeholder",converter:L({default:"Pick an option..."}),on:"update",description:"Placeholder shown on the control when nothing is selected."},{configKey:"noDataPlaceholder",attribute:"no-data-placeholder",converter:L({isNullable:!0}),on:"update",description:"Text shown when there are no options at all."},{configKey:"dropdownMinWidth",attribute:"dropdown-min-width",converter:L({isNullable:!0}),on:"update",description:"Minimum width of the dropdown panel (any CSS length)."},{configKey:"dropdownMaxWidth",attribute:"dropdown-max-width",converter:L({isNullable:!0}),on:"update",description:"Maximum width of the dropdown panel (any CSS length)."},{configKey:"maxHeight",attribute:"max-height",converter:L({default:"20rem"}),on:"update",description:"Maximum height of the dropdown list before it scrolls."},{configKey:"emptyMessage",attribute:"empty-message",converter:L({default:"No results found"}),on:"update",description:"Message shown when a search yields no matches."},{configKey:"loadingMessage",attribute:"loading-message",converter:L({default:"Loading..."}),on:"update",description:"Message shown while options are loading."},{configKey:"removeButtonTooltipText",attribute:"remove-button-tooltip-text",converter:L({isNullable:!0}),on:"update",description:"Tooltip text for a badge remove (×) button."},{configKey:"formFieldId",attribute:"name",converter:L({isNullable:!0}),on:"reinit",description:"HTML form field name/id used for the hidden input(s)."},{configKey:"dropdownWidth",attribute:"dropdown-width",converter:L({isNullable:!0}),on:"update",description:"Fixed dropdown width; mirrored to the `--ms-dropdown-width` CSS variable."},{configKey:"selectedPopoverWidth",attribute:"selected-popover-width",converter:L({isNullable:!0}),on:"update",description:"Selected-items popover width; mirrored to `--ms-selected-popover-width`."},{configKey:"valueMember",attribute:"value-member",converter:L({isNullable:!0}),reflect:!0,on:"reinit",description:"Property name on an option object that holds its value."},{configKey:"displayValueMember",attribute:"display-value-member",converter:L({isNullable:!0}),reflect:!0,on:"reinit",description:"Property name that holds an option display label."},{configKey:"searchValueMember",attribute:"search-value-member",converter:L({isNullable:!0}),reflect:!0,on:"reinit",description:"Property name searched against (falls back to the display value)."},{configKey:"iconMember",attribute:"icon-member",converter:L({isNullable:!0}),reflect:!0,on:"reinit",description:"Property name that holds an option icon."},{configKey:"subtitleMember",attribute:"subtitle-member",converter:L({isNullable:!0}),reflect:!0,on:"reinit",description:"Property name that holds an option subtitle."},{configKey:"fullTitleMember",attribute:"full-title-member",converter:L({isNullable:!0}),reflect:!0,on:"reinit",description:"Property name that holds an option full/long title."},{configKey:"groupMember",attribute:"group-member",converter:L({isNullable:!0}),reflect:!0,on:"reinit",description:"Property name used to group options under headers."},{configKey:"disabledMember",attribute:"disabled-member",converter:L({isNullable:!0}),reflect:!0,on:"reinit",description:"Property name that marks an option disabled."},{configKey:"pathMember",attribute:"path-member",converter:L({isNullable:!0}),reflect:!0,on:"reinit",description:"Property name holding a node materialized tree path."},{configKey:"parentPathMember",attribute:"parent-path-member",converter:L({isNullable:!0}),reflect:!0,on:"reinit",description:"Property name holding a node parent path."},{configKey:"levelMember",attribute:"level-member",converter:L({isNullable:!0}),reflect:!0,on:"reinit",description:"Property name holding a node depth level."},{configKey:"hasChildrenMember",attribute:"has-children-member",converter:L({isNullable:!0}),reflect:!0,on:"reinit",description:"Property name flagging that a node has children."},{configKey:"isSelectableMember",attribute:"is-selectable-member",converter:L({isNullable:!0}),reflect:!0,on:"reinit",description:"Property name marking whether a node can be selected."},{configKey:"treePathSeparator",attribute:"tree-path-separator",converter:L({default:"."}),reflect:!0,on:"reinit",description:"Separator between segments in a materialized tree path."},{configKey:"isTreeEnabled",converter:W("tristate"),on:"reinit",type:"boolean",description:"Force tree mode on/off. Property-only; when unset (null) tree mode auto-enables if a path source (path-member / getPathCallback) is present."},{configKey:"checkboxMode",attribute:"checkbox-mode",converter:k(["independent","cascade"],{default:"independent"}),reflect:!0,on:"update",description:"Tree checkbox interaction.\n- `independent` (default) — toggles only the clicked node.\n- `cascade` — checks a node whole subtree and shows a tristate (checked / indeterminate / unchecked) box on branches.\n\nTree + multiple only."},{configKey:"cascadeSelectPolicy",attribute:"cascade-select-policy",converter:k(["rolled-up","leaves","all"],{default:"rolled-up"}),reflect:!0,on:"update",description:"In `cascade` mode, which values a selection emits (badges / form / change):\n- `rolled-up` (default) — minimal cover: a fully-selected subtree collapses to its root; partially-selected branches emit their individually-checked descendants.\n- `leaves` — only the checked leaf-level nodes.\n- `all` — every fully-checked node (branches and leaves)."},{configKey:"badgesDisplayMode",attribute:"badges-display-mode",converter:k(["badges","count","compact","partial","none"],{default:"badges"}),on:"reinit",description:"How the current selection is shown in the control."},{configKey:"badgesPosition",attribute:"badges-position",converter:k(["top","bottom","left","right"],{default:"bottom"}),on:"reinit",description:"Where the badges/selection appear relative to the input."},{configKey:"badgesThresholdMode",attribute:"badges-threshold-mode",converter:k(["count","partial"],{default:"count"}),on:"update",description:'How `badgesThreshold` is interpreted: collapse to a count badge, or keep partial badges + a "more" badge.'},{configKey:"searchInputMode",attribute:"search-input-mode",converter:k(["normal","readonly","hidden"],{default:"normal"}),on:"reinit",description:"Search field mode: editable, read-only, or hidden."},{configKey:"searchMode",attribute:"search-mode",converter:k(["filter","navigate"],{default:"filter"}),on:"reinit",description:"Whether typing filters the list or navigates it."},{configKey:"actionsLayout",attribute:"actions-layout",converter:k(["nowrap","wrap"],{default:"nowrap"}),on:"reinit",description:"Whether the action bar wraps or stays on one line."},{configKey:"actionsPosition",attribute:"actions-position",converter:k(["top","bottom"],{default:"top"}),on:"reinit",description:"Whether the action bar sits above or below the list."},{configKey:"actionsAlign",attribute:"actions-align",converter:k(["stretch","left","right","center","space-between"],{default:"stretch"}),on:"update",description:"Horizontal alignment of the action buttons."},{configKey:"checkboxAlign",attribute:"checkbox-align",converter:k(["top","center","bottom"],{default:"center"}),on:"update",description:"Vertical alignment of an option checkbox."},{configKey:"valueFormat",attribute:"value-format",converter:k(["json","csv","array"],{default:"json"}),on:"reinit",description:"Serialization format the control emits its value in."},{configKey:"badgeTooltipPlacement",attribute:"badge-tooltip-placement",converter:k(Xs,{default:"top"}),on:"update",description:"Preferred placement of a badge tooltip relative to its badge (floating-ui placement)."},{configKey:"optionTooltipPlacement",attribute:"option-tooltip-placement",converter:k(Xs,{default:"top-start"}),on:"update",description:"Preferred placement of an option tooltip (floating-ui placement)."},{configKey:"mobilePresentation",attribute:"mobile-presentation",converter:k(["auto","floating","fullscreen"],{default:"auto"}),reflect:!0,on:"update",description:"How the open dropdown is presented on phones. `auto` (default) keeps the floating panel on desktop/tablet and switches to a full-screen overlay on phone-sized touch devices (touch primary + shorter viewport side < 600px, orientation-robust); `floating` forces the anchored panel everywhere; `fullscreen` forces the full-screen overlay on any device (handy for previews/testing). Resolved reactively from the device/viewport environment."},{configKey:"fullscreenAutofocus",attribute:"fullscreen-autofocus",converter:W("default-false"),on:"update",description:"In the phone fullscreen overlay, auto-focus the search field on open (pops the soft keyboard immediately). Default `false`: the sheet opens with the list visible and the keyboard closed, appearing only when the user taps the search. Set `true` to type-to-filter right away. No effect in the floating presentation."},{configKey:"badgesThreshold",attribute:"badges-threshold",converter:z(),on:"update",description:"Threshold at which badges collapse to a count/compact view."},{configKey:"badgesMaxVisible",attribute:"badges-max-visible",converter:z(),on:"update",description:"Maximum number of badges rendered before overflow."},{configKey:"minSearchLength",attribute:"min-search-length",converter:z({default:0}),on:"update",description:"Minimum characters before searching/filtering starts."},{configKey:"searchDebounce",attribute:"search-debounce",converter:z({default:0}),on:"update",description:"Debounce delay in ms applied to the search input."},{configKey:"virtualScrollThreshold",attribute:"virtual-scroll-threshold",converter:z({default:100}),on:"reinit",description:"Option count above which virtual scrolling turns on."},{configKey:"optionHeight",attribute:"option-height",converter:z({default:50}),on:"update",description:"Fixed row height in px used by virtual scrolling."},{configKey:"badgeHeight",attribute:"badge-height",converter:z({default:36}),on:"update",description:"Fixed badge height in px used for layout/virtualization."},{configKey:"virtualScrollBuffer",attribute:"virtual-scroll-buffer",converter:z({default:10}),on:"update",description:"Extra rows rendered above/below the viewport when virtualizing."},{configKey:"badgeTooltipDelay",attribute:"badge-tooltip-delay",converter:z({default:100}),on:"update",description:"Delay in ms before a badge tooltip appears."},{configKey:"badgeTooltipOffset",attribute:"badge-tooltip-offset",converter:z({default:8}),on:"update",description:"Gap in px between a badge and its tooltip."},{configKey:"optionTooltipDelay",attribute:"option-tooltip-delay",converter:z(),on:"update",description:"Delay in ms before an option tooltip appears (falls back to badgeTooltipDelay)."},{configKey:"optionTooltipOffset",attribute:"option-tooltip-offset",converter:z(),on:"update",description:"Gap in px between an option and its tooltip."},{configKey:"isMultipleEnabled",attribute:"multiple",converter:W("default-true"),on:"reinit",description:"Allow selecting multiple options. When off, selecting one replaces the previous."},{configKey:"isGroupsAllowed",attribute:"allow-groups",converter:W("default-true"),on:"reinit",description:"Allow grouping options under group headers."},{configKey:"isCheckboxesShown",attribute:"show-checkboxes",converter:W("default-true"),on:"reinit",description:"Show a checkbox on each option."},{configKey:"isActionsSticky",attribute:"sticky-actions",converter:W("default-true"),on:"update",description:"Keep the action bar pinned while the list scrolls."},{configKey:"isPlacementLocked",attribute:"lock-placement",converter:W("default-true"),on:"update",description:"Keep the dropdown initial placement instead of flipping when it fits."},{configKey:"isSearchEnabled",attribute:"enable-search",converter:W("default-true"),on:"reinit",description:"Show the search input."},{configKey:"isKeepOptionsOnSearch",attribute:"keep-options-on-search",converter:W("default-true"),on:"update",description:"Keep already-selected options visible while filtering."},{configKey:"shouldKeepSearchOnClose",attribute:"should-keep-search-on-close",converter:W("default-true"),on:"update",description:"Preserve the search text after the dropdown closes."},{configKey:"isCloseOnSelect",attribute:"close-on-select",converter:W("default-false"),on:"update",description:"Close the dropdown immediately after a selection."},{configKey:"isAddNewAllowed",attribute:"allow-add-new",converter:W("default-false"),on:"reinit",description:"Allow adding a new option from the search text."},{configKey:"isCounterShown",attribute:"show-counter",converter:W("default-false"),on:"update",description:"Show a selected-count indicator."},{configKey:"isBadgeFullTitleShown",attribute:"show-badge-full-title",converter:W("default-false"),on:"update",description:"Show the full title on badges instead of the short label."},{configKey:"isVirtualScrollEnabled",attribute:"enable-virtual-scroll",converter:W("default-false"),on:"reinit",description:"Force virtual scrolling on regardless of the threshold."},{configKey:"isBadgeTooltipsEnabled",attribute:"enable-badge-tooltips",converter:W("default-false"),on:"update",description:"Enable tooltips on badges."},{configKey:"isOptionTooltipsEnabled",attribute:"enable-option-tooltips",converter:W("default-false"),on:"update",description:"Enable tooltips on options."},{configKey:"isOptionTooltipFollowCursor",attribute:"option-tooltip-follow-cursor",converter:W("default-false"),on:"update",description:"Make option tooltips follow the pointer."},{configKey:"initialValues",attribute:"initial-values",converter:Sr(),default:[],on:"reinit",type:"Array<string | number>",description:'Values selected on first render. Accepts a JSON array (`["a","b"]`) or a bare CSV (`a,b,c`).'},{configKey:"showDebugInfo",attribute:"show-debug-info",converter:W("default-false"),on:"update",description:"Render an in-component debug panel.",deprecated:"Use per-instance logging (el.enableLogging()) instead."},{configKey:"options",converter:fo(),on:"reinit",type:"ReadonlyArray<Record<string, unknown>>",description:"The array of option objects to render. The JS API — assign `el.options` directly. For HTML authoring use the `data-options` attribute (parsed per `data-options-format`) or declarative <option> children; both feed the same list and take precedence over this property in the order: <option> children > property > data-options."},{configKey:"optionsSource",attribute:"data-options",converter:L({isNullable:!0}),on:"reinit",type:"string",description:"HTML-authoring source for the option list, parsed per `data-options-format`. Reactive: changing either attribute re-renders. Prefer the `options` property in JS; a set `options` property and declarative <option> children both win over this."},{configKey:"optionsFormat",attribute:"data-options-format",converter:k(Ks,{default:"json"}),on:"reinit",type:"'json' | 'csv' | 'plain'",description:"How to parse the `data-options` attribute: `json` (a JSON array of objects or [value, label] tuples), `csv` (rows split on `data-options-row-splitter`, cells on `data-options-splitter`; the first row is a header — map columns via *-member), or `plain` (bare values split on both splitters -> [value, label] tuples, value === label). Default `json`."},{configKey:"optionsSplitter",attribute:"data-options-splitter",converter:L({default:","}),on:"reinit",type:"string",description:'Field/cell delimiter for the `csv` and `plain` `data-options` formats. Default `,`. Escapes `\\t` `\\n` `\\r` are honoured (e.g. `data-options-splitter="\\t"` for TSV). Ignored for `json`.'},{configKey:"optionsRowSplitter",attribute:"data-options-row-splitter",converter:L({default:`
|
|
41
|
-
`}),on:"reinit",type:"string",description:'Row/record delimiter for the `csv` and `plain` `data-options` formats. Default newline. Escapes honoured (e.g. `data-options-row-splitter=";"` for single-line data). Ignored for `json`.'},{configKey:"actionButtons",converter:po({validate:s=>Array.isArray(s)}),on:"reinit",type:"Array<Record<string, unknown>>",description:"Custom action buttons for the dropdown footer/header. Property-only; when unset the default Select-All / Clear buttons apply."},{configKey:"getValueCallback",converter:N(),on:"reinit",type:"(item: unknown) => string | number",description:"Extract an option value (overrides valueMember)."},{configKey:"getPathCallback",converter:N(),on:"reinit",type:"(item: unknown) => string",description:"Extract a node tree path (enables tree mode; overrides pathMember)."},{configKey:"getGroupCallback",converter:N(),on:"reinit",type:"(item: unknown) => string",description:"Extract the group name from an option (overrides groupMember)."},{configKey:"getDisabledCallback",converter:N(),on:"reinit",type:"(item: unknown) => boolean",description:"Whether an option is disabled (overrides disabledMember)."},{configKey:"getIsSelectableCallback",converter:N(),on:"reinit",type:"(node: unknown) => boolean",description:"Whether a tree node can be selected (overrides is-selectable-member)."},{configKey:"getSearchValueCallback",converter:N(),on:"reinit",type:"(item: unknown) => string",description:"Text an option is searched against (overrides searchValueMember)."},{configKey:"searchCallback",converter:N(),on:"reinit",type:"(searchTerm: string, signal?: AbortSignal) => Promise<unknown[]>",description:"Custom / async search; return the filtered options."},{configKey:"getDisplayValueCallback",converter:N(),on:"update",type:"(item: unknown) => string",description:"Compute the display label for an option (overrides displayValueMember)."},{configKey:"getBadgeDisplayCallback",converter:N(),on:"update",type:"(item: unknown) => string",description:"Compute the text shown on an option badge."},{configKey:"getBadgeClassCallback",converter:N(),on:"update",type:"(item: unknown) => string | string[]",description:"Extra CSS class(es) for an option badge."},{configKey:"getIconCallback",converter:N(),on:"update",type:"(item: unknown) => string",description:"Icon for an option (overrides iconMember)."},{configKey:"getSubtitleCallback",converter:N(),on:"update",type:"(item: unknown) => string",description:"Subtitle for an option (overrides subtitleMember)."},{configKey:"getFullTitleCallback",converter:N(),on:"update",type:"(item: unknown) => string",description:"Full title for an option (used by badges when show-badge-full-title is on)."},{configKey:"getCounterCallback",converter:N(),on:"update",type:"(count: number, moreCount?: number) => string",description:"Render the selected-count label."},{configKey:"getValueFormatCallback",converter:N(),on:"update",type:"(selectedValues: (string | number)[]) => string",description:"Serialize the selected values for form submission."},{configKey:"getBadgeTooltipCallback",converter:N(),on:"update",type:"(item: unknown) => string | HTMLElement",description:"Tooltip content for an option badge."},{configKey:"getOptionTooltipCallback",converter:N(),on:"update",type:"(item: unknown) => string | HTMLElement",description:"Tooltip content for an option row."},{configKey:"getRemoveButtonTooltipCallback",converter:N(),on:"update",type:"(item: unknown) => string",description:"Tooltip text for a badge remove button."},{configKey:"getSelectedItemClassCallback",converter:N(),on:"update",type:"(item: unknown) => string | string[]",description:"Extra CSS class(es) for a selected item."},{configKey:"renderOptionContentCallback",converter:N(),on:"update",type:"(item: unknown, context: OptionContentRenderContext) => string | HTMLElement",description:"Custom render for an option row; may return HTML or an element."},{configKey:"renderBadgeContentCallback",converter:N(),on:"update",type:"(item: unknown, context: BadgeContentRenderContext) => string | HTMLElement",description:"Custom render for a badge; may return HTML or an element."},{configKey:"renderGroupLabelContentCallback",converter:N(),on:"update",type:"(groupName: string) => string | HTMLElement",description:"Customize a group label; may return an HTML string or element."},{configKey:"renderSelectedContentCallback",converter:N(),on:"update",type:"(item: unknown) => string",description:"Custom render for the whole selected area."},{configKey:"renderSelectedItemContentCallback",converter:N(),on:"update",type:"(item: unknown) => string | HTMLElement",description:"Custom render for one selected item."},{configKey:"customStylesCallback",converter:N(),on:"update",type:"() => string",description:"Returns a CSS string injected into the component via a replaceable style slot (§12.8)."},{configKey:"beforeSearchCallback",converter:N(),on:"update",type:"(searchTerm: string) => string | null",description:"Runs before a search; return a rewritten term or null to veto."},{configKey:"beforeSelectCallback",converter:N(),on:"update",type:"(option: unknown, selectedOptions: unknown[]) => boolean | string | void",description:"Runs before selecting; return false to veto, or a string to veto and show it as a message."},{configKey:"beforeDeselectCallback",converter:N(),on:"update",type:"(option: unknown, selectedOptions: unknown[]) => boolean | string | void",description:"Runs before deselecting; return false to veto, or a string to veto and show it as a message."},{configKey:"addNewCallback",converter:N(),on:"update",type:"(value: string) => unknown | Promise<unknown>",description:"Create a new option from the typed text."}],Lr=[{name:"select",description:"An option was selected. `detail.option` is the selected option; `detail.selectedOptions`/`detail.selectedValues` are the full selection."},{name:"deselect",description:"An option was removed from the selection. `detail.option` is that option."},{name:"change",description:"The selection changed. `detail.selectedOptions`/`detail.selectedValues` are the full selection."}],qs=new Set(["dropdownWidth","selectedPopoverWidth","showDebugInfo","initialValues","optionsSource","optionsFormat","optionsSplitter","optionsRowSplitter","mobilePresentation"]),_t={dropdownWidth:"--ms-dropdown-width",selectedPopoverWidth:"--ms-selected-popover-width"};let Er=null;function Ar(){return Er??(Er=Jo(Gs,"--ms-"))}const zr=[{key:"valueMember",member:"value",callbackKey:"getValueCallback"},{key:"displayValueMember",member:"label",callbackKey:"getDisplayValueCallback"},{key:"groupMember",member:"group",callbackKey:"getGroupCallback"},{key:"iconMember",member:"icon",callbackKey:"getIconCallback"},{key:"subtitleMember",member:"subtitle",callbackKey:"getSubtitleCallback"},{key:"disabledMember",member:"disabled",callbackKey:"getDisabledCallback"}];class Ae extends Et{constructor(){super();V(this,_);V(this,J);V(this,D);V(this,fe);V(this,tt,null);V(this,st,new Set);V(this,ot,!1);V(this,Re,!1);V(this,He);V(this,Oe);R(this,J,this.attachShadow({mode:"open"})),qo(p(this,J),Gs),typeof requestAnimationFrame=="function"?requestAnimationFrame(()=>this.setAttribute("data-ready","")):this.setAttribute("data-ready","")}formResetCallback(){var t;(t=p(this,D))==null||t.clearAll()}directionChanged(t){var o;(o=p(this,D))==null||o.refreshDirection()}reinit(){x(this,_,ao).call(this),this.isConnected&&x(this,_,Yt).call(this)}update(t){x(this,_,lo).call(this,t),"customStylesCallback"in t&&x(this,_,Qt).call(this),"showDebugInfo"in t&&x(this,_,es).call(this);const o={};for(const[i,r]of Object.entries(t))qs.has(i)||(o[i]=r===null?void 0:r);p(this,D)&&Object.keys(o).length>0&&(p(this,D).updateOptions(o)||x(this,_,Yt).call(this)),"mobilePresentation"in t&&x(this,_,St).call(this,Lt())}connect(){p(this,D)||x(this,_,Jt).call(this)}disconnect(){var t;(t=p(this,D))==null||t.destroy(),R(this,D,void 0)}environmentChanged(t){x(this,_,St).call(this,t)}get name(){return this.getAttribute("name")}set name(t){t?this.setAttribute("name",t):this.removeAttribute("name")}get selectedValue(){var t;return this.flush(),((t=p(this,D))==null?void 0:t.selectedValue)??null}get selectedItem(){var t;return this.flush(),((t=p(this,D))==null?void 0:t.selectedItem)??null}getSelected(){return this.flush(),p(this,D)?p(this,D).getSelected():[]}setSelected(t,o={}){var i;this.flush(),(i=p(this,D))==null||i.setSelected(t,o)}getValue(){return this.flush(),p(this,D)?p(this,D).getValue():null}showMessage(t,o){var i;this.flush(),(i=p(this,D))==null||i.showMessage(t,o)}hideMessage(){var t;(t=p(this,D))==null||t.hideMessage()}destroy(){var t;(t=p(this,D))==null||t.destroy()}}J=new WeakMap,D=new WeakMap,fe=new WeakMap,tt=new WeakMap,st=new WeakMap,ot=new WeakMap,Re=new WeakMap,He=new WeakMap,Oe=new WeakMap,_=new WeakSet,St=function(t){var r;const o=this.config.mobilePresentation??"auto",i=si(o,t);(r=p(this,D))==null||r.setPresentation(i==="modal"?"fullscreen":i)},Yt=function(){var t;(t=p(this,D))==null||t.destroy(),R(this,D,void 0),x(this,_,Jt).call(this)},Jt=function(){x(this,_,oo).call(this),x(this,_,co).call(this);const t=x(this,_,io).call(this),o=x(this,_,ro).call(this);o&&o.length>0?p(this,fe).dataset.initialValues=JSON.stringify(o):delete p(this,fe).dataset.initialValues,R(this,D,new Bs(p(this,fe),t)),x(this,_,Qt).call(this),x(this,_,es).call(this),x(this,_,St).call(this,Lt())},oo=function(){if(p(this,fe))return;const t=document.createElement("div");t.setAttribute("data-multiselect",""),this.className&&(t.className=this.className),p(this,J).appendChild(t),R(this,tt,Yo(p(this,J),{position:"first",className:"ms-custom-styles"})),R(this,fe,t)},io=function(){const t={...this.config};for(const i of qs)delete t[i];for(const i of Object.keys(t))t[i]===null&&delete t[i];let o=t.options;if(p(this,Re)&&p(this,He))o&&o.length>0&&j.warn("[MultiSelectElement] Both declarative <option> elements and programmatic .options detected. Using declarative options."),o=p(this,He);else if(!o||o.length===0){const i=this.config.optionsSource;if(i!=null){const r=this.config.optionsFormat??"json",{options:n,error:a}=js(i,r,{splitter:this.config.optionsSplitter,rowSplitter:this.config.optionsRowSplitter});a&&j.error(`[MultiSelectElement] ${a}`),o=n}}if(t.options=o,p(this,Re))for(const{key:i,member:r,callbackKey:n}of zr)t[i]===void 0&&!t[n]&&(t[i]=r);return t.getCounterCallback||(t.getCounterCallback=(i,r)=>r!==void 0?`+${r} more`:`${i} selected`),t.onSelect=i=>{var r;this.emit("select",{option:i,selectedOptions:((r=p(this,D))==null?void 0:r.getSelected())??[],selectedValues:x(this,_,Tt).call(this)})},t.onDeselect=i=>{var r;this.emit("deselect",{option:i,selectedOptions:((r=p(this,D))==null?void 0:r.getSelected())??[],selectedValues:x(this,_,Tt).call(this)})},t.onChange=i=>{this.emit("change",{selectedOptions:i,selectedValues:x(this,_,Tt).call(this)})},t.container=p(this,J),t.hostElement=this,t},ro=function(){if(p(this,Oe)&&p(this,Oe).length>0)return p(this,Oe);const t=this.config.initialValues;return t&&t.length>0?t:void 0},Tt=function(){var o;const t=(o=p(this,D))==null?void 0:o.getValue();return t==null?[]:Array.isArray(t)?t:[t]},Qt=function(){const t=p(this,tt);if(!t)return;const o=this.config.customStylesCallback;if(typeof o!="function"){t.clear();return}try{const i=o();t.set(i),i&&x(this,_,no).call(this,i)}catch(i){j.warn("[MultiSelectElement] customStylesCallback threw",i),t.clear()}},no=function(t){const o=Ar();if(o.size!==0)for(const{name:i,suggestions:r}of ei(t,{prefix:"--ms-",consumed:o}))p(this,st).has(i)||(p(this,st).add(i),console.warn(`[web-multiselect] customStylesCallback sets "${i}", which no web-multiselect style consumes — it will have no effect.`+(r.length?` Did you mean: ${r.join(", ")}?`:"")+" (If it's for your own custom-rendered content, ignore this.)"))},ao=function(){for(const t of Object.keys(_t))x(this,_,Zt).call(this,_t[t],this.config[t])},lo=function(t){for(const o of Object.keys(_t))o in t&&x(this,_,Zt).call(this,_t[o],t[o])},Zt=function(t,o){o==null||o===""?this.style.removeProperty(t):this.style.setProperty(t,String(o))},co=function(){if(p(this,ot))return;R(this,ot,!0);const t=x(this,_,ho).call(this);t&&(R(this,He,t),R(this,Re,!0))},ho=function(){const t=Array.from(this.children);if(t.length===0)return null;const o=[];let i=!1;const r=(n,a)=>{var c,d;const l={value:n.value||((c=n.textContent)==null?void 0:c.trim())||"",label:((d=n.textContent)==null?void 0:d.trim())||n.value||""};a&&(l.group=a),n.hasAttribute("selected")&&(p(this,Oe)??R(this,Oe,[])).push(l.value),n.hasAttribute("disabled")&&(l.disabled=!0),n.hasAttribute("data-icon")&&(l.icon=n.getAttribute("data-icon")),n.hasAttribute("data-subtitle")&&(l.subtitle=n.getAttribute("data-subtitle")),o.push(l),i=!0};for(const n of t)if(n.tagName==="OPTION")r(n);else if(n.tagName==="OPTGROUP"){const a=n,l=a.label||a.getAttribute("label")||"Group";for(const c of Array.from(a.querySelectorAll("option")))r(c,l)}if(!i)return null;j.debug(`[MultiSelectElement] Parsed ${o.length} declarative options from Light DOM`);for(const n of t)(n.tagName==="OPTION"||n.tagName==="OPTGROUP")&&n.remove();return o},es=function(){const t=p(this,J).querySelector(".ms__debug-info");if(t&&t.remove(),!this.config.showDebugInfo)return;const o=document.createElement("div");o.className="ms__debug-info";const i=document.createElement("details"),r=document.createElement("summary");r.textContent="Debug Info";const n=document.createElement("div");n.className="ms__debug-stats",i.appendChild(r),i.appendChild(n),o.appendChild(i),p(this,J).appendChild(o),x(this,_,ts).call(this)},ts=function(){var l,c,d,h;const t=p(this,J).querySelector(".ms__debug-stats");if(!t||!p(this,D))return;const o="2.0.0-rc06",i=typeof window<"u"&&((c=(l=window.components)==null?void 0:l["web-multiselect"])==null?void 0:c.getInstances().length)||0,r=p(this,D).getSelected().length,n=((d=this.config.options)==null?void 0:d.length)||0,a=p(this,D);t.innerHTML=`
|
|
36
|
+
`}handleSelectedPopoverClick(e){if(e.stopPropagation(),e.target.closest(".ms__selected-popover-close")){e.preventDefault(),this.hideSelectedPopover();return}const o=e.target.closest(".ms__badge-remove");if(o){e.preventDefault();const i=o.dataset.value,r=this.selectedOptions.get(i);r&&this.interactiveDeselect(r)&&(this.renderSelectedPopover(),this.selectedValues.size===0&&this.hideSelectedPopover())}}positionSelectedPopover(){this.presentationMode!=="fullscreen"&&(this.selectedPopoverCleanup=this.anchorFloatingPanel(this.selectedPopover,{getPlacement:()=>this.selectedPopoverPlacement,setPlacement:e=>{this.selectedPopoverPlacement=e,Y.debug(`[${this.instanceId}] Locked popover placement:`,e)}}))}updateHiddenInput(){if(!this.options.formFieldId)return;this.hiddenInputs.forEach(i=>i.remove()),this.hiddenInputs=[];const e=this.options.valueFormat||"json",t=Array.from(this.selectedOptions.values()).map(i=>this.getItemValue(i)),o=this.options.hostElement||this.element;if(e==="array")t.forEach(i=>{const r=document.createElement("input");r.type="hidden",r.name=`${this.options.formFieldId}[]`,r.value=String(i),o.appendChild(r),this.hiddenInputs.push(r)});else{const i=document.createElement("input");i.type="hidden",i.name=this.options.formFieldId,i.id=this.options.formFieldId,i.value=this.getFormValue(),o.appendChild(i),this.hiddenInputs.push(i)}}getFormValue(){const e=Array.from(this.selectedOptions.values()).map(o=>this.getItemValue(o));return this.options.getValueFormatCallback?this.options.getValueFormatCallback(e):(this.options.valueFormat||"json")==="csv"?e.join(","):JSON.stringify(e)}getSelected(){return Array.from(this.selectedOptions.values())}setSelected(e,t={}){this.selectedValues=new Set(e.map(o=>String(o))),this.selectedOptions.clear(),e.forEach(o=>{const i=String(o),r=this.allOptions.find(n=>String(this.getItemValue(n))===i);r&&this.selectedOptions.set(i,r)}),this.renderDropdown(),this.renderBadges(),this.updateHiddenInput(),t.notify&&this.options.onChange&&this.options.onChange(this.getSelected())}updateOptions(e){var n;const t=!!this.hint,o="searchHint"in e?!!e.searchHint:t;if(t!==o)return!1;Object.assign(this.options,e);const i="pathMember"in e||"getPathCallback"in e||"parentPathMember"in e||"levelMember"in e||"hasChildrenMember"in e||"treePathSeparator"in e||"isTreeEnabled"in e||"isSelectableMember"in e||"getIsSelectableCallback"in e;if("options"in e&&e.options!==void 0?(this.allOptions=e.options,this.reconcileSelectedOptions(),this.isTreeMode()?this.buildTree():this.filteredOptions=this.searchTerm?this.filteredOptions:[...this.allOptions]):i&&(this.isTreeMode()?this.buildTree():this.filteredOptions=this.searchTerm?this.filteredOptions:[...this.allOptions]),("checkboxMode"in e||"cascadeSelectPolicy"in e)&&!i&&!("options"in e)&&this.isTreeMode()&&(this.cascadeIndex=this.isCascadeMode()?Bs(this.tree,a=>String(this.getItemValue(a))):null,this.isCascadeMode()&&this.cascadeIndex)){this.cascadeCheckedAtoms=Ye(this.cascadeIndex,this.selectedValues);const a=Ut(this.cascadeIndex,this.cascadeCheckedAtoms,this.cascadePolicy(),c=>String(this.getItemValue(c))),l=new Map;for(const c of a){const d=((n=this.cascadeIndex.nodeByValue.get(c))==null?void 0:n.data)??this.selectedOptions.get(c);d!==void 0&&l.set(c,d)}this.selectedValues=new Set(a),this.selectedOptions=l}if(this.element.classList.toggle("ms--no-checkboxes",!this.options.isCheckboxesShown||!this.options.isMultipleEnabled),"badgesPosition"in e){this.effectiveBadgesPosition=this.options.badgesPosition||"bottom",this.isRTL&&(this.effectiveBadgesPosition==="left"?this.effectiveBadgesPosition="right":this.effectiveBadgesPosition==="right"&&(this.effectiveBadgesPosition="left"));const a=this.element.querySelector(".ms__wrapper");a==null||a.classList.toggle("ms__wrapper--inline",this.effectiveBadgesPosition==="left"||this.effectiveBadgesPosition==="right")}return this.isOpen||(this.input.placeholder=this.getPlaceholderText()),"searchInputMode"in e&&(this.input.readOnly=this.options.searchInputMode==="readonly",this.input.style.display=this.options.searchInputMode==="hidden"?"none":""),"searchHint"in e&&this.hint&&(this.hint.textContent=this.options.searchHint||""),this.renderDropdown(),this.renderBadges(),this.updateHiddenInput(),!0}get selectedItem(){return this.selectedOptions.size===0?null:Array.from(this.selectedOptions.values())[0]}get selectedValue(){if(!this.options.valueMember&&!this.options.getValueCallback)return null;if(this.selectedOptions.size===0)return this.options.isMultipleEnabled?[]:null;const e=Array.from(this.selectedOptions.values()).map(t=>this.getItemValue(t));return this.options.isMultipleEnabled?e:e[0]??null}getValue(){if(this.selectedOptions.size===0)return this.options.isMultipleEnabled?[]:null;const e=Array.from(this.selectedOptions.values()).map(t=>this.getItemValue(t));return this.options.isMultipleEnabled?e:e[0]??null}spawnTooltip(e){var r;(r=this.tooltips.get(e.id))==null||r.destroy();const t=this.element.getRootNode(),o=t instanceof ShadowRoot?t:null,i=fr({trigger:e.trigger,container:this.options.container??o??document.body,content:e.content,placement:e.placement??this.options.badgeTooltipPlacement??"top",offset:e.offsetDistance??this.options.badgeTooltipOffset??8,delay:{show:e.showDelay??this.options.badgeTooltipDelay??100,hide:100},cssClass:e.cssClass??"ms__badge-tooltip",visibleClass:e.visibleClass??"ms__badge-tooltip--visible",followCursor:e.followCursor,onBeforeShow:e.onBeforeShow});this.tooltips.set(e.id,i)}destroyAllTooltips(){this.tooltips.forEach(e=>e.destroy()),this.tooltips.clear()}buildBadgeTooltipContent(e){if(this.options.getBadgeTooltipCallback)return this.options.getBadgeTooltipCallback(e);const t=this.getItemBadgeDisplayValue(e),o=this.getItemSubtitle(e);return o?`${t}
|
|
37
|
+
${o}`:t}buildRemoveButtonTooltipText(e,t){return t&&this.options.getRemoveButtonTooltipCallback?this.options.getRemoveButtonTooltipCallback(t):this.options.removeButtonTooltipText?this.options.removeButtonTooltipText.replace("{0}",e):`Remove ${e}`}attachBadgeTooltips(e){if(!this.options.isBadgeTooltipsEnabled)return;const t=!!e,o=e||this.badgesContainer,i=t?"popover-":"";if(o.querySelectorAll(".ms__badge:not(.ms__badge--more)").forEach(n=>{const a=n.querySelector(".ms__badge-remove");if(!a)return;const l=a.dataset.value,c=this.selectedOptions.get(l);if(!c)return;const d=`${i}${l}`,h=`${i}${l}-remove`,f=n.querySelector(".ms__badge-text");f&&this.spawnTooltip({id:d,trigger:f,content:this.buildBadgeTooltipContent(c)});const m=this.getItemBadgeDisplayValue(c);this.spawnTooltip({id:h,trigger:a,content:this.buildRemoveButtonTooltipText(m,c),onBeforeShow:()=>{var g;return(g=this.tooltips.get(d))==null?void 0:g.hide()}})}),!t){const n=this.badgesContainer.querySelector(".ms__badge--more"),a=n==null?void 0:n.querySelector(".ms__badge-remove");if(a&&a.dataset.action==="remove-hidden"){const l=this.options.badgesMaxVisible||3,c=this.selectedOptions.size-l;this.spawnTooltip({id:"more-badge-remove",trigger:a,content:this.buildRemoveButtonTooltipText(`${c} hidden items`)})}}}buildOptionTooltipContent(e){if(this.options.getOptionTooltipCallback)return this.options.getOptionTooltipCallback(e);const t=this.getItemDisplayValue(e),o=this.getItemSubtitle(e);return o?`${t}
|
|
38
|
+
${o}`:t}attachOptionTooltips(){if(this.destroyAllOptionTooltips(),!this.options.isOptionTooltipsEnabled)return;this.dropdown.querySelectorAll(".ms__option").forEach(t=>{const o=t,i=parseInt(o.dataset.index??"-1",10);if(i<0)return;const r=this.filteredOptions[i];if(!r)return;const n=this.buildOptionTooltipContent(r);n&&this.spawnTooltip({id:`option-${i}`,trigger:o,content:n,placement:this.options.optionTooltipPlacement??"top-start",offsetDistance:this.options.optionTooltipOffset??this.options.badgeTooltipOffset??8,showDelay:this.options.optionTooltipDelay??this.options.badgeTooltipDelay??100,cssClass:"ms__option-tooltip",visibleClass:"ms__option-tooltip--visible",followCursor:this.options.isOptionTooltipFollowCursor})})}markTruncatedOptions(){if(this.presentationMode!=="fullscreen")return;this.dropdown.querySelectorAll(".ms__option").forEach(t=>{const o=t,i=o.querySelector(".ms__option-title"),r=!!i&&i.scrollWidth>i.clientWidth+1;o.classList.toggle("ms__option--truncated",r)})}toggleLabelReveal(e){var d;if(this.labelRevealPopover&&this.labelRevealTrigger===e){this.hideLabelReveal();return}this.hideLabelReveal();const t=e.closest(".ms__option");if(!t)return;const o=parseInt(t.dataset.index??"-1",10);if(o<0)return;const i=this.isTreeMode()?(d=this.treeNodes[o])==null?void 0:d.data:this.filteredOptions[o];if(!i)return;const r=this.buildOptionTooltipContent(i);if(!r)return;const n=document.createElement("div");n.className="ms__option-tooltip ms__option-tooltip--fullscreen",typeof r=="string"?n.textContent=r:n.appendChild(r);const a=this.element.getRootNode(),l=a instanceof ShadowRoot?a:null,c=this.options.container??l??document.body;this.labelRevealTrigger=e,this.labelRevealPanel=n,this.labelRevealPopover=gr({reference:e,panel:n,container:c,placement:"top-end",offset:this.options.optionTooltipOffset??this.options.badgeTooltipOffset??8,shift:8,strategy:"fixed"}),this.labelRevealPopover.open(),requestAnimationFrame(()=>n.classList.add("ms__option-tooltip--visible"))}hideLabelReveal(){this.labelRevealPopover&&(this.labelRevealPopover.destroy(),this.labelRevealPopover=null),this.labelRevealPanel&&(this.labelRevealPanel.remove(),this.labelRevealPanel=null),this.labelRevealTrigger=null}showMessage(e,t){this.hideMessage();const o=(t==null?void 0:t.variant)??"info",i=(t==null?void 0:t.duration)??3e3,r=o==="error"||o==="warning",n=document.createElement("div");n.className=`ms__message ms__message--${o}`,n.setAttribute("role",r?"alert":"status"),n.setAttribute("aria-live",r?"assertive":"polite"),typeof e=="string"?n.textContent=e:n.appendChild(e),n.addEventListener("click",()=>this.hideMessage());const a=this.element.getRootNode(),l=a instanceof ShadowRoot?a:null;if((this.options.container??l??document.body).appendChild(n),this.messageEl=n,this.presentationMode==="fullscreen"&&(this.isOpen||this.showSelectedPopover))n.classList.add("ms__message--fullscreen");else{const h=Ge(n,this.input,{strategy:"fixed",placement:(t==null?void 0:t.placement)??"bottom",offset:8,shift:8,lockPlacement:"freeze"});this.messageCleanup=()=>h.destroy()}requestAnimationFrame(()=>n.classList.add("ms__message--visible")),i>0&&(this.messageTimer=setTimeout(()=>this.hideMessage(),i))}hideMessage(){this.messageTimer!==null&&(clearTimeout(this.messageTimer),this.messageTimer=null),this.messageCleanup&&(this.messageCleanup(),this.messageCleanup=null),this.messageEl&&(this.messageEl.remove(),this.messageEl=null)}hideOptionTooltips(){for(const[e,t]of this.tooltips)e.startsWith("option-")&&t.hide()}destroyAllOptionTooltips(){var e;for(const t of Array.from(this.tooltips.keys()))t.startsWith("option-")&&((e=this.tooltips.get(t))==null||e.destroy(),this.tooltips.delete(t))}attachActionButtonTooltips(){this.dropdown.querySelectorAll(".ms__action-btn").forEach(t=>{var c,d;const o=t,i=o.dataset.action;if(!i)return;const r=parseInt(o.dataset.buttonIndex||"-1"),n=r>=0?(c=this.options.actionButtons)==null?void 0:c[r]:(d=this.options.actionButtons)==null?void 0:d.find(h=>h.action===i);if(!n)return;const a=n.getTooltipCallback?n.getTooltipCallback(this):n.tooltip;if(!a)return;const l=`action-${r>=0?r:i}`;this.spawnTooltip({id:l,trigger:o,content:a})})}destroyAllActionButtonTooltips(){var e;for(const t of Array.from(this.tooltips.keys()))t.startsWith("action-")&&((e=this.tooltips.get(t))==null||e.destroy(),this.tooltips.delete(t))}destroyAllBadgeTooltips(){var e;for(const t of Array.from(this.tooltips.keys()))!t.startsWith("action-")&&!t.startsWith("popover-")&&((e=this.tooltips.get(t))==null||e.destroy(),this.tooltips.delete(t))}destroy(){this.destroyAllTooltips(),this.hideLabelReveal(),this.hideMessage(),this.searchDebounceTimer&&(clearTimeout(this.searchDebounceTimer),this.searchDebounceTimer=void 0),this.abortInFlightSearch(),this.dropdownCleanup&&this.dropdownCleanup(),this.hintCleanup&&this.hintCleanup(),this.selectedPopoverCleanup&&this.selectedPopoverCleanup(),this.overlayHistoryActive&&(this.overlayHistoryActive=!1,typeof window<"u"&&window.removeEventListener("popstate",this.onOverlayPopstate)),this.exitFullscreen(),this.documentClickHandler&&(document.removeEventListener("click",this.documentClickHandler),this.documentClickHandler=null),this.documentKeydownHandler&&(document.removeEventListener("keydown",this.documentKeydownHandler),this.documentKeydownHandler=null),this.virtualScroll&&(this.virtualScroll.destroy(),this.virtualScroll=null),this.dropdown&&this.dropdown.remove(),this.hint&&this.hint.remove(),this.selectedPopover&&this.selectedPopover.remove(),this.element.innerHTML="",this.element.classList.remove("ms","ms--open","ms--no-checkboxes"),Xe.info(`[${this.instanceId}] Component destroyed`)}}function Tr(){return{fromAttribute(s){if(s===null||s.trim()==="")return[];const e=s.trim();if(e.startsWith("["))try{const t=JSON.parse(e);if(Array.isArray(t))return t}catch{}return e.split(",").map(t=>t.trim())},validate(s){return Array.isArray(s)&&s.every(e=>typeof e=="string"||typeof e=="number")},toAttribute(s){return Array.isArray(s)?JSON.stringify(s):null}}}const Fs=["json","csv","plain"],Ws=",",js=`
|
|
39
|
+
`;function Us(s,e,t={}){if(s==null||s.trim()==="")return{options:[]};const o=Gs(t.splitter??Ws)||Ws,i=Gs(t.rowSplitter??js)||js;switch(e){case"csv":return Pr(s,o,i);case"plain":return Ir(s,o,i);case"json":default:return Or(s)}}function Gs(s){return s.replace(/\\[ntr\\]/g,e=>e==="\\n"?`
|
|
40
|
+
`:e==="\\t"?" ":e==="\\r"?"\r":"\\")}function Or(s){let e;try{e=JSON.parse(s)}catch(t){return{options:[],error:`data-options is not valid JSON: ${t.message}`}}return Array.isArray(e)?{options:e}:{options:[],error:"data-options JSON must be an array"}}function Ir(s,e,t){return{options:s.split(t).flatMap(i=>i.split(e)).map(i=>i.trim()).filter(i=>i.length>0).map(i=>[i,i])}}function Pr(s,e,t){const o=Mr(s,e,t).filter(n=>!(n.length===1&&n[0].trim()===""));if(o.length<2)return{options:[],error:"data-options CSV needs a header row and at least one data row"};const i=o[0].map(n=>n.trim());return{options:o.slice(1).map(n=>{const a={};return i.forEach((l,c)=>{a[l]=(n[c]??"").trim()}),a})}}function Mr(s,e,t){const o=[];let i=[],r="",n=!1;for(let a=0;a<s.length;){const l=s[a];if(n){l==='"'?s[a+1]==='"'?(r+='"',a+=2):(n=!1,a+=1):(r+=l,a+=1);continue}l==='"'?(n=!0,a+=1):s.startsWith(e,a)?(i.push(r),r="",a+=e.length):s.startsWith(t,a)?(i.push(r),o.push(i),i=[],r="",a+=t.length):(l==="\r"||(r+=l),a+=1)}return i.push(r),o.push(i),o}const Xs=`@layer variables,component,overrides;@layer variables{:host{display:block;--ms-rem: 10px;font-family:var(--ms-font-family, var(--base-font-family, inherit));--ms-accent-color: var(--base-accent-color, #3b82f6);--ms-accent-color-hover: var(--base-accent-color-hover, #2563eb);--ms-accent-color-active: var(--base-accent-color-active, #1d4ed8);--ms-accent-color-light: var(--base-accent-color-light, light-dark(#eff6ff, #1e3a5f));--ms-accent-color-light-hover: var(--base-accent-color-light-hover, light-dark(#e0f2fe, #264a73));--ms-text-color-1: var(--base-text-color-1, light-dark(#111827, #f5f5f5));--ms-text-color-2: var(--base-text-color-2, light-dark(#353b47, #d4d4d4));--ms-text-color-3: var(--base-text-color-3, light-dark(#6b7280, #a3a3a3));--ms-text-color-4: var(--base-text-color-4, light-dark(#a0a3a9, #737373));--ms-text-color-on-accent: var(--base-text-color-on-accent, #ffffff);--ms-text-primary: var(--ms-text-color-1);--ms-text-secondary: var(--ms-text-color-3);--ms-primary-bg: var(--base-hover-bg, color-mix(in srgb, var(--ms-text-color-1) 8%, var(--base-main-bg, light-dark(#ffffff, #1a1a1a))));--ms-primary-bg-hover: var(--base-active-bg, color-mix(in srgb, var(--ms-text-color-1) 14%, var(--base-main-bg, light-dark(#ffffff, #1a1a1a))));--ms-border-color: var(--base-border-color, light-dark(#cbd5e1, #52525b));--ms-border: var(--base-border, 1px solid var(--ms-border-color));--ms-input-bg: var(--base-input-bg, light-dark(#ffffff, #1a1a1a));--ms-input-color: var(--base-input-color, var(--ms-text-color-1));--ms-input-border: var(--base-input-border, 1px solid var(--ms-border-color));--ms-input-border-hover: var(--base-input-border-hover, 1px solid var(--ms-accent-color));--ms-input-border-focus: var(--base-input-border-focus, 1px solid var(--ms-accent-color));--ms-input-placeholder-color: var(--base-input-placeholder-color, var(--ms-text-color-4));--ms-input-bg-disabled: var(--base-input-bg-disabled, rgba(107, 114, 128, .05));--ms-toggle-icon-color: var(--ms-text-color-3);--ms-toggle-icon-color-open: var(--ms-text-color-3);--ms-counter-badge-bg: var(--ms-accent-color);--ms-counter-badge-bg-hover: var(--ms-accent-color-hover);--ms-counter-badge-color: var(--ms-text-color-on-accent);--ms-hint-bg: var(--base-main-bg, light-dark(#ffffff, #1a1a1a));--ms-hint-color: var(--ms-text-color-4);--ms-hint-border-color: var(--ms-border-color);--ms-dropdown-bg: var(--base-dropdown-bg, var(--base-elevated-bg, light-dark(#ffffff, #1a1a1a)));--ms-dropdown-text-color: var(--ms-text-color-1);--ms-dropdown-border-color: var(--ms-border-color);--ms-dropdown-box-shadow-semantic: var(--base-dropdown-box-shadow, 0 20px 25px -5px rgb(0 0 0 / .1), 0 8px 10px -6px rgb(0 0 0 / .1));--ms-actions-bg: var(--base-main-bg, light-dark(#ffffff, #1a1a1a));--ms-actions-border-color: var(--ms-border-color);--ms-action-button-bg: transparent;--ms-action-button-bg-hover: var(--ms-primary-bg);--ms-action-button-border-color: var(--ms-border-color);--ms-action-button-border-color-hover: var(--ms-accent-color);--ms-action-button-color: var(--ms-text-color-1);--ms-group-border-color: var(--ms-border-color);--ms-option-text-color: var(--ms-text-color-1);--ms-option-bg: transparent;--ms-option-bg-hover: var(--ms-primary-bg);--ms-option-color-hover: inherit;--ms-option-bg-focused: var(--ms-primary-bg);--ms-option-color-focused: inherit;--ms-option-outline-color-focused: var(--ms-accent-color);--ms-option-bg-selected: color-mix(in srgb, var(--ms-accent-color) 10%, transparent);--ms-option-bg-matched: color-mix(in srgb, var(--ms-accent-color) 8%, transparent);--ms-option-color-matched: inherit;--ms-option-border-matched-color: color-mix(in srgb, var(--ms-accent-color) 40%, transparent);--ms-option-title-color: var(--ms-text-color-1);--ms-option-subtitle-color: var(--ms-text-color-3);--ms-option-mark-bg: color-mix(in srgb, var(--ms-accent-color) 20%, transparent);--ms-option-mark-color: inherit;--ms-loading-color: var(--ms-text-color-3);--ms-badge-bg: var(--ms-accent-color-light);--ms-badge-bg-hover: var(--base-hover-bg, var(--ms-accent-color-light-hover));--ms-badge-bg-active: var(--ms-accent-color-light-hover);--ms-badge-text-bg-hover: var(--base-hover-bg, var(--ms-accent-color-light-hover));--ms-badge-text-color-hover: var(--ms-badge-text-color);--ms-badge-counter-border-color: var(--ms-border-color);--ms-badge-counter-text-bg: var(--ms-primary-bg-hover);--ms-badge-counter-text-color: var(--ms-text-color-1);--ms-badge-counter-remove-bg: var(--ms-text-color-3);--ms-badge-counter-remove-bg-hover: var(--ms-text-color-1);--ms-badge-counter-remove-color: var(--ms-text-color-on-accent);--ms-counter-wrapper-border-color: var(--ms-border-color);--ms-count-clear-bg-hover: var(--ms-accent-color);--ms-tooltip-bg: var(--base-tooltip-bg, var(--base-inverse-bg, light-dark(#333333, #f5f5f5)));--ms-tooltip-text-color: var(--base-tooltip-text-color, light-dark(#ffffff, #1a1a1a));--ms-selected-popover-bg: var(--base-dropdown-bg, var(--base-elevated-bg, light-dark(#ffffff, #1a1a1a)));--ms-selected-popover-border-color: var(--ms-border-color);--ms-selected-popover-header-border-color: var(--ms-border-color);--ms-selected-popover-close-bg-hover: var(--ms-accent-color);--ms-input-padding: calc(.8 * var(--ms-rem)) calc(1.2 * var(--ms-rem));--ms-input-padding-right: calc(4 * var(--ms-rem));--ms-input-padding-h: calc(1.2 * var(--ms-rem));--ms-input-height: calc(var(--base-input-size-md-height, 3.5) * var(--ms-rem));--ms-input-font-size: calc(var(--base-font-size-sm, 1.4) * var(--ms-rem));--ms-input-border-width: 1px;--ms-input-border-radius: var(--ms-border-radius-md);--ms-input-text: var(--ms-text-color-1);--ms-input-bg-disabled: rgba(107, 114, 128, .05);--ms-toggle-right: calc(1.2 * var(--ms-rem));--ms-toggle-color: var(--ms-text-color-3);--ms-transform-center-y: translateY(-50%);--ms-transform-rotate-180: 180deg;--ms-counter-offset: calc(3.2 * var(--ms-rem));--ms-counter-padding: calc(.2 * var(--ms-rem)) calc(.4 * var(--ms-rem));--ms-counter-bg: var(--ms-accent-color);--ms-counter-color: var(--ms-text-color-on-accent);--ms-counter-font-size: calc(var(--base-font-size-xs, 1.2) * var(--ms-rem));--ms-counter-font-weight: var(--base-font-weight-semibold, 600);--ms-counter-border-radius: var(--ms-border-radius-sm);--ms-counter-bg-hover: var(--ms-accent-color-hover);--ms-transform-scale-hover: 1.1;--ms-hint-padding: calc(.8 * var(--ms-rem)) calc(1.2 * var(--ms-rem));--ms-hint-border: 1px solid var(--ms-hint-border-color);--ms-hint-border-radius: var(--ms-border-radius-lg);--ms-hint-box-shadow: 0 4px 6px -1px rgb(0 0 0 / .1), 0 2px 4px -2px rgb(0 0 0 / .1);--ms-hint-font-size: calc(var(--base-font-size-xs, 1.2) * var(--ms-rem));--ms-dropdown-border: var(--base-dropdown-border, 1px solid var(--ms-dropdown-border-color));--ms-dropdown-border-radius: var(--ms-border-radius-lg);--ms-dropdown-box-shadow: 0 20px 25px -5px rgb(0 0 0 / .1), 0 8px 10px -6px rgb(0 0 0 / .1);--ms-input-current-width: auto;--ms-dropdown-width: var(--ms-input-current-width);--ms-options-max-height: calc(32 * var(--ms-rem));--ms-option-color: var(--ms-text-color-1);--ms-z-index-dropdown: 9999;--ms-z-index-sticky: 1;--ms-z-index-fullscreen: 10001;--ms-z-index-fullscreen-tooltip: 10002;--ms-fullscreen-rem: 12px;--ms-fullscreen-bg: var(--ms-dropdown-bg);--ms-fullscreen-text-color: var(--ms-dropdown-text-color);--ms-fullscreen-header-bg: var(--ms-dropdown-bg);--ms-fullscreen-header-border: 1px solid var(--ms-dropdown-border-color);--ms-fullscreen-header-gap: calc(.8 * var(--ms-fullscreen-rem));--ms-fullscreen-header-padding-v: calc(.8 * var(--ms-fullscreen-rem));--ms-fullscreen-header-padding-h: calc(1.2 * var(--ms-fullscreen-rem));--ms-fullscreen-header-padding: var(--ms-fullscreen-header-padding-v) var(--ms-fullscreen-header-padding-h);--ms-fullscreen-header-min-height: calc(5.6 * var(--ms-fullscreen-rem));--ms-fullscreen-title-font-size: calc(1.7 * var(--ms-fullscreen-rem));--ms-fullscreen-title-font-weight: var(--base-font-weight-semibold, 600);--ms-fullscreen-search-border: var(--ms-input-border);--ms-fullscreen-search-border-radius: var(--ms-input-border-radius);--ms-fullscreen-search-padding: calc(.8 * var(--ms-fullscreen-rem)) calc(1.2 * var(--ms-fullscreen-rem));--ms-fullscreen-search-font-size: calc(1.6 * var(--ms-fullscreen-rem));--ms-fullscreen-search-clear-size: calc(2.8 * var(--ms-fullscreen-rem));--ms-fullscreen-search-clear-icon-size: calc(1.4 * var(--ms-fullscreen-rem));--ms-fullscreen-search-clear-inset: calc(.4 * var(--ms-fullscreen-rem));--ms-fullscreen-search-clear-gutter: calc(3.4 * var(--ms-fullscreen-rem));--ms-fullscreen-search-clear-color: var(--ms-text-muted-color, var(--ms-dropdown-text-color));--ms-fullscreen-search-clear-bg-hover: var(--ms-option-bg-matched, transparent);--ms-fullscreen-mode-toggle-size: calc(2.8 * var(--ms-fullscreen-rem));--ms-fullscreen-mode-toggle-icon-size: calc(1.5 * var(--ms-fullscreen-rem));--ms-fullscreen-mode-toggle-gap: calc(.4 * var(--ms-fullscreen-rem));--ms-fullscreen-mode-toggle-color: var(--ms-text-muted-color, var(--ms-dropdown-text-color));--ms-fullscreen-mode-toggle-bg: transparent;--ms-fullscreen-mode-toggle-bg-hover: var(--ms-option-bg-matched, transparent);--ms-fullscreen-close-size: calc(3.6 * var(--ms-fullscreen-rem));--ms-fullscreen-close-icon-size: calc(1.6 * var(--ms-fullscreen-rem));--ms-fullscreen-close-color: var(--ms-dropdown-text-color);--ms-fullscreen-close-bg: transparent;--ms-fullscreen-close-border: none;--ms-fullscreen-close-border-radius: 50%;--ms-fullscreen-close-bg-hover: var(--ms-option-bg-matched, transparent);--ms-fullscreen-close-edge-nudge: calc(.8 * var(--ms-fullscreen-rem));--ms-fullscreen-info-size: calc(2.8 * var(--ms-fullscreen-rem));--ms-fullscreen-info-icon-size: calc(1.8 * var(--ms-fullscreen-rem));--ms-fullscreen-info-color: var(--ms-accent-color);--ms-fullscreen-info-bg-hover: var(--ms-option-bg-matched, transparent);--ms-fullscreen-nav-gap: calc(.6 * var(--ms-fullscreen-rem));--ms-fullscreen-nav-padding-top: calc(.6 * var(--ms-fullscreen-rem));--ms-fullscreen-nav-count-font-size: calc(1.3 * var(--ms-fullscreen-rem));--ms-fullscreen-nav-count-color: var(--ms-text-muted-color, var(--ms-dropdown-text-color));--ms-fullscreen-nav-btn-size: calc(3.2 * var(--ms-fullscreen-rem));--ms-fullscreen-nav-btn-icon-size: calc(1.6 * var(--ms-fullscreen-rem));--ms-fullscreen-nav-btn-color: var(--ms-dropdown-text-color);--ms-fullscreen-nav-btn-bg: var(--ms-option-bg-matched, transparent);--ms-fullscreen-nav-btn-bg-hover: color-mix(in srgb, var(--ms-accent-color) 22%, transparent);--ms-icon-chevron: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path d='M5 15l7-7 7 7' stroke='black' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round' fill='none'/></svg>");--ms-icon-info: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><circle cx='12' cy='12' r='9' fill='none' stroke='black' stroke-width='2'/><circle cx='12' cy='7.5' r='1.3' fill='black'/><path d='M12 11v6' stroke='black' stroke-width='2' stroke-linecap='round' fill='none'/></svg>");--ms-fullscreen-tree-base-indent: calc(.7 * var(--ms-fullscreen-rem));--ms-fullscreen-tree-indent: calc(1.2 * var(--ms-fullscreen-rem));--ms-actions-gap: calc(.4 * var(--ms-rem));--ms-actions-padding: calc(.8 * var(--ms-rem));--ms-actions-border-bottom: 1px solid var(--ms-actions-border-color);--ms-action-btn-padding: calc(.4 * var(--ms-rem)) calc(.8 * var(--ms-rem));--ms-action-btn-font-size: calc(var(--base-font-size-xs, 1.2) * var(--ms-rem));--ms-action-btn-border: var(--ms-border);--ms-action-btn-border-radius: var(--ms-border-radius-sm);--ms-action-btn-bg: transparent;--ms-action-btn-color: inherit;--ms-action-btn-bg-hover: var(--ms-primary-bg);--ms-action-btn-border-color-hover: var(--ms-accent-color);--ms-transform-scale-active: .98;--ms-options-padding: 0;--ms-group-border-top: 1px solid var(--ms-group-border-color);--ms-group-margin-top: calc(.4 * var(--ms-rem));--ms-group-padding-top: calc(.4 * var(--ms-rem));--ms-group-label-padding: calc(.4 * var(--ms-rem)) calc(1.2 * var(--ms-rem));--ms-group-label-font-size: calc(var(--base-font-size-xs, 1.2) * var(--ms-rem));--ms-group-label-font-weight: var(--base-font-weight-semibold, 600);--ms-group-label-color: var(--ms-text-color-3);--ms-group-label-transform: uppercase;--ms-group-label-letter-spacing: .05em;--ms-option-gap: calc(.8 * var(--ms-rem));--ms-option-padding: calc(.8 * var(--ms-rem)) calc(1.2 * var(--ms-rem));--ms-option-padding-h: calc(1.2 * var(--ms-rem));--ms-option-min-height: auto;--ms-option-outline-focused: 2px solid var(--ms-option-outline-color-focused);--ms-option-focus-outline-offset: -2px;--ms-option-border-matched: 3px solid var(--ms-option-border-matched-color);--ms-option-bg-focused-hover: var(--ms-primary-bg);--ms-option-bg-matched-hover: color-mix(in srgb, var(--ms-accent-color) 12%, transparent);--ms-option-bg-selected-focused: color-mix(in srgb, var(--ms-accent-color) 15%, transparent);--ms-option-bg-selected-matched: color-mix(in srgb, var(--ms-accent-color) 15%, transparent);--ms-option-disabled-bg: var(--base-disabled-bg, transparent);--ms-option-bg-disabled-selected: color-mix(in srgb, var(--ms-accent-color) 10%, transparent);--ms-disabled-opacity: .5;--ms-option-content-gap: calc(.8 * var(--ms-rem));--ms-option-icon-size: calc(2 * var(--ms-rem));--ms-option-icon-font-size: calc(var(--base-font-size-base, 1.6) * var(--ms-rem));--ms-option-title-font-size: calc(var(--base-font-size-sm, 1.4) * var(--ms-rem));--ms-option-mark-font-weight: var(--base-font-weight-semibold, 600);--ms-option-title-white-space: normal;--ms-option-title-overflow: visible;--ms-option-title-text-overflow: clip;--ms-option-subtitle-margin-top: calc(.4 * var(--ms-rem));--ms-option-subtitle-font-size: calc(var(--base-font-size-xs, 1.2) * var(--ms-rem));--ms-option-subtitle-line-height: var(--base-line-height-tight, 1.25);--ms-checkbox-margin-top: 0;--ms-checkbox-margin-right: 0;--ms-checkbox-margin-bottom: 0;--ms-checkbox-margin-left: 0;--ms-checkbox-size: calc(1.6 * var(--ms-rem));--ms-checkbox-scale: 1;--ms-checkbox-align: center;--ms-checkbox-bg: var(--ms-input-bg);--ms-checkbox-border-width: 1px;--ms-checkbox-border-color: var(--base-checkbox-border-color, #8f8f8f);--ms-checkbox-border: var(--ms-checkbox-border-width) solid var(--ms-checkbox-border-color);--ms-checkbox-border-radius: calc(.3 * var(--ms-rem));--ms-checkbox-checkmark-thickness: 2.5px;--ms-checkbox-checked-bg: var(--ms-accent-color);--ms-checkbox-checked-border: var(--ms-checkbox-border-width) solid var(--ms-accent-color);--ms-checkbox-checkmark-color: var(--ms-text-color-on-accent);--ms-checkbox-hover-border-color: var(--ms-accent-color);--ms-checkbox-disabled-bg: var(--ms-primary-bg);--ms-checkbox-disabled-border: var(--ms-checkbox-border-width) solid var(--ms-border-color);--ms-checkbox-checked-bg-hover: var(--ms-accent-color-hover);--ms-checkbox-checked-border-color-hover: var(--ms-accent-color-hover);--ms-state-min-height: calc(8 * var(--ms-rem));--ms-empty-padding: calc(1.6 * var(--ms-rem)) calc(1.2 * var(--ms-rem));--ms-empty-font-size: calc(var(--base-font-size-sm, 1.4) * var(--ms-rem));--ms-empty-color: var(--ms-text-color-3);--ms-loader-padding: calc(1.6 * var(--ms-rem)) calc(1.2 * var(--ms-rem));--ms-loader-gap: calc(.8 * var(--ms-rem));--ms-loading-text-font-size: calc(var(--base-font-size-sm, 1.4) * var(--ms-rem));--ms-loading-text-color: var(--ms-text-color-3);--ms-badges-gap: calc(.8 * var(--ms-rem));--ms-badges-margin-bottom: calc(.8 * var(--ms-rem));--ms-badges-margin-top: calc(.8 * var(--ms-rem));--ms-badges-margin-left: calc(.4 * var(--ms-rem));--ms-badges-margin-right: calc(.4 * var(--ms-rem));--ms-inline-align: center;--ms-badge-gap: calc(.8 * var(--ms-rem));--ms-badge-height: calc(2.7 * var(--ms-rem));--ms-badge-font-size: calc(var(--base-font-size-xs, 1.2) * var(--ms-rem));--ms-badge-font-weight: var(--base-font-weight-semibold, 600);--ms-badge-border-radius: var(--ms-border-radius-sm);--ms-order-first: -1;--ms-badge-text-padding: 0 calc(.8 * var(--ms-rem));--ms-badge-text-bg: var(--ms-accent-color-light);--ms-badge-text-color: var(--ms-accent-color);--ms-badge-text-border: none;--ms-badge-remove-width: calc(2.7 * var(--ms-rem));--ms-badge-remove-bg: var(--ms-accent-color);--ms-badge-remove-color: var(--ms-text-color-on-accent);--ms-badge-remove-border: none;--ms-badge-remove-font-size: calc(var(--base-font-size-xs, 1.2) * var(--ms-rem));--ms-badge-remove-bg-hover: var(--ms-accent-color-hover);--ms-badge-remove-box-shadow-focus: 0 0 0 2px color-mix(in srgb, var(--ms-accent-color) 50%, transparent);--ms-badge-remove-icon-size: calc(1 * var(--ms-rem));--ms-icon-remove: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path d='M6 6L18 18M18 6L6 18' stroke='black' stroke-width='2.5' stroke-linecap='round' fill='none'/></svg>");--ms-icon-search-clear: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='m13.5 8.5-5 5'/><path d='m8.5 8.5 5 5'/><circle cx='11' cy='11' r='8'/><path d='m21 21-4.3-4.3'/></svg>");--ms-icon-search: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><circle cx='11' cy='11' r='8'/><path d='m21 21-4.3-4.3'/></svg>");--ms-icon-filter: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><polygon points='22 3 2 3 10 12.46 10 19 14 21 14 12.46 22 3'/></svg>");--ms-badge-counter-bg: transparent;--ms-badge-counter-border: 1px solid var(--ms-badge-counter-border-color);--ms-badge-counter-border-radius: var(--ms-border-radius-sm);--ms-more-badge-bg: var(--ms-accent-color-light);--ms-more-badge-hover-bg: var(--ms-badge-bg-hover);--ms-more-badge-active-bg: var(--ms-accent-color-light-hover);--ms-count-display-margin-bottom: calc(.8 * var(--ms-rem));--ms-count-display-margin-top: calc(.8 * var(--ms-rem));--ms-count-display-margin-left: calc(.8 * var(--ms-rem));--ms-count-display-margin-right: calc(.8 * var(--ms-rem));--ms-counter-wrapper-bg: transparent;--ms-counter-wrapper-border: var(--ms-border);--ms-counter-wrapper-border-radius: var(--ms-border-radius-sm);--ms-counter-wrapper-padding: calc(.4 * var(--ms-rem)) calc(.8 * var(--ms-rem));--ms-counter-wrapper-gap: calc(.4 * var(--ms-rem));--ms-counter-wrapper-bg-hover: var(--ms-primary-bg);--ms-counter-wrapper-border-color-hover: var(--ms-accent-color);--ms-count-text-bg: transparent;--ms-count-text-border: none;--ms-count-text-font-size: calc(var(--base-font-size-sm, 1.4) * var(--ms-rem));--ms-count-text-color: var(--ms-text-color-1);--ms-count-clear-size: calc(1.6 * var(--ms-rem));--ms-count-clear-bg: transparent;--ms-count-clear-color: var(--ms-text-color-3);--ms-count-clear-font-size: calc(var(--base-font-size-lg, 1.8) * var(--ms-rem));--ms-count-clear-border-radius: var(--ms-border-radius-sm);--ms-count-clear-bg-hover: color-mix(in srgb, var(--ms-accent-color) 20%, transparent);--ms-count-clear-color-hover: var(--ms-accent-color);--ms-count-clear-icon-size: calc(1.4 * var(--ms-rem));--ms-icon-clear: var(--ms-icon-remove);--ms-tooltip-color: var(--ms-tooltip-text-color);--ms-tooltip-padding: calc(.8 * var(--ms-rem)) calc(1.2 * var(--ms-rem));--ms-tooltip-border-radius: var(--ms-border-radius-lg);--ms-tooltip-font-size: calc(var(--base-font-size-sm, 1.4) * var(--ms-rem));--ms-tooltip-max-width: calc(32 * var(--ms-rem));--ms-tooltip-shadow: 0 2px 8px rgba(0, 0, 0, .15);--ms-tooltip-z-index: 10000;--ms-option-tooltip-bg: var(--ms-tooltip-bg);--ms-option-tooltip-text-color: var(--ms-tooltip-text-color);--ms-option-tooltip-padding: var(--ms-tooltip-padding);--ms-option-tooltip-border-radius: var(--ms-tooltip-border-radius);--ms-option-tooltip-font-size: var(--ms-tooltip-font-size);--ms-option-tooltip-max-width: var(--ms-tooltip-max-width);--ms-option-tooltip-shadow: var(--ms-tooltip-shadow);--ms-option-tooltip-z-index: var(--ms-tooltip-z-index);--ms-message-bg: var(--ms-message-info-bg);--ms-message-color: var(--ms-message-info-color);--ms-message-border: 1px solid transparent;--ms-message-border-radius: var(--ms-border-radius-lg);--ms-message-padding: calc(1 * var(--ms-rem)) calc(1.4 * var(--ms-rem));--ms-message-font-size: calc(var(--base-font-size-sm, 1.4) * var(--ms-rem));--ms-message-font-weight: var(--base-font-weight-medium, 500);--ms-message-max-width: calc(40 * var(--ms-rem));--ms-message-shadow: 0 4px 16px rgb(0 0 0 / .18);--ms-message-fullscreen-offset: calc(2.4 * var(--ms-fullscreen-rem));--ms-message-z-index: var(--ms-z-index-fullscreen-tooltip);--ms-message-info-bg: var(--ms-tooltip-bg);--ms-message-info-color: var(--ms-tooltip-text-color);--ms-message-warning-bg: var(--base-warning-bg, #f59e0b);--ms-message-warning-color: var(--base-warning-color, #1a1a1a);--ms-message-error-bg: var(--base-danger-bg, #ef4444);--ms-message-error-color: var(--base-danger-color, #ffffff);--ms-message-success-bg: var(--base-success-bg, #10b981);--ms-message-success-color: var(--base-success-color, #ffffff);--ms-z-index-popover: 10000;--ms-selected-popover-width: calc(32 * var(--ms-rem));--ms-selected-popover-max-height: calc(32 * var(--ms-rem));--ms-selected-popover-border: 1px solid var(--ms-selected-popover-border-color);--ms-selected-popover-border-radius: var(--ms-border-radius-lg);--ms-selected-popover-box-shadow: 0 20px 25px -5px rgb(0 0 0 / .1), 0 8px 10px -6px rgb(0 0 0 / .1);--ms-selected-popover-header-padding: calc(.8 * var(--ms-rem)) calc(1.2 * var(--ms-rem));--ms-selected-popover-header-bg: color-mix(in srgb, var(--ms-accent-color) 10%, transparent);--ms-selected-popover-header-border-bottom: 1px solid var(--ms-selected-popover-header-border-color);--ms-selected-popover-header-font-size: calc(var(--base-font-size-sm, 1.4) * var(--ms-rem));--ms-selected-popover-header-font-weight: var(--base-font-weight-semibold, 600);--ms-selected-popover-header-color: var(--ms-text-color-1);--ms-popover-close-size: calc(2.4 * var(--ms-rem));--ms-selected-popover-close-bg: transparent;--ms-selected-popover-close-color: var(--ms-text-color-3);--ms-selected-popover-close-font-size: calc(var(--base-font-size-xl, 2) * var(--ms-rem));--ms-selected-popover-close-border-radius: var(--ms-border-radius-sm);--ms-selected-popover-close-bg-hover: color-mix(in srgb, var(--ms-accent-color) 20%, transparent);--ms-selected-popover-close-color-hover: var(--ms-accent-color);--ms-selected-popover-close-icon-size: calc(1.4 * var(--ms-rem));--ms-selected-popover-body-gap: calc(.4 * var(--ms-rem));--ms-selected-popover-body-padding: calc(.8 * var(--ms-rem));--ms-selected-popover-body-max-height: calc(28.8 * var(--ms-rem));--ms-font-size-2xs: calc(var(--base-font-size-2xs, 1) * var(--ms-rem));--ms-font-size-xs: calc(var(--base-font-size-xs, 1.2) * var(--ms-rem));--ms-font-size-sm: calc(var(--base-font-size-sm, 1.4) * var(--ms-rem));--ms-font-size-base: calc(var(--base-font-size-base, 1.6) * var(--ms-rem));--ms-font-size-lg: calc(var(--base-font-size-lg, 1.8) * var(--ms-rem));--ms-font-weight-normal: var(--base-font-weight-normal, 400);--ms-font-weight-medium: var(--base-font-weight-medium, 500);--ms-font-weight-semibold: var(--base-font-weight-semibold, 600);--ms-line-height-none: 1;--ms-line-height-tight: var(--base-line-height-tight, 1.25);--ms-line-height-normal: var(--base-line-height-normal, 1.5);--ms-line-height-relaxed: var(--base-line-height-relaxed, 1.75);--ms-border-radius-sm: calc(var(--base-border-radius-sm, .4) * var(--ms-rem));--ms-border-radius-md: calc(var(--base-border-radius-md, .6) * var(--ms-rem));--ms-border-radius-lg: calc(var(--base-border-radius-lg, .8) * var(--ms-rem));--ms-border-radius: var(--ms-border-radius-md);--ms-spacing-xs: calc(.4 * var(--ms-rem));--ms-spacing-sm: calc(.8 * var(--ms-rem));--ms-spacing-md: calc(1.2 * var(--ms-rem));--ms-spacing-lg: calc(1.6 * var(--ms-rem));--ms-transition-fast: .15s;--ms-transition-normal: .2s;--ms-easing-snappy: cubic-bezier(.4, 0, .2, 1);--ms-placeholder-opacity: .6;--ms-disabled-input-opacity: .6;--ms-scrollbar-width: 8px;--ms-scrollbar-track-bg: transparent;--ms-scrollbar-thumb-bg: var(--ms-border-color);--ms-scrollbar-thumb-bg-hover: var(--ms-text-color-3);--ms-scrollbar-thumb-border-radius: 4px;--ms-debug-bg: var(--base-elevated-bg, light-dark(#f9fafb, #2b2b2b));--ms-debug-border-color: var(--ms-border-color);--ms-debug-text-color: var(--ms-text-color-1);--ms-debug-border-radius: var(--ms-border-radius-md);--ms-debug-summary-color: var(--ms-accent-color);--ms-debug-summary-bg-hover: var(--ms-primary-bg);--ms-debug-summary-outline-color: var(--ms-accent-color);--ms-debug-summary-border-radius: var(--ms-border-radius-sm);--ms-debug-stats-bg: var(--base-main-bg, light-dark(#ffffff, #1a1a1a));--ms-debug-stats-border-radius: var(--ms-border-radius-sm);--ms-debug-bullet-color: var(--ms-accent-color)}}@layer component{web-multiselect:not(:defined){display:block;min-height:calc(3.5 * var(--ms-rem));color:transparent!important;background:transparent}:host{-webkit-tap-highlight-color:transparent}.ms__wrapper{display:flex;flex-direction:column;align-items:stretch}.ms__wrapper--inline{flex-direction:row;align-items:var(--ms-inline-align, center)}.ms{position:relative;width:100%}}@layer component{.ms__input-wrapper{position:relative;display:flex;align-items:center}.ms__input{box-sizing:border-box;width:100%;font-family:inherit;height:var(--ms-input-height);padding:var(--ms-input-padding);padding-inline-end:var(--ms-input-padding-right);font-size:var(--ms-input-font-size);border:var(--ms-input-border);border-radius:var(--ms-input-border-radius);background:var(--ms-input-bg);color:var(--ms-input-color);cursor:pointer;transition:border var(--ms-transition-fast) var(--ms-easing-snappy)}.ms__input:hover:not(:focus):not(:disabled){border:var(--ms-input-border-hover)}.ms__input:focus{outline:none;border:var(--ms-input-border-focus)}.ms__input::placeholder{color:var(--ms-input-placeholder-color);opacity:0;transition:opacity var(--ms-transition-fast) var(--ms-easing-snappy)}:host([data-ready]) .ms__input::placeholder{opacity:var(--ms-placeholder-opacity)}.ms__toggle{position:absolute;inset-inline-end:var(--ms-toggle-right);top:50%;transform:var(--ms-transform-center-y);pointer-events:none;color:var(--ms-toggle-icon-color);transition:transform var(--ms-transition-fast) var(--ms-easing-snappy)}.ms--open .ms__toggle{transform:var(--ms-transform-center-y) rotate(var(--ms-transform-rotate-180));color:var(--ms-toggle-icon-color-open)}.ms__counter{position:absolute;inset-inline-end:var(--ms-counter-offset);top:50%;transform:var(--ms-transform-center-y);padding:var(--ms-counter-padding);background:var(--ms-counter-badge-bg);color:var(--ms-counter-badge-color);font-size:var(--ms-counter-font-size);font-weight:var(--ms-counter-font-weight);border-radius:var(--ms-counter-border-radius);cursor:pointer;transition:all var(--ms-transition-fast) var(--ms-easing-snappy)}.ms__counter:hover{background:var(--ms-counter-badge-bg-hover);transform:var(--ms-transform-center-y) scale(var(--ms-transform-scale-hover))}.ms__actions{display:flex;flex-direction:column;gap:var(--ms-actions-gap);padding:var(--ms-actions-padding)}.ms__actions--top{border-bottom:var(--ms-actions-border-bottom)}.ms__actions--bottom{flex-direction:column-reverse;border-top:var(--ms-actions-border-bottom)}.ms__actions-row{display:flex;flex-wrap:nowrap;gap:var(--ms-actions-gap)}.ms__actions--wrap .ms__actions-row{flex-wrap:wrap}.ms__actions--sticky{position:sticky;z-index:var(--ms-z-index-sticky);background:var(--ms-actions-bg)}.ms__actions--sticky.ms__actions--top{top:0}.ms__actions--sticky.ms__actions--bottom{bottom:0}.ms__actions--align-stretch .ms__action-btn{flex:1}.ms__actions--align-left .ms__actions-row{justify-content:flex-start}.ms__actions--align-right .ms__actions-row{justify-content:flex-end}.ms__actions--align-center .ms__actions-row{justify-content:center}.ms__actions--align-space-between .ms__actions-row{justify-content:space-between}.ms__action-btn{font-family:inherit;padding:var(--ms-action-btn-padding);font-size:var(--ms-action-btn-font-size);border:var(--ms-action-btn-border);border-radius:var(--ms-action-btn-border-radius);background:var(--ms-action-button-bg);color:var(--ms-action-button-color);cursor:pointer;transition:all var(--ms-transition-fast) var(--ms-easing-snappy)}@media (hover: hover){.ms__action-btn:hover{background:var(--ms-action-button-bg-hover);border-color:var(--ms-action-button-border-color-hover)}}.ms__action-btn:active{transform:scale(var(--ms-transform-scale-active))}.ms__action-btn:disabled,.ms__action-btn[disabled]{opacity:var(--ms-disabled-opacity);cursor:not-allowed;pointer-events:none}}@layer component{.ms__hint{display:none;position:fixed;z-index:var(--ms-z-index-popover);padding:var(--ms-hint-padding);background:var(--ms-hint-bg);border:var(--ms-hint-border);border-radius:var(--ms-hint-border-radius);box-shadow:var(--ms-hint-box-shadow);font-size:var(--ms-hint-font-size);color:var(--ms-hint-color);line-height:var(--ms-line-height-relaxed);max-width:100%}.ms__hint--visible{display:block}.ms__dropdown{display:none;position:fixed;font-family:inherit;z-index:var(--ms-z-index-dropdown);background:var(--ms-dropdown-bg);border:var(--ms-dropdown-border);border-radius:var(--ms-dropdown-border-radius);box-shadow:var(--ms-dropdown-box-shadow);width:var(--ms-dropdown-width);max-height:var(--ms-options-max-height);overflow:hidden;color:var(--ms-dropdown-text-color)}.ms__dropdown--visible{display:flex;flex-direction:column}.ms__dropdown--fullscreen,.ms__selected-popover--fullscreen{--ms-rem: var(--ms-fullscreen-rem);--ms-option-padding: calc(.8 * var(--ms-rem)) calc(1.2 * var(--ms-rem));--ms-option-gap: calc(.8 * var(--ms-rem));--ms-option-title-font-size: calc(var(--base-font-size-sm, 1.4) * var(--ms-rem));--ms-option-subtitle-font-size: calc(var(--base-font-size-xs, 1.2) * var(--ms-rem));--ms-option-icon-font-size: calc(var(--base-font-size-base, 1.6) * var(--ms-rem));--ms-checkbox-size: calc(1.6 * var(--ms-rem));--ms-group-label-font-size: calc(var(--base-font-size-xs, 1.2) * var(--ms-rem));--ms-group-label-padding: calc(.4 * var(--ms-rem)) calc(1.2 * var(--ms-rem));--ms-tree-base-indent: var(--ms-fullscreen-tree-base-indent);--ms-tree-indent: var(--ms-fullscreen-tree-indent)}.ms__selected-popover--fullscreen{--ms-badge-gap: calc(.8 * var(--ms-rem));--ms-badge-height: calc(4.2 * var(--ms-rem));--ms-badge-font-size: calc(var(--base-font-size-sm, 1.4) * var(--ms-rem));--ms-badge-text-padding: 0 calc(1.2 * var(--ms-rem));--ms-badge-remove-width: calc(3.6 * var(--ms-rem));--ms-badge-remove-icon-size: calc(1.2 * var(--ms-rem));--ms-badge-remove-font-size: calc(var(--base-font-size-sm, 1.4) * var(--ms-rem))}.ms__dropdown--fullscreen{--ms-actions-gap: calc(.4 * var(--ms-rem));--ms-actions-padding: calc(.8 * var(--ms-rem));--ms-action-btn-padding: calc(.6 * var(--ms-rem)) calc(1.2 * var(--ms-rem));--ms-action-btn-font-size: calc(var(--base-font-size-sm, 1.4) * var(--ms-rem))}.ms__dropdown--fullscreen{position:fixed;top:0;inset-inline-start:0;width:100vw;max-width:100vw;height:100dvh;max-height:100dvh;border:none;border-radius:0;background:var(--ms-fullscreen-bg);color:var(--ms-fullscreen-text-color);z-index:var(--ms-z-index-fullscreen);box-sizing:border-box;padding-top:env(safe-area-inset-top);padding-right:env(safe-area-inset-right);padding-bottom:env(safe-area-inset-bottom);padding-left:env(safe-area-inset-left)}.ms__dropdown--fullscreen .ms__dropdown-inner{display:flex;flex-direction:column;flex:1;min-height:0;max-height:none;overflow:hidden}.ms__dropdown--fullscreen .ms__options{flex:1 1 0;min-height:0;height:auto;max-height:none;overflow-y:auto;padding-bottom:var(--ms-option-gap)}.ms__dropdown--fullscreen .ms__actions{flex:0 0 auto}.ms__fullscreen-header,.ms__selected-popover--fullscreen .ms__selected-popover-header{flex:0 0 auto;display:flex;align-items:center;flex-wrap:wrap;gap:var(--ms-fullscreen-header-gap);min-height:var(--ms-fullscreen-header-min-height);padding:var(--ms-fullscreen-header-padding);background:var(--ms-fullscreen-header-bg);border-bottom:var(--ms-fullscreen-header-border)}.ms__fullscreen-header{align-content:flex-start}.ms__fullscreen-header>.ms__fullscreen-search-wrapper{min-height:var(--ms-fullscreen-header-min-height)}.ms__fullscreen-nav{flex:0 0 100%;display:flex;align-items:center;justify-content:space-between;gap:var(--ms-fullscreen-nav-gap);padding-top:var(--ms-fullscreen-nav-padding-top)}.ms__fullscreen-nav-count{font-size:var(--ms-fullscreen-nav-count-font-size);color:var(--ms-fullscreen-nav-count-color)}.ms__fullscreen-nav-controls{display:flex;align-items:center;gap:var(--ms-fullscreen-nav-gap)}.ms__fullscreen-nav-btn{flex:0 0 auto;display:inline-flex;align-items:center;justify-content:center;width:var(--ms-fullscreen-nav-btn-size);height:var(--ms-fullscreen-nav-btn-size);padding:0;color:var(--ms-fullscreen-nav-btn-color);background:var(--ms-fullscreen-nav-btn-bg);border:none;border-radius:50%;cursor:pointer}.ms__fullscreen-nav-btn:hover:not(:disabled){background:var(--ms-fullscreen-nav-btn-bg-hover)}.ms__fullscreen-nav-btn:disabled{opacity:.4;cursor:default}.ms__fullscreen-nav-btn:before{content:"";display:block;width:var(--ms-fullscreen-nav-btn-icon-size);height:var(--ms-fullscreen-nav-btn-icon-size);background-color:currentColor;-webkit-mask:var(--ms-icon-chevron) center / contain no-repeat;mask:var(--ms-icon-chevron) center / contain no-repeat}.ms__fullscreen-nav-btn--next:before{transform:scaleY(-1)}.ms__fullscreen-header>.ms__fullscreen-search-wrapper,.ms__selected-popover--fullscreen .ms__selected-popover-header>span{flex:1 1 auto;min-width:0}.ms__fullscreen-search-wrapper{position:relative;display:flex;align-items:center}.ms__selected-popover--fullscreen .ms__selected-popover-header{font-size:var(--ms-fullscreen-title-font-size);font-weight:var(--ms-fullscreen-title-font-weight);color:var(--ms-fullscreen-text-color)}.ms__fullscreen-search{flex:1 1 auto;min-width:0;font-family:inherit;font-size:var(--ms-fullscreen-search-font-size);color:inherit;background:transparent;border:var(--ms-fullscreen-search-border);border-radius:var(--ms-fullscreen-search-border-radius);padding:var(--ms-fullscreen-search-padding);padding-inline-end:var(--ms-fullscreen-search-clear-gutter)}.ms__fullscreen-search:focus{outline:none;border:var(--ms-input-border-focus)}.ms__fullscreen-search-clear{position:absolute;inset-inline-end:var(--ms-fullscreen-search-clear-inset);top:50%;transform:translateY(-50%);display:inline-flex;align-items:center;justify-content:center;width:var(--ms-fullscreen-search-clear-size);height:var(--ms-fullscreen-search-clear-size);padding:0;color:var(--ms-fullscreen-search-clear-color);background:transparent;border:none;border-radius:50%;cursor:pointer}.ms__fullscreen-search-clear:hover{background:var(--ms-fullscreen-search-clear-bg-hover)}.ms__fullscreen-search-clear:before{content:"";display:block;width:var(--ms-fullscreen-search-clear-icon-size);height:var(--ms-fullscreen-search-clear-icon-size);background-color:currentColor;-webkit-mask:var(--ms-icon-search-clear) center / contain no-repeat;mask:var(--ms-icon-search-clear) center / contain no-repeat}.ms__fullscreen-mode-toggle{flex:0 0 auto;display:inline-flex;align-items:center;justify-content:center;width:var(--ms-fullscreen-mode-toggle-size);height:var(--ms-fullscreen-mode-toggle-size);margin-inline-end:var(--ms-fullscreen-mode-toggle-gap);padding:0;color:var(--ms-fullscreen-mode-toggle-color);background:var(--ms-fullscreen-mode-toggle-bg);border:none;border-radius:50%;cursor:pointer}.ms__fullscreen-mode-toggle:hover{background:var(--ms-fullscreen-mode-toggle-bg-hover)}.ms__fullscreen-mode-toggle:before{content:"";display:block;width:var(--ms-fullscreen-mode-toggle-icon-size);height:var(--ms-fullscreen-mode-toggle-icon-size);background-color:currentColor;-webkit-mask:var(--ms-fullscreen-mode-toggle-icon, var(--ms-icon-search)) center / contain no-repeat;mask:var(--ms-fullscreen-mode-toggle-icon, var(--ms-icon-search)) center / contain no-repeat}.ms__fullscreen-mode-toggle[data-mode=navigate]{--ms-fullscreen-mode-toggle-icon: var(--ms-icon-search)}.ms__fullscreen-mode-toggle[data-mode=filter]{--ms-fullscreen-mode-toggle-icon: var(--ms-icon-filter)}.ms__fullscreen-close,.ms__selected-popover--fullscreen .ms__selected-popover-close{flex:0 0 auto;position:relative;box-sizing:border-box;display:inline-flex;align-items:center;justify-content:center;width:var(--ms-fullscreen-close-size);height:var(--ms-fullscreen-close-size);margin-inline-end:calc(-1 * var(--ms-fullscreen-close-edge-nudge));padding:0;color:var(--ms-fullscreen-close-color);background:var(--ms-fullscreen-close-bg);border:var(--ms-fullscreen-close-border);border-radius:var(--ms-fullscreen-close-border-radius);cursor:pointer}.ms__fullscreen-close:after,.ms__selected-popover--fullscreen .ms__selected-popover-close:after{content:"";position:absolute;inset-block-start:calc(-1 * var(--ms-fullscreen-close-size));inset-block-end:calc(-1 * var(--ms-fullscreen-header-padding-v));inset-inline-end:calc(-1 * var(--ms-fullscreen-header-padding-h));inset-inline-start:calc(-1 * var(--ms-fullscreen-header-gap))}.ms__fullscreen-close:hover,.ms__selected-popover--fullscreen .ms__selected-popover-close:hover{background:var(--ms-fullscreen-close-bg-hover);color:var(--ms-fullscreen-close-color)}.ms__fullscreen-close:before,.ms__selected-popover--fullscreen .ms__selected-popover-close:before{content:"";display:block;width:var(--ms-fullscreen-close-icon-size);height:var(--ms-fullscreen-close-icon-size);background-color:currentColor;-webkit-mask:var(--ms-icon-remove) center / contain no-repeat;mask:var(--ms-icon-remove) center / contain no-repeat}.ms__dropdown--fullscreen .ms__option-info{flex:0 0 auto;display:none;align-items:center;justify-content:center;width:var(--ms-fullscreen-info-size);height:var(--ms-fullscreen-info-size);margin-inline-start:var(--ms-option-gap);padding:0;color:var(--ms-fullscreen-info-color);background:transparent;border:none;border-radius:50%;cursor:pointer}.ms__dropdown--fullscreen .ms__option--truncated .ms__option-info{display:inline-flex}@media (hover: hover){.ms__dropdown--fullscreen .ms__option-info:hover{background:var(--ms-fullscreen-info-bg-hover)}}.ms__dropdown--fullscreen .ms__option-info:before{content:"";display:block;width:var(--ms-fullscreen-info-icon-size);height:var(--ms-fullscreen-info-icon-size);background-color:currentColor;-webkit-mask:var(--ms-icon-info) center / contain no-repeat;mask:var(--ms-icon-info) center / contain no-repeat}.ms__dropdown-inner{flex:1;overflow-y:auto;overscroll-behavior:contain;touch-action:pan-y;-webkit-overflow-scrolling:touch;scrollbar-width:thin;scrollbar-color:var(--ms-scrollbar-thumb-bg) var(--ms-scrollbar-track-bg)}.ms__dropdown-inner::-webkit-scrollbar{width:var(--ms-scrollbar-width)}.ms__dropdown-inner::-webkit-scrollbar-track{background:var(--ms-scrollbar-track-bg)}.ms__dropdown-inner::-webkit-scrollbar-thumb{background:var(--ms-scrollbar-thumb-bg);border-radius:var(--ms-scrollbar-thumb-border-radius)}.ms__dropdown-inner::-webkit-scrollbar-thumb:hover{background:var(--ms-scrollbar-thumb-bg-hover)}.ms__dropdown--virtual{max-height:none}.ms__dropdown--virtual .ms__dropdown-inner{overflow-y:visible}.ms__badge-tooltip{position:fixed;z-index:var(--ms-tooltip-z-index);opacity:0;visibility:hidden;transition:opacity var(--ms-transition-normal) ease,visibility var(--ms-transition-normal) ease;background:var(--ms-tooltip-bg);color:var(--ms-tooltip-text-color);padding:var(--ms-tooltip-padding);border-radius:var(--ms-tooltip-border-radius);font-size:var(--ms-tooltip-font-size);line-height:var(--ms-line-height-relaxed);max-width:var(--ms-tooltip-max-width);word-wrap:break-word;white-space:pre-wrap;box-shadow:var(--ms-tooltip-shadow);pointer-events:none}.ms__badge-tooltip--visible{opacity:1;visibility:visible}.ms__option-tooltip{position:fixed;z-index:var(--ms-option-tooltip-z-index);opacity:0;visibility:hidden;transition:opacity var(--ms-transition-normal) ease,visibility var(--ms-transition-normal) ease;background:var(--ms-option-tooltip-bg);color:var(--ms-option-tooltip-text-color);padding:var(--ms-option-tooltip-padding);border-radius:var(--ms-option-tooltip-border-radius);font-size:var(--ms-option-tooltip-font-size);line-height:var(--ms-line-height-relaxed);max-width:var(--ms-option-tooltip-max-width);word-wrap:break-word;white-space:pre-wrap;box-shadow:var(--ms-option-tooltip-shadow);pointer-events:none}.ms__option-tooltip--visible{opacity:1;visibility:visible}.ms__option-tooltip--fullscreen{z-index:var(--ms-z-index-fullscreen-tooltip)}.ms__message{position:fixed;z-index:var(--ms-message-z-index);box-sizing:border-box;max-width:var(--ms-message-max-width);padding:var(--ms-message-padding);font-family:inherit;font-size:var(--ms-message-font-size);font-weight:var(--ms-message-font-weight);line-height:var(--ms-line-height-normal);color:var(--ms-message-color);background:var(--ms-message-bg);border:var(--ms-message-border);border-radius:var(--ms-message-border-radius);box-shadow:var(--ms-message-shadow);cursor:pointer;opacity:0;transition:opacity var(--ms-transition-normal) ease;-webkit-tap-highlight-color:transparent}.ms__message--visible{opacity:1}.ms__message--info{background:var(--ms-message-info-bg);color:var(--ms-message-info-color)}.ms__message--warning{background:var(--ms-message-warning-bg);color:var(--ms-message-warning-color)}.ms__message--error{background:var(--ms-message-error-bg);color:var(--ms-message-error-color)}.ms__message--success{background:var(--ms-message-success-bg);color:var(--ms-message-success-color)}.ms__message--fullscreen{left:50%;right:auto;bottom:calc(var(--ms-message-fullscreen-offset) + env(safe-area-inset-bottom));transform:translate(-50%);max-width:min(var(--ms-message-max-width),calc(100vw - 4 * var(--ms-fullscreen-rem)));padding:calc(1 * var(--ms-fullscreen-rem)) calc(1.4 * var(--ms-fullscreen-rem));font-size:calc(var(--base-font-size-sm, 1.4) * var(--ms-fullscreen-rem))}.ms__selected-popover{display:none;position:fixed;z-index:var(--ms-z-index-popover);background:var(--ms-selected-popover-bg);border:var(--ms-selected-popover-border);border-radius:var(--ms-selected-popover-border-radius);box-shadow:var(--ms-selected-popover-box-shadow);width:var(--ms-selected-popover-width);max-height:var(--ms-selected-popover-max-height);overflow:hidden}.ms__selected-popover--visible{display:flex;flex-direction:column}.ms__selected-popover--virtual{display:block;overflow:visible;max-height:none}.ms__selected-popover--fullscreen{position:fixed;top:0;right:0;bottom:0;left:0;display:flex;flex-direction:column;width:100vw;max-width:100vw;height:100dvh;max-height:100dvh;border:none;border-radius:0;overflow:hidden;background:var(--ms-fullscreen-bg);color:var(--ms-fullscreen-text-color);z-index:var(--ms-z-index-fullscreen);box-sizing:border-box;padding-top:env(safe-area-inset-top);padding-right:env(safe-area-inset-right);padding-bottom:env(safe-area-inset-bottom);padding-left:env(safe-area-inset-left)}.ms__selected-popover--fullscreen .ms__selected-popover-body{flex:1 1 0;min-height:0;max-height:none}.ms__selected-popover-header{display:flex;align-items:center;justify-content:space-between;padding:var(--ms-selected-popover-header-padding);background:var(--ms-selected-popover-header-bg);border-bottom:var(--ms-selected-popover-header-border-bottom);font-size:var(--ms-selected-popover-header-font-size);font-weight:var(--ms-selected-popover-header-font-weight);color:var(--ms-selected-popover-header-color)}.ms__selected-popover-close{display:flex;align-items:center;justify-content:center;width:var(--ms-popover-close-size);height:var(--ms-popover-close-size);padding:0;border:none;background:var(--ms-selected-popover-close-bg);color:var(--ms-selected-popover-close-color);font-size:var(--ms-selected-popover-close-font-size);line-height:var(--ms-line-height-none);cursor:pointer;border-radius:var(--ms-selected-popover-close-border-radius);transition:all var(--ms-transition-fast) var(--ms-easing-snappy)}.ms__selected-popover-close:hover{background:var(--ms-selected-popover-close-bg-hover);color:var(--ms-selected-popover-close-color-hover)}.ms__selected-popover-close:before{content:"";display:block;width:var(--ms-selected-popover-close-icon-size);height:var(--ms-selected-popover-close-icon-size);background-color:currentColor;-webkit-mask:var(--ms-icon-remove) center / contain no-repeat;mask:var(--ms-icon-remove) center / contain no-repeat}.ms__selected-popover-body{display:flex;flex-direction:column;gap:var(--ms-selected-popover-body-gap);padding:var(--ms-selected-popover-body-padding);overflow-y:auto;max-height:var(--ms-selected-popover-body-max-height);scrollbar-width:thin;scrollbar-color:var(--ms-scrollbar-thumb-bg) var(--ms-scrollbar-track-bg)}.ms__selected-popover-body::-webkit-scrollbar{width:var(--ms-scrollbar-width)}.ms__selected-popover-body::-webkit-scrollbar-track{background:var(--ms-scrollbar-track-bg)}.ms__selected-popover-body::-webkit-scrollbar-thumb{background:var(--ms-scrollbar-thumb-bg);border-radius:var(--ms-scrollbar-thumb-border-radius)}.ms__selected-popover-body::-webkit-scrollbar-thumb:hover{background:var(--ms-scrollbar-thumb-bg-hover)}.ms__selected-popover-body .ms__badge{width:100%;min-height:fit-content;line-height:var(--ms-line-height-relaxed);flex-shrink:0}.ms__selected-popover-body .ms__badge-text{flex:1;min-width:0;white-space:normal;word-wrap:break-word}.ms__selected-popover-body--virtual{display:block;max-height:none;padding:0}.ms__selected-popover-body--virtual .ms__badge{height:var(--ms-badge-height-virtual, 36px);min-height:var(--ms-badge-height-virtual, 36px);max-height:var(--ms-badge-height-virtual, 36px);margin-bottom:var(--ms-selected-popover-body-gap);overflow:hidden;box-sizing:border-box}.ms__selected-popover-body--virtual .ms__badge-text{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}}@layer component{.ms--disabled .ms__input{opacity:var(--ms-disabled-input-opacity);cursor:not-allowed;background:var(--ms-input-bg-disabled)}.ms--disabled .ms__toggle{opacity:var(--ms-disabled-input-opacity)}.ms--no-checkboxes .ms__option{gap:0;padding-inline-start:var(--ms-option-padding-h)}.ms--no-checkboxes .ms__option-content{padding-inline-start:0}}@layer component;@layer component{.ms__badges{display:flex;flex-wrap:wrap;gap:var(--ms-badges-gap);padding:0}.ms__badges:empty{display:none}.ms__badges--bottom{margin-top:var(--ms-badges-margin-bottom)}.ms__badges--top{margin-bottom:var(--ms-badges-margin-top);order:var(--ms-order-first)}.ms__badges--left{order:var(--ms-order-first);margin-right:var(--ms-badges-margin-left);justify-content:flex-end}.ms__badges--right{margin-left:var(--ms-badges-margin-right);justify-content:flex-start}.ms__badge{display:inline-flex;align-items:center;height:var(--ms-badge-height);font-size:var(--ms-badge-font-size);font-weight:var(--ms-badge-font-weight);line-height:var(--ms-line-height-none);border-radius:var(--ms-badge-border-radius);overflow:hidden;max-width:100%}.ms__badge-text{display:flex;align-items:center;box-sizing:border-box;height:100%;padding:var(--ms-badge-text-padding);background:var(--ms-badge-text-bg);color:var(--ms-badge-text-color);border:var(--ms-badge-text-border);border-inline-end:none;border-start-start-radius:var(--ms-badge-border-radius);border-end-start-radius:var(--ms-badge-border-radius);border-start-end-radius:0;border-end-end-radius:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;transition:background-color var(--ms-transition-normal) ease,color var(--ms-transition-normal) ease}.ms__badge:hover .ms__badge-text{background:var(--ms-badge-text-bg-hover, var(--ms-badge-text-bg));color:var(--ms-badge-text-color-hover, var(--ms-badge-text-color))}.ms__badge-remove{display:flex;align-items:center;justify-content:center;box-sizing:border-box;font-family:inherit;width:var(--ms-badge-remove-width);height:100%;flex-shrink:0;background:var(--ms-badge-remove-bg);color:var(--ms-badge-remove-color);border:var(--ms-badge-remove-border);border-inline-start:none;border-start-end-radius:var(--ms-badge-border-radius);border-end-end-radius:var(--ms-badge-border-radius);border-start-start-radius:0;border-end-start-radius:0;cursor:pointer;transition:background-color var(--ms-transition-normal) ease;font-size:var(--ms-badge-remove-font-size)}.ms__badge-remove:hover{background:var(--ms-badge-remove-bg-hover)}.ms__badge-remove:focus{outline:none}.ms__badge-remove:focus-visible{outline:none;box-shadow:var(--ms-badge-remove-box-shadow-focus)}.ms__badge-remove:before{content:"";display:block;width:var(--ms-badge-remove-icon-size);height:var(--ms-badge-remove-icon-size);background-color:currentColor;-webkit-mask:var(--ms-icon-remove) center / contain no-repeat;mask:var(--ms-icon-remove) center / contain no-repeat}.ms__badge--counter{cursor:pointer}.ms__badge--counter .ms__badge-text{background:var(--ms-badge-counter-text-bg);color:var(--ms-badge-counter-text-color);border:var(--ms-badge-counter-border);border-inline-end:none}.ms__badge--counter .ms__badge-remove{background:var(--ms-badge-counter-remove-bg);color:var(--ms-badge-counter-remove-color);border:var(--ms-badge-counter-border);border-inline-start:none}.ms__badge--counter .ms__badge-remove:hover{background:var(--ms-badge-counter-remove-bg-hover)}.ms__badge--more,.ms__badge[data-action=show-selected]{cursor:pointer}}@layer component{.ms__count-display{display:flex;align-items:center}.ms__count-display:empty{display:none}.ms__count-display--bottom{margin-top:var(--ms-count-display-margin-bottom)}.ms__count-display--top{margin-bottom:var(--ms-count-display-margin-top);order:var(--ms-order-first)}.ms__count-display--left{order:var(--ms-order-first);margin-right:var(--ms-count-display-margin-left);justify-content:flex-start}.ms__count-display--right{margin-left:var(--ms-count-display-margin-right);justify-content:flex-end}.ms__counter-wrapper{display:inline-flex;align-items:center;gap:var(--ms-counter-wrapper-gap);background:var(--ms-counter-wrapper-bg);border:var(--ms-counter-wrapper-border);border-radius:var(--ms-counter-wrapper-border-radius);padding:var(--ms-counter-wrapper-padding);transition:all var(--ms-transition-fast) var(--ms-easing-snappy)}.ms__counter-wrapper:hover{background:var(--ms-counter-wrapper-bg-hover);border-color:var(--ms-counter-wrapper-border-color-hover)}.ms__count-text{display:inline-flex;align-items:center;background:var(--ms-count-text-bg);border:var(--ms-count-text-border);padding:0;font-size:var(--ms-count-text-font-size);color:var(--ms-count-text-color);cursor:pointer;transition:color var(--ms-transition-fast) var(--ms-easing-snappy)}.ms__count-clear{flex-shrink:0;display:flex;align-items:center;justify-content:center;width:var(--ms-count-clear-size);height:var(--ms-count-clear-size);padding:0;border:none;background:var(--ms-count-clear-bg);color:var(--ms-count-clear-color);font-size:var(--ms-count-clear-font-size);line-height:var(--ms-line-height-none);cursor:pointer;border-radius:var(--ms-count-clear-border-radius);transition:all var(--ms-transition-fast) var(--ms-easing-snappy)}.ms__count-clear:hover{background:var(--ms-count-clear-bg-hover);color:var(--ms-count-clear-color-hover)}.ms__count-clear:before{content:"";display:block;width:var(--ms-count-clear-icon-size);height:var(--ms-count-clear-icon-size);background-color:currentColor;-webkit-mask:var(--ms-icon-clear) center / contain no-repeat;mask:var(--ms-icon-clear) center / contain no-repeat}}@layer component{.ms__debug-info{margin-top:calc(.4 * var(--ms-rem));padding:calc(.4 * var(--ms-rem));background-color:var(--ms-debug-bg);border:1px solid var(--ms-debug-border-color);border-radius:var(--ms-debug-border-radius);font-size:calc(1.2 * var(--ms-rem));color:var(--ms-debug-text-color)}.ms__debug-info details summary{cursor:pointer;font-weight:600;color:var(--ms-debug-summary-color);-webkit-user-select:none;user-select:none;padding:calc(.4 * var(--ms-rem));border-radius:var(--ms-debug-summary-border-radius)}.ms__debug-info details summary:hover{background-color:var(--ms-debug-summary-bg-hover)}.ms__debug-info details summary:focus{outline:2px solid var(--ms-debug-summary-outline-color);outline-offset:2px}.ms__debug-info .ms__debug-stats{display:flex;flex-direction:column;gap:calc(.4 * var(--ms-rem));margin-top:calc(.4 * var(--ms-rem));padding:calc(.4 * var(--ms-rem));background-color:var(--ms-debug-stats-bg);border-radius:var(--ms-debug-stats-border-radius)}.ms__debug-info .ms__debug-stats span{display:flex;justify-content:space-between;padding:2px 4px;font-family:monospace;font-size:calc(1 * var(--ms-rem))}.ms__debug-info .ms__debug-stats span:before{content:"•";margin-inline-end:calc(.4 * var(--ms-rem));color:var(--ms-debug-bullet-color)}}@layer component{.ms__options{padding:var(--ms-options-padding);scrollbar-width:thin;scrollbar-color:var(--ms-scrollbar-thumb-bg) var(--ms-scrollbar-track-bg)}.ms__options::-webkit-scrollbar{width:var(--ms-scrollbar-width)}.ms__options::-webkit-scrollbar-track{background:var(--ms-scrollbar-track-bg)}.ms__options::-webkit-scrollbar-thumb{background:var(--ms-scrollbar-thumb-bg);border-radius:var(--ms-scrollbar-thumb-border-radius)}.ms__options::-webkit-scrollbar-thumb:hover{background:var(--ms-scrollbar-thumb-bg-hover)}.ms__options--virtual .ms__option,.ms__options--fixed-height .ms__option{height:var(--ms-option-height, 50px);min-height:var(--ms-option-height, 50px);max-height:var(--ms-option-height, 50px);overflow:hidden;box-sizing:border-box}.ms__group+.ms__group{border-top:var(--ms-group-border-top);margin-top:var(--ms-group-margin-top);padding-top:var(--ms-group-padding-top)}.ms__group-label{padding:var(--ms-group-label-padding);font-size:var(--ms-group-label-font-size);font-weight:var(--ms-group-label-font-weight);color:var(--ms-group-label-color);text-transform:var(--ms-group-label-transform);letter-spacing:var(--ms-group-label-letter-spacing)}.ms__option{display:flex;align-items:var(--ms-checkbox-align, center);gap:var(--ms-option-gap);padding:var(--ms-option-padding);position:relative;min-height:var(--ms-option-min-height, auto);color:var(--ms-option-text-color);background:var(--ms-option-bg);cursor:pointer;user-select:none;-webkit-user-select:none}@media (hover: hover){.ms__option:hover{background:var(--ms-option-bg-hover);color:var(--ms-option-color-hover, inherit)}}.ms__option--focused{background:var(--ms-option-bg-focused);color:var(--ms-option-color-focused, inherit);outline:var(--ms-option-outline-focused);outline-offset:var(--ms-option-focus-outline-offset)}.ms__option--matched{background:var(--ms-option-bg-matched);color:var(--ms-option-color-matched, inherit)}.ms__option--matched:before{content:"";position:absolute;inset-block:0;inset-inline-start:0;border-inline-start:var(--ms-option-border-matched);pointer-events:none}.ms__option--selected{background:var(--ms-option-bg-selected)}@media (hover: hover){.ms__option--selected:hover{background:var(--ms-option-bg-selected-hover, var(--ms-option-bg-selected))}}.ms__option--disabled{opacity:var(--ms-disabled-opacity);cursor:not-allowed;background:var(--ms-option-disabled-bg)}.ms__option--disabled:hover{background:var(--ms-option-disabled-bg)}@media (hover: hover){.ms__option--focused:hover{background:var(--ms-option-bg-focused-hover);color:var(--ms-option-color-focused-hover, var(--ms-option-color-focused, var(--ms-option-text-color)))}}.ms__option--matched:hover{background:var(--ms-option-bg-matched-hover);color:var(--ms-option-color-matched-hover, var(--ms-option-color-matched, var(--ms-option-text-color)))}.ms__option--selected.ms__option--focused{background:var(--ms-option-bg-selected-focused);outline:var(--ms-option-outline-focused);outline-offset:var(--ms-option-focus-outline-offset)}.ms__option--selected.ms__option--matched{background:var(--ms-option-bg-selected-matched)}.ms__option--disabled.ms__option--selected{background:var(--ms-option-bg-disabled-selected)}.ms__option--disabled.ms__option--focused{outline:none}.ms__option[data-checkbox-align=top]{--ms-checkbox-align: flex-start;--ms-checkbox-margin-top: calc(.2 * var(--ms-rem))}.ms__option[data-checkbox-align=bottom]{--ms-checkbox-align: flex-end}.ms__checkbox{appearance:none;-webkit-appearance:none;-moz-appearance:none;flex-shrink:0;position:relative;margin-top:var(--ms-checkbox-margin-top);margin-inline-end:var(--ms-checkbox-margin-right);margin-bottom:var(--ms-checkbox-margin-bottom);margin-inline-start:var(--ms-checkbox-margin-left);width:var(--ms-checkbox-size);height:var(--ms-checkbox-size);transform:scale(var(--ms-checkbox-scale));transform-origin:top left;cursor:pointer;background:var(--ms-checkbox-bg);border:var(--ms-checkbox-border);border-radius:var(--ms-checkbox-border-radius);transition:background-color .15s ease,border-color .15s ease}.ms__checkbox:after{content:"";position:absolute;display:none;left:50%;top:40%;width:30%;height:55%;transform:translate(-50%,-50%) rotate(45deg);border:solid var(--ms-checkbox-checkmark-color);border-width:0 var(--ms-checkbox-checkmark-thickness, 2px) var(--ms-checkbox-checkmark-thickness, 2px) 0}.ms__checkbox:hover:not(:disabled){border-color:var(--ms-checkbox-hover-border-color)}.ms__checkbox:checked{background:var(--ms-checkbox-checked-bg);border:var(--ms-checkbox-checked-border)}.ms__checkbox:checked:after{display:block}.ms__checkbox--indeterminate{background:var(--ms-checkbox-checked-bg);border:var(--ms-checkbox-checked-border)}.ms__checkbox--indeterminate:after{display:block;top:50%;left:50%;width:55%;height:0;transform:translate(-50%,-50%);border:none;border-bottom:var(--ms-checkbox-checkmark-thickness, 2px) solid var(--ms-checkbox-checkmark-color)}.ms__checkbox--indeterminate:hover:not(:disabled){background:var(--ms-checkbox-checked-bg-hover);border-color:var(--ms-checkbox-checked-border-color-hover)}.ms__checkbox:checked:hover:not(:disabled){background:var(--ms-checkbox-checked-bg-hover);border-color:var(--ms-checkbox-checked-border-color-hover)}.ms__checkbox:focus-visible{outline:2px solid var(--ms-checkbox-checked-bg);outline-offset:2px}.ms__checkbox:disabled{cursor:not-allowed;background:var(--ms-checkbox-disabled-bg);border:var(--ms-checkbox-disabled-border);opacity:.6}.ms__checkbox:disabled:checked{background:var(--ms-checkbox-disabled-bg)}.ms__option--disabled .ms__checkbox{cursor:not-allowed}.ms__option-content{flex:1;display:flex;align-items:center;gap:var(--ms-option-content-gap);min-width:0}.ms__option-icon{flex-shrink:0;width:var(--ms-option-icon-size);height:var(--ms-option-icon-size);display:flex;align-items:center;justify-content:center;font-size:var(--ms-option-icon-font-size)}.ms__option-icon svg{width:100%;height:100%;fill:currentColor}.ms__option-text{flex:1;min-width:0}.ms__option-title{font-size:var(--ms-option-title-font-size);color:var(--ms-option-title-color);line-height:var(--ms-line-height-relaxed);white-space:var(--ms-option-title-white-space, normal);overflow:var(--ms-option-title-overflow, visible);text-overflow:var(--ms-option-title-text-overflow, clip)}@media (hover: hover){.ms__option:hover .ms__option-title{color:var(--ms-option-title-color-hover, var(--ms-option-title-color))}}.ms__option--selected .ms__option-title{color:var(--ms-option-title-color-selected, var(--ms-option-title-color))}@media (hover: hover){.ms__option--selected:hover .ms__option-title{color:var(--ms-option-title-color-selected-hover, var(--ms-option-title-color-selected, var(--ms-option-title-color)))}}.ms__option-title mark{background:var(--ms-option-mark-bg);color:var(--ms-option-mark-color);font-weight:var(--ms-option-mark-font-weight)}.ms__option-subtitle{margin-top:var(--ms-option-subtitle-margin-top);font-size:var(--ms-option-subtitle-font-size);color:var(--ms-option-subtitle-color);line-height:var(--ms-option-subtitle-line-height)}@media (hover: hover){.ms__option:hover .ms__option-subtitle{color:var(--ms-option-subtitle-color-hover, var(--ms-option-subtitle-color))}}.ms__option--selected .ms__option-subtitle{color:var(--ms-option-subtitle-color-selected, var(--ms-option-subtitle-color))}@media (hover: hover){.ms__option--selected:hover .ms__option-subtitle{color:var(--ms-option-subtitle-color-selected-hover, var(--ms-option-subtitle-color-selected, var(--ms-option-subtitle-color)))}}.ms__empty{display:flex;align-items:center;justify-content:center;min-height:var(--ms-state-min-height);padding:var(--ms-empty-padding);text-align:center;font-size:var(--ms-empty-font-size);color:var(--ms-empty-color)}.ms__loader{display:flex;flex-direction:column;align-items:center;justify-content:center;min-height:var(--ms-state-min-height);padding:var(--ms-loader-padding);gap:var(--ms-loader-gap)}.ms__loading-text{font-size:var(--ms-loading-text-font-size);color:var(--ms-loading-color)}}@layer component{.ms--rtl .ms__badges{direction:rtl}.ms--rtl .ms__badges--right{margin-left:0;margin-right:var(--ms-badges-margin-right)}.ms--rtl .ms__badges--left{margin-right:0;margin-left:var(--ms-badges-margin-left)}.ms--rtl .ms__count-display{direction:rtl}.ms--rtl .ms__count-display--right{margin-left:0;margin-right:var(--ms-count-display-margin-right)}.ms--rtl .ms__count-display--left{margin-right:0;margin-left:var(--ms-count-display-margin-left)}}@layer component{.ms__option--tree{padding-inline-start:calc(var(--ms-tree-base-indent, .75rem) + var(--ms-tree-depth, 0) * var(--ms-tree-indent, 1.25rem))}.ms__option--tree-unselectable{cursor:default}.ms__option--tree-unselectable:hover{background:transparent}}@layer overrides{:host-context([data-theme="dark"]),:host-context([data-bs-theme="dark"]),:host-context(.dark){color-scheme:dark}:host-context([data-theme="light"]),:host-context([data-bs-theme="light"]),:host-context(.light){color-scheme:light}:host([data-theme="dark"]){color-scheme:dark}:host([data-theme="light"]){color-scheme:light}}`,qs=["top","top-start","top-end","bottom","bottom-start","bottom-end","left","left-start","left-end","right","right-start","right-end"],N=()=>bo(),Lr=[{configKey:"searchHint",attribute:"search-hint",converter:L({isNullable:!0}),on:"update",description:"Small hint text shown beneath the search input."},{configKey:"searchPlaceholder",attribute:"search-placeholder",converter:L({isNullable:!0}),on:"update",description:'Placeholder text for the search input. When unset it defaults to "Search..."; if `show-search-mode-toggle` is on, the default instead becomes mode-aware ("Search…" in navigate, "Filter…" in filter). An explicit value always wins and stays fixed.'},{configKey:"selectPlaceholder",attribute:"select-placeholder",converter:L({default:"Pick an option..."}),on:"update",description:"Placeholder shown on the control when nothing is selected."},{configKey:"noDataPlaceholder",attribute:"no-data-placeholder",converter:L({isNullable:!0}),on:"update",description:"Text shown when there are no options at all."},{configKey:"dropdownMinWidth",attribute:"dropdown-min-width",converter:L({isNullable:!0}),on:"update",description:"Minimum width of the dropdown panel (any CSS length)."},{configKey:"dropdownMaxWidth",attribute:"dropdown-max-width",converter:L({isNullable:!0}),on:"update",description:"Maximum width of the dropdown panel (any CSS length)."},{configKey:"maxHeight",attribute:"max-height",converter:L({default:"20rem"}),on:"update",description:"Maximum height of the dropdown list before it scrolls."},{configKey:"emptyMessage",attribute:"empty-message",converter:L({default:"No results found"}),on:"update",description:"Message shown when a search yields no matches."},{configKey:"loadingMessage",attribute:"loading-message",converter:L({default:"Loading..."}),on:"update",description:"Message shown while options are loading."},{configKey:"removeButtonTooltipText",attribute:"remove-button-tooltip-text",converter:L({isNullable:!0}),on:"update",description:"Tooltip text for a badge remove (×) button."},{configKey:"formFieldId",attribute:"name",converter:L({isNullable:!0}),on:"reinit",description:"HTML form field name/id used for the hidden input(s)."},{configKey:"dropdownWidth",attribute:"dropdown-width",converter:L({isNullable:!0}),on:"update",description:"Fixed dropdown width; mirrored to the `--ms-dropdown-width` CSS variable."},{configKey:"selectedPopoverWidth",attribute:"selected-popover-width",converter:L({isNullable:!0}),on:"update",description:"Selected-items popover width; mirrored to `--ms-selected-popover-width`."},{configKey:"valueMember",attribute:"value-member",converter:L({isNullable:!0}),reflect:!0,on:"reinit",description:"Property name on an option object that holds its value."},{configKey:"displayValueMember",attribute:"display-value-member",converter:L({isNullable:!0}),reflect:!0,on:"reinit",description:"Property name that holds an option display label."},{configKey:"searchValueMember",attribute:"search-value-member",converter:L({isNullable:!0}),reflect:!0,on:"reinit",description:"Property name searched against (falls back to the display value)."},{configKey:"iconMember",attribute:"icon-member",converter:L({isNullable:!0}),reflect:!0,on:"reinit",description:"Property name that holds an option icon."},{configKey:"subtitleMember",attribute:"subtitle-member",converter:L({isNullable:!0}),reflect:!0,on:"reinit",description:"Property name that holds an option subtitle."},{configKey:"fullTitleMember",attribute:"full-title-member",converter:L({isNullable:!0}),reflect:!0,on:"reinit",description:"Property name that holds an option full/long title."},{configKey:"groupMember",attribute:"group-member",converter:L({isNullable:!0}),reflect:!0,on:"reinit",description:"Property name used to group options under headers."},{configKey:"disabledMember",attribute:"disabled-member",converter:L({isNullable:!0}),reflect:!0,on:"reinit",description:"Property name that marks an option disabled."},{configKey:"pathMember",attribute:"path-member",converter:L({isNullable:!0}),reflect:!0,on:"reinit",description:"Property name holding a node materialized tree path."},{configKey:"parentPathMember",attribute:"parent-path-member",converter:L({isNullable:!0}),reflect:!0,on:"reinit",description:"Property name holding a node parent path."},{configKey:"levelMember",attribute:"level-member",converter:L({isNullable:!0}),reflect:!0,on:"reinit",description:"Property name holding a node depth level."},{configKey:"hasChildrenMember",attribute:"has-children-member",converter:L({isNullable:!0}),reflect:!0,on:"reinit",description:"Property name flagging that a node has children."},{configKey:"isSelectableMember",attribute:"is-selectable-member",converter:L({isNullable:!0}),reflect:!0,on:"reinit",description:"Property name marking whether a node can be selected."},{configKey:"treePathSeparator",attribute:"tree-path-separator",converter:L({default:"."}),reflect:!0,on:"reinit",description:"Separator between segments in a materialized tree path."},{configKey:"isTreeEnabled",converter:F("tristate"),on:"reinit",type:"boolean",description:"Force tree mode on/off. Property-only; when unset (null) tree mode auto-enables if a path source (path-member / getPathCallback) is present."},{configKey:"checkboxMode",attribute:"checkbox-mode",converter:k(["independent","cascade"],{default:"independent"}),reflect:!0,on:"update",description:"Tree checkbox interaction.\n- `independent` (default) — toggles only the clicked node.\n- `cascade` — checks a node whole subtree and shows a tristate (checked / indeterminate / unchecked) box on branches.\n\nTree + multiple only."},{configKey:"cascadeSelectPolicy",attribute:"cascade-select-policy",converter:k(["rolled-up","leaves","all"],{default:"rolled-up"}),reflect:!0,on:"update",description:"In `cascade` mode, which values a selection emits (badges / form / change):\n- `rolled-up` (default) — minimal cover: a fully-selected subtree collapses to its root; partially-selected branches emit their individually-checked descendants.\n- `leaves` — only the checked leaf-level nodes.\n- `all` — every fully-checked node (branches and leaves)."},{configKey:"badgesDisplayMode",attribute:"badges-display-mode",converter:k(["badges","count","compact","partial","none"],{default:"badges"}),on:"reinit",description:"How the current selection is shown in the control."},{configKey:"badgesPosition",attribute:"badges-position",converter:k(["top","bottom","left","right"],{default:"bottom"}),on:"reinit",description:"Where the badges/selection appear relative to the input."},{configKey:"badgesThresholdMode",attribute:"badges-threshold-mode",converter:k(["count","partial"],{default:"count"}),on:"update",description:'How `badgesThreshold` is interpreted: collapse to a count badge, or keep partial badges + a "more" badge.'},{configKey:"searchInputMode",attribute:"search-input-mode",converter:k(["normal","readonly","hidden"],{default:"normal"}),on:"reinit",description:"Search field mode: editable, read-only, or hidden."},{configKey:"searchMode",attribute:"search-mode",converter:k(["filter","navigate"],{default:"filter"}),on:"reinit",description:"Whether typing filters the list or navigates it."},{configKey:"actionsLayout",attribute:"actions-layout",converter:k(["nowrap","wrap"],{default:"nowrap"}),on:"reinit",description:"Whether the action bar wraps or stays on one line."},{configKey:"actionsPosition",attribute:"actions-position",converter:k(["top","bottom"],{default:"top"}),on:"reinit",description:"Whether the action bar sits above or below the list."},{configKey:"actionsAlign",attribute:"actions-align",converter:k(["stretch","left","right","center","space-between"],{default:"stretch"}),on:"update",description:"Horizontal alignment of the action buttons."},{configKey:"checkboxAlign",attribute:"checkbox-align",converter:k(["top","center","bottom"],{default:"center"}),on:"update",description:"Vertical alignment of an option checkbox."},{configKey:"valueFormat",attribute:"value-format",converter:k(["json","csv","array"],{default:"json"}),on:"reinit",description:"Serialization format the control emits its value in."},{configKey:"badgeTooltipPlacement",attribute:"badge-tooltip-placement",converter:k(qs,{default:"top"}),on:"update",description:"Preferred placement of a badge tooltip relative to its badge (floating-ui placement)."},{configKey:"optionTooltipPlacement",attribute:"option-tooltip-placement",converter:k(qs,{default:"top-start"}),on:"update",description:"Preferred placement of an option tooltip (floating-ui placement)."},{configKey:"mobilePresentation",attribute:"mobile-presentation",converter:k(["auto","floating","fullscreen"],{default:"auto"}),reflect:!0,on:"update",description:"How the open dropdown is presented on phones. `auto` (default) keeps the floating panel on desktop/tablet and switches to a full-screen overlay on phone-sized touch devices (touch primary + shorter viewport side < 600px, orientation-robust); `floating` forces the anchored panel everywhere; `fullscreen` forces the full-screen overlay on any device (handy for previews/testing). Resolved reactively from the device/viewport environment."},{configKey:"fullscreenAutofocus",attribute:"fullscreen-autofocus",converter:F("default-false"),on:"update",description:"In the phone fullscreen overlay, auto-focus the search field on open (pops the soft keyboard immediately). Default `false`: the sheet opens with the list visible and the keyboard closed, appearing only when the user taps the search. Set `true` to type-to-filter right away. No effect in the floating presentation."},{configKey:"badgesThreshold",attribute:"badges-threshold",converter:z(),on:"update",description:"Threshold at which badges collapse to a count/compact view."},{configKey:"badgesMaxVisible",attribute:"badges-max-visible",converter:z(),on:"update",description:"Maximum number of badges rendered before overflow."},{configKey:"minSearchLength",attribute:"min-search-length",converter:z({default:0}),on:"update",description:"Minimum characters before searching/filtering starts."},{configKey:"searchDebounce",attribute:"search-debounce",converter:z({default:0}),on:"update",description:"Debounce delay in ms applied to the search input."},{configKey:"virtualScrollThreshold",attribute:"virtual-scroll-threshold",converter:z({default:100}),on:"reinit",description:"Option count above which virtual scrolling turns on."},{configKey:"optionHeight",attribute:"option-height",converter:z({default:50}),on:"update",description:"Fixed row height in px used by virtual scrolling."},{configKey:"badgeHeight",attribute:"badge-height",converter:z({default:36}),on:"update",description:"Fixed badge height in px used for layout/virtualization."},{configKey:"virtualScrollBuffer",attribute:"virtual-scroll-buffer",converter:z({default:10}),on:"update",description:"Extra rows rendered above/below the viewport when virtualizing."},{configKey:"badgeTooltipDelay",attribute:"badge-tooltip-delay",converter:z({default:100}),on:"update",description:"Delay in ms before a badge tooltip appears."},{configKey:"badgeTooltipOffset",attribute:"badge-tooltip-offset",converter:z({default:8}),on:"update",description:"Gap in px between a badge and its tooltip."},{configKey:"optionTooltipDelay",attribute:"option-tooltip-delay",converter:z(),on:"update",description:"Delay in ms before an option tooltip appears (falls back to badgeTooltipDelay)."},{configKey:"optionTooltipOffset",attribute:"option-tooltip-offset",converter:z(),on:"update",description:"Gap in px between an option and its tooltip."},{configKey:"isMultipleEnabled",attribute:"multiple",converter:F("default-true"),on:"reinit",description:"Allow selecting multiple options. When off, selecting one replaces the previous."},{configKey:"isGroupsAllowed",attribute:"allow-groups",converter:F("default-true"),on:"reinit",description:"Allow grouping options under group headers."},{configKey:"isCheckboxesShown",attribute:"show-checkboxes",converter:F("default-true"),on:"reinit",description:"Show a checkbox on each option."},{configKey:"isActionsSticky",attribute:"sticky-actions",converter:F("default-true"),on:"update",description:"Keep the action bar pinned while the list scrolls."},{configKey:"isPlacementLocked",attribute:"lock-placement",converter:F("default-true"),on:"update",description:"Keep the dropdown initial placement instead of flipping when it fits."},{configKey:"isSearchEnabled",attribute:"enable-search",converter:F("default-true"),on:"reinit",description:"Show the search input."},{configKey:"isKeepOptionsOnSearch",attribute:"keep-options-on-search",converter:F("default-true"),on:"update",description:"Keep already-selected options visible while filtering."},{configKey:"shouldKeepSearchOnClose",attribute:"should-keep-search-on-close",converter:F("default-true"),on:"update",description:"Preserve the search text after the dropdown closes."},{configKey:"isCloseOnSelect",attribute:"close-on-select",converter:F("default-false"),on:"update",description:"Close the dropdown immediately after a selection."},{configKey:"isAddNewAllowed",attribute:"allow-add-new",converter:F("default-false"),on:"reinit",description:"Allow adding a new option from the search text."},{configKey:"isCounterShown",attribute:"show-counter",converter:F("default-false"),on:"update",description:"Show a selected-count indicator."},{configKey:"isBadgeFullTitleShown",attribute:"show-badge-full-title",converter:F("default-false"),on:"update",description:"Show the full title on badges instead of the short label."},{configKey:"isVirtualScrollEnabled",attribute:"enable-virtual-scroll",converter:F("default-false"),on:"reinit",description:"Force virtual scrolling on regardless of the threshold."},{configKey:"isBadgeTooltipsEnabled",attribute:"enable-badge-tooltips",converter:F("default-false"),on:"update",description:"Enable tooltips on badges."},{configKey:"isOptionTooltipsEnabled",attribute:"enable-option-tooltips",converter:F("default-false"),on:"update",description:"Enable tooltips on options."},{configKey:"isOptionTooltipFollowCursor",attribute:"option-tooltip-follow-cursor",converter:F("default-false"),on:"update",description:"Make option tooltips follow the pointer."},{configKey:"isSearchModeToggleShown",attribute:"show-search-mode-toggle",converter:F("default-false"),on:"update",description:"Show a clickable toggle in the phone fullscreen overlay search header that flips `search-mode` between `filter` and `navigate` live. Fullscreen-only; no effect in the floating presentation or when search is disabled."},{configKey:"initialValues",attribute:"initial-values",converter:Tr(),default:[],on:"reinit",type:"Array<string | number>",description:'Values selected on first render. Accepts a JSON array (`["a","b"]`) or a bare CSV (`a,b,c`).'},{configKey:"showDebugInfo",attribute:"show-debug-info",converter:F("default-false"),on:"update",description:"Render an in-component debug panel.",deprecated:"Use per-instance logging (el.enableLogging()) instead."},{configKey:"options",converter:go(),on:"reinit",type:"ReadonlyArray<Record<string, unknown>>",description:"The array of option objects to render. The JS API — assign `el.options` directly. For HTML authoring use the `data-options` attribute (parsed per `data-options-format`) or declarative <option> children; both feed the same list and take precedence over this property in the order: <option> children > property > data-options."},{configKey:"optionsSource",attribute:"data-options",converter:L({isNullable:!0}),on:"reinit",type:"string",description:"HTML-authoring source for the option list, parsed per `data-options-format`. Reactive: changing either attribute re-renders. Prefer the `options` property in JS; a set `options` property and declarative <option> children both win over this."},{configKey:"optionsFormat",attribute:"data-options-format",converter:k(Fs,{default:"json"}),on:"reinit",type:"'json' | 'csv' | 'plain'",description:"How to parse the `data-options` attribute: `json` (a JSON array of objects or [value, label] tuples), `csv` (rows split on `data-options-row-splitter`, cells on `data-options-splitter`; the first row is a header — map columns via *-member), or `plain` (bare values split on both splitters -> [value, label] tuples, value === label). Default `json`."},{configKey:"optionsSplitter",attribute:"data-options-splitter",converter:L({default:","}),on:"reinit",type:"string",description:'Field/cell delimiter for the `csv` and `plain` `data-options` formats. Default `,`. Escapes `\\t` `\\n` `\\r` are honoured (e.g. `data-options-splitter="\\t"` for TSV). Ignored for `json`.'},{configKey:"optionsRowSplitter",attribute:"data-options-row-splitter",converter:L({default:`
|
|
41
|
+
`}),on:"reinit",type:"string",description:'Row/record delimiter for the `csv` and `plain` `data-options` formats. Default newline. Escapes honoured (e.g. `data-options-row-splitter=";"` for single-line data). Ignored for `json`.'},{configKey:"actionButtons",converter:fo({validate:s=>Array.isArray(s)}),on:"reinit",type:"Array<Record<string, unknown>>",description:"Custom action buttons for the dropdown footer/header. Property-only; when unset the default Select-All / Clear buttons apply."},{configKey:"getValueCallback",converter:N(),on:"reinit",type:"(item: unknown) => string | number",description:"Extract an option value (overrides valueMember)."},{configKey:"getPathCallback",converter:N(),on:"reinit",type:"(item: unknown) => string",description:"Extract a node tree path (enables tree mode; overrides pathMember)."},{configKey:"getGroupCallback",converter:N(),on:"reinit",type:"(item: unknown) => string",description:"Extract the group name from an option (overrides groupMember)."},{configKey:"getDisabledCallback",converter:N(),on:"reinit",type:"(item: unknown) => boolean",description:"Whether an option is disabled (overrides disabledMember)."},{configKey:"getIsSelectableCallback",converter:N(),on:"reinit",type:"(node: unknown) => boolean",description:"Whether a tree node can be selected (overrides is-selectable-member)."},{configKey:"getSearchValueCallback",converter:N(),on:"reinit",type:"(item: unknown) => string",description:"Text an option is searched against (overrides searchValueMember)."},{configKey:"searchCallback",converter:N(),on:"reinit",type:"(searchTerm: string, signal?: AbortSignal) => Promise<unknown[]>",description:"Custom / async search; return the filtered options."},{configKey:"getDisplayValueCallback",converter:N(),on:"update",type:"(item: unknown) => string",description:"Compute the display label for an option (overrides displayValueMember)."},{configKey:"getBadgeDisplayCallback",converter:N(),on:"update",type:"(item: unknown) => string",description:"Compute the text shown on an option badge."},{configKey:"getBadgeClassCallback",converter:N(),on:"update",type:"(item: unknown) => string | string[]",description:"Extra CSS class(es) for an option badge."},{configKey:"getIconCallback",converter:N(),on:"update",type:"(item: unknown) => string",description:"Icon for an option (overrides iconMember)."},{configKey:"getSubtitleCallback",converter:N(),on:"update",type:"(item: unknown) => string",description:"Subtitle for an option (overrides subtitleMember)."},{configKey:"getFullTitleCallback",converter:N(),on:"update",type:"(item: unknown) => string",description:"Full title for an option (used by badges when show-badge-full-title is on)."},{configKey:"getCounterCallback",converter:N(),on:"update",type:"(count: number, moreCount?: number) => string",description:"Render the selected-count label."},{configKey:"getValueFormatCallback",converter:N(),on:"update",type:"(selectedValues: (string | number)[]) => string",description:"Serialize the selected values for form submission."},{configKey:"getBadgeTooltipCallback",converter:N(),on:"update",type:"(item: unknown) => string | HTMLElement",description:"Tooltip content for an option badge."},{configKey:"getOptionTooltipCallback",converter:N(),on:"update",type:"(item: unknown) => string | HTMLElement",description:"Tooltip content for an option row."},{configKey:"getRemoveButtonTooltipCallback",converter:N(),on:"update",type:"(item: unknown) => string",description:"Tooltip text for a badge remove button."},{configKey:"getSelectedItemClassCallback",converter:N(),on:"update",type:"(item: unknown) => string | string[]",description:"Extra CSS class(es) for a selected item."},{configKey:"renderOptionContentCallback",converter:N(),on:"update",type:"(item: unknown, context: OptionContentRenderContext) => string | HTMLElement",description:"Custom render for an option row; may return HTML or an element."},{configKey:"renderBadgeContentCallback",converter:N(),on:"update",type:"(item: unknown, context: BadgeContentRenderContext) => string | HTMLElement",description:"Custom render for a badge; may return HTML or an element."},{configKey:"renderGroupLabelContentCallback",converter:N(),on:"update",type:"(groupName: string) => string | HTMLElement",description:"Customize a group label; may return an HTML string or element."},{configKey:"renderSelectedContentCallback",converter:N(),on:"update",type:"(item: unknown) => string",description:"Custom render for the whole selected area."},{configKey:"renderSelectedItemContentCallback",converter:N(),on:"update",type:"(item: unknown) => string | HTMLElement",description:"Custom render for one selected item."},{configKey:"customStylesCallback",converter:N(),on:"update",type:"() => string",description:"Returns a CSS string injected into the component via a replaceable style slot (§12.8)."},{configKey:"beforeSearchCallback",converter:N(),on:"update",type:"(searchTerm: string) => string | null",description:"Runs before a search; return a rewritten term or null to veto."},{configKey:"beforeSelectCallback",converter:N(),on:"update",type:"(option: unknown, selectedOptions: unknown[]) => boolean | string | void",description:"Runs before selecting; return false to veto, or a string to veto and show it as a message."},{configKey:"beforeDeselectCallback",converter:N(),on:"update",type:"(option: unknown, selectedOptions: unknown[]) => boolean | string | void",description:"Runs before deselecting; return false to veto, or a string to veto and show it as a message."},{configKey:"addNewCallback",converter:N(),on:"update",type:"(value: string) => unknown | Promise<unknown>",description:"Create a new option from the typed text."},{configKey:"keydownCallback",converter:N(),on:"update",type:"(context: MultiSelectKeydownContext) => boolean | void",description:"Intercept keydown before built-in handling; return true to suppress the default. Gets the event, current state, and an imperative controller."}],Er=[{name:"select",description:"An option was selected. `detail.option` is the selected option; `detail.selectedOptions`/`detail.selectedValues` are the full selection."},{name:"deselect",description:"An option was removed from the selection. `detail.option` is that option."},{name:"change",description:"The selection changed. `detail.selectedOptions`/`detail.selectedValues` are the full selection."}],Ys=new Set(["dropdownWidth","selectedPopoverWidth","showDebugInfo","initialValues","optionsSource","optionsFormat","optionsSplitter","optionsRowSplitter","mobilePresentation"]),_t={dropdownWidth:"--ms-dropdown-width",selectedPopoverWidth:"--ms-selected-popover-width"};let Ar=null;function zr(){return Ar??(Ar=Qo(Xs,"--ms-"))}const Nr=[{key:"valueMember",member:"value",callbackKey:"getValueCallback"},{key:"displayValueMember",member:"label",callbackKey:"getDisplayValueCallback"},{key:"groupMember",member:"group",callbackKey:"getGroupCallback"},{key:"iconMember",member:"icon",callbackKey:"getIconCallback"},{key:"subtitleMember",member:"subtitle",callbackKey:"getSubtitleCallback"},{key:"disabledMember",member:"disabled",callbackKey:"getDisabledCallback"}];class Ae extends Et{constructor(){super();$(this,_);$(this,J);$(this,V);$(this,fe);$(this,tt,null);$(this,st,new Set);$(this,ot,!1);$(this,Re,!1);$(this,He);$(this,Oe);R(this,J,this.attachShadow({mode:"open"})),Yo(p(this,J),Xs),typeof requestAnimationFrame=="function"?requestAnimationFrame(()=>this.setAttribute("data-ready","")):this.setAttribute("data-ready","")}formResetCallback(){var t;(t=p(this,V))==null||t.clearAll()}directionChanged(t){var o;(o=p(this,V))==null||o.refreshDirection()}reinit(){x(this,_,lo).call(this),this.isConnected&&x(this,_,Jt).call(this)}update(t){x(this,_,co).call(this,t),"customStylesCallback"in t&&x(this,_,Zt).call(this),"showDebugInfo"in t&&x(this,_,ts).call(this);const o={};for(const[i,r]of Object.entries(t))Ys.has(i)||(o[i]=r===null?void 0:r);p(this,V)&&Object.keys(o).length>0&&(p(this,V).updateOptions(o)||x(this,_,Jt).call(this)),"mobilePresentation"in t&&x(this,_,St).call(this,Lt())}connect(){p(this,V)||x(this,_,Qt).call(this)}disconnect(){var t;(t=p(this,V))==null||t.destroy(),R(this,V,void 0)}environmentChanged(t){x(this,_,St).call(this,t)}get name(){return this.getAttribute("name")}set name(t){t?this.setAttribute("name",t):this.removeAttribute("name")}get selectedValue(){var t;return this.flush(),((t=p(this,V))==null?void 0:t.selectedValue)??null}get selectedItem(){var t;return this.flush(),((t=p(this,V))==null?void 0:t.selectedItem)??null}getSelected(){return this.flush(),p(this,V)?p(this,V).getSelected():[]}setSelected(t,o={}){var i;this.flush(),(i=p(this,V))==null||i.setSelected(t,o)}getValue(){return this.flush(),p(this,V)?p(this,V).getValue():null}showMessage(t,o){var i;this.flush(),(i=p(this,V))==null||i.showMessage(t,o)}hideMessage(){var t;(t=p(this,V))==null||t.hideMessage()}destroy(){var t;(t=p(this,V))==null||t.destroy()}}J=new WeakMap,V=new WeakMap,fe=new WeakMap,tt=new WeakMap,st=new WeakMap,ot=new WeakMap,Re=new WeakMap,He=new WeakMap,Oe=new WeakMap,_=new WeakSet,St=function(t){var r;const o=this.config.mobilePresentation??"auto",i=oi(o,t);(r=p(this,V))==null||r.setPresentation(i==="modal"?"fullscreen":i)},Jt=function(){var t;(t=p(this,V))==null||t.destroy(),R(this,V,void 0),x(this,_,Qt).call(this)},Qt=function(){x(this,_,io).call(this),x(this,_,ho).call(this);const t=x(this,_,ro).call(this),o=x(this,_,no).call(this);o&&o.length>0?p(this,fe).dataset.initialValues=JSON.stringify(o):delete p(this,fe).dataset.initialValues,R(this,V,new Ks(p(this,fe),t)),x(this,_,Zt).call(this),x(this,_,ts).call(this),x(this,_,St).call(this,Lt())},io=function(){if(p(this,fe))return;const t=document.createElement("div");t.setAttribute("data-multiselect",""),this.className&&(t.className=this.className),p(this,J).appendChild(t),R(this,tt,Jo(p(this,J),{position:"first",className:"ms-custom-styles"})),R(this,fe,t)},ro=function(){const t={...this.config};for(const i of Ys)delete t[i];for(const i of Object.keys(t))t[i]===null&&delete t[i];let o=t.options;if(p(this,Re)&&p(this,He))o&&o.length>0&&j.warn("[MultiSelectElement] Both declarative <option> elements and programmatic .options detected. Using declarative options."),o=p(this,He);else if(!o||o.length===0){const i=this.config.optionsSource;if(i!=null){const r=this.config.optionsFormat??"json",{options:n,error:a}=Us(i,r,{splitter:this.config.optionsSplitter,rowSplitter:this.config.optionsRowSplitter});a&&j.error(`[MultiSelectElement] ${a}`),o=n}}if(t.options=o,p(this,Re))for(const{key:i,member:r,callbackKey:n}of Nr)t[i]===void 0&&!t[n]&&(t[i]=r);return t.getCounterCallback||(t.getCounterCallback=(i,r)=>r!==void 0?`+${r} more`:`${i} selected`),t.onSelect=i=>{var r;this.emit("select",{option:i,selectedOptions:((r=p(this,V))==null?void 0:r.getSelected())??[],selectedValues:x(this,_,Tt).call(this)})},t.onDeselect=i=>{var r;this.emit("deselect",{option:i,selectedOptions:((r=p(this,V))==null?void 0:r.getSelected())??[],selectedValues:x(this,_,Tt).call(this)})},t.onChange=i=>{this.emit("change",{selectedOptions:i,selectedValues:x(this,_,Tt).call(this)})},t.container=p(this,J),t.hostElement=this,t},no=function(){if(p(this,Oe)&&p(this,Oe).length>0)return p(this,Oe);const t=this.config.initialValues;return t&&t.length>0?t:void 0},Tt=function(){var o;const t=(o=p(this,V))==null?void 0:o.getValue();return t==null?[]:Array.isArray(t)?t:[t]},Zt=function(){const t=p(this,tt);if(!t)return;const o=this.config.customStylesCallback;if(typeof o!="function"){t.clear();return}try{const i=o();t.set(i),i&&x(this,_,ao).call(this,i)}catch(i){j.warn("[MultiSelectElement] customStylesCallback threw",i),t.clear()}},ao=function(t){const o=zr();if(o.size!==0)for(const{name:i,suggestions:r}of ti(t,{prefix:"--ms-",consumed:o}))p(this,st).has(i)||(p(this,st).add(i),console.warn(`[web-multiselect] customStylesCallback sets "${i}", which no web-multiselect style consumes — it will have no effect.`+(r.length?` Did you mean: ${r.join(", ")}?`:"")+" (If it's for your own custom-rendered content, ignore this.)"))},lo=function(){for(const t of Object.keys(_t))x(this,_,es).call(this,_t[t],this.config[t])},co=function(t){for(const o of Object.keys(_t))o in t&&x(this,_,es).call(this,_t[o],t[o])},es=function(t,o){o==null||o===""?this.style.removeProperty(t):this.style.setProperty(t,String(o))},ho=function(){if(p(this,ot))return;R(this,ot,!0);const t=x(this,_,uo).call(this);t&&(R(this,He,t),R(this,Re,!0))},uo=function(){const t=Array.from(this.children);if(t.length===0)return null;const o=[];let i=!1;const r=(n,a)=>{var c,d;const l={value:n.value||((c=n.textContent)==null?void 0:c.trim())||"",label:((d=n.textContent)==null?void 0:d.trim())||n.value||""};a&&(l.group=a),n.hasAttribute("selected")&&(p(this,Oe)??R(this,Oe,[])).push(l.value),n.hasAttribute("disabled")&&(l.disabled=!0),n.hasAttribute("data-icon")&&(l.icon=n.getAttribute("data-icon")),n.hasAttribute("data-subtitle")&&(l.subtitle=n.getAttribute("data-subtitle")),o.push(l),i=!0};for(const n of t)if(n.tagName==="OPTION")r(n);else if(n.tagName==="OPTGROUP"){const a=n,l=a.label||a.getAttribute("label")||"Group";for(const c of Array.from(a.querySelectorAll("option")))r(c,l)}if(!i)return null;j.debug(`[MultiSelectElement] Parsed ${o.length} declarative options from Light DOM`);for(const n of t)(n.tagName==="OPTION"||n.tagName==="OPTGROUP")&&n.remove();return o},ts=function(){const t=p(this,J).querySelector(".ms__debug-info");if(t&&t.remove(),!this.config.showDebugInfo)return;const o=document.createElement("div");o.className="ms__debug-info";const i=document.createElement("details"),r=document.createElement("summary");r.textContent="Debug Info";const n=document.createElement("div");n.className="ms__debug-stats",i.appendChild(r),i.appendChild(n),o.appendChild(i),p(this,J).appendChild(o),x(this,_,ss).call(this)},ss=function(){var l,c,d,h;const t=p(this,J).querySelector(".ms__debug-stats");if(!t||!p(this,V))return;const o="2.0.0-rc08",i=typeof window<"u"&&((c=(l=window.components)==null?void 0:l["web-multiselect"])==null?void 0:c.getInstances().length)||0,r=p(this,V).getSelected().length,n=((d=this.config.options)==null?void 0:d.length)||0,a=p(this,V);t.innerHTML=`
|
|
42
42
|
<span>Version: ${o}</span>
|
|
43
43
|
<span>Total Instances: ${i}</span>
|
|
44
44
|
<span>Options: ${n}</span>
|
|
@@ -47,4 +47,4 @@ ${o}`:t}attachOptionTooltips(){if(this.destroyAllOptionTooltips(),!this.options.
|
|
|
47
47
|
<span>Dropdown: ${a.isOpen?"Open":"Closed"}</span>
|
|
48
48
|
<span>Search: ${a.searchTerm||"none"}</span>
|
|
49
49
|
<span>Loading: ${a.isLoading?"Yes":"No"}</span>
|
|
50
|
-
`,setTimeout(()=>{this.config.showDebugInfo&&x(this,_,
|
|
50
|
+
`,setTimeout(()=>{this.config.showDebugInfo&&x(this,_,ss).call(this)},500)},u(Ae,"formAssociated",!0),u(Ae,"inputs",Lr),u(Ae,"events",Er),typeof customElements<"u"&&!customElements.get("web-multiselect")&&customElements.define("web-multiselect",Ae),Xo("web-multiselect",Ae,{config:{name:"@keenmate/web-multiselect",version:"2.0.0-rc08",author:"Keenmate",license:"MIT",repository:"git+https://github.com/keenmate/web-multiselect.git",homepage:"https://web-multiselect.keenmate.dev"},logging:ne}),S.LOGGING_CATEGORIES=br,S.MultiSelectElement=Ae,S.OPTIONS_FORMATS=Fs,S.WebMultiSelect=Ks,S.dataLogger=j,S.disableLogging=yr,S.enableLogging=vr,S.initLogger=Xe,S.interactionLogger=U,S.parseOptionsData=Us,S.setCategoryLevel=xr,S.setLogLevel=wr,S.uiLogger=Y,Object.defineProperty(S,Symbol.toStringTag,{value:"Module"})});
|