@keenmate/web-multiselect 1.7.0 → 1.8.0
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 +25 -25
- package/dist/multiselect.js +271 -271
- package/dist/multiselect.umd.js +4 -4
- package/dist/style.css +1 -1
- package/package.json +1 -1
- package/src/css/_badges-display.css +11 -11
- package/src/css/_input-dropdown.css +8 -8
- package/src/css/_options.css +8 -8
- package/src/css/_tooltips-popover.css +5 -5
- package/src/css/_variables.css +48 -48
package/dist/multiselect.umd.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
(function(y,I){typeof exports=="object"&&typeof module<"u"?I(exports):typeof define=="function"&&define.amd?define(["exports"],I):(y=typeof globalThis<"u"?globalThis:y||self,I(y.MultiSelect={}))})(this,function(y){"use strict";var bs=Object.defineProperty;var vs=(y,I,L)=>I in y?bs(y,I,{enumerable:!0,configurable:!0,writable:!0,value:L}):y[I]=L;var m=(y,I,L)=>vs(y,typeof I!="symbol"?I+"":I,L);const I=Math.min,L=Math.max,le=Math.round,ce=Math.floor,V=o=>({x:o,y:o}),ut={left:"right",right:"left",bottom:"top",top:"bottom"},gt={start:"end",end:"start"};function Ee(o,e,t){return L(o,I(e,t))}function de(o,e){return typeof o=="function"?o(e):o}function N(o){return o.split("-")[0]}function he(o){return o.split("-")[1]}function Me(o){return o==="x"?"y":"x"}function $e(o){return o==="y"?"height":"width"}const bt=new Set(["top","bottom"]);function D(o){return bt.has(N(o))?"y":"x"}function ze(o){return Me(D(o))}function vt(o,e,t){t===void 0&&(t=!1);const s=he(o),i=ze(o),r=$e(i);let n=i==="x"?s===(t?"end":"start")?"right":"left":s==="start"?"bottom":"top";return e.reference[r]>e.floating[r]&&(n=me(n)),[n,me(n)]}function ft(o){const e=me(o);return[_e(o),e,_e(e)]}function _e(o){return o.replace(/start|end/g,e=>gt[e])}const Ve=["left","right"],Pe=["right","left"],wt=["top","bottom"],_t=["bottom","top"];function xt(o,e,t){switch(o){case"top":case"bottom":return t?e?Pe:Ve:e?Ve:Pe;case"left":case"right":return e?wt:_t;default:return[]}}function kt(o,e,t,s){const i=he(o);let r=xt(N(o),t==="start",s);return i&&(r=r.map(n=>n+"-"+i),e&&(r=r.concat(r.map(_e)))),r}function me(o){return o.replace(/left|right|bottom|top/g,e=>ut[e])}function yt(o){return{top:0,right:0,bottom:0,left:0,...o}}function Ct(o){return typeof o!="number"?yt(o):{top:o,right:o,bottom:o,left:o}}function pe(o){const{x:e,y:t,width:s,height:i}=o;return{width:s,height:i,top:t,left:e,right:e+s,bottom:t+i,x:e,y:t}}function Be(o,e,t){let{reference:s,floating:i}=o;const r=D(e),n=ze(e),a=$e(n),l=N(e),c=r==="y",d=s.x+s.width/2-i.width/2,p=s.y+s.height/2-i.height/2,u=s[a]/2-i[a]/2;let h;switch(l){case"top":h={x:d,y:s.y-i.height};break;case"bottom":h={x:d,y:s.y+s.height};break;case"right":h={x:s.x+s.width,y:p};break;case"left":h={x:s.x-i.width,y:p};break;default:h={x:s.x,y:s.y}}switch(he(e)){case"start":h[n]-=u*(t&&c?-1:1);break;case"end":h[n]+=u*(t&&c?-1:1);break}return h}const St=async(o,e,t)=>{const{placement:s="bottom",strategy:i="absolute",middleware:r=[],platform:n}=t,a=r.filter(Boolean),l=await(n.isRTL==null?void 0:n.isRTL(e));let c=await n.getElementRects({reference:o,floating:e,strategy:i}),{x:d,y:p}=Be(c,s,l),u=s,h={},g=0;for(let b=0;b<a.length;b++){const{name:f,fn:w}=a[b],{x:_,y:k,data:A,reset:S}=await w({x:d,y:p,initialPlacement:s,placement:u,strategy:i,middlewareData:h,rects:c,platform:n,elements:{reference:o,floating:e}});d=_??d,p=k??p,h={...h,[f]:{...h[f],...A}},S&&g<=50&&(g++,typeof S=="object"&&(S.placement&&(u=S.placement),S.rects&&(c=S.rects===!0?await n.getElementRects({reference:o,floating:e,strategy:i}):S.rects),{x:d,y:p}=Be(c,u,l)),b=-1)}return{x:d,y:p,placement:u,strategy:i,middlewareData:h}};async function De(o,e){var t;e===void 0&&(e={});const{x:s,y:i,platform:r,rects:n,elements:a,strategy:l}=o,{boundary:c="clippingAncestors",rootBoundary:d="viewport",elementContext:p="floating",altBoundary:u=!1,padding:h=0}=de(e,o),g=Ct(h),f=a[u?p==="floating"?"reference":"floating":p],w=pe(await r.getClippingRect({element:(t=await(r.isElement==null?void 0:r.isElement(f)))==null||t?f:f.contextElement||await(r.getDocumentElement==null?void 0:r.getDocumentElement(a.floating)),boundary:c,rootBoundary:d,strategy:l})),_=p==="floating"?{x:s,y:i,width:n.floating.width,height:n.floating.height}:n.reference,k=await(r.getOffsetParent==null?void 0:r.getOffsetParent(a.floating)),A=await(r.isElement==null?void 0:r.isElement(k))?await(r.getScale==null?void 0:r.getScale(k))||{x:1,y:1}:{x:1,y:1},S=pe(r.convertOffsetParentRelativeRectToViewportRelativeRect?await r.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:_,offsetParent:k,strategy:l}):_);return{top:(w.top-S.top+g.top)/A.y,bottom:(S.bottom-w.bottom+g.bottom)/A.y,left:(w.left-S.left+g.left)/A.x,right:(S.right-w.right+g.right)/A.x}}const Tt=function(o){return o===void 0&&(o={}),{name:"flip",options:o,async fn(e){var t,s;const{placement:i,middlewareData:r,rects:n,initialPlacement:a,platform:l,elements:c}=e,{mainAxis:d=!0,crossAxis:p=!0,fallbackPlacements:u,fallbackStrategy:h="bestFit",fallbackAxisSideDirection:g="none",flipAlignment:b=!0,...f}=de(o,e);if((t=r.arrow)!=null&&t.alignmentOffset)return{};const w=N(i),_=D(a),k=N(a)===a,A=await(l.isRTL==null?void 0:l.isRTL(c.floating)),S=u||(k||!b?[me(a)]:ft(a)),ne=g!=="none";!u&&ne&&S.push(...kt(a,b,g,A));const J=[a,...S],Oe=await De(e,f),we=[];let X=((s=r.flip)==null?void 0:s.overflows)||[];if(d&&we.push(Oe[w]),p){const W=vt(i,n,A);we.push(Oe[W[0]],Oe[W[1]])}if(X=[...X,{placement:i,overflows:we}],!we.every(W=>W<=0)){var ht,mt;const W=(((ht=r.flip)==null?void 0:ht.index)||0)+1,Le=J[W];if(Le&&(!(p==="alignment"?_!==D(Le):!1)||X.every(z=>D(z.placement)===_?z.overflows[0]>0:!0)))return{data:{index:W,overflows:X},reset:{placement:Le}};let ae=(mt=X.filter(j=>j.overflows[0]<=0).sort((j,z)=>j.overflows[1]-z.overflows[1])[0])==null?void 0:mt.placement;if(!ae)switch(h){case"bestFit":{var pt;const j=(pt=X.filter(z=>{if(ne){const H=D(z.placement);return H===_||H==="y"}return!0}).map(z=>[z.placement,z.overflows.filter(H=>H>0).reduce((H,gs)=>H+gs,0)]).sort((z,H)=>z[1]-H[1])[0])==null?void 0:pt[0];j&&(ae=j);break}case"initialPlacement":ae=a;break}if(i!==ae)return{reset:{placement:ae}}}return{}}}},At=new Set(["left","top"]);async function It(o,e){const{placement:t,platform:s,elements:i}=o,r=await(s.isRTL==null?void 0:s.isRTL(i.floating)),n=N(t),a=he(t),l=D(t)==="y",c=At.has(n)?-1:1,d=r&&l?-1:1,p=de(e,o);let{mainAxis:u,crossAxis:h,alignmentAxis:g}=typeof p=="number"?{mainAxis:p,crossAxis:0,alignmentAxis:null}:{mainAxis:p.mainAxis||0,crossAxis:p.crossAxis||0,alignmentAxis:p.alignmentAxis};return a&&typeof g=="number"&&(h=a==="end"?g*-1:g),l?{x:h*d,y:u*c}:{x:u*c,y:h*d}}const Ot=function(o){return o===void 0&&(o=0),{name:"offset",options:o,async fn(e){var t,s;const{x:i,y:r,placement:n,middlewareData:a}=e,l=await It(e,o);return n===((t=a.offset)==null?void 0:t.placement)&&(s=a.arrow)!=null&&s.alignmentOffset?{}:{x:i+l.x,y:r+l.y,data:{...l,placement:n}}}}},Lt=function(o){return o===void 0&&(o={}),{name:"shift",options:o,async fn(e){const{x:t,y:s,placement:i}=e,{mainAxis:r=!0,crossAxis:n=!1,limiter:a={fn:f=>{let{x:w,y:_}=f;return{x:w,y:_}}},...l}=de(o,e),c={x:t,y:s},d=await De(e,l),p=D(N(i)),u=Me(p);let h=c[u],g=c[p];if(r){const f=u==="y"?"top":"left",w=u==="y"?"bottom":"right",_=h+d[f],k=h-d[w];h=Ee(_,h,k)}if(n){const f=p==="y"?"top":"left",w=p==="y"?"bottom":"right",_=g+d[f],k=g-d[w];g=Ee(_,g,k)}const b=a.fn({...e,[u]:h,[p]:g});return{...b,data:{x:b.x-t,y:b.y-s,enabled:{[u]:r,[p]:n}}}}}};function ue(){return typeof window<"u"}function U(o){return Re(o)?(o.nodeName||"").toLowerCase():"#document"}function O(o){var e;return(o==null||(e=o.ownerDocument)==null?void 0:e.defaultView)||window}function P(o){var e;return(e=(Re(o)?o.ownerDocument:o.document)||window.document)==null?void 0:e.documentElement}function Re(o){return ue()?o instanceof Node||o instanceof O(o).Node:!1}function E(o){return ue()?o instanceof Element||o instanceof O(o).Element:!1}function B(o){return ue()?o instanceof HTMLElement||o instanceof O(o).HTMLElement:!1}function He(o){return!ue()||typeof ShadowRoot>"u"?!1:o instanceof ShadowRoot||o instanceof O(o).ShadowRoot}const Et=new Set(["inline","contents"]);function Z(o){const{overflow:e,overflowX:t,overflowY:s,display:i}=M(o);return/auto|scroll|overlay|hidden|clip/.test(e+s+t)&&!Et.has(i)}const Mt=new Set(["table","td","th"]);function $t(o){return Mt.has(U(o))}const zt=[":popover-open",":modal"];function ge(o){return zt.some(e=>{try{return o.matches(e)}catch{return!1}})}const Vt=["transform","translate","scale","rotate","perspective"],Pt=["transform","translate","scale","rotate","perspective","filter"],Bt=["paint","layout","strict","content"];function xe(o){const e=ke(),t=E(o)?M(o):o;return Vt.some(s=>t[s]?t[s]!=="none":!1)||(t.containerType?t.containerType!=="normal":!1)||!e&&(t.backdropFilter?t.backdropFilter!=="none":!1)||!e&&(t.filter?t.filter!=="none":!1)||Pt.some(s=>(t.willChange||"").includes(s))||Bt.some(s=>(t.contain||"").includes(s))}function Dt(o){let e=R(o);for(;B(e)&&!K(e);){if(xe(e))return e;if(ge(e))return null;e=R(e)}return null}function ke(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const Rt=new Set(["html","body","#document"]);function K(o){return Rt.has(U(o))}function M(o){return O(o).getComputedStyle(o)}function be(o){return E(o)?{scrollLeft:o.scrollLeft,scrollTop:o.scrollTop}:{scrollLeft:o.scrollX,scrollTop:o.scrollY}}function R(o){if(U(o)==="html")return o;const e=o.assignedSlot||o.parentNode||He(o)&&o.host||P(o);return He(e)?e.host:e}function Ne(o){const e=R(o);return K(e)?o.ownerDocument?o.ownerDocument.body:o.body:B(e)&&Z(e)?e:Ne(e)}function Q(o,e,t){var s;e===void 0&&(e=[]),t===void 0&&(t=!0);const i=Ne(o),r=i===((s=o.ownerDocument)==null?void 0:s.body),n=O(i);if(r){const a=ye(n);return e.concat(n,n.visualViewport||[],Z(i)?i:[],a&&t?Q(a):[])}return e.concat(i,Q(i,[],t))}function ye(o){return o.parent&&Object.getPrototypeOf(o.parent)?o.frameElement:null}function Fe(o){const e=M(o);let t=parseFloat(e.width)||0,s=parseFloat(e.height)||0;const i=B(o),r=i?o.offsetWidth:t,n=i?o.offsetHeight:s,a=le(t)!==r||le(s)!==n;return a&&(t=r,s=n),{width:t,height:s,$:a}}function Ce(o){return E(o)?o:o.contextElement}function Y(o){const e=Ce(o);if(!B(e))return V(1);const t=e.getBoundingClientRect(),{width:s,height:i,$:r}=Fe(e);let n=(r?le(t.width):t.width)/s,a=(r?le(t.height):t.height)/i;return(!n||!Number.isFinite(n))&&(n=1),(!a||!Number.isFinite(a))&&(a=1),{x:n,y:a}}const Ht=V(0);function Ge(o){const e=O(o);return!ke()||!e.visualViewport?Ht:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function Nt(o,e,t){return e===void 0&&(e=!1),!t||e&&t!==O(o)?!1:e}function F(o,e,t,s){e===void 0&&(e=!1),t===void 0&&(t=!1);const i=o.getBoundingClientRect(),r=Ce(o);let n=V(1);e&&(s?E(s)&&(n=Y(s)):n=Y(o));const a=Nt(r,t,s)?Ge(r):V(0);let l=(i.left+a.x)/n.x,c=(i.top+a.y)/n.y,d=i.width/n.x,p=i.height/n.y;if(r){const u=O(r),h=s&&E(s)?O(s):s;let g=u,b=ye(g);for(;b&&s&&h!==g;){const f=Y(b),w=b.getBoundingClientRect(),_=M(b),k=w.left+(b.clientLeft+parseFloat(_.paddingLeft))*f.x,A=w.top+(b.clientTop+parseFloat(_.paddingTop))*f.y;l*=f.x,c*=f.y,d*=f.x,p*=f.y,l+=k,c+=A,g=O(b),b=ye(g)}}return pe({width:d,height:p,x:l,y:c})}function ve(o,e){const t=be(o).scrollLeft;return e?e.left+t:F(P(o)).left+t}function We(o,e){const t=o.getBoundingClientRect(),s=t.left+e.scrollLeft-ve(o,t),i=t.top+e.scrollTop;return{x:s,y:i}}function Ft(o){let{elements:e,rect:t,offsetParent:s,strategy:i}=o;const r=i==="fixed",n=P(s),a=e?ge(e.floating):!1;if(s===n||a&&r)return t;let l={scrollLeft:0,scrollTop:0},c=V(1);const d=V(0),p=B(s);if((p||!p&&!r)&&((U(s)!=="body"||Z(n))&&(l=be(s)),B(s))){const h=F(s);c=Y(s),d.x=h.x+s.clientLeft,d.y=h.y+s.clientTop}const u=n&&!p&&!r?We(n,l):V(0);return{width:t.width*c.x,height:t.height*c.y,x:t.x*c.x-l.scrollLeft*c.x+d.x+u.x,y:t.y*c.y-l.scrollTop*c.y+d.y+u.y}}function Gt(o){return Array.from(o.getClientRects())}function Wt(o){const e=P(o),t=be(o),s=o.ownerDocument.body,i=L(e.scrollWidth,e.clientWidth,s.scrollWidth,s.clientWidth),r=L(e.scrollHeight,e.clientHeight,s.scrollHeight,s.clientHeight);let n=-t.scrollLeft+ve(o);const a=-t.scrollTop;return M(s).direction==="rtl"&&(n+=L(e.clientWidth,s.clientWidth)-i),{width:i,height:r,x:n,y:a}}const je=25;function jt(o,e){const t=O(o),s=P(o),i=t.visualViewport;let r=s.clientWidth,n=s.clientHeight,a=0,l=0;if(i){r=i.width,n=i.height;const d=ke();(!d||d&&e==="fixed")&&(a=i.offsetLeft,l=i.offsetTop)}const c=ve(s);if(c<=0){const d=s.ownerDocument,p=d.body,u=getComputedStyle(p),h=d.compatMode==="CSS1Compat"&&parseFloat(u.marginLeft)+parseFloat(u.marginRight)||0,g=Math.abs(s.clientWidth-p.clientWidth-h);g<=je&&(r-=g)}else c<=je&&(r+=c);return{width:r,height:n,x:a,y:l}}const Ut=new Set(["absolute","fixed"]);function Kt(o,e){const t=F(o,!0,e==="fixed"),s=t.top+o.clientTop,i=t.left+o.clientLeft,r=B(o)?Y(o):V(1),n=o.clientWidth*r.x,a=o.clientHeight*r.y,l=i*r.x,c=s*r.y;return{width:n,height:a,x:l,y:c}}function Ue(o,e,t){let s;if(e==="viewport")s=jt(o,t);else if(e==="document")s=Wt(P(o));else if(E(e))s=Kt(e,t);else{const i=Ge(o);s={x:e.x-i.x,y:e.y-i.y,width:e.width,height:e.height}}return pe(s)}function Ke(o,e){const t=R(o);return t===e||!E(t)||K(t)?!1:M(t).position==="fixed"||Ke(t,e)}function Yt(o,e){const t=e.get(o);if(t)return t;let s=Q(o,[],!1).filter(a=>E(a)&&U(a)!=="body"),i=null;const r=M(o).position==="fixed";let n=r?R(o):o;for(;E(n)&&!K(n);){const a=M(n),l=xe(n);!l&&a.position==="fixed"&&(i=null),(r?!l&&!i:!l&&a.position==="static"&&!!i&&Ut.has(i.position)||Z(n)&&!l&&Ke(o,n))?s=s.filter(d=>d!==n):i=a,n=R(n)}return e.set(o,s),s}function Jt(o){let{element:e,boundary:t,rootBoundary:s,strategy:i}=o;const n=[...t==="clippingAncestors"?ge(e)?[]:Yt(e,this._c):[].concat(t),s],a=n[0],l=n.reduce((c,d)=>{const p=Ue(e,d,i);return c.top=L(p.top,c.top),c.right=I(p.right,c.right),c.bottom=I(p.bottom,c.bottom),c.left=L(p.left,c.left),c},Ue(e,a,i));return{width:l.right-l.left,height:l.bottom-l.top,x:l.left,y:l.top}}function Xt(o){const{width:e,height:t}=Fe(o);return{width:e,height:t}}function Zt(o,e,t){const s=B(e),i=P(e),r=t==="fixed",n=F(o,!0,r,e);let a={scrollLeft:0,scrollTop:0};const l=V(0);function c(){l.x=ve(i)}if(s||!s&&!r)if((U(e)!=="body"||Z(i))&&(a=be(e)),s){const h=F(e,!0,r,e);l.x=h.x+e.clientLeft,l.y=h.y+e.clientTop}else i&&c();r&&!s&&i&&c();const d=i&&!s&&!r?We(i,a):V(0),p=n.left+a.scrollLeft-l.x-d.x,u=n.top+a.scrollTop-l.y-d.y;return{x:p,y:u,width:n.width,height:n.height}}function Se(o){return M(o).position==="static"}function Ye(o,e){if(!B(o)||M(o).position==="fixed")return null;if(e)return e(o);let t=o.offsetParent;return P(o)===t&&(t=t.ownerDocument.body),t}function Je(o,e){const t=O(o);if(ge(o))return t;if(!B(o)){let i=R(o);for(;i&&!K(i);){if(E(i)&&!Se(i))return i;i=R(i)}return t}let s=Ye(o,e);for(;s&&$t(s)&&Se(s);)s=Ye(s,e);return s&&K(s)&&Se(s)&&!xe(s)?t:s||Dt(o)||t}const Qt=async function(o){const e=this.getOffsetParent||Je,t=this.getDimensions,s=await t(o.floating);return{reference:Zt(o.reference,await e(o.floating),o.strategy),floating:{x:0,y:0,width:s.width,height:s.height}}};function qt(o){return M(o).direction==="rtl"}const es={convertOffsetParentRelativeRectToViewportRelativeRect:Ft,getDocumentElement:P,getClippingRect:Jt,getOffsetParent:Je,getElementRects:Qt,getClientRects:Gt,getDimensions:Xt,getScale:Y,isElement:E,isRTL:qt};function Xe(o,e){return o.x===e.x&&o.y===e.y&&o.width===e.width&&o.height===e.height}function ts(o,e){let t=null,s;const i=P(o);function r(){var a;clearTimeout(s),(a=t)==null||a.disconnect(),t=null}function n(a,l){a===void 0&&(a=!1),l===void 0&&(l=1),r();const c=o.getBoundingClientRect(),{left:d,top:p,width:u,height:h}=c;if(a||e(),!u||!h)return;const g=ce(p),b=ce(i.clientWidth-(d+u)),f=ce(i.clientHeight-(p+h)),w=ce(d),k={rootMargin:-g+"px "+-b+"px "+-f+"px "+-w+"px",threshold:L(0,I(1,l))||1};let A=!0;function S(ne){const J=ne[0].intersectionRatio;if(J!==l){if(!A)return n();J?n(!1,J):s=setTimeout(()=>{n(!1,1e-7)},1e3)}J===1&&!Xe(c,o.getBoundingClientRect())&&n(),A=!1}try{t=new IntersectionObserver(S,{...k,root:i.ownerDocument})}catch{t=new IntersectionObserver(S,k)}t.observe(o)}return n(!0),r}function q(o,e,t,s){s===void 0&&(s={});const{ancestorScroll:i=!0,ancestorResize:r=!0,elementResize:n=typeof ResizeObserver=="function",layoutShift:a=typeof IntersectionObserver=="function",animationFrame:l=!1}=s,c=Ce(o),d=i||r?[...c?Q(c):[],...Q(e)]:[];d.forEach(w=>{i&&w.addEventListener("scroll",t,{passive:!0}),r&&w.addEventListener("resize",t)});const p=c&&a?ts(c,t):null;let u=-1,h=null;n&&(h=new ResizeObserver(w=>{let[_]=w;_&&_.target===c&&h&&(h.unobserve(e),cancelAnimationFrame(u),u=requestAnimationFrame(()=>{var k;(k=h)==null||k.observe(e)})),t()}),c&&!l&&h.observe(c),h.observe(e));let g,b=l?F(o):null;l&&f();function f(){const w=F(o);b&&!Xe(b,w)&&t(),b=w,g=requestAnimationFrame(f)}return t(),()=>{var w;d.forEach(_=>{i&&_.removeEventListener("scroll",t),r&&_.removeEventListener("resize",t)}),p==null||p(),(w=h)==null||w.disconnect(),h=null,l&&cancelAnimationFrame(g)}}const ee=Ot,te=Lt,fe=Tt,se=(o,e,t)=>{const s=new Map,i={platform:es,...t},r={...i.platform,_c:s};return St(o,e,{...i,platform:r})};var Ze=function(){},$="undefined",ss=typeof window!==$&&typeof window.navigator!==$&&/Trident\/|MSIE /.test(window.navigator.userAgent),Te=["trace","debug","info","warn","error"],oe={},x=null;function Qe(o,e){var t=o[e];if(typeof t.bind=="function")return t.bind(o);try{return Function.prototype.bind.call(t,o)}catch{return function(){return Function.prototype.apply.apply(t,[o,arguments])}}}function os(){console.log&&(console.log.apply?console.log.apply(console,arguments):Function.prototype.apply.apply(console.log,[console,arguments])),console.trace&&console.trace()}function is(o){return o==="debug"&&(o="log"),typeof console===$?!1:o==="trace"&&ss?os:console[o]!==void 0?Qe(console,o):console.log!==void 0?Qe(console,"log"):Ze}function ie(){for(var o=this.getLevel(),e=0;e<Te.length;e++){var t=Te[e];this[t]=e<o?Ze:this.methodFactory(t,o,this.name)}if(this.log=this.debug,typeof console===$&&o<this.levels.SILENT)return"No console available for logging"}function rs(o){return function(){typeof console!==$&&(ie.call(this),this[o].apply(this,arguments))}}function ns(o,e,t){return is(o)||rs.apply(this,arguments)}function qe(o,e){var t=this,s,i,r,n="loglevel";typeof o=="string"?n+=":"+o:typeof o=="symbol"&&(n=void 0);function a(u){var h=(Te[u]||"silent").toUpperCase();if(!(typeof window===$||!n)){try{window.localStorage[n]=h;return}catch{}try{window.document.cookie=encodeURIComponent(n)+"="+h+";"}catch{}}}function l(){var u;if(!(typeof window===$||!n)){try{u=window.localStorage[n]}catch{}if(typeof u===$)try{var h=window.document.cookie,g=encodeURIComponent(n),b=h.indexOf(g+"=");b!==-1&&(u=/^([^;]+)/.exec(h.slice(b+g.length+1))[1])}catch{}return t.levels[u]===void 0&&(u=void 0),u}}function c(){if(!(typeof window===$||!n)){try{window.localStorage.removeItem(n)}catch{}try{window.document.cookie=encodeURIComponent(n)+"=; expires=Thu, 01 Jan 1970 00:00:00 UTC"}catch{}}}function d(u){var h=u;if(typeof h=="string"&&t.levels[h.toUpperCase()]!==void 0&&(h=t.levels[h.toUpperCase()]),typeof h=="number"&&h>=0&&h<=t.levels.SILENT)return h;throw new TypeError("log.setLevel() called with invalid level: "+u)}t.name=o,t.levels={TRACE:0,DEBUG:1,INFO:2,WARN:3,ERROR:4,SILENT:5},t.methodFactory=e||ns,t.getLevel=function(){return r??i??s},t.setLevel=function(u,h){return r=d(u),h!==!1&&a(r),ie.call(t)},t.setDefaultLevel=function(u){i=d(u),l()||t.setLevel(u,!1)},t.resetLevel=function(){r=null,c(),ie.call(t)},t.enableAll=function(u){t.setLevel(t.levels.TRACE,u)},t.disableAll=function(u){t.setLevel(t.levels.SILENT,u)},t.rebuild=function(){if(x!==t&&(s=d(x.getLevel())),ie.call(t),x===t)for(var u in oe)oe[u].rebuild()},s=d(x?x.getLevel():"WARN");var p=l();p!=null&&(r=d(p)),ie.call(t)}x=new qe,x.getLogger=function(e){if(typeof e!="symbol"&&typeof e!="string"||e==="")throw new TypeError("You must supply a name when creating a logger.");var t=oe[e];return t||(t=oe[e]=new qe(e,x.methodFactory)),t};var as=typeof window!==$?window.log:void 0;x.noConflict=function(){return typeof window!==$&&window.log===x&&(window.log=as),x},x.getLoggers=function(){return oe},x.default=x;var ls=function(o){for(var e=1,t=arguments.length,s;e<t;e++)for(s in arguments[e])Object.prototype.hasOwnProperty.call(arguments[e],s)&&(o[s]=arguments[e][s]);return o},cs={template:"[%t] %l:",levelFormatter:function(o){return o.toUpperCase()},nameFormatter:function(o){return o||"root"},timestampFormatter:function(o){return o.toTimeString().replace(/.*(\d{2}:\d{2}:\d{2}).*/,"$1")},format:void 0},et,G={},ds=function(o){if(!o||!o.getLogger)throw new TypeError("Argument is not a root logger");et=o},hs=function(o,e){if(!o||!o.setLevel)throw new TypeError("Argument is not a logger");var t=o.methodFactory,s=o.name||"",i=G[s]||G[""]||cs;function r(n,a,l){var c=t(n,a,l),d=G[l]||G[""],p=d.template.indexOf("%t")!==-1,u=d.template.indexOf("%l")!==-1,h=d.template.indexOf("%n")!==-1;return function(){for(var g="",b=arguments.length,f=Array(b),w=0;w<b;w++)f[w]=arguments[w];if(s||!G[l]){var _=d.timestampFormatter(new Date),k=d.levelFormatter(n),A=d.nameFormatter(l);d.format?g+=d.format(k,A,_):(g+=d.template,p&&(g=g.replace(/%t/,_)),u&&(g=g.replace(/%l/,k)),h&&(g=g.replace(/%n/,A))),f.length&&typeof f[0]=="string"?f[0]=g+" "+f[0]:f.unshift(g)}c.apply(void 0,f)}}return G[s]||(o.methodFactory=r),e=e||{},e.template&&(e.format=void 0),G[s]=ls({},i,e),o.setLevel(o.getLevel()),et||o.warn("It is necessary to call the function reg() of loglevel-plugin-prefix before calling apply. From the next release, it will throw an error. See more: https://github.com/kutuluk/loglevel-plugin-prefix/blob/master/README.md"),o},tt={reg:ds,apply:hs};const st={debug:"#0ea5e9",info:"#10b981",warn:"#f59e0b",error:"#ef4444"};tt.reg(x),tt.apply(x,{format(o,e,t){return st[o.toLowerCase()],`%c[${t}]%c %c[${o}]%c ${e?`%c[${e}]%c `:""}`},timestampFormatter(o){return o.toTimeString().split(" ")[0]+"."+o.getMilliseconds().toString().padStart(3,"0")}});const ms=x.methodFactory;x.methodFactory=function(o,e,t){const s=ms(o,e,t);return function(...i){if(i.length>0&&typeof i[0]=="string"&&i[0].includes("%c")){const r=st[o]||"#666",n=[i[0],`color: ${r}; font-weight: bold;`,"color: inherit;",`color: ${r}; font-weight: bold;`,"color: inherit;",...t?[`color: ${r}; font-weight: bold;`,"color: inherit;"]:[],...i.slice(1)];s(...n)}else s(...i)}},x.setLevel("silent");const re=x.getLogger("MULTISELECT:INIT"),C=x.getLogger("MULTISELECT:DATA"),v=x.getLogger("MULTISELECT:UI"),T=x.getLogger("MULTISELECT:INTERACTION"),ot=["MULTISELECT:INIT","MULTISELECT:DATA","MULTISELECT:UI","MULTISELECT:INTERACTION"];function it(){x.setLevel("debug")}function rt(){x.setLevel("silent")}function nt(o){x.setLevel(o)}function at(o,e){x.getLogger(o).setLevel(e)}class lt{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),s=Math.max(0,e-this.bufferSize),i=Math.min(this.items.length,t+this.bufferSize);return{start:s,end:i}}render(){const{start:e,end:t}=this.calculateVisibleRange();if(e===this.visibleStart&&t===this.visibleEnd)return;this.visibleStart=e,this.visibleEnd=t,this.onVisibleRangeChange&&this.onVisibleRangeChange(e,t);let s="";for(let i=e;i<t;i++){const r=this.items[i],n=this.renderItem(r,i),a=i*this.itemHeight;s+=`<div class="ms__virtual-item" style="position: absolute; top: ${a}px; left: 0; right: 0; height: ${this.itemHeight}px;" data-index="${i}">`,s+=n,s+="</div>"}this.viewport.innerHTML=s}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,s=t+this.itemHeight,i=this.container.scrollTop,r=i+this.viewportHeight;t<i?this.container.scrollTop=t:s>r&&(this.container.scrollTop=s-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=""}}class ct{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,"hiddenInputs",[]);m(this,"focusedIndex",-1);m(this,"matchingIndices",new Set);m(this,"searchTerm","");m(this,"isLoading",!1);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,"dropdownCleanup",null);m(this,"hintCleanup",null);m(this,"selectedPopoverCleanup",null);m(this,"badgeTooltips",new Map);m(this,"badgeTooltipCleanups",new Map);m(this,"badgeTooltipShowTimeouts",new Map);m(this,"badgeTooltipHideTimeouts",new Map);m(this,"actionButtonTooltips",new Map);m(this,"actionButtonTooltipCleanups",new Map);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");this.element=e,this.instanceId=`MS-${Math.random().toString(36).substr(2,9)}`,this.options={searchHint:e.dataset.searchHint||"",searchPlaceholder:e.dataset.searchPlaceholder||"Search...",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,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()}getItemValue(e){return Array.isArray(e)&&e.length===2?e[0]:this.options.valueMember&&e[this.options.valueMember]!==void 0?e[this.options.valueMember]:this.options.getValueCallback?this.options.getValueCallback(e):"[N/A]"}getItemDisplayValue(e){return Array.isArray(e)&&e.length===2?String(e[1]):this.options.displayValueMember&&e[this.options.displayValueMember]!==void 0?String(e[this.options.displayValueMember]):this.options.getDisplayValueCallback?this.options.getDisplayValueCallback(e):"[N/A]"}getItemBadgeDisplayValue(e){return this.options.getBadgeDisplayCallback?this.options.getBadgeDisplayCallback(e):this.getItemDisplayValue(e)}getItemSearchValue(e){return this.options.searchValueMember&&e[this.options.searchValueMember]!==void 0?String(e[this.options.searchValueMember]):this.options.getSearchValueCallback?this.options.getSearchValueCallback(e):this.getItemDisplayValue(e)}getItemIcon(e){if(!Array.isArray(e)){if(this.options.iconMember&&e[this.options.iconMember]!==void 0)return String(e[this.options.iconMember]);if(this.options.getIconCallback)return this.options.getIconCallback(e)}}getItemSubtitle(e){if(!Array.isArray(e)){if(this.options.subtitleMember&&e[this.options.subtitleMember]!==void 0)return String(e[this.options.subtitleMember]);if(this.options.getSubtitleCallback)return this.options.getSubtitleCallback(e)}}getItemGroup(e){if(!Array.isArray(e)){if(this.options.groupMember&&e[this.options.groupMember]!==void 0)return String(e[this.options.groupMember]);if(this.options.getGroupCallback)return this.options.getGroupCallback(e)}}getItemDisabled(e){return Array.isArray(e)?!1:this.options.disabledMember&&e[this.options.disabledMember]!==void 0?!!e[this.options.disabledMember]:this.options.getDisabledCallback?this.options.getDisabledCallback(e):!1}init(){this.parseOptions(),this.buildHTML(),this.attachEvents(),this.parseInitialSelection(),re.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){C.error(`[${this.instanceId}] Failed to parse data-options:`,t),this.allOptions=[]}else this.options.options&&(this.allOptions=this.options.options);this.filteredOptions=[...this.allOptions]}buildHTML(){const e=this.options.container||document.body,t=this.element.getRootNode(),s=t instanceof ShadowRoot?t.host:this.element,i=s.getAttribute("dir")==="rtl",r=s.closest('[dir="rtl"]')!==null;this.isRTL=i||r,re.debug(`[${this.instanceId}] RTL Debug:`,{isShadowRoot:t instanceof ShadowRoot,hostElement:s,elementDir:s.getAttribute("dir"),hasElementDir:i,hasAncestorDir:r,isRTL:this.isRTL}),this.effectiveBadgesPosition=this.options.badgesPosition||"bottom",this.isRTL&&(this.effectiveBadgesPosition==="left"?this.effectiveBadgesPosition="right":this.effectiveBadgesPosition==="right"&&(this.effectiveBadgesPosition="left")),this.element.classList.add("ms"),this.isRTL&&(this.element.classList.add("ms--rtl"),re.debug(`[${this.instanceId}] Added ms--rtl class to element`)),(!this.options.isCheckboxesShown||!this.options.isMultipleEnabled)&&this.element.classList.add("ms--no-checkboxes");const n=document.createElement("div");n.className="ms__input-wrapper",this.input=document.createElement("input"),this.input.type="text",this.input.className="ms__input",this.input.placeholder=this.options.searchPlaceholder,this.input.autocomplete="off",this.options.searchInputMode==="readonly"?this.input.readOnly=!0:this.options.searchInputMode==="hidden"&&(this.input.style.display="none");const a=document.createElement("span");a.className="ms__toggle",a.innerHTML="▼",this.counter=document.createElement("span"),this.counter.className="ms__counter",this.counter.style.display="none",n.appendChild(this.input),n.appendChild(this.counter),n.appendChild(a),this.badgesContainer=document.createElement("div"),this.badgesContainer.className="ms__badges";const l=document.createElement("div");l.className="ms-wrapper",(this.effectiveBadgesPosition==="left"||this.effectiveBadgesPosition==="right")&&l.classList.add("ms-wrapper--inline"),l.appendChild(n),l.appendChild(this.badgesContainer),this.element.appendChild(l),this.dropdown=document.createElement("div"),this.dropdown.className="ms__dropdown",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",this.hint.textContent=this.options.searchHint,e.appendChild(this.hint)),this.selectedPopover=document.createElement("div"),this.selectedPopover.className="ms__selected-popover",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(){if(this.destroyAllActionButtonTooltips(),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 e="";if(this.isLoading){e+='<div class="ms__loader">',e+='<div class="pa-loader pa-loader--sm"></div>',e+=`<div class="ms__loading-text">${this.options.loadingMessage}</div>`,e+="</div>",this.dropdownInner.innerHTML=e;return}if(this.options.isMultipleEnabled&&this.options.actionButtons&&this.options.actionButtons.length>0){const t=this.options.isActionsSticky?" ms__actions--sticky":"",s=this.options.actionsLayout==="wrap"?" ms__actions--wrap":"";e+=`<div class="ms__actions${t}${s}">`,this.options.actionButtons.forEach(i=>{if(!(i.isVisibleCallback?i.isVisibleCallback(this):i.isVisible??!0))return;const a=(i.isDisabledCallback?i.isDisabledCallback(this):i.isDisabled??!1)?" disabled":"",l=i.getTextCallback?i.getTextCallback(this):i.text;let c="";if(i.getClassCallback){const d=i.getClassCallback(this);c=Array.isArray(d)?` ${d.join(" ")}`:d?` ${d}`:""}else i.cssClass&&(c=` ${i.cssClass}`);e+=`<button type="button"${a} class="ms__action-btn${c}" data-action="${i.action}">${l}</button>`}),e+="</div>"}if(e+='<div class="ms__options">',this.filteredOptions.length===0)e+=`<div class="ms__empty">${this.options.emptyMessage}</div>`;else if(this.options.isGroupsAllowed){const t=this.groupOptions(this.filteredOptions);Object.keys(t).forEach(s=>{if(e+='<div class="ms__group">',s!=="__ungrouped__")if(this.options.renderGroupLabelContentCallback){const i=this.options.renderGroupLabelContentCallback(s);if(i instanceof HTMLElement){const r=document.createElement("div");r.className="ms__group-label",r.appendChild(i),e+=r.outerHTML}else e+=`<div class="ms__group-label">${i}</div>`}else e+=`<div class="ms__group-label">${s}</div>`;t[s].forEach((i,r)=>{e+=this.renderOption(i,r)}),e+="</div>"})}else this.filteredOptions.forEach((t,s)=>{e+=this.renderOption(t,s)});e+="</div>",this.dropdownInner.innerHTML=e,this.attachActionButtonTooltips()}renderDropdownVirtual(){if(this.destroyAllActionButtonTooltips(),!this.virtualScroll){let s="";if(this.options.isMultipleEnabled&&this.options.actionButtons&&this.options.actionButtons.length>0){const n=this.options.isActionsSticky?" ms__actions--sticky":"",a=this.options.actionsLayout==="wrap"?" ms__actions--wrap":"";s+=`<div class="ms__actions${n}${a}">`,this.options.actionButtons.forEach(l=>{if(!(l.isVisibleCallback?l.isVisibleCallback(this):l.isVisible??!0))return;const p=(l.isDisabledCallback?l.isDisabledCallback(this):l.isDisabled??!1)?" disabled":"",u=l.getTextCallback?l.getTextCallback(this):l.text;let h="";if(l.getClassCallback){const g=l.getClassCallback(this);h=Array.isArray(g)?` ${g.join(" ")}`:g?` ${g}`:""}else l.cssClass&&(h=` ${l.cssClass}`);s+=`<button type="button"${p} class="ms__action-btn${h}" data-action="${l.action}">${u}</button>`}),s+="</div>"}const i=this.options.maxHeight||"20rem",r=this.options.optionHeight??50;s+=`<div class="ms__options ms__options--virtual" style="height: ${i}; max-height: ${i}; overflow-y: auto; position: relative; --ms-option-height: ${r}px;"></div>`,this.dropdownInner.innerHTML=s,this.optionsContainer=this.dropdownInner.querySelector(".ms__options")}if(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.options.optionHeight??50,t=this.options.virtualScrollBuffer??10;requestAnimationFrame(()=>{this.optionsContainer&&(this.virtualScroll?this.virtualScroll.setItems(this.filteredOptions):this.virtualScroll=new lt({container:this.optionsContainer,itemHeight:e,items:this.filteredOptions,renderItem:(s,i)=>this.renderOption(s,i),bufferSize:t}),this.attachActionButtonTooltips())})}renderOption(e,t){const s=this.getItemValue(e),i=this.getItemDisplayValue(e),r=this.getItemIcon(e),n=this.getItemSubtitle(e),a=this.getItemDisabled(e),l=this.selectedValues.has(String(s)),c=t===this.focusedIndex,d=this.matchingIndices.has(t),p=["ms__option"];l&&p.push("ms__option--selected"),c&&p.push("ms__option--focused"),d&&p.push("ms__option--matched"),a&&p.push("ms__option--disabled");const u=this.options.checkboxAlign&&this.options.checkboxAlign!=="center"?` data-checkbox-align="${this.options.checkboxAlign}"`:"";let h=`<div class="${p.join(" ")}" data-value="${s}" data-index="${t}"${u}>`;if(this.options.isCheckboxesShown&&this.options.isMultipleEnabled&&(h+=`<input type="checkbox" class="ms__checkbox" ${l?"checked":""} ${a?"disabled":""}>`),h+='<div class="ms__option-content">',this.options.renderOptionContentCallback){const g={index:t,isSelected:l,isFocused:c,isMatched:d,isDisabled:a},b=this.options.renderOptionContentCallback(e,g);typeof b=="string"?h+=b:h+=b.outerHTML}else r&&(h+=`<span class="ms__option-icon">${r}</span>`),h+='<div class="ms__option-text">',h+=`<div class="ms__option-title">${this.highlightMatch(i,this.searchTerm)}</div>`,n&&(h+=`<div class="ms__option-subtitle">${n}</div>`),h+="</div>";return h+="</div>",h+="</div>",h}highlightMatch(e,t){if(!t)return e;const s=new RegExp(`(${t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")})`,"gi");return e.replace(s,"<mark>$1</mark>")}groupOptions(e){const t={};return e.forEach(s=>{const i=this.getItemGroup(s)||"__ungrouped__";t[i]||(t[i]=[]),t[i].push(s)}),t}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])),v.warn(`[${this.instanceId}] renderBadges() single-select mode`,{isOpen:this.isOpen,count:t,selectedOptionsLength:e.length,willSetValue:!this.isOpen&&t>0&&e.length>0,selectedLabel:r}),!this.isOpen&&t>0&&e.length>0?(v.info(`[${this.instanceId}] ✅ SETTING input.value = "${r}"`),this.input.value=r,v.info(`[${this.instanceId}] 🔍 VERIFY input.value = "${this.input.value}"`)):this.isOpen?v.info(`[${this.instanceId}] ⏭️ SKIPPING input update (dropdown is open)`):(v.info(`[${this.instanceId}] ❌ CLEARING input.value (no selection)`),this.input.value="");return}let s=this.options.badgesDisplayMode;if(this.options.badgesThreshold!==null&&t>this.options.badgesThreshold&&s!=="none"&&(s=this.options.badgesThresholdMode||"count"),!this.isOpen)if(t>0&&s==="count"){const r=this.options.getCounterCallback?this.options.getCounterCallback(t):`${t} selected`;this.input.placeholder=r}else this.input.placeholder=this.options.searchPlaceholder;if(this.options.isCounterShown&&t>0?(this.counter.textContent=`[${t}]`,this.counter.style.display=""):this.counter.style.display="none",s==="none"){this.badgesContainer.innerHTML="";return}if(s==="badges")this.badgesContainer.className=`ms__badges ms__badges--${this.effectiveBadgesPosition}`,this.badgesContainer.innerHTML=e.map(r=>{const n=this.getItemValue(r);let a;if(this.options.renderBadgeContentCallback){const c={displayMode:"badges",isInPopover:!1},d=this.options.renderBadgeContentCallback(r,c);a=typeof d=="string"?d:d.outerHTML}else a=this.getItemBadgeDisplayValue(r);let l="ms__badge";if(this.options.getBadgeClassCallback){const c=this.options.getBadgeClassCallback(r),d=Array.isArray(c)?c:[c];l+=" "+d.filter(p=>p).join(" ")}return`
|
|
1
|
+
(function(y,I){typeof exports=="object"&&typeof module<"u"?I(exports):typeof define=="function"&&define.amd?define(["exports"],I):(y=typeof globalThis<"u"?globalThis:y||self,I(y.MultiSelect={}))})(this,function(y){"use strict";var bs=Object.defineProperty;var vs=(y,I,L)=>I in y?bs(y,I,{enumerable:!0,configurable:!0,writable:!0,value:L}):y[I]=L;var m=(y,I,L)=>vs(y,typeof I!="symbol"?I+"":I,L);const I=Math.min,L=Math.max,le=Math.round,ce=Math.floor,V=o=>({x:o,y:o}),ut={left:"right",right:"left",bottom:"top",top:"bottom"},gt={start:"end",end:"start"};function Ee(o,e,t){return L(o,I(e,t))}function de(o,e){return typeof o=="function"?o(e):o}function N(o){return o.split("-")[0]}function he(o){return o.split("-")[1]}function Me(o){return o==="x"?"y":"x"}function $e(o){return o==="y"?"height":"width"}const bt=new Set(["top","bottom"]);function D(o){return bt.has(N(o))?"y":"x"}function ze(o){return Me(D(o))}function vt(o,e,t){t===void 0&&(t=!1);const s=he(o),i=ze(o),r=$e(i);let n=i==="x"?s===(t?"end":"start")?"right":"left":s==="start"?"bottom":"top";return e.reference[r]>e.floating[r]&&(n=me(n)),[n,me(n)]}function ft(o){const e=me(o);return[_e(o),e,_e(e)]}function _e(o){return o.replace(/start|end/g,e=>gt[e])}const Ve=["left","right"],Pe=["right","left"],wt=["top","bottom"],_t=["bottom","top"];function xt(o,e,t){switch(o){case"top":case"bottom":return t?e?Pe:Ve:e?Ve:Pe;case"left":case"right":return e?wt:_t;default:return[]}}function Ct(o,e,t,s){const i=he(o);let r=xt(N(o),t==="start",s);return i&&(r=r.map(n=>n+"-"+i),e&&(r=r.concat(r.map(_e)))),r}function me(o){return o.replace(/left|right|bottom|top/g,e=>ut[e])}function yt(o){return{top:0,right:0,bottom:0,left:0,...o}}function kt(o){return typeof o!="number"?yt(o):{top:o,right:o,bottom:o,left:o}}function pe(o){const{x:e,y:t,width:s,height:i}=o;return{width:s,height:i,top:t,left:e,right:e+s,bottom:t+i,x:e,y:t}}function Be(o,e,t){let{reference:s,floating:i}=o;const r=D(e),n=ze(e),a=$e(n),l=N(e),c=r==="y",d=s.x+s.width/2-i.width/2,p=s.y+s.height/2-i.height/2,u=s[a]/2-i[a]/2;let h;switch(l){case"top":h={x:d,y:s.y-i.height};break;case"bottom":h={x:d,y:s.y+s.height};break;case"right":h={x:s.x+s.width,y:p};break;case"left":h={x:s.x-i.width,y:p};break;default:h={x:s.x,y:s.y}}switch(he(e)){case"start":h[n]-=u*(t&&c?-1:1);break;case"end":h[n]+=u*(t&&c?-1:1);break}return h}const St=async(o,e,t)=>{const{placement:s="bottom",strategy:i="absolute",middleware:r=[],platform:n}=t,a=r.filter(Boolean),l=await(n.isRTL==null?void 0:n.isRTL(e));let c=await n.getElementRects({reference:o,floating:e,strategy:i}),{x:d,y:p}=Be(c,s,l),u=s,h={},g=0;for(let b=0;b<a.length;b++){const{name:f,fn:w}=a[b],{x:_,y:C,data:A,reset:S}=await w({x:d,y:p,initialPlacement:s,placement:u,strategy:i,middlewareData:h,rects:c,platform:n,elements:{reference:o,floating:e}});d=_??d,p=C??p,h={...h,[f]:{...h[f],...A}},S&&g<=50&&(g++,typeof S=="object"&&(S.placement&&(u=S.placement),S.rects&&(c=S.rects===!0?await n.getElementRects({reference:o,floating:e,strategy:i}):S.rects),{x:d,y:p}=Be(c,u,l)),b=-1)}return{x:d,y:p,placement:u,strategy:i,middlewareData:h}};async function De(o,e){var t;e===void 0&&(e={});const{x:s,y:i,platform:r,rects:n,elements:a,strategy:l}=o,{boundary:c="clippingAncestors",rootBoundary:d="viewport",elementContext:p="floating",altBoundary:u=!1,padding:h=0}=de(e,o),g=kt(h),f=a[u?p==="floating"?"reference":"floating":p],w=pe(await r.getClippingRect({element:(t=await(r.isElement==null?void 0:r.isElement(f)))==null||t?f:f.contextElement||await(r.getDocumentElement==null?void 0:r.getDocumentElement(a.floating)),boundary:c,rootBoundary:d,strategy:l})),_=p==="floating"?{x:s,y:i,width:n.floating.width,height:n.floating.height}:n.reference,C=await(r.getOffsetParent==null?void 0:r.getOffsetParent(a.floating)),A=await(r.isElement==null?void 0:r.isElement(C))?await(r.getScale==null?void 0:r.getScale(C))||{x:1,y:1}:{x:1,y:1},S=pe(r.convertOffsetParentRelativeRectToViewportRelativeRect?await r.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:_,offsetParent:C,strategy:l}):_);return{top:(w.top-S.top+g.top)/A.y,bottom:(S.bottom-w.bottom+g.bottom)/A.y,left:(w.left-S.left+g.left)/A.x,right:(S.right-w.right+g.right)/A.x}}const Tt=function(o){return o===void 0&&(o={}),{name:"flip",options:o,async fn(e){var t,s;const{placement:i,middlewareData:r,rects:n,initialPlacement:a,platform:l,elements:c}=e,{mainAxis:d=!0,crossAxis:p=!0,fallbackPlacements:u,fallbackStrategy:h="bestFit",fallbackAxisSideDirection:g="none",flipAlignment:b=!0,...f}=de(o,e);if((t=r.arrow)!=null&&t.alignmentOffset)return{};const w=N(i),_=D(a),C=N(a)===a,A=await(l.isRTL==null?void 0:l.isRTL(c.floating)),S=u||(C||!b?[me(a)]:ft(a)),ne=g!=="none";!u&&ne&&S.push(...Ct(a,b,g,A));const J=[a,...S],Oe=await De(e,f),we=[];let X=((s=r.flip)==null?void 0:s.overflows)||[];if(d&&we.push(Oe[w]),p){const W=vt(i,n,A);we.push(Oe[W[0]],Oe[W[1]])}if(X=[...X,{placement:i,overflows:we}],!we.every(W=>W<=0)){var ht,mt;const W=(((ht=r.flip)==null?void 0:ht.index)||0)+1,Le=J[W];if(Le&&(!(p==="alignment"?_!==D(Le):!1)||X.every(z=>D(z.placement)===_?z.overflows[0]>0:!0)))return{data:{index:W,overflows:X},reset:{placement:Le}};let ae=(mt=X.filter(j=>j.overflows[0]<=0).sort((j,z)=>j.overflows[1]-z.overflows[1])[0])==null?void 0:mt.placement;if(!ae)switch(h){case"bestFit":{var pt;const j=(pt=X.filter(z=>{if(ne){const H=D(z.placement);return H===_||H==="y"}return!0}).map(z=>[z.placement,z.overflows.filter(H=>H>0).reduce((H,gs)=>H+gs,0)]).sort((z,H)=>z[1]-H[1])[0])==null?void 0:pt[0];j&&(ae=j);break}case"initialPlacement":ae=a;break}if(i!==ae)return{reset:{placement:ae}}}return{}}}},At=new Set(["left","top"]);async function It(o,e){const{placement:t,platform:s,elements:i}=o,r=await(s.isRTL==null?void 0:s.isRTL(i.floating)),n=N(t),a=he(t),l=D(t)==="y",c=At.has(n)?-1:1,d=r&&l?-1:1,p=de(e,o);let{mainAxis:u,crossAxis:h,alignmentAxis:g}=typeof p=="number"?{mainAxis:p,crossAxis:0,alignmentAxis:null}:{mainAxis:p.mainAxis||0,crossAxis:p.crossAxis||0,alignmentAxis:p.alignmentAxis};return a&&typeof g=="number"&&(h=a==="end"?g*-1:g),l?{x:h*d,y:u*c}:{x:u*c,y:h*d}}const Ot=function(o){return o===void 0&&(o=0),{name:"offset",options:o,async fn(e){var t,s;const{x:i,y:r,placement:n,middlewareData:a}=e,l=await It(e,o);return n===((t=a.offset)==null?void 0:t.placement)&&(s=a.arrow)!=null&&s.alignmentOffset?{}:{x:i+l.x,y:r+l.y,data:{...l,placement:n}}}}},Lt=function(o){return o===void 0&&(o={}),{name:"shift",options:o,async fn(e){const{x:t,y:s,placement:i}=e,{mainAxis:r=!0,crossAxis:n=!1,limiter:a={fn:f=>{let{x:w,y:_}=f;return{x:w,y:_}}},...l}=de(o,e),c={x:t,y:s},d=await De(e,l),p=D(N(i)),u=Me(p);let h=c[u],g=c[p];if(r){const f=u==="y"?"top":"left",w=u==="y"?"bottom":"right",_=h+d[f],C=h-d[w];h=Ee(_,h,C)}if(n){const f=p==="y"?"top":"left",w=p==="y"?"bottom":"right",_=g+d[f],C=g-d[w];g=Ee(_,g,C)}const b=a.fn({...e,[u]:h,[p]:g});return{...b,data:{x:b.x-t,y:b.y-s,enabled:{[u]:r,[p]:n}}}}}};function ue(){return typeof window<"u"}function U(o){return Re(o)?(o.nodeName||"").toLowerCase():"#document"}function O(o){var e;return(o==null||(e=o.ownerDocument)==null?void 0:e.defaultView)||window}function P(o){var e;return(e=(Re(o)?o.ownerDocument:o.document)||window.document)==null?void 0:e.documentElement}function Re(o){return ue()?o instanceof Node||o instanceof O(o).Node:!1}function E(o){return ue()?o instanceof Element||o instanceof O(o).Element:!1}function B(o){return ue()?o instanceof HTMLElement||o instanceof O(o).HTMLElement:!1}function He(o){return!ue()||typeof ShadowRoot>"u"?!1:o instanceof ShadowRoot||o instanceof O(o).ShadowRoot}const Et=new Set(["inline","contents"]);function Z(o){const{overflow:e,overflowX:t,overflowY:s,display:i}=M(o);return/auto|scroll|overlay|hidden|clip/.test(e+s+t)&&!Et.has(i)}const Mt=new Set(["table","td","th"]);function $t(o){return Mt.has(U(o))}const zt=[":popover-open",":modal"];function ge(o){return zt.some(e=>{try{return o.matches(e)}catch{return!1}})}const Vt=["transform","translate","scale","rotate","perspective"],Pt=["transform","translate","scale","rotate","perspective","filter"],Bt=["paint","layout","strict","content"];function xe(o){const e=Ce(),t=E(o)?M(o):o;return Vt.some(s=>t[s]?t[s]!=="none":!1)||(t.containerType?t.containerType!=="normal":!1)||!e&&(t.backdropFilter?t.backdropFilter!=="none":!1)||!e&&(t.filter?t.filter!=="none":!1)||Pt.some(s=>(t.willChange||"").includes(s))||Bt.some(s=>(t.contain||"").includes(s))}function Dt(o){let e=R(o);for(;B(e)&&!K(e);){if(xe(e))return e;if(ge(e))return null;e=R(e)}return null}function Ce(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const Rt=new Set(["html","body","#document"]);function K(o){return Rt.has(U(o))}function M(o){return O(o).getComputedStyle(o)}function be(o){return E(o)?{scrollLeft:o.scrollLeft,scrollTop:o.scrollTop}:{scrollLeft:o.scrollX,scrollTop:o.scrollY}}function R(o){if(U(o)==="html")return o;const e=o.assignedSlot||o.parentNode||He(o)&&o.host||P(o);return He(e)?e.host:e}function Ne(o){const e=R(o);return K(e)?o.ownerDocument?o.ownerDocument.body:o.body:B(e)&&Z(e)?e:Ne(e)}function Q(o,e,t){var s;e===void 0&&(e=[]),t===void 0&&(t=!0);const i=Ne(o),r=i===((s=o.ownerDocument)==null?void 0:s.body),n=O(i);if(r){const a=ye(n);return e.concat(n,n.visualViewport||[],Z(i)?i:[],a&&t?Q(a):[])}return e.concat(i,Q(i,[],t))}function ye(o){return o.parent&&Object.getPrototypeOf(o.parent)?o.frameElement:null}function Fe(o){const e=M(o);let t=parseFloat(e.width)||0,s=parseFloat(e.height)||0;const i=B(o),r=i?o.offsetWidth:t,n=i?o.offsetHeight:s,a=le(t)!==r||le(s)!==n;return a&&(t=r,s=n),{width:t,height:s,$:a}}function ke(o){return E(o)?o:o.contextElement}function Y(o){const e=ke(o);if(!B(e))return V(1);const t=e.getBoundingClientRect(),{width:s,height:i,$:r}=Fe(e);let n=(r?le(t.width):t.width)/s,a=(r?le(t.height):t.height)/i;return(!n||!Number.isFinite(n))&&(n=1),(!a||!Number.isFinite(a))&&(a=1),{x:n,y:a}}const Ht=V(0);function Ge(o){const e=O(o);return!Ce()||!e.visualViewport?Ht:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function Nt(o,e,t){return e===void 0&&(e=!1),!t||e&&t!==O(o)?!1:e}function F(o,e,t,s){e===void 0&&(e=!1),t===void 0&&(t=!1);const i=o.getBoundingClientRect(),r=ke(o);let n=V(1);e&&(s?E(s)&&(n=Y(s)):n=Y(o));const a=Nt(r,t,s)?Ge(r):V(0);let l=(i.left+a.x)/n.x,c=(i.top+a.y)/n.y,d=i.width/n.x,p=i.height/n.y;if(r){const u=O(r),h=s&&E(s)?O(s):s;let g=u,b=ye(g);for(;b&&s&&h!==g;){const f=Y(b),w=b.getBoundingClientRect(),_=M(b),C=w.left+(b.clientLeft+parseFloat(_.paddingLeft))*f.x,A=w.top+(b.clientTop+parseFloat(_.paddingTop))*f.y;l*=f.x,c*=f.y,d*=f.x,p*=f.y,l+=C,c+=A,g=O(b),b=ye(g)}}return pe({width:d,height:p,x:l,y:c})}function ve(o,e){const t=be(o).scrollLeft;return e?e.left+t:F(P(o)).left+t}function We(o,e){const t=o.getBoundingClientRect(),s=t.left+e.scrollLeft-ve(o,t),i=t.top+e.scrollTop;return{x:s,y:i}}function Ft(o){let{elements:e,rect:t,offsetParent:s,strategy:i}=o;const r=i==="fixed",n=P(s),a=e?ge(e.floating):!1;if(s===n||a&&r)return t;let l={scrollLeft:0,scrollTop:0},c=V(1);const d=V(0),p=B(s);if((p||!p&&!r)&&((U(s)!=="body"||Z(n))&&(l=be(s)),B(s))){const h=F(s);c=Y(s),d.x=h.x+s.clientLeft,d.y=h.y+s.clientTop}const u=n&&!p&&!r?We(n,l):V(0);return{width:t.width*c.x,height:t.height*c.y,x:t.x*c.x-l.scrollLeft*c.x+d.x+u.x,y:t.y*c.y-l.scrollTop*c.y+d.y+u.y}}function Gt(o){return Array.from(o.getClientRects())}function Wt(o){const e=P(o),t=be(o),s=o.ownerDocument.body,i=L(e.scrollWidth,e.clientWidth,s.scrollWidth,s.clientWidth),r=L(e.scrollHeight,e.clientHeight,s.scrollHeight,s.clientHeight);let n=-t.scrollLeft+ve(o);const a=-t.scrollTop;return M(s).direction==="rtl"&&(n+=L(e.clientWidth,s.clientWidth)-i),{width:i,height:r,x:n,y:a}}const je=25;function jt(o,e){const t=O(o),s=P(o),i=t.visualViewport;let r=s.clientWidth,n=s.clientHeight,a=0,l=0;if(i){r=i.width,n=i.height;const d=Ce();(!d||d&&e==="fixed")&&(a=i.offsetLeft,l=i.offsetTop)}const c=ve(s);if(c<=0){const d=s.ownerDocument,p=d.body,u=getComputedStyle(p),h=d.compatMode==="CSS1Compat"&&parseFloat(u.marginLeft)+parseFloat(u.marginRight)||0,g=Math.abs(s.clientWidth-p.clientWidth-h);g<=je&&(r-=g)}else c<=je&&(r+=c);return{width:r,height:n,x:a,y:l}}const Ut=new Set(["absolute","fixed"]);function Kt(o,e){const t=F(o,!0,e==="fixed"),s=t.top+o.clientTop,i=t.left+o.clientLeft,r=B(o)?Y(o):V(1),n=o.clientWidth*r.x,a=o.clientHeight*r.y,l=i*r.x,c=s*r.y;return{width:n,height:a,x:l,y:c}}function Ue(o,e,t){let s;if(e==="viewport")s=jt(o,t);else if(e==="document")s=Wt(P(o));else if(E(e))s=Kt(e,t);else{const i=Ge(o);s={x:e.x-i.x,y:e.y-i.y,width:e.width,height:e.height}}return pe(s)}function Ke(o,e){const t=R(o);return t===e||!E(t)||K(t)?!1:M(t).position==="fixed"||Ke(t,e)}function Yt(o,e){const t=e.get(o);if(t)return t;let s=Q(o,[],!1).filter(a=>E(a)&&U(a)!=="body"),i=null;const r=M(o).position==="fixed";let n=r?R(o):o;for(;E(n)&&!K(n);){const a=M(n),l=xe(n);!l&&a.position==="fixed"&&(i=null),(r?!l&&!i:!l&&a.position==="static"&&!!i&&Ut.has(i.position)||Z(n)&&!l&&Ke(o,n))?s=s.filter(d=>d!==n):i=a,n=R(n)}return e.set(o,s),s}function Jt(o){let{element:e,boundary:t,rootBoundary:s,strategy:i}=o;const n=[...t==="clippingAncestors"?ge(e)?[]:Yt(e,this._c):[].concat(t),s],a=n[0],l=n.reduce((c,d)=>{const p=Ue(e,d,i);return c.top=L(p.top,c.top),c.right=I(p.right,c.right),c.bottom=I(p.bottom,c.bottom),c.left=L(p.left,c.left),c},Ue(e,a,i));return{width:l.right-l.left,height:l.bottom-l.top,x:l.left,y:l.top}}function Xt(o){const{width:e,height:t}=Fe(o);return{width:e,height:t}}function Zt(o,e,t){const s=B(e),i=P(e),r=t==="fixed",n=F(o,!0,r,e);let a={scrollLeft:0,scrollTop:0};const l=V(0);function c(){l.x=ve(i)}if(s||!s&&!r)if((U(e)!=="body"||Z(i))&&(a=be(e)),s){const h=F(e,!0,r,e);l.x=h.x+e.clientLeft,l.y=h.y+e.clientTop}else i&&c();r&&!s&&i&&c();const d=i&&!s&&!r?We(i,a):V(0),p=n.left+a.scrollLeft-l.x-d.x,u=n.top+a.scrollTop-l.y-d.y;return{x:p,y:u,width:n.width,height:n.height}}function Se(o){return M(o).position==="static"}function Ye(o,e){if(!B(o)||M(o).position==="fixed")return null;if(e)return e(o);let t=o.offsetParent;return P(o)===t&&(t=t.ownerDocument.body),t}function Je(o,e){const t=O(o);if(ge(o))return t;if(!B(o)){let i=R(o);for(;i&&!K(i);){if(E(i)&&!Se(i))return i;i=R(i)}return t}let s=Ye(o,e);for(;s&&$t(s)&&Se(s);)s=Ye(s,e);return s&&K(s)&&Se(s)&&!xe(s)?t:s||Dt(o)||t}const Qt=async function(o){const e=this.getOffsetParent||Je,t=this.getDimensions,s=await t(o.floating);return{reference:Zt(o.reference,await e(o.floating),o.strategy),floating:{x:0,y:0,width:s.width,height:s.height}}};function qt(o){return M(o).direction==="rtl"}const es={convertOffsetParentRelativeRectToViewportRelativeRect:Ft,getDocumentElement:P,getClippingRect:Jt,getOffsetParent:Je,getElementRects:Qt,getClientRects:Gt,getDimensions:Xt,getScale:Y,isElement:E,isRTL:qt};function Xe(o,e){return o.x===e.x&&o.y===e.y&&o.width===e.width&&o.height===e.height}function ts(o,e){let t=null,s;const i=P(o);function r(){var a;clearTimeout(s),(a=t)==null||a.disconnect(),t=null}function n(a,l){a===void 0&&(a=!1),l===void 0&&(l=1),r();const c=o.getBoundingClientRect(),{left:d,top:p,width:u,height:h}=c;if(a||e(),!u||!h)return;const g=ce(p),b=ce(i.clientWidth-(d+u)),f=ce(i.clientHeight-(p+h)),w=ce(d),C={rootMargin:-g+"px "+-b+"px "+-f+"px "+-w+"px",threshold:L(0,I(1,l))||1};let A=!0;function S(ne){const J=ne[0].intersectionRatio;if(J!==l){if(!A)return n();J?n(!1,J):s=setTimeout(()=>{n(!1,1e-7)},1e3)}J===1&&!Xe(c,o.getBoundingClientRect())&&n(),A=!1}try{t=new IntersectionObserver(S,{...C,root:i.ownerDocument})}catch{t=new IntersectionObserver(S,C)}t.observe(o)}return n(!0),r}function q(o,e,t,s){s===void 0&&(s={});const{ancestorScroll:i=!0,ancestorResize:r=!0,elementResize:n=typeof ResizeObserver=="function",layoutShift:a=typeof IntersectionObserver=="function",animationFrame:l=!1}=s,c=ke(o),d=i||r?[...c?Q(c):[],...Q(e)]:[];d.forEach(w=>{i&&w.addEventListener("scroll",t,{passive:!0}),r&&w.addEventListener("resize",t)});const p=c&&a?ts(c,t):null;let u=-1,h=null;n&&(h=new ResizeObserver(w=>{let[_]=w;_&&_.target===c&&h&&(h.unobserve(e),cancelAnimationFrame(u),u=requestAnimationFrame(()=>{var C;(C=h)==null||C.observe(e)})),t()}),c&&!l&&h.observe(c),h.observe(e));let g,b=l?F(o):null;l&&f();function f(){const w=F(o);b&&!Xe(b,w)&&t(),b=w,g=requestAnimationFrame(f)}return t(),()=>{var w;d.forEach(_=>{i&&_.removeEventListener("scroll",t),r&&_.removeEventListener("resize",t)}),p==null||p(),(w=h)==null||w.disconnect(),h=null,l&&cancelAnimationFrame(g)}}const ee=Ot,te=Lt,fe=Tt,se=(o,e,t)=>{const s=new Map,i={platform:es,...t},r={...i.platform,_c:s};return St(o,e,{...i,platform:r})};var Ze=function(){},$="undefined",ss=typeof window!==$&&typeof window.navigator!==$&&/Trident\/|MSIE /.test(window.navigator.userAgent),Te=["trace","debug","info","warn","error"],oe={},x=null;function Qe(o,e){var t=o[e];if(typeof t.bind=="function")return t.bind(o);try{return Function.prototype.bind.call(t,o)}catch{return function(){return Function.prototype.apply.apply(t,[o,arguments])}}}function os(){console.log&&(console.log.apply?console.log.apply(console,arguments):Function.prototype.apply.apply(console.log,[console,arguments])),console.trace&&console.trace()}function is(o){return o==="debug"&&(o="log"),typeof console===$?!1:o==="trace"&&ss?os:console[o]!==void 0?Qe(console,o):console.log!==void 0?Qe(console,"log"):Ze}function ie(){for(var o=this.getLevel(),e=0;e<Te.length;e++){var t=Te[e];this[t]=e<o?Ze:this.methodFactory(t,o,this.name)}if(this.log=this.debug,typeof console===$&&o<this.levels.SILENT)return"No console available for logging"}function rs(o){return function(){typeof console!==$&&(ie.call(this),this[o].apply(this,arguments))}}function ns(o,e,t){return is(o)||rs.apply(this,arguments)}function qe(o,e){var t=this,s,i,r,n="loglevel";typeof o=="string"?n+=":"+o:typeof o=="symbol"&&(n=void 0);function a(u){var h=(Te[u]||"silent").toUpperCase();if(!(typeof window===$||!n)){try{window.localStorage[n]=h;return}catch{}try{window.document.cookie=encodeURIComponent(n)+"="+h+";"}catch{}}}function l(){var u;if(!(typeof window===$||!n)){try{u=window.localStorage[n]}catch{}if(typeof u===$)try{var h=window.document.cookie,g=encodeURIComponent(n),b=h.indexOf(g+"=");b!==-1&&(u=/^([^;]+)/.exec(h.slice(b+g.length+1))[1])}catch{}return t.levels[u]===void 0&&(u=void 0),u}}function c(){if(!(typeof window===$||!n)){try{window.localStorage.removeItem(n)}catch{}try{window.document.cookie=encodeURIComponent(n)+"=; expires=Thu, 01 Jan 1970 00:00:00 UTC"}catch{}}}function d(u){var h=u;if(typeof h=="string"&&t.levels[h.toUpperCase()]!==void 0&&(h=t.levels[h.toUpperCase()]),typeof h=="number"&&h>=0&&h<=t.levels.SILENT)return h;throw new TypeError("log.setLevel() called with invalid level: "+u)}t.name=o,t.levels={TRACE:0,DEBUG:1,INFO:2,WARN:3,ERROR:4,SILENT:5},t.methodFactory=e||ns,t.getLevel=function(){return r??i??s},t.setLevel=function(u,h){return r=d(u),h!==!1&&a(r),ie.call(t)},t.setDefaultLevel=function(u){i=d(u),l()||t.setLevel(u,!1)},t.resetLevel=function(){r=null,c(),ie.call(t)},t.enableAll=function(u){t.setLevel(t.levels.TRACE,u)},t.disableAll=function(u){t.setLevel(t.levels.SILENT,u)},t.rebuild=function(){if(x!==t&&(s=d(x.getLevel())),ie.call(t),x===t)for(var u in oe)oe[u].rebuild()},s=d(x?x.getLevel():"WARN");var p=l();p!=null&&(r=d(p)),ie.call(t)}x=new qe,x.getLogger=function(e){if(typeof e!="symbol"&&typeof e!="string"||e==="")throw new TypeError("You must supply a name when creating a logger.");var t=oe[e];return t||(t=oe[e]=new qe(e,x.methodFactory)),t};var as=typeof window!==$?window.log:void 0;x.noConflict=function(){return typeof window!==$&&window.log===x&&(window.log=as),x},x.getLoggers=function(){return oe},x.default=x;var ls=function(o){for(var e=1,t=arguments.length,s;e<t;e++)for(s in arguments[e])Object.prototype.hasOwnProperty.call(arguments[e],s)&&(o[s]=arguments[e][s]);return o},cs={template:"[%t] %l:",levelFormatter:function(o){return o.toUpperCase()},nameFormatter:function(o){return o||"root"},timestampFormatter:function(o){return o.toTimeString().replace(/.*(\d{2}:\d{2}:\d{2}).*/,"$1")},format:void 0},et,G={},ds=function(o){if(!o||!o.getLogger)throw new TypeError("Argument is not a root logger");et=o},hs=function(o,e){if(!o||!o.setLevel)throw new TypeError("Argument is not a logger");var t=o.methodFactory,s=o.name||"",i=G[s]||G[""]||cs;function r(n,a,l){var c=t(n,a,l),d=G[l]||G[""],p=d.template.indexOf("%t")!==-1,u=d.template.indexOf("%l")!==-1,h=d.template.indexOf("%n")!==-1;return function(){for(var g="",b=arguments.length,f=Array(b),w=0;w<b;w++)f[w]=arguments[w];if(s||!G[l]){var _=d.timestampFormatter(new Date),C=d.levelFormatter(n),A=d.nameFormatter(l);d.format?g+=d.format(C,A,_):(g+=d.template,p&&(g=g.replace(/%t/,_)),u&&(g=g.replace(/%l/,C)),h&&(g=g.replace(/%n/,A))),f.length&&typeof f[0]=="string"?f[0]=g+" "+f[0]:f.unshift(g)}c.apply(void 0,f)}}return G[s]||(o.methodFactory=r),e=e||{},e.template&&(e.format=void 0),G[s]=ls({},i,e),o.setLevel(o.getLevel()),et||o.warn("It is necessary to call the function reg() of loglevel-plugin-prefix before calling apply. From the next release, it will throw an error. See more: https://github.com/kutuluk/loglevel-plugin-prefix/blob/master/README.md"),o},tt={reg:ds,apply:hs};const st={debug:"#0ea5e9",info:"#10b981",warn:"#f59e0b",error:"#ef4444"};tt.reg(x),tt.apply(x,{format(o,e,t){return st[o.toLowerCase()],`%c[${t}]%c %c[${o}]%c ${e?`%c[${e}]%c `:""}`},timestampFormatter(o){return o.toTimeString().split(" ")[0]+"."+o.getMilliseconds().toString().padStart(3,"0")}});const ms=x.methodFactory;x.methodFactory=function(o,e,t){const s=ms(o,e,t);return function(...i){if(i.length>0&&typeof i[0]=="string"&&i[0].includes("%c")){const r=st[o]||"#666",n=[i[0],`color: ${r}; font-weight: bold;`,"color: inherit;",`color: ${r}; font-weight: bold;`,"color: inherit;",...t?[`color: ${r}; font-weight: bold;`,"color: inherit;"]:[],...i.slice(1)];s(...n)}else s(...i)}},x.setLevel("silent");const re=x.getLogger("MULTISELECT:INIT"),k=x.getLogger("MULTISELECT:DATA"),v=x.getLogger("MULTISELECT:UI"),T=x.getLogger("MULTISELECT:INTERACTION"),ot=["MULTISELECT:INIT","MULTISELECT:DATA","MULTISELECT:UI","MULTISELECT:INTERACTION"];function it(){x.setLevel("debug")}function rt(){x.setLevel("silent")}function nt(o){x.setLevel(o)}function at(o,e){x.getLogger(o).setLevel(e)}class lt{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),s=Math.max(0,e-this.bufferSize),i=Math.min(this.items.length,t+this.bufferSize);return{start:s,end:i}}render(){const{start:e,end:t}=this.calculateVisibleRange();if(e===this.visibleStart&&t===this.visibleEnd)return;this.visibleStart=e,this.visibleEnd=t,this.onVisibleRangeChange&&this.onVisibleRangeChange(e,t);let s="";for(let i=e;i<t;i++){const r=this.items[i],n=this.renderItem(r,i),a=i*this.itemHeight;s+=`<div class="ms__virtual-item" style="position: absolute; top: ${a}px; left: 0; right: 0; height: ${this.itemHeight}px;" data-index="${i}">`,s+=n,s+="</div>"}this.viewport.innerHTML=s}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,s=t+this.itemHeight,i=this.container.scrollTop,r=i+this.viewportHeight;t<i?this.container.scrollTop=t:s>r&&(this.container.scrollTop=s-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=""}}class ct{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,"hiddenInputs",[]);m(this,"focusedIndex",-1);m(this,"matchingIndices",new Set);m(this,"searchTerm","");m(this,"isLoading",!1);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,"dropdownCleanup",null);m(this,"hintCleanup",null);m(this,"selectedPopoverCleanup",null);m(this,"badgeTooltips",new Map);m(this,"badgeTooltipCleanups",new Map);m(this,"badgeTooltipShowTimeouts",new Map);m(this,"badgeTooltipHideTimeouts",new Map);m(this,"actionButtonTooltips",new Map);m(this,"actionButtonTooltipCleanups",new Map);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");this.element=e,this.instanceId=`MS-${Math.random().toString(36).substr(2,9)}`,this.options={searchHint:e.dataset.searchHint||"",searchPlaceholder:e.dataset.searchPlaceholder||"Search...",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,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()}getItemValue(e){return Array.isArray(e)&&e.length===2?e[0]:this.options.valueMember&&e[this.options.valueMember]!==void 0?e[this.options.valueMember]:this.options.getValueCallback?this.options.getValueCallback(e):"[N/A]"}getItemDisplayValue(e){return Array.isArray(e)&&e.length===2?String(e[1]):this.options.displayValueMember&&e[this.options.displayValueMember]!==void 0?String(e[this.options.displayValueMember]):this.options.getDisplayValueCallback?this.options.getDisplayValueCallback(e):"[N/A]"}getItemBadgeDisplayValue(e){return this.options.getBadgeDisplayCallback?this.options.getBadgeDisplayCallback(e):this.getItemDisplayValue(e)}getItemSearchValue(e){return this.options.searchValueMember&&e[this.options.searchValueMember]!==void 0?String(e[this.options.searchValueMember]):this.options.getSearchValueCallback?this.options.getSearchValueCallback(e):this.getItemDisplayValue(e)}getItemIcon(e){if(!Array.isArray(e)){if(this.options.iconMember&&e[this.options.iconMember]!==void 0)return String(e[this.options.iconMember]);if(this.options.getIconCallback)return this.options.getIconCallback(e)}}getItemSubtitle(e){if(!Array.isArray(e)){if(this.options.subtitleMember&&e[this.options.subtitleMember]!==void 0)return String(e[this.options.subtitleMember]);if(this.options.getSubtitleCallback)return this.options.getSubtitleCallback(e)}}getItemGroup(e){if(!Array.isArray(e)){if(this.options.groupMember&&e[this.options.groupMember]!==void 0)return String(e[this.options.groupMember]);if(this.options.getGroupCallback)return this.options.getGroupCallback(e)}}getItemDisabled(e){return Array.isArray(e)?!1:this.options.disabledMember&&e[this.options.disabledMember]!==void 0?!!e[this.options.disabledMember]:this.options.getDisabledCallback?this.options.getDisabledCallback(e):!1}init(){this.parseOptions(),this.buildHTML(),this.attachEvents(),this.parseInitialSelection(),re.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){k.error(`[${this.instanceId}] Failed to parse data-options:`,t),this.allOptions=[]}else this.options.options&&(this.allOptions=this.options.options);this.filteredOptions=[...this.allOptions]}buildHTML(){const e=this.options.container||document.body,t=this.element.getRootNode(),s=t instanceof ShadowRoot?t.host:this.element,i=s.getAttribute("dir")==="rtl",r=s.closest('[dir="rtl"]')!==null;this.isRTL=i||r,re.debug(`[${this.instanceId}] RTL Debug:`,{isShadowRoot:t instanceof ShadowRoot,hostElement:s,elementDir:s.getAttribute("dir"),hasElementDir:i,hasAncestorDir:r,isRTL:this.isRTL}),this.effectiveBadgesPosition=this.options.badgesPosition||"bottom",this.isRTL&&(this.effectiveBadgesPosition==="left"?this.effectiveBadgesPosition="right":this.effectiveBadgesPosition==="right"&&(this.effectiveBadgesPosition="left")),this.element.classList.add("ms"),this.isRTL&&(this.element.classList.add("ms--rtl"),re.debug(`[${this.instanceId}] Added ms--rtl class to element`)),(!this.options.isCheckboxesShown||!this.options.isMultipleEnabled)&&this.element.classList.add("ms--no-checkboxes");const n=document.createElement("div");n.className="ms__input-wrapper",this.input=document.createElement("input"),this.input.type="text",this.input.className="ms__input",this.input.placeholder=this.options.searchPlaceholder,this.input.autocomplete="off",this.options.searchInputMode==="readonly"?this.input.readOnly=!0:this.options.searchInputMode==="hidden"&&(this.input.style.display="none");const a=document.createElement("span");a.className="ms__toggle",a.innerHTML="▼",this.counter=document.createElement("span"),this.counter.className="ms__counter",this.counter.style.display="none",n.appendChild(this.input),n.appendChild(this.counter),n.appendChild(a),this.badgesContainer=document.createElement("div"),this.badgesContainer.className="ms__badges";const l=document.createElement("div");l.className="ms-wrapper",(this.effectiveBadgesPosition==="left"||this.effectiveBadgesPosition==="right")&&l.classList.add("ms-wrapper--inline"),l.appendChild(n),l.appendChild(this.badgesContainer),this.element.appendChild(l),this.dropdown=document.createElement("div"),this.dropdown.className="ms__dropdown",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",this.hint.textContent=this.options.searchHint,e.appendChild(this.hint)),this.selectedPopover=document.createElement("div"),this.selectedPopover.className="ms__selected-popover",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(){if(this.destroyAllActionButtonTooltips(),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 e="";if(this.isLoading){e+='<div class="ms__loader">',e+='<div class="pa-loader pa-loader--sm"></div>',e+=`<div class="ms__loading-text">${this.options.loadingMessage}</div>`,e+="</div>",this.dropdownInner.innerHTML=e;return}if(this.options.isMultipleEnabled&&this.options.actionButtons&&this.options.actionButtons.length>0){const t=this.options.isActionsSticky?" ms__actions--sticky":"",s=this.options.actionsLayout==="wrap"?" ms__actions--wrap":"";e+=`<div class="ms__actions${t}${s}">`,this.options.actionButtons.forEach(i=>{if(!(i.isVisibleCallback?i.isVisibleCallback(this):i.isVisible??!0))return;const a=(i.isDisabledCallback?i.isDisabledCallback(this):i.isDisabled??!1)?" disabled":"",l=i.getTextCallback?i.getTextCallback(this):i.text;let c="";if(i.getClassCallback){const d=i.getClassCallback(this);c=Array.isArray(d)?` ${d.join(" ")}`:d?` ${d}`:""}else i.cssClass&&(c=` ${i.cssClass}`);e+=`<button type="button"${a} class="ms__action-btn${c}" data-action="${i.action}">${l}</button>`}),e+="</div>"}if(e+='<div class="ms__options">',this.filteredOptions.length===0)e+=`<div class="ms__empty">${this.options.emptyMessage}</div>`;else if(this.options.isGroupsAllowed){const t=this.groupOptions(this.filteredOptions);Object.keys(t).forEach(s=>{if(e+='<div class="ms__group">',s!=="__ungrouped__")if(this.options.renderGroupLabelContentCallback){const i=this.options.renderGroupLabelContentCallback(s);if(i instanceof HTMLElement){const r=document.createElement("div");r.className="ms__group-label",r.appendChild(i),e+=r.outerHTML}else e+=`<div class="ms__group-label">${i}</div>`}else e+=`<div class="ms__group-label">${s}</div>`;t[s].forEach((i,r)=>{e+=this.renderOption(i,r)}),e+="</div>"})}else this.filteredOptions.forEach((t,s)=>{e+=this.renderOption(t,s)});e+="</div>",this.dropdownInner.innerHTML=e,this.attachActionButtonTooltips()}renderDropdownVirtual(){if(this.destroyAllActionButtonTooltips(),!this.virtualScroll){let s="";if(this.options.isMultipleEnabled&&this.options.actionButtons&&this.options.actionButtons.length>0){const n=this.options.isActionsSticky?" ms__actions--sticky":"",a=this.options.actionsLayout==="wrap"?" ms__actions--wrap":"";s+=`<div class="ms__actions${n}${a}">`,this.options.actionButtons.forEach(l=>{if(!(l.isVisibleCallback?l.isVisibleCallback(this):l.isVisible??!0))return;const p=(l.isDisabledCallback?l.isDisabledCallback(this):l.isDisabled??!1)?" disabled":"",u=l.getTextCallback?l.getTextCallback(this):l.text;let h="";if(l.getClassCallback){const g=l.getClassCallback(this);h=Array.isArray(g)?` ${g.join(" ")}`:g?` ${g}`:""}else l.cssClass&&(h=` ${l.cssClass}`);s+=`<button type="button"${p} class="ms__action-btn${h}" data-action="${l.action}">${u}</button>`}),s+="</div>"}const i=this.options.maxHeight||"20rem",r=this.options.optionHeight??50;s+=`<div class="ms__options ms__options--virtual" style="height: ${i}; max-height: ${i}; overflow-y: auto; position: relative; --ms-option-height: ${r}px;"></div>`,this.dropdownInner.innerHTML=s,this.optionsContainer=this.dropdownInner.querySelector(".ms__options")}if(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.options.optionHeight??50,t=this.options.virtualScrollBuffer??10;requestAnimationFrame(()=>{this.optionsContainer&&(this.virtualScroll?this.virtualScroll.setItems(this.filteredOptions):this.virtualScroll=new lt({container:this.optionsContainer,itemHeight:e,items:this.filteredOptions,renderItem:(s,i)=>this.renderOption(s,i),bufferSize:t}),this.attachActionButtonTooltips())})}renderOption(e,t){const s=this.getItemValue(e),i=this.getItemDisplayValue(e),r=this.getItemIcon(e),n=this.getItemSubtitle(e),a=this.getItemDisabled(e),l=this.selectedValues.has(String(s)),c=t===this.focusedIndex,d=this.matchingIndices.has(t),p=["ms__option"];l&&p.push("ms__option--selected"),c&&p.push("ms__option--focused"),d&&p.push("ms__option--matched"),a&&p.push("ms__option--disabled");const u=this.options.checkboxAlign&&this.options.checkboxAlign!=="center"?` data-checkbox-align="${this.options.checkboxAlign}"`:"";let h=`<div class="${p.join(" ")}" data-value="${s}" data-index="${t}"${u}>`;if(this.options.isCheckboxesShown&&this.options.isMultipleEnabled&&(h+=`<input type="checkbox" class="ms__checkbox" ${l?"checked":""} ${a?"disabled":""}>`),h+='<div class="ms__option-content">',this.options.renderOptionContentCallback){const g={index:t,isSelected:l,isFocused:c,isMatched:d,isDisabled:a},b=this.options.renderOptionContentCallback(e,g);typeof b=="string"?h+=b:h+=b.outerHTML}else r&&(h+=`<span class="ms__option-icon">${r}</span>`),h+='<div class="ms__option-text">',h+=`<div class="ms__option-title">${this.highlightMatch(i,this.searchTerm)}</div>`,n&&(h+=`<div class="ms__option-subtitle">${n}</div>`),h+="</div>";return h+="</div>",h+="</div>",h}highlightMatch(e,t){if(!t)return e;const s=new RegExp(`(${t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")})`,"gi");return e.replace(s,"<mark>$1</mark>")}groupOptions(e){const t={};return e.forEach(s=>{const i=this.getItemGroup(s)||"__ungrouped__";t[i]||(t[i]=[]),t[i].push(s)}),t}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])),v.warn(`[${this.instanceId}] renderBadges() single-select mode`,{isOpen:this.isOpen,count:t,selectedOptionsLength:e.length,willSetValue:!this.isOpen&&t>0&&e.length>0,selectedLabel:r}),!this.isOpen&&t>0&&e.length>0?(v.info(`[${this.instanceId}] ✅ SETTING input.value = "${r}"`),this.input.value=r,v.info(`[${this.instanceId}] 🔍 VERIFY input.value = "${this.input.value}"`)):this.isOpen?v.info(`[${this.instanceId}] ⏭️ SKIPPING input update (dropdown is open)`):(v.info(`[${this.instanceId}] ❌ CLEARING input.value (no selection)`),this.input.value="");return}let s=this.options.badgesDisplayMode;if(this.options.badgesThreshold!==null&&t>this.options.badgesThreshold&&s!=="none"&&(s=this.options.badgesThresholdMode||"count"),!this.isOpen)if(t>0&&s==="count"){const r=this.options.getCounterCallback?this.options.getCounterCallback(t):`${t} selected`;this.input.placeholder=r}else this.input.placeholder=this.options.searchPlaceholder;if(this.options.isCounterShown&&t>0?(this.counter.textContent=`[${t}]`,this.counter.style.display=""):this.counter.style.display="none",s==="none"){this.badgesContainer.innerHTML="";return}if(s==="badges")this.badgesContainer.className=`ms__badges ms__badges--${this.effectiveBadgesPosition}`,this.badgesContainer.innerHTML=e.map(r=>{const n=this.getItemValue(r);let a;if(this.options.renderBadgeContentCallback){const c={displayMode:"badges",isInPopover:!1},d=this.options.renderBadgeContentCallback(r,c);a=typeof d=="string"?d:d.outerHTML}else a=this.getItemBadgeDisplayValue(r);let l="ms__badge";if(this.options.getBadgeClassCallback){const c=this.options.getBadgeClassCallback(r),d=Array.isArray(c)?c:[c];l+=" "+d.filter(p=>p).join(" ")}return`
|
|
2
2
|
<div class="${l}">
|
|
3
3
|
<span class="ms__badge-text">${a}</span>
|
|
4
4
|
<button type="button" class="ms__badge-remove" data-value="${n}" aria-label="Remove ${this.getItemBadgeDisplayValue(r)}"></button>
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
<span class="ms__badge-text">${r}</span>
|
|
24
24
|
<button type="button" class="ms__badge-remove" data-action="clear-count" aria-label="Clear all selections"></button>
|
|
25
25
|
</div>
|
|
26
|
-
`}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.open()}),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)),setTimeout(()=>{document.addEventListener("click",e=>this.handleClickOutside(e))},0),this.dropdown.addEventListener("click",e=>this.handleDropdownClick(e)),this.dropdownInner.addEventListener("wheel",e=>{if(this.virtualScroll)return;const t=e.currentTarget,s=t.scrollTop===0,i=t.scrollTop+t.clientHeight>=t.scrollHeight;(e.deltaY<0&&s||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 s=this.options.beforeSearchCallback(e);if(s===null){C.debug(`[${this.instanceId}] beforeSearchCallback blocked search for term:`,e),this.filteredOptions=[...this.allOptions],this.matchingIndices.clear(),this.renderDropdown();return}t=s,t!==e&&C.debug(`[${this.instanceId}] beforeSearchCallback transformed: "${e}" -> "${t}"`)}if(this.options.searchCallback){if(t.length<this.options.minSearchLength){this.isLoading=!1,this.options.isKeepOptionsOnSearch?(this.filteredOptions=[...this.allOptions],C.debug(`[${this.instanceId}] Search term below minimum, showing ${this.allOptions.length} initial options`)):this.filteredOptions=[],this.matchingIndices.clear(),this.renderDropdown();return}this.isLoading=!0,this.renderDropdown(),C.debug(`[${this.instanceId}] Loading data for search term:`,t);try{const s=await this.options.searchCallback(t);if(this.searchTerm===e){const i=s||[];this.filteredOptions=[...i],this.isLoading=!1,this.matchingIndices.clear(),this.focusedIndex=this.options.isSearchEnabled&&this.filteredOptions.length>0?0:-1,this.renderDropdown(),C.debug(`[${this.instanceId}] Loaded ${i.length} results`)}}catch(s){C.error(`[${this.instanceId}] Error loading data:`,s),this.isLoading=!1,this.options.isKeepOptionsOnSearch?this.filteredOptions=[...this.allOptions]:this.filteredOptions=[],this.matchingIndices.clear(),this.renderDropdown()}}else{if(!t)this.filteredOptions=[...this.allOptions],this.matchingIndices.clear(),this.focusedIndex=this.filteredOptions.length>0?0:-1;else{const s=this.options.searchMode||"filter",i=t.toLowerCase();if(s==="filter")this.filteredOptions=this.allOptions.filter(r=>this.getItemSearchValue(r).toLowerCase().includes(i)),this.matchingIndices.clear(),this.focusedIndex=this.filteredOptions.length>0?0:-1,C.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,C.debug(`[${this.instanceId}] Navigate mode: ${this.matchingIndices.size} matches, jumped to index ${r}`)):C.debug(`[${this.instanceId}] Navigate mode: No matches found, keeping previous focus`)}}this.renderDropdown(),this.options.searchMode==="navigate"&&this.focusedIndex>=0&&this.scrollToFocused()}}handleKeydown(e){if(!this.isOpen){(e.key==="Enter"||e.key==="ArrowDown")&&(e.preventDefault(),this.open());return}if(!this.options.isSearchEnabled){const t=e.key.length===1||e.key==="Backspace"||e.key==="Delete",s=["ArrowUp","ArrowDown","PageUp","PageDown","Home","End","Enter","Escape","Tab"].includes(e.key);if(t&&!s){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());break;case"Escape":e.preventDefault(),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 i;T.debug(`[${this.instanceId}] Dropdown clicked`,{target:e.target.className}),e.stopPropagation();const t=e.target.closest("[data-action]");if(t){e.preventDefault();const r=t.dataset.action;if(T.debug(`[${this.instanceId}] Action button clicked:`,r),r==="select-all")this.selectAll();else if(r==="clear-all")this.clearAll();else if(r==="custom"){const n=(i=this.options.actionButtons)==null?void 0:i.find(a=>{var l;return a.action==="custom"&&a.text===((l=t.textContent)==null?void 0:l.trim())});n!=null&&n.onClick&&n.onClick(this)}return}const s=e.target.closest(".ms__option");if(s&&!s.classList.contains("ms__option--disabled")){e.preventDefault();const r=s.dataset.value,n=this.filteredOptions.find(a=>String(this.getItemValue(a))===r);T.debug(`[${this.instanceId}] Option clicked:`,{value:r,closeOnSelect:this.options.isCloseOnSelect,placeholder:this.options.searchPlaceholder}),n&&this.toggleOption(n)}}handleBadgeClick(e){if(e.target.closest('[data-action="clear-count"]')){e.preventDefault(),e.stopPropagation(),T.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"){T.debug(`[${this.instanceId}] Remove hidden items button clicked`);const l=this.options.badgesMaxVisible||3;Array.from(this.selectedOptions.values()).slice(l).forEach(p=>this.deselectOption(p));return}const n=i.dataset.value,a=this.selectedOptions.get(n);a&&this.deselectOption(a);return}if(e.target.closest(".ms__badge--more")&&!e.target.closest(".ms__badge-remove")){e.preventDefault(),e.stopPropagation(),T.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"]')))){v.debug(`[${this.instanceId}] Closing selected popover due to click outside`),this.hideSelectedPopover();return}if(!this.isOpen)return;const s=t.some(r=>r instanceof Node&&(this.element.contains(r)||this.dropdown.contains(r)||this.hint&&this.hint.contains(r)));T.debug(`[${this.instanceId}] handleClickOutside`,{target:e.target.className,targetTag:e.target.tagName,clickedInside:s,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}),s||(T.warn(`[${this.instanceId}] Closing dropdown due to click outside`),this.close())}focusNext(){this.filteredOptions.length!==0&&(this.focusedIndex=Math.min(this.filteredOptions.length-1,this.focusedIndex+1),this.renderDropdown(),this.scrollToFocused())}focusPrevious(){this.filteredOptions.length!==0&&(this.focusedIndex=Math.max(0,this.focusedIndex-1),this.renderDropdown(),this.scrollToFocused())}focusFirst(){this.filteredOptions.length!==0&&(this.focusedIndex=0,this.renderDropdown(),this.scrollToFocused())}focusLast(){this.filteredOptions.length!==0&&(this.focusedIndex=this.filteredOptions.length-1,this.renderDropdown(),this.scrollToFocused())}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),s=(t+1)%e.length;this.focusedIndex=e[s],this.renderDropdown(),this.scrollToFocused(),T.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),s=t<=0?e.length-1:t-1;this.focusedIndex=e[s],this.renderDropdown(),this.scrollToFocused(),T.debug(`[${this.instanceId}] Jumped to previous match: index ${this.focusedIndex} (${t+1} of ${e.length})`)}focusPageUp(){this.filteredOptions.length!==0&&(this.focusedIndex=Math.max(0,this.focusedIndex-10),this.renderDropdown(),this.scrollToFocused())}focusPageDown(){this.filteredOptions.length!==0&&(this.focusedIndex=Math.min(this.filteredOptions.length-1,this.focusedIndex+10),this.renderDropdown(),this.scrollToFocused())}scrollToFocused(){if(this.virtualScroll&&this.focusedIndex>=0)this.virtualScroll.scrollToIndex(this.focusedIndex);else{const e=this.dropdown.querySelector(".ms__option--focused");e&&e.scrollIntoView({block:"nearest",behavior:"smooth"})}}toggleOption(e){const t=this.getItemValue(e),s=String(t);if(T.debug(`[${this.instanceId}] toggleOption called`,{value:t,multiple:this.options.isMultipleEnabled}),!this.options.isMultipleEnabled){this.selectedValues.has(s)?(T.debug(`[${this.instanceId}] Deselecting option in single-select mode`,{value:t}),this.deselectOption(e)):(T.debug(`[${this.instanceId}] Clearing previous selections and selecting new option`,{value:t}),this.selectedValues.clear(),this.selectedOptions.clear(),this.selectOption(e)),v.info(`[${this.instanceId}] ❌ Closing dropdown (single-select mode)`),this.close();return}this.selectedValues.has(s)?(T.debug(`[${this.instanceId}] Deselecting option`,{value:t}),this.deselectOption(e)):(T.debug(`[${this.instanceId}] Selecting option`,{value:t}),this.selectOption(e)),T.debug(`[${this.instanceId}] Checking closeOnSelect`,{closeOnSelect:this.options.isCloseOnSelect,willClose:this.options.isCloseOnSelect===!0,placeholder:this.options.searchPlaceholder}),this.options.isCloseOnSelect?(v.info(`[${this.instanceId}] ❌ Closing dropdown (closeOnSelect=true)`),this.close()):v.info(`[${this.instanceId}] ✅ Keeping dropdown open (closeOnSelect=false)`)}async handleAddNew(e){if(this.options.addNewCallback)try{C.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){C.error(`[${this.instanceId}] Error adding new option:`,t)}}selectOption(e){const t=this.getItemValue(e),s=String(t);this.selectedValues.add(s),this.selectedOptions.set(s,e),this.renderDropdown(),this.renderBadges(),this.updateHiddenInput(),this.options.selectCallback&&this.options.selectCallback(e),this.options.changeCallback&&this.options.changeCallback(this.getSelected())}deselectOption(e){const t=this.getItemValue(e),s=String(t);this.selectedValues.delete(s),this.selectedOptions.delete(s),this.renderDropdown(),this.renderBadges(),this.updateHiddenInput(),this.options.deselectCallback&&this.options.deselectCallback(e),this.options.changeCallback&&this.options.changeCallback(this.getSelected())}selectAll(){this.filteredOptions.forEach(e=>{if(!this.getItemDisabled(e)){const t=this.getItemValue(e),s=String(t);this.selectedValues.add(s),this.selectedOptions.set(s,e)}}),this.renderDropdown(),this.renderBadges(),this.updateHiddenInput(),this.options.changeCallback&&this.options.changeCallback(this.getSelected())}clearAll(){this.selectedValues.clear(),this.selectedOptions.clear(),this.renderDropdown(),this.renderBadges(),this.updateHiddenInput(),this.options.changeCallback&&this.options.changeCallback(this.getSelected())}open(){v.debug(`[${this.instanceId}] open() called`,{isOpen:this.isOpen}),!this.isOpen&&(this.isOpen=!0,this.element.classList.add("ms--open"),this.dropdown.classList.add("ms__dropdown--visible"),v.info(`[${this.instanceId}] Dropdown opened`),this.input.placeholder=this.options.searchPlaceholder,!this.options.isMultipleEnabled&&this.options.isSearchEnabled&&(this.input.value=""),this.options.searchCallback&&this.options.isKeepOptionsOnSearch&&!this.searchTerm&&(this.filteredOptions=[...this.allOptions],v.debug(`[${this.instanceId}] Showing ${this.allOptions.length} initial options on open`)),this.renderDropdown(),this.positionDropdown(),this.hint&&(this.hint.classList.add("ms__hint--visible"),this.positionHint()))}close(){if(v.debug(`[${this.instanceId}] close() called`,{isOpen:this.isOpen}),!!this.isOpen){if(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="";const e=this.options.isMultipleEnabled||this.options.isSearchEnabled;v.warn(`[${this.instanceId}] close() - input clearing decision`,{multiple:this.options.isMultipleEnabled,enableSearch:this.options.isSearchEnabled,willClearInput:e,currentInputValue:this.input.value}),e?(v.info(`[${this.instanceId}] 🧹 close() CLEARING input.value`),this.input.value=""):v.info(`[${this.instanceId}] 🔒 close() KEEPING input.value = "${this.input.value}"`),this.filteredOptions=[...this.allOptions]}this.focusedIndex=-1,v.info(`[${this.instanceId}] 📞 close() CALLING renderBadges()`),this.renderBadges(),v.info(`[${this.instanceId}] ✅ close() AFTER renderBadges(), input.value = "${this.input.value}"`),this.dropdownCleanup&&(this.dropdownCleanup(),this.dropdownCleanup=null),this.hintCleanup&&(this.hintCleanup(),this.hintCleanup=null),this.dropdownPlacement=null,v.info(`[${this.instanceId}] Dropdown closed. Stack trace:`),v.trace()}}positionDropdown(){this.dropdownCleanup=q(this.input,this.dropdown,()=>{const e=this.options.isPlacementLocked&&this.dropdownPlacement?this.dropdownPlacement:"bottom-start",t=[ee(4),...this.options.isPlacementLocked&&this.dropdownPlacement?[]:[fe()],te({padding:8})];se(this.input,this.dropdown,{placement:e,middleware:t}).then(({x:s,y:i,placement:r})=>{this.options.isPlacementLocked&&!this.dropdownPlacement&&(this.dropdownPlacement=r,v.debug(`[${this.instanceId}] Locked dropdown placement:`,r));const n={left:`${s}px`,top:`${i}px`,width:`${this.input.offsetWidth}px`};this.options.dropdownMinWidth&&(n.minWidth=this.options.dropdownMinWidth),this.options.dropdownMaxWidth&&(n.maxWidth=this.options.dropdownMaxWidth),Object.assign(this.dropdown.style,n),this.hint&&this.isOpen&&this.positionHint()})})}positionHint(){this.hint&&(this.hintCleanup&&this.hintCleanup(),this.hintCleanup=q(this.input,this.hint,()=>{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"))),se(this.input,this.hint,{placement:e,middleware:[ee(4),te({padding:8})]}).then(({x:t,y:s})=>{Object.assign(this.hint.style,{left:`${t}px`,top:`${s}px`})})}))}parseInitialSelection(){const e=this.element.dataset.initialValues;if(e)try{JSON.parse(e).forEach(s=>{const i=String(s);this.selectedValues.add(i);const r=this.allOptions.find(n=>String(this.getItemValue(n))===i);r&&this.selectedOptions.set(i,r)}),this.renderBadges()}catch(t){C.error(`[${this.instanceId}] Failed to parse initial values:`,t)}}toggleSelectedPopover(){this.showSelectedPopover?this.hideSelectedPopover():this.showPopover()}showPopover(){v.debug(`[${this.instanceId}] showPopover() called`),this.isOpen&&this.close(),this.showSelectedPopover=!0,this.renderSelectedPopover(),this.selectedPopover.classList.add("ms__selected-popover--visible"),this.selectedValues.size>=100&&this.selectedPopover.classList.add("ms__selected-popover--virtual"),this.positionSelectedPopover()}hideSelectedPopover(){v.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.selectedPopoverPlacement=null,this.selectedPopoverVirtualScroll&&(this.selectedPopoverVirtualScroll.destroy(),this.selectedPopoverVirtualScroll=null,this.selectedPopoverContainer=null),this.selectedPopoverCleanup&&(this.selectedPopoverCleanup(),this.selectedPopoverCleanup=null)}renderSelectedPopover(){const e=Array.from(this.selectedOptions.values()),t=this.selectedValues.size;if(t>=100){this.renderSelectedPopoverVirtual(e,t);return}this.selectedPopover.innerHTML=`
|
|
26
|
+
`}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.open()}),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)),setTimeout(()=>{document.addEventListener("click",e=>this.handleClickOutside(e))},0),this.dropdown.addEventListener("click",e=>this.handleDropdownClick(e)),this.dropdownInner.addEventListener("wheel",e=>{if(this.virtualScroll)return;const t=e.currentTarget,s=t.scrollTop===0,i=t.scrollTop+t.clientHeight>=t.scrollHeight;(e.deltaY<0&&s||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 s=this.options.beforeSearchCallback(e);if(s===null){k.debug(`[${this.instanceId}] beforeSearchCallback blocked search for term:`,e),this.filteredOptions=[...this.allOptions],this.matchingIndices.clear(),this.renderDropdown();return}t=s,t!==e&&k.debug(`[${this.instanceId}] beforeSearchCallback transformed: "${e}" -> "${t}"`)}if(this.options.searchCallback){if(t.length<this.options.minSearchLength){this.isLoading=!1,this.options.isKeepOptionsOnSearch?(this.filteredOptions=[...this.allOptions],k.debug(`[${this.instanceId}] Search term below minimum, showing ${this.allOptions.length} initial options`)):this.filteredOptions=[],this.matchingIndices.clear(),this.renderDropdown();return}this.isLoading=!0,this.renderDropdown(),k.debug(`[${this.instanceId}] Loading data for search term:`,t);try{const s=await this.options.searchCallback(t);if(this.searchTerm===e){const i=s||[];this.filteredOptions=[...i],this.isLoading=!1,this.matchingIndices.clear(),this.focusedIndex=this.options.isSearchEnabled&&this.filteredOptions.length>0?0:-1,this.renderDropdown(),k.debug(`[${this.instanceId}] Loaded ${i.length} results`)}}catch(s){k.error(`[${this.instanceId}] Error loading data:`,s),this.isLoading=!1,this.options.isKeepOptionsOnSearch?this.filteredOptions=[...this.allOptions]:this.filteredOptions=[],this.matchingIndices.clear(),this.renderDropdown()}}else{if(!t)this.filteredOptions=[...this.allOptions],this.matchingIndices.clear(),this.focusedIndex=this.filteredOptions.length>0?0:-1;else{const s=this.options.searchMode||"filter",i=t.toLowerCase();if(s==="filter")this.filteredOptions=this.allOptions.filter(r=>this.getItemSearchValue(r).toLowerCase().includes(i)),this.matchingIndices.clear(),this.focusedIndex=this.filteredOptions.length>0?0:-1,k.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,k.debug(`[${this.instanceId}] Navigate mode: ${this.matchingIndices.size} matches, jumped to index ${r}`)):k.debug(`[${this.instanceId}] Navigate mode: No matches found, keeping previous focus`)}}this.renderDropdown(),this.options.searchMode==="navigate"&&this.focusedIndex>=0&&this.scrollToFocused()}}handleKeydown(e){if(!this.isOpen){(e.key==="Enter"||e.key==="ArrowDown")&&(e.preventDefault(),this.open());return}if(!this.options.isSearchEnabled){const t=e.key.length===1||e.key==="Backspace"||e.key==="Delete",s=["ArrowUp","ArrowDown","PageUp","PageDown","Home","End","Enter","Escape","Tab"].includes(e.key);if(t&&!s){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());break;case"Escape":e.preventDefault(),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 i;T.debug(`[${this.instanceId}] Dropdown clicked`,{target:e.target.className}),e.stopPropagation();const t=e.target.closest("[data-action]");if(t){e.preventDefault();const r=t.dataset.action;if(T.debug(`[${this.instanceId}] Action button clicked:`,r),r==="select-all")this.selectAll();else if(r==="clear-all")this.clearAll();else if(r==="custom"){const n=(i=this.options.actionButtons)==null?void 0:i.find(a=>{var l;return a.action==="custom"&&a.text===((l=t.textContent)==null?void 0:l.trim())});n!=null&&n.onClick&&n.onClick(this)}return}const s=e.target.closest(".ms__option");if(s&&!s.classList.contains("ms__option--disabled")){e.preventDefault();const r=s.dataset.value,n=this.filteredOptions.find(a=>String(this.getItemValue(a))===r);T.debug(`[${this.instanceId}] Option clicked:`,{value:r,closeOnSelect:this.options.isCloseOnSelect,placeholder:this.options.searchPlaceholder}),n&&this.toggleOption(n)}}handleBadgeClick(e){if(e.target.closest('[data-action="clear-count"]')){e.preventDefault(),e.stopPropagation(),T.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"){T.debug(`[${this.instanceId}] Remove hidden items button clicked`);const l=this.options.badgesMaxVisible||3;Array.from(this.selectedOptions.values()).slice(l).forEach(p=>this.deselectOption(p));return}const n=i.dataset.value,a=this.selectedOptions.get(n);a&&this.deselectOption(a);return}if(e.target.closest(".ms__badge--more")&&!e.target.closest(".ms__badge-remove")){e.preventDefault(),e.stopPropagation(),T.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"]')))){v.debug(`[${this.instanceId}] Closing selected popover due to click outside`),this.hideSelectedPopover();return}if(!this.isOpen)return;const s=t.some(r=>r instanceof Node&&(this.element.contains(r)||this.dropdown.contains(r)||this.hint&&this.hint.contains(r)));T.debug(`[${this.instanceId}] handleClickOutside`,{target:e.target.className,targetTag:e.target.tagName,clickedInside:s,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}),s||(T.warn(`[${this.instanceId}] Closing dropdown due to click outside`),this.close())}focusNext(){this.filteredOptions.length!==0&&(this.focusedIndex=Math.min(this.filteredOptions.length-1,this.focusedIndex+1),this.renderDropdown(),this.scrollToFocused())}focusPrevious(){this.filteredOptions.length!==0&&(this.focusedIndex=Math.max(0,this.focusedIndex-1),this.renderDropdown(),this.scrollToFocused())}focusFirst(){this.filteredOptions.length!==0&&(this.focusedIndex=0,this.renderDropdown(),this.scrollToFocused())}focusLast(){this.filteredOptions.length!==0&&(this.focusedIndex=this.filteredOptions.length-1,this.renderDropdown(),this.scrollToFocused())}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),s=(t+1)%e.length;this.focusedIndex=e[s],this.renderDropdown(),this.scrollToFocused(),T.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),s=t<=0?e.length-1:t-1;this.focusedIndex=e[s],this.renderDropdown(),this.scrollToFocused(),T.debug(`[${this.instanceId}] Jumped to previous match: index ${this.focusedIndex} (${t+1} of ${e.length})`)}focusPageUp(){this.filteredOptions.length!==0&&(this.focusedIndex=Math.max(0,this.focusedIndex-10),this.renderDropdown(),this.scrollToFocused())}focusPageDown(){this.filteredOptions.length!==0&&(this.focusedIndex=Math.min(this.filteredOptions.length-1,this.focusedIndex+10),this.renderDropdown(),this.scrollToFocused())}scrollToFocused(){if(this.virtualScroll&&this.focusedIndex>=0)this.virtualScroll.scrollToIndex(this.focusedIndex);else{const e=this.dropdown.querySelector(".ms__option--focused");e&&e.scrollIntoView({block:"nearest",behavior:"smooth"})}}toggleOption(e){const t=this.getItemValue(e),s=String(t);if(T.debug(`[${this.instanceId}] toggleOption called`,{value:t,multiple:this.options.isMultipleEnabled}),!this.options.isMultipleEnabled){this.selectedValues.has(s)?(T.debug(`[${this.instanceId}] Deselecting option in single-select mode`,{value:t}),this.deselectOption(e)):(T.debug(`[${this.instanceId}] Clearing previous selections and selecting new option`,{value:t}),this.selectedValues.clear(),this.selectedOptions.clear(),this.selectOption(e)),v.info(`[${this.instanceId}] ❌ Closing dropdown (single-select mode)`),this.close();return}this.selectedValues.has(s)?(T.debug(`[${this.instanceId}] Deselecting option`,{value:t}),this.deselectOption(e)):(T.debug(`[${this.instanceId}] Selecting option`,{value:t}),this.selectOption(e)),T.debug(`[${this.instanceId}] Checking closeOnSelect`,{closeOnSelect:this.options.isCloseOnSelect,willClose:this.options.isCloseOnSelect===!0,placeholder:this.options.searchPlaceholder}),this.options.isCloseOnSelect?(v.info(`[${this.instanceId}] ❌ Closing dropdown (closeOnSelect=true)`),this.close()):v.info(`[${this.instanceId}] ✅ Keeping dropdown open (closeOnSelect=false)`)}async handleAddNew(e){if(this.options.addNewCallback)try{k.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){k.error(`[${this.instanceId}] Error adding new option:`,t)}}selectOption(e){const t=this.getItemValue(e),s=String(t);this.selectedValues.add(s),this.selectedOptions.set(s,e),this.renderDropdown(),this.renderBadges(),this.updateHiddenInput(),this.options.selectCallback&&this.options.selectCallback(e),this.options.changeCallback&&this.options.changeCallback(this.getSelected())}deselectOption(e){const t=this.getItemValue(e),s=String(t);this.selectedValues.delete(s),this.selectedOptions.delete(s),this.renderDropdown(),this.renderBadges(),this.updateHiddenInput(),this.options.deselectCallback&&this.options.deselectCallback(e),this.options.changeCallback&&this.options.changeCallback(this.getSelected())}selectAll(){this.filteredOptions.forEach(e=>{if(!this.getItemDisabled(e)){const t=this.getItemValue(e),s=String(t);this.selectedValues.add(s),this.selectedOptions.set(s,e)}}),this.renderDropdown(),this.renderBadges(),this.updateHiddenInput(),this.options.changeCallback&&this.options.changeCallback(this.getSelected())}clearAll(){this.selectedValues.clear(),this.selectedOptions.clear(),this.renderDropdown(),this.renderBadges(),this.updateHiddenInput(),this.options.changeCallback&&this.options.changeCallback(this.getSelected())}open(){v.debug(`[${this.instanceId}] open() called`,{isOpen:this.isOpen}),!this.isOpen&&(this.isOpen=!0,this.element.classList.add("ms--open"),this.dropdown.classList.add("ms__dropdown--visible"),v.info(`[${this.instanceId}] Dropdown opened`),this.input.placeholder=this.options.searchPlaceholder,!this.options.isMultipleEnabled&&this.options.isSearchEnabled&&(this.input.value=""),this.options.searchCallback&&this.options.isKeepOptionsOnSearch&&!this.searchTerm&&(this.filteredOptions=[...this.allOptions],v.debug(`[${this.instanceId}] Showing ${this.allOptions.length} initial options on open`)),this.renderDropdown(),this.positionDropdown(),this.hint&&(this.hint.classList.add("ms__hint--visible"),this.positionHint()))}close(){if(v.debug(`[${this.instanceId}] close() called`,{isOpen:this.isOpen}),!!this.isOpen){if(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="";const e=this.options.isMultipleEnabled||this.options.isSearchEnabled;v.warn(`[${this.instanceId}] close() - input clearing decision`,{multiple:this.options.isMultipleEnabled,enableSearch:this.options.isSearchEnabled,willClearInput:e,currentInputValue:this.input.value}),e?(v.info(`[${this.instanceId}] 🧹 close() CLEARING input.value`),this.input.value=""):v.info(`[${this.instanceId}] 🔒 close() KEEPING input.value = "${this.input.value}"`),this.filteredOptions=[...this.allOptions]}this.focusedIndex=-1,v.info(`[${this.instanceId}] 📞 close() CALLING renderBadges()`),this.renderBadges(),v.info(`[${this.instanceId}] ✅ close() AFTER renderBadges(), input.value = "${this.input.value}"`),this.dropdownCleanup&&(this.dropdownCleanup(),this.dropdownCleanup=null),this.hintCleanup&&(this.hintCleanup(),this.hintCleanup=null),this.dropdownPlacement=null,v.info(`[${this.instanceId}] Dropdown closed. Stack trace:`),v.trace()}}positionDropdown(){this.dropdownCleanup=q(this.input,this.dropdown,()=>{const e=this.options.isPlacementLocked&&this.dropdownPlacement?this.dropdownPlacement:"bottom-start",t=[ee(4),...this.options.isPlacementLocked&&this.dropdownPlacement?[]:[fe()],te({padding:8})];se(this.input,this.dropdown,{placement:e,middleware:t}).then(({x:s,y:i,placement:r})=>{this.options.isPlacementLocked&&!this.dropdownPlacement&&(this.dropdownPlacement=r,v.debug(`[${this.instanceId}] Locked dropdown placement:`,r));const n={left:`${s}px`,top:`${i}px`,width:`${this.input.offsetWidth}px`};this.options.dropdownMinWidth&&(n.minWidth=this.options.dropdownMinWidth),this.options.dropdownMaxWidth&&(n.maxWidth=this.options.dropdownMaxWidth),Object.assign(this.dropdown.style,n),this.hint&&this.isOpen&&this.positionHint()})})}positionHint(){this.hint&&(this.hintCleanup&&this.hintCleanup(),this.hintCleanup=q(this.input,this.hint,()=>{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"))),se(this.input,this.hint,{placement:e,middleware:[ee(4),te({padding:8})]}).then(({x:t,y:s})=>{Object.assign(this.hint.style,{left:`${t}px`,top:`${s}px`})})}))}parseInitialSelection(){const e=this.element.dataset.initialValues;if(e)try{JSON.parse(e).forEach(s=>{const i=String(s);this.selectedValues.add(i);const r=this.allOptions.find(n=>String(this.getItemValue(n))===i);r&&this.selectedOptions.set(i,r)}),this.renderBadges()}catch(t){k.error(`[${this.instanceId}] Failed to parse initial values:`,t)}}toggleSelectedPopover(){this.showSelectedPopover?this.hideSelectedPopover():this.showPopover()}showPopover(){v.debug(`[${this.instanceId}] showPopover() called`),this.isOpen&&this.close(),this.showSelectedPopover=!0,this.renderSelectedPopover(),this.selectedPopover.classList.add("ms__selected-popover--visible"),this.selectedValues.size>=100&&this.selectedPopover.classList.add("ms__selected-popover--virtual"),this.positionSelectedPopover()}hideSelectedPopover(){v.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.selectedPopoverPlacement=null,this.selectedPopoverVirtualScroll&&(this.selectedPopoverVirtualScroll.destroy(),this.selectedPopoverVirtualScroll=null,this.selectedPopoverContainer=null),this.selectedPopoverCleanup&&(this.selectedPopoverCleanup(),this.selectedPopoverCleanup=null)}renderSelectedPopover(){const e=Array.from(this.selectedOptions.values()),t=this.selectedValues.size;if(t>=100){this.renderSelectedPopoverVirtual(e,t);return}this.selectedPopover.innerHTML=`
|
|
27
27
|
<div class="ms__selected-popover-header">
|
|
28
28
|
<span>Selected Items (${t})</span>
|
|
29
29
|
<button type="button" class="ms__selected-popover-close" aria-label="Close">×</button>
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
<button type="button" class="ms__badge-remove" data-value="${t}" aria-label="Remove ${this.getItemBadgeDisplayValue(e)}"></button>
|
|
44
44
|
</div>
|
|
45
45
|
`}handleSelectedPopoverClick(e){if(e.stopPropagation(),e.target.closest(".ms__selected-popover-close")){e.preventDefault(),this.hideSelectedPopover();return}const s=e.target.closest(".ms__badge-remove");if(s){e.preventDefault();const i=s.dataset.value,r=this.selectedOptions.get(i);r&&(this.deselectOption(r),this.renderSelectedPopover(),this.selectedValues.size===0&&this.hideSelectedPopover())}}positionSelectedPopover(){this.selectedPopoverCleanup=q(this.input,this.selectedPopover,()=>{const e=this.selectedPopoverPlacement||"bottom-start";se(this.input,this.selectedPopover,{placement:e,middleware:[ee(4),...this.selectedPopoverPlacement?[]:[fe()],te({padding:8})]}).then(({x:t,y:s,placement:i})=>{this.selectedPopoverPlacement||(this.selectedPopoverPlacement=i,v.debug(`[${this.instanceId}] Locked popover placement:`,i));const r={left:`${t}px`,top:`${s}px`,width:`${this.input.offsetWidth}px`};this.options.dropdownMinWidth&&(r.minWidth=this.options.dropdownMinWidth),Object.assign(this.selectedPopover.style,r)})})}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)),s=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),s.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(),s.appendChild(i),this.hiddenInputs.push(i)}}getFormValue(){const e=Array.from(this.selectedOptions.values()).map(s=>this.getItemValue(s));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){this.selectedValues=new Set(e.map(t=>String(t))),this.selectedOptions.clear(),e.forEach(t=>{const s=String(t),i=this.allOptions.find(r=>String(this.getItemValue(r))===s);i&&this.selectedOptions.set(s,i)}),this.renderDropdown(),this.renderBadges(),this.updateHiddenInput()}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}attachBadgeTooltips(e){if(!this.options.isBadgeTooltipsEnabled){v.debug(`[${this.instanceId}] Tooltips disabled - isBadgeTooltipsEnabled is false`);return}const s=(e||this.badgesContainer).querySelectorAll(".ms__badge:not(.ms__badge--more)");if(v.debug(`[${this.instanceId}] Found ${s.length} badges to attach tooltips to`),s.forEach(i=>{const r=i,n=r.querySelector(".ms__badge-remove");if(!n)return;const a=n.dataset.value,l=this.selectedOptions.get(a);if(!l)return;const c=r.querySelector(".ms__badge-text");c&&this.createTooltipForElement(c,l,a);const d=this.getItemBadgeDisplayValue(l);this.createRemoveButtonTooltip(n,d,a,l)}),!e){const i=this.badgesContainer.querySelector(".ms__badge--more");if(i){const r=i.querySelector(".ms__badge-remove");if(r&&r.dataset.action==="remove-hidden"){const n=this.options.badgesMaxVisible||3,l=Array.from(this.selectedOptions.values()).length-n;this.createRemoveButtonTooltip(r,`${l} hidden items`,"more-badge-remove")}}}}createTooltipForElement(e,t,s){const i=document.createElement("div");i.className="ms__badge-tooltip";let r;if(this.options.getBadgeTooltipCallback)r=this.options.getBadgeTooltipCallback(t),v.debug(`[${this.instanceId}] Using custom callback for tooltip content`);else{const c=this.getItemBadgeDisplayValue(t),d=this.getItemSubtitle(t);r=d?`${c}
|
|
46
|
-
${d}`:c,v.debug(`[${this.instanceId}] Using default content: "${r}"`)}typeof r=="string"?i.textContent=r:i.appendChild(r),(this.options.container||document.body).appendChild(i),v.debug(`[${this.instanceId}] Tooltip element created and appended for "${s}"`),this.badgeTooltips.set(s,i);const a=()=>{const c=this.badgeTooltipHideTimeouts.get(s);c&&(clearTimeout(c),this.badgeTooltipHideTimeouts.delete(s)),v.debug(`[${this.instanceId}] Mouse entered badge "${s}", will show tooltip in ${this.options.badgeTooltipDelay??100}ms`);const d=window.setTimeout(()=>{v.debug(`[${this.instanceId}] Showing tooltip for "${s}"`),i.classList.add("ms__badge-tooltip--visible"),this.positionBadgeTooltip(e,i,s),this.badgeTooltipShowTimeouts.delete(s)},this.options.badgeTooltipDelay??100);this.badgeTooltipShowTimeouts.set(s,d)},l=()=>{const c=this.badgeTooltipShowTimeouts.get(s);c&&(clearTimeout(c),this.badgeTooltipShowTimeouts.delete(s));const d=window.setTimeout(()=>{i.classList.remove("ms__badge-tooltip--visible"),this.cleanupBadgeTooltip(s),this.badgeTooltipHideTimeouts.delete(s)},100);this.badgeTooltipHideTimeouts.set(s,d)};e.addEventListener("mouseenter",a),e.addEventListener("mouseleave",l)}createRemoveButtonTooltip(e,t,s,i){const r=document.createElement("div");r.className="ms__badge-tooltip";let n;i&&this.options.getRemoveButtonTooltipCallback?n=this.options.getRemoveButtonTooltipCallback(i):this.options.removeButtonTooltipText?n=this.options.removeButtonTooltipText.replace("{0}",t):n=`Remove ${t}`,r.textContent=n,(this.options.container||document.body).appendChild(r);const l=`${s}-remove`;this.badgeTooltips.set(l,r);const c=()=>{const p=this.badgeTooltipHideTimeouts.get(l);p&&(clearTimeout(p),this.badgeTooltipHideTimeouts.delete(l));const u=this.badgeTooltips.get(s);u&&u.classList.remove("ms__badge-tooltip--visible");const h=window.setTimeout(()=>{r.classList.add("ms__badge-tooltip--visible"),this.positionBadgeTooltip(e,r,l),this.badgeTooltipShowTimeouts.delete(l)},this.options.badgeTooltipDelay??100);this.badgeTooltipShowTimeouts.set(l,h)},d=()=>{const p=this.badgeTooltipShowTimeouts.get(l);p&&(clearTimeout(p),this.badgeTooltipShowTimeouts.delete(l));const u=window.setTimeout(()=>{r.classList.remove("ms__badge-tooltip--visible"),this.cleanupBadgeTooltip(l),this.badgeTooltipHideTimeouts.delete(l)},100);this.badgeTooltipHideTimeouts.set(l,u)};e.addEventListener("mouseenter",c),e.addEventListener("mouseleave",d)}positionBadgeTooltip(e,t,s){const i=q(e,t,()=>{se(e,t,{placement:this.options.badgeTooltipPlacement||"top",strategy:"fixed",middleware:[ee(this.options.badgeTooltipOffset||8),fe(),te({padding:8})]}).then(({x:r,y:n})=>{Object.assign(t.style,{left:`${r}px`,top:`${n}px`}),v.debug(`[${this.instanceId}] Positioned tooltip "${s}" at x:${r}, y:${n}`,{placement:this.options.badgeTooltipPlacement||"top",tooltipClasses:t.className,tooltipDisplay:window.getComputedStyle(t).display,tooltipOpacity:window.getComputedStyle(t).opacity,tooltipVisibility:window.getComputedStyle(t).visibility,tooltipZIndex:window.getComputedStyle(t).zIndex,tooltipPosition:window.getComputedStyle(t).position})})});this.badgeTooltipCleanups.set(s,i)}cleanupBadgeTooltip(e){const t=this.badgeTooltipShowTimeouts.get(e);t&&(clearTimeout(t),this.badgeTooltipShowTimeouts.delete(e));const s=this.badgeTooltipHideTimeouts.get(e);s&&(clearTimeout(s),this.badgeTooltipHideTimeouts.delete(e));const i=this.badgeTooltipCleanups.get(e);i&&(i(),this.badgeTooltipCleanups.delete(e))}destroyAllBadgeTooltips(){this.badgeTooltipShowTimeouts.forEach(e=>clearTimeout(e)),this.badgeTooltipShowTimeouts.clear(),this.badgeTooltipHideTimeouts.forEach(e=>clearTimeout(e)),this.badgeTooltipHideTimeouts.clear(),this.badgeTooltipCleanups.forEach(e=>e()),this.badgeTooltipCleanups.clear(),this.badgeTooltips.forEach(e=>e.remove()),this.badgeTooltips.clear()}attachActionButtonTooltips(){const e=this.dropdown.querySelectorAll(".ms__action-btn");v.debug(`[${this.instanceId}] Found ${e.length} action buttons to attach tooltips to`),e.forEach(t=>{var l;const s=t,i=s.dataset.action;if(!i)return;const r=(l=this.options.actionButtons)==null?void 0:l.find(c=>c.action==="custom"?s.dataset.customAction===s.dataset.action:c.action===i);if(!r)return;let n;if(r.getTooltipCallback?(n=r.getTooltipCallback(this),v.debug(`[${this.instanceId}] Using getTooltipCallback for action button "${i}": "${n}"`)):(n=r.tooltip,v.debug(`[${this.instanceId}] Using static tooltip for action button "${i}": "${n}"`)),!n){v.debug(`[${this.instanceId}] No tooltip for action button "${i}"`);return}const a=`action-${i}-${Date.now()}`;this.createActionButtonTooltip(s,n,a)})}createActionButtonTooltip(e,t,s){const i=document.createElement("div");i.className="ms__badge-tooltip",i.textContent=t,(this.options.container||document.body).appendChild(i),v.debug(`[${this.instanceId}] Tooltip element created for action button "${s}"`),this.actionButtonTooltips.set(s,i);let n,a;const l=()=>{clearTimeout(a),v.debug(`[${this.instanceId}] Mouse entered action button "${s}", will show tooltip in ${this.options.badgeTooltipDelay??100}ms`),n=window.setTimeout(()=>{v.debug(`[${this.instanceId}] Showing tooltip for action button "${s}"`),i.classList.add("ms__badge-tooltip--visible"),this.positionActionButtonTooltip(e,i,s)},this.options.badgeTooltipDelay??100)},c=()=>{clearTimeout(n),a=window.setTimeout(()=>{i.classList.remove("ms__badge-tooltip--visible"),this.cleanupActionButtonTooltip(s)},100)};e.addEventListener("mouseenter",l),e.addEventListener("mouseleave",c)}positionActionButtonTooltip(e,t,s){const i=q(e,t,()=>{se(e,t,{placement:this.options.badgeTooltipPlacement||"top",strategy:"fixed",middleware:[ee(this.options.badgeTooltipOffset||8),fe(),te({padding:8})]}).then(({x:r,y:n})=>{Object.assign(t.style,{left:`${r}px`,top:`${n}px`}),v.debug(`[${this.instanceId}] Positioned action button tooltip "${s}" at x:${r}, y:${n}`)})});this.actionButtonTooltipCleanups.set(s,i)}cleanupActionButtonTooltip(e){const t=this.actionButtonTooltipCleanups.get(e);t&&(t(),this.actionButtonTooltipCleanups.delete(e))}destroyAllActionButtonTooltips(){this.actionButtonTooltipCleanups.forEach(e=>e()),this.actionButtonTooltipCleanups.clear(),this.actionButtonTooltips.forEach(e=>e.remove()),this.actionButtonTooltips.clear()}destroy(){this.destroyAllBadgeTooltips(),this.destroyAllActionButtonTooltips(),this.dropdownCleanup&&this.dropdownCleanup(),this.hintCleanup&&this.hintCleanup(),this.selectedPopoverCleanup&&this.selectedPopoverCleanup(),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"),re.info(`[${this.instanceId}] Component destroyed`)}}const ps=':host{--ms-rem: 10px;font-family:var(--ms-font-family, var(--base-font-family, inherit));display:block;--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, #eff6ff);--ms-accent-color-light-hover: var(--base-accent-color-light-hover, #e0f2fe);--ms-text-color-1: var(--base-text-color-1, #111827);--ms-text-color-2: var(--base-text-color-2, #353b47);--ms-text-color-3: var(--base-text-color-3, #6b7280);--ms-text-color-4: var(--base-text-color-4, #a0a3a9);--ms-text-on-accent: var(--base-text-on-accent, #ffffff);--ms-text-primary: var(--ms-text-color-1);--ms-text-secondary: var(--ms-text-color-3);--ms-primary-bg: var(--base-primary-bg, #f3f4f6);--ms-primary-bg-hover: var(--base-primary-bg-hover, #e5e7eb);--ms-border-color: var(--base-border-color, #e5e7eb);--ms-border: var(--base-border, 1px solid var(--ms-border-color));--ms-input-background: var(--base-input-background, #ffffff);--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-background-disabled: var(--base-input-background-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-background: var(--ms-accent-color);--ms-counter-badge-background-hover: var(--ms-accent-color-hover);--ms-counter-badge-color: var(--ms-text-on-accent);--ms-hint-background: var(--base-hint-background, #ffffff);--ms-hint-color: var(--ms-text-color-4);--ms-hint-border-color: var(--ms-border-color);--ms-dropdown-background: var(--base-dropdown-background, #ffffff);--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-background: var(--base-actions-background, #ffffff);--ms-actions-border-color: var(--ms-border-color);--ms-action-button-background: transparent;--ms-action-button-background-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-background: transparent;--ms-option-background-hover: var(--ms-primary-bg);--ms-option-color-hover: inherit;--ms-option-background-focused: var(--ms-primary-bg);--ms-option-color-focused: inherit;--ms-option-outline-color-focused: var(--ms-accent-color);--ms-option-background-selected: color-mix(in srgb, var(--ms-accent-color) 10%, transparent);--ms-option-background-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-background: color-mix(in srgb, var(--ms-accent-color) 20%, transparent);--ms-loading-color: var(--ms-text-color-3);--ms-badge-background: var(--ms-accent-color-light);--ms-badge-background-hover: var(--base-badge-background-hover, var(--ms-input-background));--ms-badge-background-active: var(--ms-accent-color-light-hover);--ms-badge-text-background: var(--ms-accent-color-light);--ms-badge-text-background-hover: var(--base-badge-background-hover, var(--ms-input-background));--ms-badge-text-color-hover: var(--ms-badge-text-color);--ms-badge-remove-background: var(--ms-accent-color);--ms-badge-remove-background-hover: var(--ms-accent-color-hover);--ms-badge-counter-border-color: var(--ms-border-color);--ms-badge-counter-text-background: var(--ms-primary-bg);--ms-badge-counter-remove-background: var(--ms-text-color-3);--ms-badge-counter-remove-background-hover: var(--ms-text-color-1);--ms-counter-wrapper-background: transparent;--ms-counter-wrapper-background-hover: var(--ms-primary-bg);--ms-counter-wrapper-border-color: var(--ms-border-color);--ms-count-clear-background: transparent;--ms-count-clear-background-hover: var(--ms-accent-color);--ms-tooltip-background: var(--base-tooltip-background, #333333);--ms-tooltip-text-color: var(--base-tooltip-text-color, #ffffff);--ms-selected-popover-background: var(--base-popover-background, #ffffff);--ms-selected-popover-border-color: var(--ms-border-color);--ms-selected-popover-header-background: color-mix(in srgb, var(--ms-accent-color) 10%, transparent);--ms-selected-popover-header-border-color: var(--ms-border-color);--ms-selected-popover-close-background: transparent;--ms-selected-popover-close-background-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-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-input-size-xs-font: calc(var(--base-font-size-xs, 1.2) * var(--ms-rem));--ms-input-size-xs-padding-v: calc(.4 * var(--ms-rem));--ms-input-size-xs-padding-h: calc(.8 * var(--ms-rem));--ms-input-size-xs-height: calc(var(--base-input-size-xs-height, 3.1) * var(--ms-rem));--ms-input-size-sm-font: calc(var(--base-font-size-sm, 1.4) * var(--ms-rem));--ms-input-size-sm-padding-v: calc(.5 * var(--ms-rem));--ms-input-size-sm-padding-h: calc(1 * var(--ms-rem));--ms-input-size-sm-height: calc(var(--base-input-size-sm-height, 3.3) * var(--ms-rem));--ms-input-size-md-font: calc(var(--base-font-size-sm, 1.4) * var(--ms-rem));--ms-input-size-md-padding-v: calc(.8 * var(--ms-rem));--ms-input-size-md-padding-h: calc(1.2 * var(--ms-rem));--ms-input-size-md-height: calc(var(--base-input-size-md-height, 3.5) * var(--ms-rem));--ms-input-size-lg-font: calc(var(--base-font-size-base, 1.6) * var(--ms-rem));--ms-input-size-lg-padding-v: calc(1 * var(--ms-rem));--ms-input-size-lg-padding-h: calc(1.4 * var(--ms-rem));--ms-input-size-lg-height: calc(var(--base-input-size-lg-height, 3.8) * var(--ms-rem));--ms-input-size-xl-font: calc(var(--base-font-size-lg, 1.8) * var(--ms-rem));--ms-input-size-xl-padding-v: calc(1.2 * var(--ms-rem));--ms-input-size-xl-padding-h: calc(1.6 * var(--ms-rem));--ms-input-size-xl-height: calc(var(--base-input-size-xl-height, 4.1) * var(--ms-rem));--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-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: var(--ms-border);--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-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-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-actions-gap: calc(.4 * var(--ms-rem));--ms-actions-padding: calc(.8 * var(--ms-rem));--ms-actions-border-bottom: var(--ms-border);--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: var(--ms-border);--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-bg: transparent;--ms-option-bg-hover: var(--ms-primary-bg);--ms-option-bg-focused: var(--ms-primary-bg);--ms-option-outline-focused: 2px solid var(--ms-accent-color);--ms-option-focus-outline-offset: -2px;--ms-option-bg-matched: color-mix(in srgb, var(--ms-accent-color) 8%, transparent);--ms-option-border-matched: 3px solid color-mix(in srgb, var(--ms-accent-color) 40%, transparent);--ms-option-bg-selected: color-mix(in srgb, var(--ms-accent-color) 10%, transparent);--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-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-bg: color-mix(in srgb, var(--ms-accent-color) 20%, transparent);--ms-option-mark-color: inherit;--ms-option-mark-font-weight: var(--base-font-weight-semibold, 600);--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-background);--ms-checkbox-border: var(--ms-border);--ms-checkbox-border-radius: calc(.3 * var(--ms-rem));--ms-checkbox-checked-bg: var(--ms-accent-color);--ms-checkbox-checked-border: 1px solid var(--ms-accent-color);--ms-checkbox-checkmark-color: var(--ms-text-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-border);--ms-checkbox-checked-bg-hover: var(--ms-accent-color-hover);--ms-checkbox-checked-border-color-hover: var(--ms-accent-color-hover);--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));--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-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-badge-bg: var(--ms-accent-color-light);--ms-badge-bg-hover: var(--ms-badge-background-hover);--ms-badge-bg-active: var(--ms-accent-color-light-hover);--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-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-icon-remove: "×";--ms-badge-counter-bg: transparent;--ms-badge-counter-border: var(--ms-border);--ms-badge-counter-border-radius: var(--ms-border-radius-sm);--ms-badge-counter-text-color: var(--ms-text-color-3);--ms-badge-counter-text-bg: var(--ms-badge-counter-text-background);--ms-badge-counter-remove-bg: var(--ms-text-color-3);--ms-badge-counter-remove-color: var(--ms-text-on-accent);--ms-badge-counter-remove-bg-hover: var(--ms-badge-counter-remove-background-hover);--ms-more-badge-bg: var(--ms-accent-color-light);--ms-more-badge-hover-bg: var(--ms-badge-background-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: 50%;--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-icon-clear: "×";--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-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: var(--ms-border);--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: var(--ms-border);--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: 50%;--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-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}multi-select:not(:defined){display:block;min-height:calc(3.5 * var(--ms-rem));color:transparent!important;background:transparent}.ms-wrapper{display:flex;flex-direction:column;align-items:stretch}.ms-wrapper--inline{flex-direction:row;align-items:flex-start}.ms{position:relative;width:100%}.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-right: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-background);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__input.ms__input--xs{font-size:var(--ms-input-size-xs-font);padding:var(--ms-input-size-xs-padding-v) var(--ms-input-size-xs-padding-h);padding-right:calc(var(--ms-input-size-xs-padding-h) * 2.5);height:var(--ms-input-size-xs-height)}.ms__input.ms__input--sm{font-size:var(--ms-input-size-sm-font);padding:var(--ms-input-size-sm-padding-v) var(--ms-input-size-sm-padding-h);padding-right:calc(var(--ms-input-size-sm-padding-h) * 2.5);height:var(--ms-input-size-sm-height)}.ms__input.ms__input--lg{font-size:var(--ms-input-size-lg-font);padding:var(--ms-input-size-lg-padding-v) var(--ms-input-size-lg-padding-h);padding-right:calc(var(--ms-input-size-lg-padding-h) * 2.5);height:var(--ms-input-size-lg-height)}.ms__input.ms__input--xl{font-size:var(--ms-input-size-xl-font);padding:var(--ms-input-size-xl-padding-v) var(--ms-input-size-xl-padding-h);padding-right:calc(var(--ms-input-size-xl-padding-h) * 2.5);height:var(--ms-input-size-xl-height)}.ms__toggle{position:absolute;right: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;right:var(--ms-counter-offset);top:50%;transform:var(--ms-transform-center-y);padding:var(--ms-counter-padding);background:var(--ms-counter-badge-background);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-background-hover);transform:var(--ms-transform-center-y) scale(var(--ms-transform-scale-hover))}.ms__hint{display:none;position:absolute;z-index:var(--ms-z-index-popover);padding:var(--ms-hint-padding);background:var(--ms-hint-background);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:absolute;font-family:inherit;z-index:var(--ms-z-index-dropdown);background:var(--ms-dropdown-background);border:var(--ms-dropdown-border);border-radius:var(--ms-dropdown-border-radius);box-shadow:var(--ms-dropdown-box-shadow);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-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__actions{display:flex;flex-wrap:nowrap;gap:var(--ms-actions-gap);padding:var(--ms-actions-padding);border-bottom:var(--ms-actions-border-bottom)}.ms__actions--wrap{flex-wrap:wrap}.ms__actions--sticky{position:sticky;top:0;z-index:var(--ms-z-index-sticky);background:var(--ms-actions-background)}.ms__action-btn{flex:1;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-background);color:var(--ms-action-button-color);cursor:pointer;transition:all var(--ms-transition-fast) var(--ms-easing-snappy)}.ms__action-btn:hover{background:var(--ms-action-button-background-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}.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{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);color:var(--ms-option-text-color);background:var(--ms-option-background);cursor:pointer}.ms__option:hover{background:var(--ms-option-background-hover);color:var(--ms-option-color-hover, inherit)}.ms__option--focused{background:var(--ms-option-background-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-background-matched);color:var(--ms-option-color-matched, inherit);border-left:var(--ms-option-border-matched)}.ms__option--selected{background:var(--ms-option-background-selected)}.ms__option--selected:hover{background:var(--ms-option-bg-selected-hover, var(--ms-option-background-selected))}.ms__option--disabled{opacity:var(--ms-disabled-opacity);cursor:not-allowed}.ms__option--disabled:hover{background:var(--ms-option-background)}.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);border-left:var(--ms-option-border-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-right:var(--ms-checkbox-margin-right);margin-bottom:var(--ms-checkbox-margin-bottom);margin-left: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 2px 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: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)}.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))}.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-background);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)}.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))}.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{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;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)}.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__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-background);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-background-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-background);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-background-hover);color:var(--ms-count-clear-color-hover)}.ms__count-clear:before{content:var(--ms-icon-clear)}.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-background);color:var(--ms-badge-text-color);border:var(--ms-badge-text-border);border-right:none;border-radius:var(--ms-badge-border-radius) 0 0 var(--ms-badge-border-radius);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-background-hover, var(--ms-badge-text-background));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-background);color:var(--ms-badge-remove-color);border:var(--ms-badge-remove-border);border-left:none;border-radius:0 var(--ms-badge-border-radius) var(--ms-badge-border-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-background-hover)}.ms__badge-remove:focus{outline:none;box-shadow:var(--ms-badge-remove-box-shadow-focus)}.ms__badge-remove:before{content:var(--ms-icon-remove);font-size:var(--ms-font-size-base);line-height:var(--ms-line-height-none)}.ms__badge--counter{cursor:pointer}.ms__badge--counter .ms__badge-text{background:var(--ms-badge-counter-text-background);color:var(--ms-badge-counter-text-color);border:var(--ms-badge-counter-border);border-right:none}.ms__badge--counter .ms__badge-remove{background:var(--ms-badge-counter-remove-background);color:var(--ms-badge-counter-remove-color);border:var(--ms-badge-counter-border);border-left:none}.ms__badge--counter .ms__badge-remove:hover{background:var(--ms-badge-counter-remove-background-hover)}.ms__badge--more{cursor:pointer}.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-background);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__selected-popover{display:none;position:absolute;z-index:var(--ms-z-index-popover);background:var(--ms-selected-popover-background);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-header{display:flex;align-items:center;justify-content:space-between;padding:var(--ms-selected-popover-header-padding);background:var(--ms-selected-popover-header-background);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-background);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-background-hover);color:var(--ms-selected-popover-close-color-hover)}.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)}.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}.ms--rtl .ms__input-wrapper{direction:rtl}.ms--rtl .ms__input{text-align:right;padding-left:var(--ms-input-padding-right);padding-right:var(--ms-input-padding-h)}.ms--rtl .ms__toggle{left:var(--ms-toggle-right)!important;right:auto!important}.ms--rtl .ms__counter{left:var(--ms-counter-offset)!important;right:auto!important}.ms--rtl .ms__dropdown{direction:rtl;text-align:right}.ms--rtl .ms__option{flex-direction:row-reverse}.ms--rtl .ms__checkbox{margin-left:var(--ms-spacing-sm);margin-right:0}.ms--rtl .ms__option-content{text-align:right}.ms--rtl .ms__option-icon{margin-left:var(--ms-spacing-xs);margin-right:0}.ms--rtl .ms__badges{direction:rtl}.ms--rtl .ms__badge{flex-direction:row-reverse}.ms--rtl .ms__badge-remove{border-radius:var(--ms-badge-border-radius) 0 0 var(--ms-badge-border-radius);border-left:var(--ms-badge-remove-border);border-right:none}.ms--rtl .ms__badge-text{border-radius:0 var(--ms-badge-border-radius) var(--ms-badge-border-radius) 0;border-right:var(--ms-badge-text-border);border-left:none}.ms--rtl .ms__count-display{direction:rtl}.ms--rtl .ms__counter-wrapper{flex-direction:row-reverse}.ms--rtl .ms__selected-popover{direction:rtl;text-align:right}.ms--rtl .ms__actions{direction:rtl}.ms--rtl .ms__group-label,.ms--rtl .ms__empty{text-align:right}.ms--rtl .ms__hint{direction:rtl;text-align:right}.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-left:var(--ms-option-padding-h)}.ms--no-checkboxes .ms__option-content{padding-left:0}.ms-debug-info{margin-top:calc(.4 * var(--ms-rem));padding:calc(.4 * var(--ms-rem));background-color:#f9fafb;border:1px solid #e5e7eb;border-radius:calc(var(--base-border-radius-md, .6) * var(--ms-rem));font-size:calc(1.2 * var(--ms-rem));color:#111827}.ms-debug-info details summary{cursor:pointer;font-weight:600;color:#2563eb;-webkit-user-select:none;user-select:none;padding:calc(.4 * var(--ms-rem));border-radius:calc(var(--base-border-radius-sm, .4) * var(--ms-rem))}.ms-debug-info details summary:hover{background-color:#f3f4f6}.ms-debug-info details summary:focus{outline:2px solid #3b82f6;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:#fff;border-radius:calc(var(--base-border-radius-sm, .4) * var(--ms-rem))}.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-right:calc(.4 * var(--ms-rem));color:#3b82f6}',us=typeof HTMLElement<"u"?HTMLElement:class{},Ae=new Set;function dt(){return Array.from(Ae)}class Ie extends us{constructor(){super();m(this,"picker");m(this,"containerElement");m(this,"shadow");m(this,"_options");m(this,"_valueMember");m(this,"_getValueCallback");m(this,"_displayValueMember");m(this,"_getDisplayValueCallback");m(this,"_getBadgeDisplayCallback");m(this,"_getBadgeClassCallback");m(this,"_customStylesCallback");m(this,"_searchValueMember");m(this,"_getSearchValueCallback");m(this,"_iconMember");m(this,"_getIconCallback");m(this,"_subtitleMember");m(this,"_getSubtitleCallback");m(this,"_groupMember");m(this,"_getGroupCallback");m(this,"_renderGroupLabelContentCallback");m(this,"_disabledMember");m(this,"_getDisabledCallback");m(this,"_getValueFormatCallback");m(this,"_getBadgeTooltipCallback");m(this,"_getRemoveButtonTooltipCallback");m(this,"_renderOptionContentCallback");m(this,"_renderBadgeContentCallback");m(this,"_renderSelectedItemContentCallback");m(this,"_getSelectedItemClassCallback");m(this,"_renderSelectedContentCallback");m(this,"_getCounterCallback");m(this,"_actionButtons");m(this,"_beforeSearchCallback");m(this,"_searchCallback");m(this,"_addNewCallback");m(this,"_selectCallback");m(this,"_deselectCallback");m(this,"_changeCallback");m(this,"_declarativeSelectedValues");this.shadow=this.attachShadow({mode:"open"});const t=document.createElement("style");t.textContent=ps,this.shadow.appendChild(t),requestAnimationFrame(()=>{this.setAttribute("data-ready","")})}static get observedAttributes(){return["search-hint","search-placeholder","multiple","allow-groups","show-checkboxes","sticky-actions","close-on-select","lock-placement","dropdown-min-width","dropdown-max-width","badges-display-mode","badges-threshold","badges-max-visible","badges-threshold-mode","badges-position","show-counter","keep-options-on-search","should-keep-search-on-close","max-height","empty-message","loading-message","min-search-length","enable-search","search-input-mode","search-mode","actions-layout","allow-add-new","initial-values","enable-virtual-scroll","virtual-scroll-threshold","option-height","badge-height","virtual-scroll-buffer","value-member","display-value-member","search-value-member","icon-member","subtitle-member","group-member","disabled-member","name","value-format","enable-badge-tooltips","badge-tooltip-placement","remove-button-tooltip-text","show-debug-info"]}connectedCallback(){Ae.add(this),this.render();const t=this.parseDeclarativeOptions();t&&(this._options&&this._options.length>0&&C.warn("[MultiSelectElement] Both declarative <option> elements and programmatic .options detected. Using declarative options."),this._options=t),this.initializePicker()}disconnectedCallback(){Ae.delete(this),this.picker&&this.picker.destroy()}attributeChangedCallback(t,s,i){s!==i&&this.picker&&t!=="initial-values"&&(this.picker.destroy(),this.initializePicker())}render(){this.containerElement=document.createElement("div"),this.containerElement.setAttribute("data-multiselect",""),this.className&&(this.containerElement.className=this.className),this.shadow.appendChild(this.containerElement),this.getAttribute("show-debug-info")==="true"&&this.renderDebugInfo()}renderDebugInfo(){const t=this.shadow.querySelector(".ms-debug-info");t&&t.remove();const s=document.createElement("div");s.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),s.appendChild(i),this.shadow.appendChild(s),this.updateDebugInfo()}updateDebugInfo(){var h,g;const t=this.shadow.querySelector(".ms-debug-stats");if(!t||!this.picker)return;const s="1.7.0",i=dt().length,n=this.picker.getSelected().length,a=((h=this._options)==null?void 0:h.length)||0,l=this.picker,c=l.isOpen||!1,d=l.searchTerm||"",p=l.isLoading||!1,u=((g=l.filteredOptions)==null?void 0:g.length)||0;t.innerHTML=`
|
|
46
|
+
${d}`:c,v.debug(`[${this.instanceId}] Using default content: "${r}"`)}typeof r=="string"?i.textContent=r:i.appendChild(r),(this.options.container||document.body).appendChild(i),v.debug(`[${this.instanceId}] Tooltip element created and appended for "${s}"`),this.badgeTooltips.set(s,i);const a=()=>{const c=this.badgeTooltipHideTimeouts.get(s);c&&(clearTimeout(c),this.badgeTooltipHideTimeouts.delete(s)),v.debug(`[${this.instanceId}] Mouse entered badge "${s}", will show tooltip in ${this.options.badgeTooltipDelay??100}ms`);const d=window.setTimeout(()=>{v.debug(`[${this.instanceId}] Showing tooltip for "${s}"`),i.classList.add("ms__badge-tooltip--visible"),this.positionBadgeTooltip(e,i,s),this.badgeTooltipShowTimeouts.delete(s)},this.options.badgeTooltipDelay??100);this.badgeTooltipShowTimeouts.set(s,d)},l=()=>{const c=this.badgeTooltipShowTimeouts.get(s);c&&(clearTimeout(c),this.badgeTooltipShowTimeouts.delete(s));const d=window.setTimeout(()=>{i.classList.remove("ms__badge-tooltip--visible"),this.cleanupBadgeTooltip(s),this.badgeTooltipHideTimeouts.delete(s)},100);this.badgeTooltipHideTimeouts.set(s,d)};e.addEventListener("mouseenter",a),e.addEventListener("mouseleave",l)}createRemoveButtonTooltip(e,t,s,i){const r=document.createElement("div");r.className="ms__badge-tooltip";let n;i&&this.options.getRemoveButtonTooltipCallback?n=this.options.getRemoveButtonTooltipCallback(i):this.options.removeButtonTooltipText?n=this.options.removeButtonTooltipText.replace("{0}",t):n=`Remove ${t}`,r.textContent=n,(this.options.container||document.body).appendChild(r);const l=`${s}-remove`;this.badgeTooltips.set(l,r);const c=()=>{const p=this.badgeTooltipHideTimeouts.get(l);p&&(clearTimeout(p),this.badgeTooltipHideTimeouts.delete(l));const u=this.badgeTooltips.get(s);u&&u.classList.remove("ms__badge-tooltip--visible");const h=window.setTimeout(()=>{r.classList.add("ms__badge-tooltip--visible"),this.positionBadgeTooltip(e,r,l),this.badgeTooltipShowTimeouts.delete(l)},this.options.badgeTooltipDelay??100);this.badgeTooltipShowTimeouts.set(l,h)},d=()=>{const p=this.badgeTooltipShowTimeouts.get(l);p&&(clearTimeout(p),this.badgeTooltipShowTimeouts.delete(l));const u=window.setTimeout(()=>{r.classList.remove("ms__badge-tooltip--visible"),this.cleanupBadgeTooltip(l),this.badgeTooltipHideTimeouts.delete(l)},100);this.badgeTooltipHideTimeouts.set(l,u)};e.addEventListener("mouseenter",c),e.addEventListener("mouseleave",d)}positionBadgeTooltip(e,t,s){const i=q(e,t,()=>{se(e,t,{placement:this.options.badgeTooltipPlacement||"top",strategy:"fixed",middleware:[ee(this.options.badgeTooltipOffset||8),fe(),te({padding:8})]}).then(({x:r,y:n})=>{Object.assign(t.style,{left:`${r}px`,top:`${n}px`}),v.debug(`[${this.instanceId}] Positioned tooltip "${s}" at x:${r}, y:${n}`,{placement:this.options.badgeTooltipPlacement||"top",tooltipClasses:t.className,tooltipDisplay:window.getComputedStyle(t).display,tooltipOpacity:window.getComputedStyle(t).opacity,tooltipVisibility:window.getComputedStyle(t).visibility,tooltipZIndex:window.getComputedStyle(t).zIndex,tooltipPosition:window.getComputedStyle(t).position})})});this.badgeTooltipCleanups.set(s,i)}cleanupBadgeTooltip(e){const t=this.badgeTooltipShowTimeouts.get(e);t&&(clearTimeout(t),this.badgeTooltipShowTimeouts.delete(e));const s=this.badgeTooltipHideTimeouts.get(e);s&&(clearTimeout(s),this.badgeTooltipHideTimeouts.delete(e));const i=this.badgeTooltipCleanups.get(e);i&&(i(),this.badgeTooltipCleanups.delete(e))}destroyAllBadgeTooltips(){this.badgeTooltipShowTimeouts.forEach(e=>clearTimeout(e)),this.badgeTooltipShowTimeouts.clear(),this.badgeTooltipHideTimeouts.forEach(e=>clearTimeout(e)),this.badgeTooltipHideTimeouts.clear(),this.badgeTooltipCleanups.forEach(e=>e()),this.badgeTooltipCleanups.clear(),this.badgeTooltips.forEach(e=>e.remove()),this.badgeTooltips.clear()}attachActionButtonTooltips(){const e=this.dropdown.querySelectorAll(".ms__action-btn");v.debug(`[${this.instanceId}] Found ${e.length} action buttons to attach tooltips to`),e.forEach(t=>{var l;const s=t,i=s.dataset.action;if(!i)return;const r=(l=this.options.actionButtons)==null?void 0:l.find(c=>c.action==="custom"?s.dataset.customAction===s.dataset.action:c.action===i);if(!r)return;let n;if(r.getTooltipCallback?(n=r.getTooltipCallback(this),v.debug(`[${this.instanceId}] Using getTooltipCallback for action button "${i}": "${n}"`)):(n=r.tooltip,v.debug(`[${this.instanceId}] Using static tooltip for action button "${i}": "${n}"`)),!n){v.debug(`[${this.instanceId}] No tooltip for action button "${i}"`);return}const a=`action-${i}-${Date.now()}`;this.createActionButtonTooltip(s,n,a)})}createActionButtonTooltip(e,t,s){const i=document.createElement("div");i.className="ms__badge-tooltip",i.textContent=t,(this.options.container||document.body).appendChild(i),v.debug(`[${this.instanceId}] Tooltip element created for action button "${s}"`),this.actionButtonTooltips.set(s,i);let n,a;const l=()=>{clearTimeout(a),v.debug(`[${this.instanceId}] Mouse entered action button "${s}", will show tooltip in ${this.options.badgeTooltipDelay??100}ms`),n=window.setTimeout(()=>{v.debug(`[${this.instanceId}] Showing tooltip for action button "${s}"`),i.classList.add("ms__badge-tooltip--visible"),this.positionActionButtonTooltip(e,i,s)},this.options.badgeTooltipDelay??100)},c=()=>{clearTimeout(n),a=window.setTimeout(()=>{i.classList.remove("ms__badge-tooltip--visible"),this.cleanupActionButtonTooltip(s)},100)};e.addEventListener("mouseenter",l),e.addEventListener("mouseleave",c)}positionActionButtonTooltip(e,t,s){const i=q(e,t,()=>{se(e,t,{placement:this.options.badgeTooltipPlacement||"top",strategy:"fixed",middleware:[ee(this.options.badgeTooltipOffset||8),fe(),te({padding:8})]}).then(({x:r,y:n})=>{Object.assign(t.style,{left:`${r}px`,top:`${n}px`}),v.debug(`[${this.instanceId}] Positioned action button tooltip "${s}" at x:${r}, y:${n}`)})});this.actionButtonTooltipCleanups.set(s,i)}cleanupActionButtonTooltip(e){const t=this.actionButtonTooltipCleanups.get(e);t&&(t(),this.actionButtonTooltipCleanups.delete(e))}destroyAllActionButtonTooltips(){this.actionButtonTooltipCleanups.forEach(e=>e()),this.actionButtonTooltipCleanups.clear(),this.actionButtonTooltips.forEach(e=>e.remove()),this.actionButtonTooltips.clear()}destroy(){this.destroyAllBadgeTooltips(),this.destroyAllActionButtonTooltips(),this.dropdownCleanup&&this.dropdownCleanup(),this.hintCleanup&&this.hintCleanup(),this.selectedPopoverCleanup&&this.selectedPopoverCleanup(),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"),re.info(`[${this.instanceId}] Component destroyed`)}}const ps=':host{--ms-rem: 10px;font-family:var(--ms-font-family, var(--base-font-family, inherit));display:block;--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, #eff6ff);--ms-accent-color-light-hover: var(--base-accent-color-light-hover, #e0f2fe);--ms-text-color-1: var(--base-text-color-1, #111827);--ms-text-color-2: var(--base-text-color-2, #353b47);--ms-text-color-3: var(--base-text-color-3, #6b7280);--ms-text-color-4: var(--base-text-color-4, #a0a3a9);--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-primary-bg, #f3f4f6);--ms-primary-bg-hover: var(--base-primary-bg-hover, #e5e7eb);--ms-border-color: var(--base-border-color, #e5e7eb);--ms-border: var(--base-border, 1px solid var(--ms-border-color));--ms-input-bg: var(--base-input-bg, #ffffff);--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-hint-bg, #ffffff);--ms-hint-color: var(--ms-text-color-4);--ms-hint-border-color: var(--ms-border-color);--ms-dropdown-bg: var(--base-dropdown-bg, #ffffff);--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-actions-bg, #ffffff);--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-color-hover: inherit;--ms-option-color-focused: inherit;--ms-option-outline-color-focused: var(--ms-accent-color);--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-loading-color: var(--ms-text-color-3);--ms-badge-bg-hover: var(--base-badge-bg-hover, var(--ms-input-bg));--ms-badge-text-bg-hover: var(--base-badge-bg-hover, var(--ms-input-bg));--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);--ms-badge-counter-remove-bg-hover: var(--ms-text-color-1);--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, #333333);--ms-tooltip-text-color: var(--base-tooltip-text-color, #ffffff);--ms-selected-popover-bg: var(--base-popover-bg, #ffffff);--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-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-input-size-xs-font: calc(var(--base-font-size-xs, 1.2) * var(--ms-rem));--ms-input-size-xs-padding-v: calc(.4 * var(--ms-rem));--ms-input-size-xs-padding-h: calc(.8 * var(--ms-rem));--ms-input-size-xs-height: calc(var(--base-input-size-xs-height, 3.1) * var(--ms-rem));--ms-input-size-sm-font: calc(var(--base-font-size-sm, 1.4) * var(--ms-rem));--ms-input-size-sm-padding-v: calc(.5 * var(--ms-rem));--ms-input-size-sm-padding-h: calc(1 * var(--ms-rem));--ms-input-size-sm-height: calc(var(--base-input-size-sm-height, 3.3) * var(--ms-rem));--ms-input-size-md-font: calc(var(--base-font-size-sm, 1.4) * var(--ms-rem));--ms-input-size-md-padding-v: calc(.8 * var(--ms-rem));--ms-input-size-md-padding-h: calc(1.2 * var(--ms-rem));--ms-input-size-md-height: calc(var(--base-input-size-md-height, 3.5) * var(--ms-rem));--ms-input-size-lg-font: calc(var(--base-font-size-base, 1.6) * var(--ms-rem));--ms-input-size-lg-padding-v: calc(1 * var(--ms-rem));--ms-input-size-lg-padding-h: calc(1.4 * var(--ms-rem));--ms-input-size-lg-height: calc(var(--base-input-size-lg-height, 3.8) * var(--ms-rem));--ms-input-size-xl-font: calc(var(--base-font-size-lg, 1.8) * var(--ms-rem));--ms-input-size-xl-padding-v: calc(1.2 * var(--ms-rem));--ms-input-size-xl-padding-h: calc(1.6 * var(--ms-rem));--ms-input-size-xl-height: calc(var(--base-input-size-xl-height, 4.1) * var(--ms-rem));--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: var(--ms-border);--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-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-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-actions-gap: calc(.4 * var(--ms-rem));--ms-actions-padding: calc(.8 * var(--ms-rem));--ms-actions-border-bottom: var(--ms-border);--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: var(--ms-border);--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-bg: transparent;--ms-option-bg-hover: var(--ms-primary-bg);--ms-option-bg-focused: var(--ms-primary-bg);--ms-option-outline-focused: 2px solid var(--ms-accent-color);--ms-option-focus-outline-offset: -2px;--ms-option-bg-matched: color-mix(in srgb, var(--ms-accent-color) 8%, transparent);--ms-option-border-matched: 3px solid color-mix(in srgb, var(--ms-accent-color) 40%, transparent);--ms-option-bg-selected: color-mix(in srgb, var(--ms-accent-color) 10%, transparent);--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-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-bg: color-mix(in srgb, var(--ms-accent-color) 20%, transparent);--ms-option-mark-color: inherit;--ms-option-mark-font-weight: var(--base-font-weight-semibold, 600);--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: var(--ms-border);--ms-checkbox-border-radius: calc(.3 * var(--ms-rem));--ms-checkbox-checked-bg: var(--ms-accent-color);--ms-checkbox-checked-border: 1px 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-border);--ms-checkbox-checked-bg-hover: var(--ms-accent-color-hover);--ms-checkbox-checked-border-color-hover: var(--ms-accent-color-hover);--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));--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-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-badge-bg: var(--ms-accent-color-light);--ms-badge-bg-hover: var(--ms-badge-bg-hover);--ms-badge-bg-active: var(--ms-accent-color-light-hover);--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-icon-remove: "×";--ms-badge-counter-bg: transparent;--ms-badge-counter-border: var(--ms-border);--ms-badge-counter-border-radius: var(--ms-border-radius-sm);--ms-badge-counter-text-color: var(--ms-text-color-3);--ms-badge-counter-text-bg: var(--ms-badge-counter-text-bg);--ms-badge-counter-remove-bg: var(--ms-text-color-3);--ms-badge-counter-remove-color: var(--ms-text-color-on-accent);--ms-badge-counter-remove-bg-hover: var(--ms-badge-counter-remove-bg-hover);--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: 50%;--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-icon-clear: "×";--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-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: var(--ms-border);--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: var(--ms-border);--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: 50%;--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-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}multi-select:not(:defined){display:block;min-height:calc(3.5 * var(--ms-rem));color:transparent!important;background:transparent}.ms-wrapper{display:flex;flex-direction:column;align-items:stretch}.ms-wrapper--inline{flex-direction:row;align-items:flex-start}.ms{position:relative;width:100%}.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-right: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__input.ms__input--xs{font-size:var(--ms-input-size-xs-font);padding:var(--ms-input-size-xs-padding-v) var(--ms-input-size-xs-padding-h);padding-right:calc(var(--ms-input-size-xs-padding-h) * 2.5);height:var(--ms-input-size-xs-height)}.ms__input.ms__input--sm{font-size:var(--ms-input-size-sm-font);padding:var(--ms-input-size-sm-padding-v) var(--ms-input-size-sm-padding-h);padding-right:calc(var(--ms-input-size-sm-padding-h) * 2.5);height:var(--ms-input-size-sm-height)}.ms__input.ms__input--lg{font-size:var(--ms-input-size-lg-font);padding:var(--ms-input-size-lg-padding-v) var(--ms-input-size-lg-padding-h);padding-right:calc(var(--ms-input-size-lg-padding-h) * 2.5);height:var(--ms-input-size-lg-height)}.ms__input.ms__input--xl{font-size:var(--ms-input-size-xl-font);padding:var(--ms-input-size-xl-padding-v) var(--ms-input-size-xl-padding-h);padding-right:calc(var(--ms-input-size-xl-padding-h) * 2.5);height:var(--ms-input-size-xl-height)}.ms__toggle{position:absolute;right: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;right: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__hint{display:none;position:absolute;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:absolute;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);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-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__actions{display:flex;flex-wrap:nowrap;gap:var(--ms-actions-gap);padding:var(--ms-actions-padding);border-bottom:var(--ms-actions-border-bottom)}.ms__actions--wrap{flex-wrap:wrap}.ms__actions--sticky{position:sticky;top:0;z-index:var(--ms-z-index-sticky);background:var(--ms-actions-bg)}.ms__action-btn{flex:1;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)}.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}.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{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);color:var(--ms-option-text-color);background:var(--ms-option-bg);cursor:pointer}.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);border-left:var(--ms-option-border-matched)}.ms__option--selected{background:var(--ms-option-bg-selected)}.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}.ms__option--disabled:hover{background:var(--ms-option-bg)}.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);border-left:var(--ms-option-border-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-right:var(--ms-checkbox-margin-right);margin-bottom:var(--ms-checkbox-margin-bottom);margin-left: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 2px 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: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)}.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))}.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)}.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))}.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{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;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)}.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__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:var(--ms-icon-clear)}.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-right:none;border-radius:var(--ms-badge-border-radius) 0 0 var(--ms-badge-border-radius);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-left:none;border-radius:0 var(--ms-badge-border-radius) var(--ms-badge-border-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;box-shadow:var(--ms-badge-remove-box-shadow-focus)}.ms__badge-remove:before{content:var(--ms-icon-remove);font-size:var(--ms-font-size-base);line-height:var(--ms-line-height-none)}.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-right: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-left:none}.ms__badge--counter .ms__badge-remove:hover{background:var(--ms-badge-counter-remove-bg-hover)}.ms__badge--more{cursor:pointer}.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__selected-popover{display:none;position:absolute;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-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-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)}.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}.ms--rtl .ms__input-wrapper{direction:rtl}.ms--rtl .ms__input{text-align:right;padding-left:var(--ms-input-padding-right);padding-right:var(--ms-input-padding-h)}.ms--rtl .ms__toggle{left:var(--ms-toggle-right)!important;right:auto!important}.ms--rtl .ms__counter{left:var(--ms-counter-offset)!important;right:auto!important}.ms--rtl .ms__dropdown{direction:rtl;text-align:right}.ms--rtl .ms__option{flex-direction:row-reverse}.ms--rtl .ms__checkbox{margin-left:var(--ms-spacing-sm);margin-right:0}.ms--rtl .ms__option-content{text-align:right}.ms--rtl .ms__option-icon{margin-left:var(--ms-spacing-xs);margin-right:0}.ms--rtl .ms__badges{direction:rtl}.ms--rtl .ms__badge{flex-direction:row-reverse}.ms--rtl .ms__badge-remove{border-radius:var(--ms-badge-border-radius) 0 0 var(--ms-badge-border-radius);border-left:var(--ms-badge-remove-border);border-right:none}.ms--rtl .ms__badge-text{border-radius:0 var(--ms-badge-border-radius) var(--ms-badge-border-radius) 0;border-right:var(--ms-badge-text-border);border-left:none}.ms--rtl .ms__count-display{direction:rtl}.ms--rtl .ms__counter-wrapper{flex-direction:row-reverse}.ms--rtl .ms__selected-popover{direction:rtl;text-align:right}.ms--rtl .ms__actions{direction:rtl}.ms--rtl .ms__group-label,.ms--rtl .ms__empty{text-align:right}.ms--rtl .ms__hint{direction:rtl;text-align:right}.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-left:var(--ms-option-padding-h)}.ms--no-checkboxes .ms__option-content{padding-left:0}.ms-debug-info{margin-top:calc(.4 * var(--ms-rem));padding:calc(.4 * var(--ms-rem));background-color:#f9fafb;border:1px solid #e5e7eb;border-radius:calc(var(--base-border-radius-md, .6) * var(--ms-rem));font-size:calc(1.2 * var(--ms-rem));color:#111827}.ms-debug-info details summary{cursor:pointer;font-weight:600;color:#2563eb;-webkit-user-select:none;user-select:none;padding:calc(.4 * var(--ms-rem));border-radius:calc(var(--base-border-radius-sm, .4) * var(--ms-rem))}.ms-debug-info details summary:hover{background-color:#f3f4f6}.ms-debug-info details summary:focus{outline:2px solid #3b82f6;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:#fff;border-radius:calc(var(--base-border-radius-sm, .4) * var(--ms-rem))}.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-right:calc(.4 * var(--ms-rem));color:#3b82f6}',us=typeof HTMLElement<"u"?HTMLElement:class{},Ae=new Set;function dt(){return Array.from(Ae)}class Ie extends us{constructor(){super();m(this,"picker");m(this,"containerElement");m(this,"shadow");m(this,"_options");m(this,"_valueMember");m(this,"_getValueCallback");m(this,"_displayValueMember");m(this,"_getDisplayValueCallback");m(this,"_getBadgeDisplayCallback");m(this,"_getBadgeClassCallback");m(this,"_customStylesCallback");m(this,"_searchValueMember");m(this,"_getSearchValueCallback");m(this,"_iconMember");m(this,"_getIconCallback");m(this,"_subtitleMember");m(this,"_getSubtitleCallback");m(this,"_groupMember");m(this,"_getGroupCallback");m(this,"_renderGroupLabelContentCallback");m(this,"_disabledMember");m(this,"_getDisabledCallback");m(this,"_getValueFormatCallback");m(this,"_getBadgeTooltipCallback");m(this,"_getRemoveButtonTooltipCallback");m(this,"_renderOptionContentCallback");m(this,"_renderBadgeContentCallback");m(this,"_renderSelectedItemContentCallback");m(this,"_getSelectedItemClassCallback");m(this,"_renderSelectedContentCallback");m(this,"_getCounterCallback");m(this,"_actionButtons");m(this,"_beforeSearchCallback");m(this,"_searchCallback");m(this,"_addNewCallback");m(this,"_selectCallback");m(this,"_deselectCallback");m(this,"_changeCallback");m(this,"_declarativeSelectedValues");this.shadow=this.attachShadow({mode:"open"});const t=document.createElement("style");t.textContent=ps,this.shadow.appendChild(t),requestAnimationFrame(()=>{this.setAttribute("data-ready","")})}static get observedAttributes(){return["search-hint","search-placeholder","multiple","allow-groups","show-checkboxes","sticky-actions","close-on-select","lock-placement","dropdown-min-width","dropdown-max-width","badges-display-mode","badges-threshold","badges-max-visible","badges-threshold-mode","badges-position","show-counter","keep-options-on-search","should-keep-search-on-close","max-height","empty-message","loading-message","min-search-length","enable-search","search-input-mode","search-mode","actions-layout","allow-add-new","initial-values","enable-virtual-scroll","virtual-scroll-threshold","option-height","badge-height","virtual-scroll-buffer","value-member","display-value-member","search-value-member","icon-member","subtitle-member","group-member","disabled-member","name","value-format","enable-badge-tooltips","badge-tooltip-placement","remove-button-tooltip-text","show-debug-info"]}connectedCallback(){Ae.add(this),this.render();const t=this.parseDeclarativeOptions();t&&(this._options&&this._options.length>0&&k.warn("[MultiSelectElement] Both declarative <option> elements and programmatic .options detected. Using declarative options."),this._options=t),this.initializePicker()}disconnectedCallback(){Ae.delete(this),this.picker&&this.picker.destroy()}attributeChangedCallback(t,s,i){s!==i&&this.picker&&t!=="initial-values"&&(this.picker.destroy(),this.initializePicker())}render(){this.containerElement=document.createElement("div"),this.containerElement.setAttribute("data-multiselect",""),this.className&&(this.containerElement.className=this.className),this.shadow.appendChild(this.containerElement),this.getAttribute("show-debug-info")==="true"&&this.renderDebugInfo()}renderDebugInfo(){const t=this.shadow.querySelector(".ms-debug-info");t&&t.remove();const s=document.createElement("div");s.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),s.appendChild(i),this.shadow.appendChild(s),this.updateDebugInfo()}updateDebugInfo(){var h,g;const t=this.shadow.querySelector(".ms-debug-stats");if(!t||!this.picker)return;const s="1.8.0",i=dt().length,n=this.picker.getSelected().length,a=((h=this._options)==null?void 0:h.length)||0,l=this.picker,c=l.isOpen||!1,d=l.searchTerm||"",p=l.isLoading||!1,u=((g=l.filteredOptions)==null?void 0:g.length)||0;t.innerHTML=`
|
|
47
47
|
<span>Version: ${s}</span>
|
|
48
48
|
<span>Total Instances: ${i}</span>
|
|
49
49
|
<span>Options: ${a}</span>
|
|
@@ -52,4 +52,4 @@ ${d}`:c,v.debug(`[${this.instanceId}] Using default content: "${r}"`)}typeof r==
|
|
|
52
52
|
<span>Dropdown: ${c?"Open":"Closed"}</span>
|
|
53
53
|
<span>Search: ${d||"none"}</span>
|
|
54
54
|
<span>Loading: ${p?"Yes":"No"}</span>
|
|
55
|
-
`,setTimeout(()=>{this.getAttribute("show-debug-info")==="true"&&this.updateDebugInfo()},500)}parseDeclarativeOptions(){var r,n,a,l;const t=[],s=Array.from(this.children);if(s.length===0)return null;let i=!1;for(const c of s)if(c.tagName==="OPTION"){const d=c,p={value:d.value||((r=d.textContent)==null?void 0:r.trim())||"",label:((n=d.textContent)==null?void 0:n.trim())||d.value||""};d.hasAttribute("selected")&&(this._declarativeSelectedValues||(this._declarativeSelectedValues=[]),this._declarativeSelectedValues.push(p.value)),d.hasAttribute("disabled")&&(p.disabled=!0),d.hasAttribute("data-icon")&&(p.icon=d.getAttribute("data-icon")),d.hasAttribute("data-subtitle")&&(p.subtitle=d.getAttribute("data-subtitle")),t.push(p),i=!0}else if(c.tagName==="OPTGROUP"){const d=c,p=d.label||d.getAttribute("label")||"Group",u=Array.from(d.querySelectorAll("option"));for(const h of u){const g={value:h.value||((a=h.textContent)==null?void 0:a.trim())||"",label:((l=h.textContent)==null?void 0:l.trim())||h.value||"",group:p};h.hasAttribute("selected")&&(this._declarativeSelectedValues||(this._declarativeSelectedValues=[]),this._declarativeSelectedValues.push(g.value)),h.hasAttribute("disabled")&&(g.disabled=!0),h.hasAttribute("data-icon")&&(g.icon=h.getAttribute("data-icon")),h.hasAttribute("data-subtitle")&&(g.subtitle=h.getAttribute("data-subtitle")),t.push(g),i=!0}}return i?(C.debug(`[MultiSelectElement] Parsed ${t.length} declarative options from Light DOM`),s.forEach(c=>{(c.tagName==="OPTION"||c.tagName==="OPTGROUP")&&c.remove()}),t):null}initializePicker(){if(!this.containerElement)return;let t;if(this._declarativeSelectedValues&&this._declarativeSelectedValues.length>0)t=this._declarativeSelectedValues,C.debug(`[MultiSelectElement] Using ${t.length} declaratively selected values`);else{const i=this.getAttribute("initial-values");if(i)try{t=JSON.parse(i)}catch(r){C.error("[MultiSelectElement] Failed to parse initial-values:",r)}}const s={searchHint:this.getAttribute("search-hint")||void 0,searchPlaceholder:this.getAttribute("search-placeholder")||"Search...",dropdownMinWidth:this.getAttribute("dropdown-min-width")||void 0,dropdownMaxWidth:this.getAttribute("dropdown-max-width")||void 0,badgesDisplayMode:this.getAttribute("badges-display-mode")||"badges",badgesPosition:this.getAttribute("badges-position")||"bottom",badgesThresholdMode:this.getAttribute("badges-threshold-mode")||"count",maxHeight:this.getAttribute("max-height")||"20rem",emptyMessage:this.getAttribute("empty-message")||"No results found",loadingMessage:this.getAttribute("loading-message")||"Loading...",searchInputMode:this.getAttribute("search-input-mode")||"normal",searchMode:this.getAttribute("search-mode")||"filter",actionsLayout:this.getAttribute("actions-layout")||"nowrap",badgesThreshold:this.getAttribute("badges-threshold")?parseInt(this.getAttribute("badges-threshold")):void 0,badgesMaxVisible:this.getAttribute("badges-max-visible")?parseInt(this.getAttribute("badges-max-visible")):void 0,minSearchLength:this.getAttribute("min-search-length")?parseInt(this.getAttribute("min-search-length")):0,isMultipleEnabled:this.getAttribute("multiple")!=="false",isGroupsAllowed:this.getAttribute("allow-groups")!=="false",isCheckboxesShown:this.getAttribute("show-checkboxes")!=="false",isActionsSticky:this.getAttribute("sticky-actions")!=="false",isCloseOnSelect:this.getAttribute("close-on-select")==="true",isPlacementLocked:this.getAttribute("lock-placement")!=="false",isSearchEnabled:this.getAttribute("enable-search")!=="false",isAddNewAllowed:this.getAttribute("allow-add-new")==="true",isCounterShown:this.getAttribute("show-counter")==="true",isKeepOptionsOnSearch:this.getAttribute("keep-options-on-search")!=="false",shouldKeepSearchOnClose:this.getAttribute("should-keep-search-on-close")!=="false",isVirtualScrollEnabled:this.getAttribute("enable-virtual-scroll")==="true",actionButtons:this._actionButtons,checkboxAlign:this.getAttribute("checkbox-align")||"center",virtualScrollThreshold:this.getAttribute("virtual-scroll-threshold")?parseInt(this.getAttribute("virtual-scroll-threshold")):100,optionHeight:this.getAttribute("option-height")?parseInt(this.getAttribute("option-height")):50,badgeHeight:this.getAttribute("badge-height")?parseInt(this.getAttribute("badge-height")):36,virtualScrollBuffer:this.getAttribute("virtual-scroll-buffer")?parseInt(this.getAttribute("virtual-scroll-buffer")):10,valueMember:this.getAttribute("value-member")||this._valueMember,displayValueMember:this.getAttribute("display-value-member")||this._displayValueMember,searchValueMember:this.getAttribute("search-value-member")||this._searchValueMember,iconMember:this.getAttribute("icon-member")||this._iconMember,subtitleMember:this.getAttribute("subtitle-member")||this._subtitleMember,groupMember:this.getAttribute("group-member")||this._groupMember,disabledMember:this.getAttribute("disabled-member")||this._disabledMember,getValueCallback:this._getValueCallback,getDisplayValueCallback:this._getDisplayValueCallback,getBadgeDisplayCallback:this._getBadgeDisplayCallback,getBadgeClassCallback:this._getBadgeClassCallback,customStylesCallback:this._customStylesCallback,getSearchValueCallback:this._getSearchValueCallback,getIconCallback:this._getIconCallback,getSubtitleCallback:this._getSubtitleCallback,getGroupCallback:this._getGroupCallback,renderGroupLabelContentCallback:this._renderGroupLabelContentCallback,getDisabledCallback:this._getDisabledCallback,renderOptionContentCallback:this._renderOptionContentCallback,renderBadgeContentCallback:this._renderBadgeContentCallback,renderSelectedItemContentCallback:this._renderSelectedItemContentCallback,getSelectedItemClassCallback:this._getSelectedItemClassCallback,renderSelectedContentCallback:this._renderSelectedContentCallback,formFieldId:this.getAttribute("name")||void 0,valueFormat:this.getAttribute("value-format")||"json",getValueFormatCallback:this._getValueFormatCallback,isBadgeTooltipsEnabled:this.getAttribute("enable-badge-tooltips")==="true",getBadgeTooltipCallback:this._getBadgeTooltipCallback,getRemoveButtonTooltipCallback:this._getRemoveButtonTooltipCallback,removeButtonTooltipText:this.getAttribute("remove-button-tooltip-text")||void 0,badgeTooltipPlacement:this.getAttribute("badge-tooltip-placement")||"top",badgeTooltipDelay:parseInt(this.getAttribute("badge-tooltip-delay")||"100"),badgeTooltipOffset:parseInt(this.getAttribute("badge-tooltip-offset")||"8"),getCounterCallback:this._getCounterCallback||((i,r)=>r!==void 0?`+${r} more`:`${i} selected`),options:this._options,beforeSearchCallback:this._beforeSearchCallback,searchCallback:this._searchCallback,addNewCallback:this._addNewCallback,selectCallback:i=>{var r;this._selectCallback&&this._selectCallback(i),this.dispatchEvent(new CustomEvent("select",{detail:{option:i,selectedOptions:(r=this.picker)==null?void 0:r.getSelected(),selectedValues:(()=>{var a;const n=(a=this.picker)==null?void 0:a.getValue();return n==null?[]:Array.isArray(n)?n:[n]})()}}))},deselectCallback:i=>{var r;this._deselectCallback&&this._deselectCallback(i),this.dispatchEvent(new CustomEvent("deselect",{detail:{option:i,selectedOptions:(r=this.picker)==null?void 0:r.getSelected(),selectedValues:(()=>{var a;const n=(a=this.picker)==null?void 0:a.getValue();return n==null?[]:Array.isArray(n)?n:[n]})()}}))},changeCallback:i=>{this._changeCallback&&this._changeCallback(i),this.dispatchEvent(new CustomEvent("change",{detail:{selectedOptions:i,selectedValues:(()=>{var n;const r=(n=this.picker)==null?void 0:n.getValue();return r==null?[]:Array.isArray(r)?r:[r]})()}}))},container:this.shadow,hostElement:this};if(t&&(this.containerElement.dataset.initialValues=JSON.stringify(t)),this.picker=new ct(this.containerElement,s),this._customStylesCallback){const i=this._customStylesCallback();if(i){const r=document.createElement("style");r.className="ms-custom-styles",r.textContent=i,this.shadow.insertBefore(r,this.shadow.firstChild)}}}reinitialize(){this.picker&&(this.picker.destroy(),this.initializePicker())}get options(){return this._options}set options(t){this._options=t,this.reinitialize()}set valueMember(t){this._valueMember=t||void 0,t?this.setAttribute("value-member",t):this.removeAttribute("value-member")}get valueMember(){return this.getAttribute("value-member")}set displayValueMember(t){this._displayValueMember=t||void 0,t?this.setAttribute("display-value-member",t):this.removeAttribute("display-value-member")}get displayValueMember(){return this.getAttribute("display-value-member")}set searchValueMember(t){this._searchValueMember=t||void 0,t?this.setAttribute("search-value-member",t):this.removeAttribute("search-value-member")}get searchValueMember(){return this.getAttribute("search-value-member")}set iconMember(t){this._iconMember=t||void 0,t?this.setAttribute("icon-member",t):this.removeAttribute("icon-member")}get iconMember(){return this.getAttribute("icon-member")}set subtitleMember(t){this._subtitleMember=t||void 0,t?this.setAttribute("subtitle-member",t):this.removeAttribute("subtitle-member")}get subtitleMember(){return this.getAttribute("subtitle-member")}set groupMember(t){this._groupMember=t||void 0,t?this.setAttribute("group-member",t):this.removeAttribute("group-member")}get groupMember(){return this.getAttribute("group-member")}set disabledMember(t){this._disabledMember=t||void 0,t?this.setAttribute("disabled-member",t):this.removeAttribute("disabled-member")}get disabledMember(){return this.getAttribute("disabled-member")}set getValueCallback(t){this._getValueCallback=t,this.reinitialize()}get getValueCallback(){return this._getValueCallback}set getDisplayValueCallback(t){this._getDisplayValueCallback=t,this.reinitialize()}get getDisplayValueCallback(){return this._getDisplayValueCallback}set getBadgeDisplayCallback(t){this._getBadgeDisplayCallback=t,this.reinitialize()}get getBadgeDisplayCallback(){return this._getBadgeDisplayCallback}set getBadgeClassCallback(t){this._getBadgeClassCallback=t,this.reinitialize()}get getBadgeClassCallback(){return this._getBadgeClassCallback}set customStylesCallback(t){if(this._customStylesCallback=t,this.picker&&t){const s=t();if(s){const i=this.shadow.querySelector("style.ms-custom-styles");i&&i.remove();const r=document.createElement("style");r.className="ms-custom-styles",r.textContent=s,this.shadow.appendChild(r),this.picker.renderBadges()}}}get customStylesCallback(){return this._customStylesCallback}set getSearchValueCallback(t){this._getSearchValueCallback=t,this.reinitialize()}get getSearchValueCallback(){return this._getSearchValueCallback}set getIconCallback(t){this._getIconCallback=t,this.reinitialize()}get getIconCallback(){return this._getIconCallback}set getSubtitleCallback(t){this._getSubtitleCallback=t,this.reinitialize()}get getSubtitleCallback(){return this._getSubtitleCallback}set getGroupCallback(t){this._getGroupCallback=t,this.reinitialize()}get getGroupCallback(){return this._getGroupCallback}set renderGroupLabelContentCallback(t){this._renderGroupLabelContentCallback=t,this.reinitialize()}get renderGroupLabelContentCallback(){return this._renderGroupLabelContentCallback}set getDisabledCallback(t){this._getDisabledCallback=t,this.reinitialize()}get getDisabledCallback(){return this._getDisabledCallback}set renderOptionContentCallback(t){this._renderOptionContentCallback=t,this.reinitialize()}get renderOptionContentCallback(){return this._renderOptionContentCallback}set renderBadgeContentCallback(t){this._renderBadgeContentCallback=t,this.reinitialize()}get renderBadgeContentCallback(){return this._renderBadgeContentCallback}set renderSelectedItemContentCallback(t){this._renderSelectedItemContentCallback=t,this.reinitialize()}get renderSelectedItemContentCallback(){return this._renderSelectedItemContentCallback}set getSelectedItemClassCallback(t){this._getSelectedItemClassCallback=t,this.reinitialize()}get getSelectedItemClassCallback(){return this._getSelectedItemClassCallback}set renderSelectedContentCallback(t){this._renderSelectedContentCallback=t,this.reinitialize()}get renderSelectedContentCallback(){return this._renderSelectedContentCallback}set name(t){t?this.setAttribute("name",t):this.removeAttribute("name")}get name(){return this.getAttribute("name")}set valueFormat(t){t?this.setAttribute("value-format",t):this.removeAttribute("value-format")}get valueFormat(){return this.getAttribute("value-format")}set getValueFormatCallback(t){this._getValueFormatCallback=t,this.reinitialize()}get getValueFormatCallback(){return this._getValueFormatCallback}set thresholdMode(t){t?this.setAttribute("threshold-mode",t):this.removeAttribute("threshold-mode")}get thresholdMode(){return this.getAttribute("threshold-mode")}set badgesMaxVisible(t){t!==null?this.setAttribute("badges-max-visible",String(t)):this.removeAttribute("badges-max-visible")}get badgesMaxVisible(){const t=this.getAttribute("badges-max-visible");return t?parseInt(t):null}set checkboxAlign(t){t?this.setAttribute("checkbox-align",t):this.removeAttribute("checkbox-align")}get checkboxAlign(){return this.getAttribute("checkbox-align")}set enableBadgeTooltips(t){t?this.setAttribute("enable-badge-tooltips","true"):this.removeAttribute("enable-badge-tooltips")}get enableBadgeTooltips(){return this.getAttribute("enable-badge-tooltips")==="true"}set badgeTooltipPlacement(t){t?this.setAttribute("badge-tooltip-placement",t):this.removeAttribute("badge-tooltip-placement")}get badgeTooltipPlacement(){return this.getAttribute("badge-tooltip-placement")}set getBadgeTooltipCallback(t){this._getBadgeTooltipCallback=t,this.reinitialize()}get getBadgeTooltipCallback(){return this._getBadgeTooltipCallback}set getRemoveButtonTooltipCallback(t){this._getRemoveButtonTooltipCallback=t,this.reinitialize()}get getRemoveButtonTooltipCallback(){return this._getRemoveButtonTooltipCallback}set removeButtonTooltipText(t){t?this.setAttribute("remove-button-tooltip-text",t):this.removeAttribute("remove-button-tooltip-text")}get removeButtonTooltipText(){return this.getAttribute("remove-button-tooltip-text")}set getCounterCallback(t){this._getCounterCallback=t,this.reinitialize()}get getCounterCallback(){return this._getCounterCallback}get beforeSearchCallback(){return this._beforeSearchCallback}set beforeSearchCallback(t){this._beforeSearchCallback=t,this.reinitialize()}get searchCallback(){return this._searchCallback}set searchCallback(t){this._searchCallback=t,this.reinitialize()}get addNewCallback(){return this._addNewCallback}set addNewCallback(t){this._addNewCallback=t,this.reinitialize()}get selectCallback(){return this._selectCallback}set selectCallback(t){this._selectCallback=t}get deselectCallback(){return this._deselectCallback}set deselectCallback(t){this._deselectCallback=t}get changeCallback(){return this._changeCallback}set changeCallback(t){this._changeCallback=t}get actionButtons(){return this._actionButtons}set actionButtons(t){this._actionButtons=t,this.reinitialize()}get selectedValue(){var t;return((t=this.picker)==null?void 0:t.selectedValue)??null}get selectedItem(){var t;return((t=this.picker)==null?void 0:t.selectedItem)??null}getSelected(){return this.picker?this.picker.getSelected():[]}setSelected(t){this.picker&&this.picker.setSelected(t)}getValue(){return this.picker?this.picker.getValue():null}destroy(){this.picker&&this.picker.destroy()}}typeof window<"u"&&typeof customElements<"u"&&(customElements.get("web-multiselect")||customElements.define("web-multiselect",Ie)),typeof window<"u"&&(window.components=window.components||{},window.components["web-multiselect"]={version:()=>"1.7.0",config:{name:"@keenmate/web-multiselect",version:"1.7.0",author:"Keenmate",license:"MIT",repository:"git+https://github.com/keenmate/web-multiselect.git",homepage:"https://github.com/keenmate/web-multiselect#readme"},logging:{enableLogging:it,disableLogging:rt,setLogLevel:nt,setCategoryLevel:at,getCategories:()=>[...ot]},register:()=>{typeof customElements<"u"&&!customElements.get("web-multiselect")&&customElements.define("web-multiselect",Ie)},getInstances:()=>dt()}),y.LOGGING_CATEGORIES=ot,y.MultiSelectElement=Ie,y.WebMultiSelect=ct,y.dataLogger=C,y.disableLogging=rt,y.enableLogging=it,y.initLogger=re,y.interactionLogger=T,y.setCategoryLevel=at,y.setLogLevel=nt,y.uiLogger=v,Object.defineProperty(y,Symbol.toStringTag,{value:"Module"})});
|
|
55
|
+
`,setTimeout(()=>{this.getAttribute("show-debug-info")==="true"&&this.updateDebugInfo()},500)}parseDeclarativeOptions(){var r,n,a,l;const t=[],s=Array.from(this.children);if(s.length===0)return null;let i=!1;for(const c of s)if(c.tagName==="OPTION"){const d=c,p={value:d.value||((r=d.textContent)==null?void 0:r.trim())||"",label:((n=d.textContent)==null?void 0:n.trim())||d.value||""};d.hasAttribute("selected")&&(this._declarativeSelectedValues||(this._declarativeSelectedValues=[]),this._declarativeSelectedValues.push(p.value)),d.hasAttribute("disabled")&&(p.disabled=!0),d.hasAttribute("data-icon")&&(p.icon=d.getAttribute("data-icon")),d.hasAttribute("data-subtitle")&&(p.subtitle=d.getAttribute("data-subtitle")),t.push(p),i=!0}else if(c.tagName==="OPTGROUP"){const d=c,p=d.label||d.getAttribute("label")||"Group",u=Array.from(d.querySelectorAll("option"));for(const h of u){const g={value:h.value||((a=h.textContent)==null?void 0:a.trim())||"",label:((l=h.textContent)==null?void 0:l.trim())||h.value||"",group:p};h.hasAttribute("selected")&&(this._declarativeSelectedValues||(this._declarativeSelectedValues=[]),this._declarativeSelectedValues.push(g.value)),h.hasAttribute("disabled")&&(g.disabled=!0),h.hasAttribute("data-icon")&&(g.icon=h.getAttribute("data-icon")),h.hasAttribute("data-subtitle")&&(g.subtitle=h.getAttribute("data-subtitle")),t.push(g),i=!0}}return i?(k.debug(`[MultiSelectElement] Parsed ${t.length} declarative options from Light DOM`),s.forEach(c=>{(c.tagName==="OPTION"||c.tagName==="OPTGROUP")&&c.remove()}),t):null}initializePicker(){if(!this.containerElement)return;let t;if(this._declarativeSelectedValues&&this._declarativeSelectedValues.length>0)t=this._declarativeSelectedValues,k.debug(`[MultiSelectElement] Using ${t.length} declaratively selected values`);else{const i=this.getAttribute("initial-values");if(i)try{t=JSON.parse(i)}catch(r){k.error("[MultiSelectElement] Failed to parse initial-values:",r)}}const s={searchHint:this.getAttribute("search-hint")||void 0,searchPlaceholder:this.getAttribute("search-placeholder")||"Search...",dropdownMinWidth:this.getAttribute("dropdown-min-width")||void 0,dropdownMaxWidth:this.getAttribute("dropdown-max-width")||void 0,badgesDisplayMode:this.getAttribute("badges-display-mode")||"badges",badgesPosition:this.getAttribute("badges-position")||"bottom",badgesThresholdMode:this.getAttribute("badges-threshold-mode")||"count",maxHeight:this.getAttribute("max-height")||"20rem",emptyMessage:this.getAttribute("empty-message")||"No results found",loadingMessage:this.getAttribute("loading-message")||"Loading...",searchInputMode:this.getAttribute("search-input-mode")||"normal",searchMode:this.getAttribute("search-mode")||"filter",actionsLayout:this.getAttribute("actions-layout")||"nowrap",badgesThreshold:this.getAttribute("badges-threshold")?parseInt(this.getAttribute("badges-threshold")):void 0,badgesMaxVisible:this.getAttribute("badges-max-visible")?parseInt(this.getAttribute("badges-max-visible")):void 0,minSearchLength:this.getAttribute("min-search-length")?parseInt(this.getAttribute("min-search-length")):0,isMultipleEnabled:this.getAttribute("multiple")!=="false",isGroupsAllowed:this.getAttribute("allow-groups")!=="false",isCheckboxesShown:this.getAttribute("show-checkboxes")!=="false",isActionsSticky:this.getAttribute("sticky-actions")!=="false",isCloseOnSelect:this.getAttribute("close-on-select")==="true",isPlacementLocked:this.getAttribute("lock-placement")!=="false",isSearchEnabled:this.getAttribute("enable-search")!=="false",isAddNewAllowed:this.getAttribute("allow-add-new")==="true",isCounterShown:this.getAttribute("show-counter")==="true",isKeepOptionsOnSearch:this.getAttribute("keep-options-on-search")!=="false",shouldKeepSearchOnClose:this.getAttribute("should-keep-search-on-close")!=="false",isVirtualScrollEnabled:this.getAttribute("enable-virtual-scroll")==="true",actionButtons:this._actionButtons,checkboxAlign:this.getAttribute("checkbox-align")||"center",virtualScrollThreshold:this.getAttribute("virtual-scroll-threshold")?parseInt(this.getAttribute("virtual-scroll-threshold")):100,optionHeight:this.getAttribute("option-height")?parseInt(this.getAttribute("option-height")):50,badgeHeight:this.getAttribute("badge-height")?parseInt(this.getAttribute("badge-height")):36,virtualScrollBuffer:this.getAttribute("virtual-scroll-buffer")?parseInt(this.getAttribute("virtual-scroll-buffer")):10,valueMember:this.getAttribute("value-member")||this._valueMember,displayValueMember:this.getAttribute("display-value-member")||this._displayValueMember,searchValueMember:this.getAttribute("search-value-member")||this._searchValueMember,iconMember:this.getAttribute("icon-member")||this._iconMember,subtitleMember:this.getAttribute("subtitle-member")||this._subtitleMember,groupMember:this.getAttribute("group-member")||this._groupMember,disabledMember:this.getAttribute("disabled-member")||this._disabledMember,getValueCallback:this._getValueCallback,getDisplayValueCallback:this._getDisplayValueCallback,getBadgeDisplayCallback:this._getBadgeDisplayCallback,getBadgeClassCallback:this._getBadgeClassCallback,customStylesCallback:this._customStylesCallback,getSearchValueCallback:this._getSearchValueCallback,getIconCallback:this._getIconCallback,getSubtitleCallback:this._getSubtitleCallback,getGroupCallback:this._getGroupCallback,renderGroupLabelContentCallback:this._renderGroupLabelContentCallback,getDisabledCallback:this._getDisabledCallback,renderOptionContentCallback:this._renderOptionContentCallback,renderBadgeContentCallback:this._renderBadgeContentCallback,renderSelectedItemContentCallback:this._renderSelectedItemContentCallback,getSelectedItemClassCallback:this._getSelectedItemClassCallback,renderSelectedContentCallback:this._renderSelectedContentCallback,formFieldId:this.getAttribute("name")||void 0,valueFormat:this.getAttribute("value-format")||"json",getValueFormatCallback:this._getValueFormatCallback,isBadgeTooltipsEnabled:this.getAttribute("enable-badge-tooltips")==="true",getBadgeTooltipCallback:this._getBadgeTooltipCallback,getRemoveButtonTooltipCallback:this._getRemoveButtonTooltipCallback,removeButtonTooltipText:this.getAttribute("remove-button-tooltip-text")||void 0,badgeTooltipPlacement:this.getAttribute("badge-tooltip-placement")||"top",badgeTooltipDelay:parseInt(this.getAttribute("badge-tooltip-delay")||"100"),badgeTooltipOffset:parseInt(this.getAttribute("badge-tooltip-offset")||"8"),getCounterCallback:this._getCounterCallback||((i,r)=>r!==void 0?`+${r} more`:`${i} selected`),options:this._options,beforeSearchCallback:this._beforeSearchCallback,searchCallback:this._searchCallback,addNewCallback:this._addNewCallback,selectCallback:i=>{var r;this._selectCallback&&this._selectCallback(i),this.dispatchEvent(new CustomEvent("select",{detail:{option:i,selectedOptions:(r=this.picker)==null?void 0:r.getSelected(),selectedValues:(()=>{var a;const n=(a=this.picker)==null?void 0:a.getValue();return n==null?[]:Array.isArray(n)?n:[n]})()}}))},deselectCallback:i=>{var r;this._deselectCallback&&this._deselectCallback(i),this.dispatchEvent(new CustomEvent("deselect",{detail:{option:i,selectedOptions:(r=this.picker)==null?void 0:r.getSelected(),selectedValues:(()=>{var a;const n=(a=this.picker)==null?void 0:a.getValue();return n==null?[]:Array.isArray(n)?n:[n]})()}}))},changeCallback:i=>{this._changeCallback&&this._changeCallback(i),this.dispatchEvent(new CustomEvent("change",{detail:{selectedOptions:i,selectedValues:(()=>{var n;const r=(n=this.picker)==null?void 0:n.getValue();return r==null?[]:Array.isArray(r)?r:[r]})()}}))},container:this.shadow,hostElement:this};if(t&&(this.containerElement.dataset.initialValues=JSON.stringify(t)),this.picker=new ct(this.containerElement,s),this._customStylesCallback){const i=this._customStylesCallback();if(i){const r=document.createElement("style");r.className="ms-custom-styles",r.textContent=i,this.shadow.insertBefore(r,this.shadow.firstChild)}}}reinitialize(){this.picker&&(this.picker.destroy(),this.initializePicker())}get options(){return this._options}set options(t){this._options=t,this.reinitialize()}set valueMember(t){this._valueMember=t||void 0,t?this.setAttribute("value-member",t):this.removeAttribute("value-member")}get valueMember(){return this.getAttribute("value-member")}set displayValueMember(t){this._displayValueMember=t||void 0,t?this.setAttribute("display-value-member",t):this.removeAttribute("display-value-member")}get displayValueMember(){return this.getAttribute("display-value-member")}set searchValueMember(t){this._searchValueMember=t||void 0,t?this.setAttribute("search-value-member",t):this.removeAttribute("search-value-member")}get searchValueMember(){return this.getAttribute("search-value-member")}set iconMember(t){this._iconMember=t||void 0,t?this.setAttribute("icon-member",t):this.removeAttribute("icon-member")}get iconMember(){return this.getAttribute("icon-member")}set subtitleMember(t){this._subtitleMember=t||void 0,t?this.setAttribute("subtitle-member",t):this.removeAttribute("subtitle-member")}get subtitleMember(){return this.getAttribute("subtitle-member")}set groupMember(t){this._groupMember=t||void 0,t?this.setAttribute("group-member",t):this.removeAttribute("group-member")}get groupMember(){return this.getAttribute("group-member")}set disabledMember(t){this._disabledMember=t||void 0,t?this.setAttribute("disabled-member",t):this.removeAttribute("disabled-member")}get disabledMember(){return this.getAttribute("disabled-member")}set getValueCallback(t){this._getValueCallback=t,this.reinitialize()}get getValueCallback(){return this._getValueCallback}set getDisplayValueCallback(t){this._getDisplayValueCallback=t,this.reinitialize()}get getDisplayValueCallback(){return this._getDisplayValueCallback}set getBadgeDisplayCallback(t){this._getBadgeDisplayCallback=t,this.reinitialize()}get getBadgeDisplayCallback(){return this._getBadgeDisplayCallback}set getBadgeClassCallback(t){this._getBadgeClassCallback=t,this.reinitialize()}get getBadgeClassCallback(){return this._getBadgeClassCallback}set customStylesCallback(t){if(this._customStylesCallback=t,this.picker&&t){const s=t();if(s){const i=this.shadow.querySelector("style.ms-custom-styles");i&&i.remove();const r=document.createElement("style");r.className="ms-custom-styles",r.textContent=s,this.shadow.appendChild(r),this.picker.renderBadges()}}}get customStylesCallback(){return this._customStylesCallback}set getSearchValueCallback(t){this._getSearchValueCallback=t,this.reinitialize()}get getSearchValueCallback(){return this._getSearchValueCallback}set getIconCallback(t){this._getIconCallback=t,this.reinitialize()}get getIconCallback(){return this._getIconCallback}set getSubtitleCallback(t){this._getSubtitleCallback=t,this.reinitialize()}get getSubtitleCallback(){return this._getSubtitleCallback}set getGroupCallback(t){this._getGroupCallback=t,this.reinitialize()}get getGroupCallback(){return this._getGroupCallback}set renderGroupLabelContentCallback(t){this._renderGroupLabelContentCallback=t,this.reinitialize()}get renderGroupLabelContentCallback(){return this._renderGroupLabelContentCallback}set getDisabledCallback(t){this._getDisabledCallback=t,this.reinitialize()}get getDisabledCallback(){return this._getDisabledCallback}set renderOptionContentCallback(t){this._renderOptionContentCallback=t,this.reinitialize()}get renderOptionContentCallback(){return this._renderOptionContentCallback}set renderBadgeContentCallback(t){this._renderBadgeContentCallback=t,this.reinitialize()}get renderBadgeContentCallback(){return this._renderBadgeContentCallback}set renderSelectedItemContentCallback(t){this._renderSelectedItemContentCallback=t,this.reinitialize()}get renderSelectedItemContentCallback(){return this._renderSelectedItemContentCallback}set getSelectedItemClassCallback(t){this._getSelectedItemClassCallback=t,this.reinitialize()}get getSelectedItemClassCallback(){return this._getSelectedItemClassCallback}set renderSelectedContentCallback(t){this._renderSelectedContentCallback=t,this.reinitialize()}get renderSelectedContentCallback(){return this._renderSelectedContentCallback}set name(t){t?this.setAttribute("name",t):this.removeAttribute("name")}get name(){return this.getAttribute("name")}set valueFormat(t){t?this.setAttribute("value-format",t):this.removeAttribute("value-format")}get valueFormat(){return this.getAttribute("value-format")}set getValueFormatCallback(t){this._getValueFormatCallback=t,this.reinitialize()}get getValueFormatCallback(){return this._getValueFormatCallback}set thresholdMode(t){t?this.setAttribute("threshold-mode",t):this.removeAttribute("threshold-mode")}get thresholdMode(){return this.getAttribute("threshold-mode")}set badgesMaxVisible(t){t!==null?this.setAttribute("badges-max-visible",String(t)):this.removeAttribute("badges-max-visible")}get badgesMaxVisible(){const t=this.getAttribute("badges-max-visible");return t?parseInt(t):null}set checkboxAlign(t){t?this.setAttribute("checkbox-align",t):this.removeAttribute("checkbox-align")}get checkboxAlign(){return this.getAttribute("checkbox-align")}set enableBadgeTooltips(t){t?this.setAttribute("enable-badge-tooltips","true"):this.removeAttribute("enable-badge-tooltips")}get enableBadgeTooltips(){return this.getAttribute("enable-badge-tooltips")==="true"}set badgeTooltipPlacement(t){t?this.setAttribute("badge-tooltip-placement",t):this.removeAttribute("badge-tooltip-placement")}get badgeTooltipPlacement(){return this.getAttribute("badge-tooltip-placement")}set getBadgeTooltipCallback(t){this._getBadgeTooltipCallback=t,this.reinitialize()}get getBadgeTooltipCallback(){return this._getBadgeTooltipCallback}set getRemoveButtonTooltipCallback(t){this._getRemoveButtonTooltipCallback=t,this.reinitialize()}get getRemoveButtonTooltipCallback(){return this._getRemoveButtonTooltipCallback}set removeButtonTooltipText(t){t?this.setAttribute("remove-button-tooltip-text",t):this.removeAttribute("remove-button-tooltip-text")}get removeButtonTooltipText(){return this.getAttribute("remove-button-tooltip-text")}set getCounterCallback(t){this._getCounterCallback=t,this.reinitialize()}get getCounterCallback(){return this._getCounterCallback}get beforeSearchCallback(){return this._beforeSearchCallback}set beforeSearchCallback(t){this._beforeSearchCallback=t,this.reinitialize()}get searchCallback(){return this._searchCallback}set searchCallback(t){this._searchCallback=t,this.reinitialize()}get addNewCallback(){return this._addNewCallback}set addNewCallback(t){this._addNewCallback=t,this.reinitialize()}get selectCallback(){return this._selectCallback}set selectCallback(t){this._selectCallback=t}get deselectCallback(){return this._deselectCallback}set deselectCallback(t){this._deselectCallback=t}get changeCallback(){return this._changeCallback}set changeCallback(t){this._changeCallback=t}get actionButtons(){return this._actionButtons}set actionButtons(t){this._actionButtons=t,this.reinitialize()}get selectedValue(){var t;return((t=this.picker)==null?void 0:t.selectedValue)??null}get selectedItem(){var t;return((t=this.picker)==null?void 0:t.selectedItem)??null}getSelected(){return this.picker?this.picker.getSelected():[]}setSelected(t){this.picker&&this.picker.setSelected(t)}getValue(){return this.picker?this.picker.getValue():null}destroy(){this.picker&&this.picker.destroy()}}typeof window<"u"&&typeof customElements<"u"&&(customElements.get("web-multiselect")||customElements.define("web-multiselect",Ie)),typeof window<"u"&&(window.components=window.components||{},window.components["web-multiselect"]={version:()=>"1.8.0",config:{name:"@keenmate/web-multiselect",version:"1.8.0",author:"Keenmate",license:"MIT",repository:"git+https://github.com/keenmate/web-multiselect.git",homepage:"https://github.com/keenmate/web-multiselect#readme"},logging:{enableLogging:it,disableLogging:rt,setLogLevel:nt,setCategoryLevel:at,getCategories:()=>[...ot]},register:()=>{typeof customElements<"u"&&!customElements.get("web-multiselect")&&customElements.define("web-multiselect",Ie)},getInstances:()=>dt()}),y.LOGGING_CATEGORIES=ot,y.MultiSelectElement=Ie,y.WebMultiSelect=ct,y.dataLogger=k,y.disableLogging=rt,y.enableLogging=it,y.initLogger=re,y.interactionLogger=T,y.setCategoryLevel=at,y.setLogLevel=nt,y.uiLogger=v,Object.defineProperty(y,Symbol.toStringTag,{value:"Module"})});
|