var Ft=Math.min,vt=Math.max,Ht=Math.round;var ot=n=>({x:n,y:n}),ji={left:"right",right:"left",bottom:"top",top:"bottom"},qi={start:"end",end:"start"};function Oe(n,t,e){return vt(n,Ft(t,e))}function Vt(n,t){return typeof n=="function"?n(t):n}function yt(n){return n.split("-")[0]}function Wt(n){return n.split("-")[1]}function De(n){return n==="x"?"y":"x"}function Ae(n){return n==="y"?"height":"width"}var Ji=new Set(["top","bottom"]);function ht(n){return Ji.has(yt(n))?"y":"x"}function Ce(n){return De(ht(n))}function Je(n,t,e){e===void 0&&(e=!1);let i=Wt(n),o=Ce(n),s=Ae(o),r=o==="x"?i===(e?"end":"start")?"right":"left":i==="start"?"bottom":"top";return t.reference[s]>t.floating[s]&&(r=Bt(r)),[r,Bt(r)]}function Qe(n){let t=Bt(n);return[ee(n),t,ee(t)]}function ee(n){return n.replace(/start|end/g,t=>qi[t])}var je=["left","right"],qe=["right","left"],Qi=["top","bottom"],Zi=["bottom","top"];function tn(n,t,e){switch(n){case"top":case"bottom":return e?t?qe:je:t?je:qe;case"left":case"right":return t?Qi:Zi;default:return[]}}function Ze(n,t,e,i){let o=Wt(n),s=tn(yt(n),e==="start",i);return o&&(s=s.map(r=>r+"-"+o),t&&(s=s.concat(s.map(ee)))),s}function Bt(n){return n.replace(/left|right|bottom|top/g,t=>ji[t])}function en(n){return{top:0,right:0,bottom:0,left:0,...n}}function ti(n){return typeof n!="number"?en(n):{top:n,right:n,bottom:n,left:n}}function Et(n){let{x:t,y:e,width:i,height:o}=n;return{width:i,height:o,top:e,left:t,right:t+i,bottom:e+o,x:t,y:e}}function ei(n,t,e){let{reference:i,floating:o}=n,s=ht(t),r=Ce(t),a=Ae(r),l=yt(t),c=s==="y",f=i.x+i.width/2-o.width/2,d=i.y+i.height/2-o.height/2,p=i[a]/2-o[a]/2,u;switch(l){case"top":u={x:f,y:i.y-o.height};break;case"bottom":u={x:f,y:i.y+i.height};break;case"right":u={x:i.x+i.width,y:d};break;case"left":u={x:i.x-o.width,y:d};break;default:u={x:i.x,y:i.y}}switch(Wt(t)){case"start":u[r]-=p*(e&&c?-1:1);break;case"end":u[r]+=p*(e&&c?-1:1);break}return u}var ii=async(n,t,e)=>{let{placement:i="bottom",strategy:o="absolute",middleware:s=[],platform:r}=e,a=s.filter(Boolean),l=await(r.isRTL==null?void 0:r.isRTL(t)),c=await r.getElementRects({reference:n,floating:t,strategy:o}),{x:f,y:d}=ei(c,i,l),p=i,u={},g=0;for(let m=0;mk<=0)){var X,tt;let k=(((X=s.flip)==null?void 0:X.index)||0)+1,Y=q[k];if(Y&&(!(d==="alignment"?w!==ht(Y):!1)||V.every(B=>ht(B.placement)===w?B.overflows[0]>0:!0)))return{data:{index:k,overflows:V},reset:{placement:Y}};let P=(tt=V.filter($=>$.overflows[0]<=0).sort(($,B)=>$.overflows[1]-B.overflows[1])[0])==null?void 0:tt.placement;if(!P)switch(u){case"bestFit":{var W;let $=(W=V.filter(B=>{if(F){let lt=ht(B.placement);return lt===w||lt==="y"}return!0}).map(B=>[B.placement,B.overflows.filter(lt=>lt>0).reduce((lt,Ue)=>lt+Ue,0)]).sort((B,lt)=>B[1]-lt[1])[0])==null?void 0:W[0];$&&(P=$);break}case"initialPlacement":P=a;break}if(o!==P)return{reset:{placement:P}}}return{}}}};var nn=new Set(["left","top"]);async function on(n,t){let{placement:e,platform:i,elements:o}=n,s=await(i.isRTL==null?void 0:i.isRTL(o.floating)),r=yt(e),a=Wt(e),l=ht(e)==="y",c=nn.has(r)?-1:1,f=s&&l?-1:1,d=Vt(t,n),{mainAxis:p,crossAxis:u,alignmentAxis:g}=typeof d=="number"?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return a&&typeof g=="number"&&(u=a==="end"?g*-1:g),l?{x:u*f,y:p*c}:{x:p*c,y:u*f}}var oi=function(n){return n===void 0&&(n=0),{name:"offset",options:n,async fn(t){var e,i;let{x:o,y:s,placement:r,middlewareData:a}=t,l=await on(t,n);return r===((e=a.offset)==null?void 0:e.placement)&&(i=a.arrow)!=null&&i.alignmentOffset?{}:{x:o+l.x,y:s+l.y,data:{...l,placement:r}}}}},si=function(n){return n===void 0&&(n={}),{name:"shift",options:n,async fn(t){let{x:e,y:i,placement:o}=t,{mainAxis:s=!0,crossAxis:r=!1,limiter:a={fn:S=>{let{x:O,y:w}=S;return{x:O,y:w}}},...l}=Vt(n,t),c={x:e,y:i},f=await Le(t,l),d=ht(yt(o)),p=De(d),u=c[p],g=c[d];if(s){let S=p==="y"?"top":"left",O=p==="y"?"bottom":"right",w=u+f[S],D=u-f[O];u=Oe(w,u,D)}if(r){let S=d==="y"?"top":"left",O=d==="y"?"bottom":"right",w=g+f[S],D=g-f[O];g=Oe(w,g,D)}let m=a.fn({...t,[p]:u,[d]:g});return{...m,data:{x:m.x-e,y:m.y-i,enabled:{[p]:s,[d]:r}}}}}};function ne(){return typeof window<"u"}function Ot(n){return ai(n)?(n.nodeName||"").toLowerCase():"#document"}function U(n){var t;return(n==null||(t=n.ownerDocument)==null?void 0:t.defaultView)||window}function ct(n){var t;return(t=(ai(n)?n.ownerDocument:n.document)||window.document)==null?void 0:t.documentElement}function ai(n){return ne()?n instanceof Node||n instanceof U(n).Node:!1}function et(n){return ne()?n instanceof Element||n instanceof U(n).Element:!1}function st(n){return ne()?n instanceof HTMLElement||n instanceof U(n).HTMLElement:!1}function ri(n){return!ne()||typeof ShadowRoot>"u"?!1:n instanceof ShadowRoot||n instanceof U(n).ShadowRoot}var sn=new Set(["inline","contents"]);function It(n){let{overflow:t,overflowX:e,overflowY:i,display:o}=it(n);return/auto|scroll|overlay|hidden|clip/.test(t+i+e)&&!sn.has(o)}var rn=new Set(["table","td","th"]);function li(n){return rn.has(Ot(n))}var an=[":popover-open",":modal"];function zt(n){return an.some(t=>{try{return n.matches(t)}catch{return!1}})}var ln=["transform","translate","scale","rotate","perspective"],cn=["transform","translate","scale","rotate","perspective","filter"],dn=["paint","layout","strict","content"];function oe(n){let t=se(),e=et(n)?it(n):n;return ln.some(i=>e[i]?e[i]!=="none":!1)||(e.containerType?e.containerType!=="normal":!1)||!t&&(e.backdropFilter?e.backdropFilter!=="none":!1)||!t&&(e.filter?e.filter!=="none":!1)||cn.some(i=>(e.willChange||"").includes(i))||dn.some(i=>(e.contain||"").includes(i))}function ci(n){let t=ut(n);for(;st(t)&&!Dt(t);){if(oe(t))return t;if(zt(t))return null;t=ut(t)}return null}function se(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}var fn=new Set(["html","body","#document"]);function Dt(n){return fn.has(Ot(n))}function it(n){return U(n).getComputedStyle(n)}function Xt(n){return et(n)?{scrollLeft:n.scrollLeft,scrollTop:n.scrollTop}:{scrollLeft:n.scrollX,scrollTop:n.scrollY}}function ut(n){if(Ot(n)==="html")return n;let t=n.assignedSlot||n.parentNode||ri(n)&&n.host||ct(n);return ri(t)?t.host:t}function di(n){let t=ut(n);return Dt(t)?n.ownerDocument?n.ownerDocument.body:n.body:st(t)&&It(t)?t:di(t)}function ie(n,t,e){var i;t===void 0&&(t=[]),e===void 0&&(e=!0);let o=di(n),s=o===((i=n.ownerDocument)==null?void 0:i.body),r=U(o);if(s){let a=re(r);return t.concat(r,r.visualViewport||[],It(o)?o:[],a&&e?ie(a):[])}return t.concat(o,ie(o,[],e))}function re(n){return n.parent&&Object.getPrototypeOf(n.parent)?n.frameElement:null}function pi(n){let t=it(n),e=parseFloat(t.width)||0,i=parseFloat(t.height)||0,o=st(n),s=o?n.offsetWidth:e,r=o?n.offsetHeight:i,a=Ht(e)!==s||Ht(i)!==r;return a&&(e=s,i=r),{width:e,height:i,$:a}}function gi(n){return et(n)?n:n.contextElement}function Tt(n){let t=gi(n);if(!st(t))return ot(1);let e=t.getBoundingClientRect(),{width:i,height:o,$:s}=pi(t),r=(s?Ht(e.width):e.width)/i,a=(s?Ht(e.height):e.height)/o;return(!r||!Number.isFinite(r))&&(r=1),(!a||!Number.isFinite(a))&&(a=1),{x:r,y:a}}var hn=ot(0);function mi(n){let t=U(n);return!se()||!t.visualViewport?hn:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function un(n,t,e){return t===void 0&&(t=!1),!e||t&&e!==U(n)?!1:t}function Kt(n,t,e,i){t===void 0&&(t=!1),e===void 0&&(e=!1);let o=n.getBoundingClientRect(),s=gi(n),r=ot(1);t&&(i?et(i)&&(r=Tt(i)):r=Tt(n));let a=un(s,e,i)?mi(s):ot(0),l=(o.left+a.x)/r.x,c=(o.top+a.y)/r.y,f=o.width/r.x,d=o.height/r.y;if(s){let p=U(s),u=i&&et(i)?U(i):i,g=p,m=re(g);for(;m&&i&&u!==g;){let S=Tt(m),O=m.getBoundingClientRect(),w=it(m),D=O.left+(m.clientLeft+parseFloat(w.paddingLeft))*S.x,A=O.top+(m.clientTop+parseFloat(w.paddingTop))*S.y;l*=S.x,c*=S.y,f*=S.x,d*=S.y,l+=D,c+=A,g=U(m),m=re(g)}}return Et({width:f,height:d,x:l,y:c})}function ae(n,t){let e=Xt(n).scrollLeft;return t?t.left+e:Kt(ct(n)).left+e}function bi(n,t){let e=n.getBoundingClientRect(),i=e.left+t.scrollLeft-ae(n,e),o=e.top+t.scrollTop;return{x:i,y:o}}function pn(n){let{elements:t,rect:e,offsetParent:i,strategy:o}=n,s=o==="fixed",r=ct(i),a=t?zt(t.floating):!1;if(i===r||a&&s)return e;let l={scrollLeft:0,scrollTop:0},c=ot(1),f=ot(0),d=st(i);if((d||!d&&!s)&&((Ot(i)!=="body"||It(r))&&(l=Xt(i)),st(i))){let u=Kt(i);c=Tt(i),f.x=u.x+i.clientLeft,f.y=u.y+i.clientTop}let p=r&&!d&&!s?bi(r,l):ot(0);return{width:e.width*c.x,height:e.height*c.y,x:e.x*c.x-l.scrollLeft*c.x+f.x+p.x,y:e.y*c.y-l.scrollTop*c.y+f.y+p.y}}function gn(n){return Array.from(n.getClientRects())}function mn(n){let t=ct(n),e=Xt(n),i=n.ownerDocument.body,o=vt(t.scrollWidth,t.clientWidth,i.scrollWidth,i.clientWidth),s=vt(t.scrollHeight,t.clientHeight,i.scrollHeight,i.clientHeight),r=-e.scrollLeft+ae(n),a=-e.scrollTop;return it(i).direction==="rtl"&&(r+=vt(t.clientWidth,i.clientWidth)-o),{width:o,height:s,x:r,y:a}}var fi=25;function bn(n,t){let e=U(n),i=ct(n),o=e.visualViewport,s=i.clientWidth,r=i.clientHeight,a=0,l=0;if(o){s=o.width,r=o.height;let f=se();(!f||f&&t==="fixed")&&(a=o.offsetLeft,l=o.offsetTop)}let c=ae(i);if(c<=0){let f=i.ownerDocument,d=f.body,p=getComputedStyle(d),u=f.compatMode==="CSS1Compat"&&parseFloat(p.marginLeft)+parseFloat(p.marginRight)||0,g=Math.abs(i.clientWidth-d.clientWidth-u);g<=fi&&(s-=g)}else c<=fi&&(s+=c);return{width:s,height:r,x:a,y:l}}var vn=new Set(["absolute","fixed"]);function yn(n,t){let e=Kt(n,!0,t==="fixed"),i=e.top+n.clientTop,o=e.left+n.clientLeft,s=st(n)?Tt(n):ot(1),r=n.clientWidth*s.x,a=n.clientHeight*s.y,l=o*s.x,c=i*s.y;return{width:r,height:a,x:l,y:c}}function hi(n,t,e){let i;if(t==="viewport")i=bn(n,e);else if(t==="document")i=mn(ct(n));else if(et(t))i=yn(t,e);else{let o=mi(n);i={x:t.x-o.x,y:t.y-o.y,width:t.width,height:t.height}}return Et(i)}function vi(n,t){let e=ut(n);return e===t||!et(e)||Dt(e)?!1:it(e).position==="fixed"||vi(e,t)}function wn(n,t){let e=t.get(n);if(e)return e;let i=ie(n,[],!1).filter(a=>et(a)&&Ot(a)!=="body"),o=null,s=it(n).position==="fixed",r=s?ut(n):n;for(;et(r)&&!Dt(r);){let a=it(r),l=oe(r);!l&&a.position==="fixed"&&(o=null),(s?!l&&!o:!l&&a.position==="static"&&!!o&&vn.has(o.position)||It(r)&&!l&&vi(n,r))?i=i.filter(f=>f!==r):o=a,r=ut(r)}return t.set(n,i),i}function Sn(n){let{element:t,boundary:e,rootBoundary:i,strategy:o}=n,r=[...e==="clippingAncestors"?zt(t)?[]:wn(t,this._c):[].concat(e),i],a=r[0],l=r.reduce((c,f)=>{let d=hi(t,f,o);return c.top=vt(d.top,c.top),c.right=Ft(d.right,c.right),c.bottom=Ft(d.bottom,c.bottom),c.left=vt(d.left,c.left),c},hi(t,a,o));return{width:l.right-l.left,height:l.bottom-l.top,x:l.left,y:l.top}}function xn(n){let{width:t,height:e}=pi(n);return{width:t,height:e}}function En(n,t,e){let i=st(t),o=ct(t),s=e==="fixed",r=Kt(n,!0,s,t),a={scrollLeft:0,scrollTop:0},l=ot(0);function c(){l.x=ae(o)}if(i||!i&&!s)if((Ot(t)!=="body"||It(o))&&(a=Xt(t)),i){let u=Kt(t,!0,s,t);l.x=u.x+t.clientLeft,l.y=u.y+t.clientTop}else o&&c();s&&!i&&o&&c();let f=o&&!i&&!s?bi(o,a):ot(0),d=r.left+a.scrollLeft-l.x-f.x,p=r.top+a.scrollTop-l.y-f.y;return{x:d,y:p,width:r.width,height:r.height}}function Ie(n){return it(n).position==="static"}function ui(n,t){if(!st(n)||it(n).position==="fixed")return null;if(t)return t(n);let e=n.offsetParent;return ct(n)===e&&(e=e.ownerDocument.body),e}function yi(n,t){let e=U(n);if(zt(n))return e;if(!st(n)){let o=ut(n);for(;o&&!Dt(o);){if(et(o)&&!Ie(o))return o;o=ut(o)}return e}let i=ui(n,t);for(;i&&li(i)&&Ie(i);)i=ui(i,t);return i&&Dt(i)&&Ie(i)&&!oe(i)?e:i||ci(n)||e}var On=async function(n){let t=this.getOffsetParent||yi,e=this.getDimensions,i=await e(n.floating);return{reference:En(n.reference,await t(n.floating),n.strategy),floating:{x:0,y:0,width:i.width,height:i.height}}};function Dn(n){return it(n).direction==="rtl"}var An={convertOffsetParentRelativeRectToViewportRelativeRect:pn,getDocumentElement:ct,getClippingRect:Sn,getOffsetParent:yi,getElementRects:On,getClientRects:gn,getDimensions:xn,getScale:Tt,isElement:et,isRTL:Dn};var wi=oi;var Si=si,xi=ni;var Ei=(n,t,e)=>{let i=new Map,o={platform:An,...e},s={...o.platform,_c:i};return ii(n,t,{...o,platform:s})};function Oi(n,t){var e=Object.keys(n);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(n);t&&(i=i.filter(function(o){return Object.getOwnPropertyDescriptor(n,o).enumerable})),e.push.apply(e,i)}return e}function ft(n){for(var t=1;t=0)&&(e[o]=n[o]);return e}function In(n,t){if(n==null)return{};var e=Ln(n,t),i,o;if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(n);for(o=0;o=0)&&Object.prototype.propertyIsEnumerable.call(n,i)&&(e[i]=n[i])}return e}var Tn="1.15.6";function pt(n){if(typeof window<"u"&&window.navigator)return!!navigator.userAgent.match(n)}var mt=pt(/(?:Trident.*rv[ :]?11\.|msie|iemobile|Windows Phone)/i),Zt=pt(/Edge/i),Di=pt(/firefox/i),Gt=pt(/safari/i)&&!pt(/chrome/i)&&!pt(/android/i),Xe=pt(/iP(ad|od|hone)/i),Pi=pt(/chrome/i)&&pt(/android/i),Mi={capture:!1,passive:!1};function E(n,t,e){n.addEventListener(t,e,!mt&&Mi)}function x(n,t,e){n.removeEventListener(t,e,!mt&&Mi)}function be(n,t){if(t){if(t[0]===">"&&(t=t.substring(1)),n)try{if(n.matches)return n.matches(t);if(n.msMatchesSelector)return n.msMatchesSelector(t);if(n.webkitMatchesSelector)return n.webkitMatchesSelector(t)}catch{return!1}return!1}}function Ni(n){return n.host&&n!==document&&n.host.nodeType?n.host:n.parentNode}function at(n,t,e,i){if(n){e=e||document;do{if(t!=null&&(t[0]===">"?n.parentNode===e&&be(n,t):be(n,t))||i&&n===e)return n;if(n===e)break}while(n=Ni(n))}return null}var Ai=/\s+/g;function Q(n,t,e){if(n&&t)if(n.classList)n.classList[e?"add":"remove"](t);else{var i=(" "+n.className+" ").replace(Ai," ").replace(" "+t+" "," ");n.className=(i+(e?" "+t:"")).replace(Ai," ")}}function b(n,t,e){var i=n&&n.style;if(i){if(e===void 0)return document.defaultView&&document.defaultView.getComputedStyle?e=document.defaultView.getComputedStyle(n,""):n.currentStyle&&(e=n.currentStyle),t===void 0?e:e[t];!(t in i)&&t.indexOf("webkit")===-1&&(t="-webkit-"+t),i[t]=e+(typeof e=="string"?"":"px")}}function Nt(n,t){var e="";if(typeof n=="string")e=n;else do{var i=b(n,"transform");i&&i!=="none"&&(e=i+" "+e)}while(!t&&(n=n.parentNode));var o=window.DOMMatrix||window.WebKitCSSMatrix||window.CSSMatrix||window.MSCSSMatrix;return o&&new o(e)}function ki(n,t,e){if(n){var i=n.getElementsByTagName(t),o=0,s=i.length;if(e)for(;o=s:r=o<=s,!r)return i;if(i===dt())break;i=xt(i,!1)}return!1}function kt(n,t,e,i){for(var o=0,s=0,r=n.children;s2&&arguments[2]!==void 0?arguments[2]:{},o=i.evt,s=In(i,Fn);te.pluginEvent.bind(v)(t,e,ft({dragEl:h,parentEl:_,ghostEl:y,rootEl:L,nextEl:Lt,lastDownEl:ue,cloneEl:I,cloneHidden:St,dragStarted:Yt,putSortable:H,activeSortable:v.active,originalEvent:o,oldIndex:Mt,oldDraggableIndex:qt,newIndex:Z,newDraggableIndex:wt,hideGhostForTarget:Ki,unhideGhostForTarget:Yi,cloneNowHidden:function(){St=!0},cloneNowShown:function(){St=!1},dispatchSortableEvent:function(a){K({sortable:e,name:a,originalEvent:o})}},s))};function K(n){Bn(ft({putSortable:H,cloneEl:I,targetEl:h,rootEl:L,oldIndex:Mt,oldDraggableIndex:qt,newIndex:Z,newDraggableIndex:wt},n))}var h,_,y,L,Lt,ue,I,St,Mt,Z,qt,wt,le,H,Pt=!1,ve=!1,ye=[],At,rt,Re,Pe,Ii,Ti,Yt,Rt,Jt,Qt=!1,ce=!1,pe,z,Me=[],He=!1,we=[],xe=typeof document<"u",de=Xe,_i=Zt||mt?"cssFloat":"float",Hn=xe&&!Pi&&!Xe&&"draggable"in document.createElement("div"),Wi=(function(){if(xe){if(mt)return!1;var n=document.createElement("x");return n.style.cssText="pointer-events:auto",n.style.pointerEvents==="auto"}})(),zi=function(t,e){var i=b(t),o=parseInt(i.width)-parseInt(i.paddingLeft)-parseInt(i.paddingRight)-parseInt(i.borderLeftWidth)-parseInt(i.borderRightWidth),s=kt(t,0,e),r=kt(t,1,e),a=s&&b(s),l=r&&b(r),c=a&&parseInt(a.marginLeft)+parseInt(a.marginRight)+N(s).width,f=l&&parseInt(l.marginLeft)+parseInt(l.marginRight)+N(r).width;if(i.display==="flex")return i.flexDirection==="column"||i.flexDirection==="column-reverse"?"vertical":"horizontal";if(i.display==="grid")return i.gridTemplateColumns.split(" ").length<=1?"vertical":"horizontal";if(s&&a.float&&a.float!=="none"){var d=a.float==="left"?"left":"right";return r&&(l.clear==="both"||l.clear===d)?"vertical":"horizontal"}return s&&(a.display==="block"||a.display==="flex"||a.display==="table"||a.display==="grid"||c>=o&&i[_i]==="none"||r&&i[_i]==="none"&&c+f>o)?"vertical":"horizontal"},Vn=function(t,e,i){var o=i?t.left:t.top,s=i?t.right:t.bottom,r=i?t.width:t.height,a=i?e.left:e.top,l=i?e.right:e.bottom,c=i?e.width:e.height;return o===a||s===l||o+r/2===a+c/2},Wn=function(t,e){var i;return ye.some(function(o){var s=o[j].options.emptyInsertThreshold;if(!(!s||Ke(o))){var r=N(o),a=t>=r.left-s&&t<=r.right+s,l=e>=r.top-s&&e<=r.bottom+s;if(a&&l)return i=o}}),i},Xi=function(t){function e(s,r){return function(a,l,c,f){var d=a.options.group.name&&l.options.group.name&&a.options.group.name===l.options.group.name;if(s==null&&(r||d))return!0;if(s==null||s===!1)return!1;if(r&&s==="clone")return s;if(typeof s=="function")return e(s(a,l,c,f),r)(a,l,c,f);var p=(r?a:l).options.group.name;return s===!0||typeof s=="string"&&s===p||s.join&&s.indexOf(p)>-1}}var i={},o=t.group;(!o||he(o)!="object")&&(o={name:o}),i.name=o.name,i.checkPull=e(o.pull,!0),i.checkPut=e(o.put),i.revertClone=o.revertClone,t.group=i},Ki=function(){!Wi&&y&&b(y,"display","none")},Yi=function(){!Wi&&y&&b(y,"display","")};xe&&!Pi&&document.addEventListener("click",function(n){if(ve)return n.preventDefault(),n.stopPropagation&&n.stopPropagation(),n.stopImmediatePropagation&&n.stopImmediatePropagation(),ve=!1,!1},!0);var Ct=function(t){if(h){t=t.touches?t.touches[0]:t;var e=Wn(t.clientX,t.clientY);if(e){var i={};for(var o in t)t.hasOwnProperty(o)&&(i[o]=t[o]);i.target=i.rootEl=e,i.preventDefault=void 0,i.stopPropagation=void 0,e[j]._onDragOver(i)}}},zn=function(t){h&&h.parentNode[j]._isOutsideThisEl(t.target)};function v(n,t){if(!(n&&n.nodeType&&n.nodeType===1))throw"Sortable: `el` must be an HTMLElement, not ".concat({}.toString.call(n));this.el=n,this.options=t=gt({},t),n[j]=this;var e={group:null,sort:!0,disabled:!1,store:null,handle:null,draggable:/^[uo]l$/i.test(n.nodeName)?">li":">*",swapThreshold:1,invertSwap:!1,invertedSwapThreshold:null,removeCloneOnHide:!0,direction:function(){return zi(n,this.options)},ghostClass:"sortable-ghost",chosenClass:"sortable-chosen",dragClass:"sortable-drag",ignore:"a, img",filter:null,preventOnFilter:!0,animation:0,easing:null,setData:function(r,a){r.setData("Text",a.textContent)},dropBubble:!1,dragoverBubble:!1,dataIdAttr:"data-id",delay:0,delayOnTouchOnly:!1,touchStartThreshold:(Number.parseInt?Number:window).parseInt(window.devicePixelRatio,10)||1,forceFallback:!1,fallbackClass:"sortable-fallback",fallbackOnBody:!1,fallbackTolerance:0,fallbackOffset:{x:0,y:0},supportPointer:v.supportPointer!==!1&&"PointerEvent"in window&&(!Gt||Xe),emptyInsertThreshold:5};te.initializePlugins(this,n,e);for(var i in e)!(i in t)&&(t[i]=e[i]);Xi(t);for(var o in this)o.charAt(0)==="_"&&typeof this[o]=="function"&&(this[o]=this[o].bind(this));this.nativeDraggable=t.forceFallback?!1:Hn,this.nativeDraggable&&(this.options.touchStartThreshold=1),t.supportPointer?E(n,"pointerdown",this._onTapStart):(E(n,"mousedown",this._onTapStart),E(n,"touchstart",this._onTapStart)),this.nativeDraggable&&(E(n,"dragover",this),E(n,"dragenter",this)),ye.push(this.el),t.store&&t.store.get&&this.sort(t.store.get(this)||[]),gt(this,Mn())}v.prototype={constructor:v,_isOutsideThisEl:function(t){!this.el.contains(t)&&t!==this.el&&(Rt=null)},_getDirection:function(t,e){return typeof this.options.direction=="function"?this.options.direction.call(this,t,e,h):this.options.direction},_onTapStart:function(t){if(t.cancelable){var e=this,i=this.el,o=this.options,s=o.preventOnFilter,r=t.type,a=t.touches&&t.touches[0]||t.pointerType&&t.pointerType==="touch"&&t,l=(a||t).target,c=t.target.shadowRoot&&(t.path&&t.path[0]||t.composedPath&&t.composedPath()[0])||l,f=o.filter;if(qn(i),!h&&!(/mousedown|pointerdown/.test(r)&&t.button!==0||o.disabled)&&!c.isContentEditable&&!(!this.nativeDraggable&&Gt&&l&&l.tagName.toUpperCase()==="SELECT")&&(l=at(l,o.draggable,i,!1),!(l&&l.animated)&&ue!==l)){if(Mt=nt(l),qt=nt(l,o.draggable),typeof f=="function"){if(f.call(this,t,l,this)){K({sortable:e,rootEl:c,name:"filter",targetEl:l,toEl:i,fromEl:i}),G("filter",e,{evt:t}),s&&t.preventDefault();return}}else if(f&&(f=f.split(",").some(function(d){if(d=at(c,d.trim(),i,!1),d)return K({sortable:e,rootEl:d,name:"filter",targetEl:l,fromEl:i,toEl:i}),G("filter",e,{evt:t}),!0}),f)){s&&t.preventDefault();return}o.handle&&!at(c,o.handle,i,!1)||this._prepareDragStart(t,a,l)}}},_prepareDragStart:function(t,e,i){var o=this,s=o.el,r=o.options,a=s.ownerDocument,l;if(i&&!h&&i.parentNode===s){var c=N(i);if(L=s,h=i,_=h.parentNode,Lt=h.nextSibling,ue=i,le=r.group,v.dragged=h,At={target:h,clientX:(e||t).clientX,clientY:(e||t).clientY},Ii=At.clientX-c.left,Ti=At.clientY-c.top,this._lastX=(e||t).clientX,this._lastY=(e||t).clientY,h.style["will-change"]="all",l=function(){if(G("delayEnded",o,{evt:t}),v.eventCanceled){o._onDrop();return}o._disableDelayedDragEvents(),!Di&&o.nativeDraggable&&(h.draggable=!0),o._triggerDragStart(t,e),K({sortable:o,name:"choose",originalEvent:t}),Q(h,r.chosenClass,!0)},r.ignore.split(",").forEach(function(f){ki(h,f.trim(),Ne)}),E(a,"dragover",Ct),E(a,"mousemove",Ct),E(a,"touchmove",Ct),r.supportPointer?(E(a,"pointerup",o._onDrop),!this.nativeDraggable&&E(a,"pointercancel",o._onDrop)):(E(a,"mouseup",o._onDrop),E(a,"touchend",o._onDrop),E(a,"touchcancel",o._onDrop)),Di&&this.nativeDraggable&&(this.options.touchStartThreshold=4,h.draggable=!0),G("delayStart",this,{evt:t}),r.delay&&(!r.delayOnTouchOnly||e)&&(!this.nativeDraggable||!(Zt||mt))){if(v.eventCanceled){this._onDrop();return}r.supportPointer?(E(a,"pointerup",o._disableDelayedDrag),E(a,"pointercancel",o._disableDelayedDrag)):(E(a,"mouseup",o._disableDelayedDrag),E(a,"touchend",o._disableDelayedDrag),E(a,"touchcancel",o._disableDelayedDrag)),E(a,"mousemove",o._delayedDragTouchMoveHandler),E(a,"touchmove",o._delayedDragTouchMoveHandler),r.supportPointer&&E(a,"pointermove",o._delayedDragTouchMoveHandler),o._dragStartTimer=setTimeout(l,r.delay)}else l()}},_delayedDragTouchMoveHandler:function(t){var e=t.touches?t.touches[0]:t;Math.max(Math.abs(e.clientX-this._lastX),Math.abs(e.clientY-this._lastY))>=Math.floor(this.options.touchStartThreshold/(this.nativeDraggable&&window.devicePixelRatio||1))&&this._disableDelayedDrag()},_disableDelayedDrag:function(){h&&Ne(h),clearTimeout(this._dragStartTimer),this._disableDelayedDragEvents()},_disableDelayedDragEvents:function(){var t=this.el.ownerDocument;x(t,"mouseup",this._disableDelayedDrag),x(t,"touchend",this._disableDelayedDrag),x(t,"touchcancel",this._disableDelayedDrag),x(t,"pointerup",this._disableDelayedDrag),x(t,"pointercancel",this._disableDelayedDrag),x(t,"mousemove",this._delayedDragTouchMoveHandler),x(t,"touchmove",this._delayedDragTouchMoveHandler),x(t,"pointermove",this._delayedDragTouchMoveHandler)},_triggerDragStart:function(t,e){e=e||t.pointerType=="touch"&&t,!this.nativeDraggable||e?this.options.supportPointer?E(document,"pointermove",this._onTouchMove):e?E(document,"touchmove",this._onTouchMove):E(document,"mousemove",this._onTouchMove):(E(h,"dragend",this),E(L,"dragstart",this._onDragStart));try{document.selection?ge(function(){document.selection.empty()}):window.getSelection().removeAllRanges()}catch{}},_dragStarted:function(t,e){if(Pt=!1,L&&h){G("dragStarted",this,{evt:e}),this.nativeDraggable&&E(document,"dragover",zn);var i=this.options;!t&&Q(h,i.dragClass,!1),Q(h,i.ghostClass,!0),v.active=this,t&&this._appendGhost(),K({sortable:this,name:"start",originalEvent:e})}else this._nulling()},_emulateDragOver:function(){if(rt){this._lastX=rt.clientX,this._lastY=rt.clientY,Ki();for(var t=document.elementFromPoint(rt.clientX,rt.clientY),e=t;t&&t.shadowRoot&&(t=t.shadowRoot.elementFromPoint(rt.clientX,rt.clientY),t!==e);)e=t;if(h.parentNode[j]._isOutsideThisEl(t),e)do{if(e[j]){var i=void 0;if(i=e[j]._onDragOver({clientX:rt.clientX,clientY:rt.clientY,target:t,rootEl:e}),i&&!this.options.dragoverBubble)break}t=e}while(e=Ni(e));Yi()}},_onTouchMove:function(t){if(At){var e=this.options,i=e.fallbackTolerance,o=e.fallbackOffset,s=t.touches?t.touches[0]:t,r=y&&Nt(y,!0),a=y&&r&&r.a,l=y&&r&&r.d,c=de&&z&&Li(z),f=(s.clientX-At.clientX+o.x)/(a||1)+(c?c[0]-Me[0]:0)/(a||1),d=(s.clientY-At.clientY+o.y)/(l||1)+(c?c[1]-Me[1]:0)/(l||1);if(!v.active&&!Pt){if(i&&Math.max(Math.abs(s.clientX-this._lastX),Math.abs(s.clientY-this._lastY))=0&&(K({rootEl:_,name:"add",toEl:_,fromEl:L,originalEvent:t}),K({sortable:this,name:"remove",toEl:_,originalEvent:t}),K({rootEl:_,name:"sort",toEl:_,fromEl:L,originalEvent:t}),K({sortable:this,name:"sort",toEl:_,originalEvent:t})),H&&H.save()):Z!==Mt&&Z>=0&&(K({sortable:this,name:"update",toEl:_,originalEvent:t}),K({sortable:this,name:"sort",toEl:_,originalEvent:t})),v.active&&((Z==null||Z===-1)&&(Z=Mt,wt=qt),K({sortable:this,name:"end",toEl:_,originalEvent:t}),this.save()))),this._nulling()},_nulling:function(){G("nulling",this),L=h=_=y=Lt=I=ue=St=At=rt=Yt=Z=wt=Mt=qt=Rt=Jt=H=le=v.dragged=v.ghost=v.clone=v.active=null,we.forEach(function(t){t.checked=!0}),we.length=Re=Pe=0},handleEvent:function(t){switch(t.type){case"drop":case"dragend":this._onDrop(t);break;case"dragenter":case"dragover":h&&(this._onDragOver(t),Xn(t));break;case"selectstart":t.preventDefault();break}},toArray:function(){for(var t=[],e,i=this.el.children,o=0,s=i.length,r=this.options;oo.right+s||n.clientY>i.bottom&&n.clientX>i.left:n.clientY>o.bottom+s||n.clientX>i.right&&n.clientY>i.top}function Un(n,t,e,i,o,s,r,a){var l=i?n.clientY:n.clientX,c=i?e.height:e.width,f=i?e.top:e.left,d=i?e.bottom:e.right,p=!1;if(!r){if(a&&pef+c*s/2:ld-pe)return-Jt}else if(l>f+c*(1-o)/2&&ld-c*s/2)?l>f+c/2?1:-1:0}function Gn(n){return nt(h){}}){this.element=t,this.options=e,this.originalOptions=JSON.parse(JSON.stringify(e)),this.placeholder=i,this.state=o,this.canOptionLabelsWrap=s,this.canSelectPlaceholder=r,this.initialOptionLabel=a,this.initialOptionLabels=l,this.initialState=c,this.isHtmlAllowed=f,this.isAutofocused=d,this.isDisabled=p,this.isMultiple=u,this.isReorderable=g,this.isSearchable=m,this.getOptionLabelUsing=S,this.getOptionLabelsUsing=O,this.getOptionsUsing=w,this.getSearchResultsUsing=D,this.hasDynamicOptions=A,this.hasDynamicSearchResults=C,this.searchPrompt=F,this.searchDebounce=q,this.loadingMessage=J,this.searchingMessage=T,this.noSearchResultsMessage=V,this.activeSearchId=0,this.maxItems=X,this.maxItemsMessage=tt,this.optionsLimit=W,this.position=k,this.searchableOptionFields=Array.isArray(Y)?Y:["label"],this.livewireId=P,this.statePath=$,this.onStateChange=B,this.labelRepository={},this.isOpen=!1,this.selectedIndex=-1,this.searchQuery="",this.searchTimeout=null,this.isSearching=!1,this.selectedDisplayVersion=0,this.render(),this.setUpEventListeners(),this.isAutofocused&&this.selectButton.focus()}populateLabelRepositoryFromOptions(t){if(!(!t||!Array.isArray(t)))for(let e of t)e.options&&Array.isArray(e.options)?this.populateLabelRepositoryFromOptions(e.options):e.value!==void 0&&e.label!==void 0&&(this.labelRepository[e.value]=e.label)}render(){this.populateLabelRepositoryFromOptions(this.options),this.container=document.createElement("div"),this.container.className="fi-select-input-ctn",this.canOptionLabelsWrap||this.container.classList.add("fi-select-input-ctn-option-labels-not-wrapped"),this.container.setAttribute("aria-haspopup","listbox"),this.selectButton=document.createElement("button"),this.selectButton.className="fi-select-input-btn",this.selectButton.type="button",this.selectButton.setAttribute("aria-expanded","false"),this.selectedDisplay=document.createElement("div"),this.selectedDisplay.className="fi-select-input-value-ctn",this.updateSelectedDisplay(),this.selectButton.appendChild(this.selectedDisplay),this.dropdown=document.createElement("div"),this.dropdown.className="fi-dropdown-panel fi-scrollable",this.dropdown.setAttribute("role","listbox"),this.dropdown.setAttribute("tabindex","-1"),this.dropdown.style.display="none",this.dropdownId=`fi-select-input-dropdown-${Math.random().toString(36).substring(2,11)}`,this.dropdown.id=this.dropdownId,this.isMultiple&&this.dropdown.setAttribute("aria-multiselectable","true"),this.isSearchable&&(this.searchContainer=document.createElement("div"),this.searchContainer.className="fi-select-input-search-ctn",this.searchInput=document.createElement("input"),this.searchInput.className="fi-input",this.searchInput.type="text",this.searchInput.placeholder=this.searchPrompt,this.searchInput.setAttribute("aria-label","Search"),this.searchContainer.appendChild(this.searchInput),this.dropdown.appendChild(this.searchContainer),this.searchInput.addEventListener("input",t=>{this.isDisabled||this.handleSearch(t)}),this.searchInput.addEventListener("keydown",t=>{if(!this.isDisabled){if(t.key==="Tab"){t.preventDefault();let e=this.getVisibleOptions();if(e.length===0)return;t.shiftKey?this.selectedIndex=e.length-1:this.selectedIndex=0,e.forEach(i=>{i.classList.remove("fi-selected")}),e[this.selectedIndex].classList.add("fi-selected"),e[this.selectedIndex].focus()}else if(t.key==="ArrowDown"){if(t.preventDefault(),t.stopPropagation(),this.getVisibleOptions().length===0)return;this.selectedIndex=-1,this.searchInput.blur(),this.focusNextOption()}else if(t.key==="ArrowUp"){t.preventDefault(),t.stopPropagation();let e=this.getVisibleOptions();if(e.length===0)return;this.selectedIndex=e.length-1,this.searchInput.blur(),e[this.selectedIndex].classList.add("fi-selected"),e[this.selectedIndex].focus(),e[this.selectedIndex].id&&this.dropdown.setAttribute("aria-activedescendant",e[this.selectedIndex].id),this.scrollOptionIntoView(e[this.selectedIndex])}else if(t.key==="Enter"){if(t.preventDefault(),t.stopPropagation(),this.isSearching)return;let e=this.getVisibleOptions();if(e.length===0)return;let i=e.find(s=>{let r=s.getAttribute("aria-disabled")==="true",a=s.classList.contains("fi-disabled"),l=s.offsetParent===null;return!(r||a||l)});if(!i)return;let o=i.getAttribute("data-value");if(o===null)return;this.selectOption(o)}}})),this.optionsList=document.createElement("ul"),this.renderOptions(),this.container.appendChild(this.selectButton),this.container.appendChild(this.dropdown),this.element.appendChild(this.container),this.applyDisabledState()}renderOptions(){this.optionsList.innerHTML="";let t=0,e=this.options,i=0,o=!1;this.options.forEach(a=>{a.options&&Array.isArray(a.options)?(i+=a.options.length,o=!0):i++}),o?this.optionsList.className="fi-select-input-options-ctn":i>0&&(this.optionsList.className="fi-dropdown-list");let s=o?null:this.optionsList,r=0;for(let a of e){if(this.optionsLimit&&r>=this.optionsLimit)break;if(a.options&&Array.isArray(a.options)){let l=a.options;if(this.isMultiple&&Array.isArray(this.state)&&this.state.length>0&&(l=a.options.filter(c=>!this.state.includes(c.value))),l.length>0){if(this.optionsLimit){let c=this.optionsLimit-r;c{let a=this.createOptionElement(r.value,r);s.appendChild(a)}),i.appendChild(o),i.appendChild(s),this.optionsList.appendChild(i)}createOptionElement(t,e){let i=t,o=e,s=!1;typeof e=="object"&&e!==null&&"label"in e&&"value"in e&&(i=e.value,o=e.label,s=e.isDisabled||!1);let r=document.createElement("li");r.className="fi-dropdown-list-item fi-select-input-option",s&&r.classList.add("fi-disabled");let a=`fi-select-input-option-${Math.random().toString(36).substring(2,11)}`;if(r.id=a,r.setAttribute("role","option"),r.setAttribute("data-value",i),r.setAttribute("tabindex","0"),s&&r.setAttribute("aria-disabled","true"),this.isHtmlAllowed&&typeof o=="string"){let f=document.createElement("div");f.innerHTML=o;let d=f.textContent||f.innerText||o;r.setAttribute("aria-label",d)}let l=this.isMultiple?Array.isArray(this.state)&&this.state.includes(i):this.state===i;r.setAttribute("aria-selected",l?"true":"false"),l&&r.classList.add("fi-selected");let c=document.createElement("span");return this.isHtmlAllowed?c.innerHTML=o:c.textContent=o,r.appendChild(c),s||r.addEventListener("click",f=>{f.preventDefault(),f.stopPropagation(),this.selectOption(i),this.isMultiple&&(this.isSearchable&&this.searchInput?setTimeout(()=>{this.searchInput.focus()},0):setTimeout(()=>{r.focus()},0))}),r}async updateSelectedDisplay(){this.selectedDisplayVersion=this.selectedDisplayVersion+1;let t=this.selectedDisplayVersion,e=document.createDocumentFragment();if(this.isMultiple){if(!Array.isArray(this.state)||this.state.length===0){let o=document.createElement("span");o.textContent=this.placeholder,o.classList.add("fi-select-input-placeholder"),e.appendChild(o)}else{let o=await this.getLabelsForMultipleSelection();if(t!==this.selectedDisplayVersion)return;this.addBadgesForSelectedOptions(o,e)}t===this.selectedDisplayVersion&&(this.selectedDisplay.replaceChildren(e),this.isOpen&&this.positionDropdown());return}if(this.state===null||this.state===""){let o=document.createElement("span");o.textContent=this.placeholder,o.classList.add("fi-select-input-placeholder"),e.appendChild(o),t===this.selectedDisplayVersion&&this.selectedDisplay.replaceChildren(e);return}let i=await this.getLabelForSingleSelection();t===this.selectedDisplayVersion&&(this.addSingleSelectionDisplay(i,e),t===this.selectedDisplayVersion&&this.selectedDisplay.replaceChildren(e))}async getLabelsForMultipleSelection(){let t=this.getSelectedOptionLabels(),e=[];if(Array.isArray(this.state)){for(let o of this.state)if(!R(this.labelRepository[o])){if(R(t[o])){this.labelRepository[o]=t[o];continue}e.push(o.toString())}}if(e.length>0&&R(this.initialOptionLabels)&&JSON.stringify(this.state)===JSON.stringify(this.initialState)){if(Array.isArray(this.initialOptionLabels))for(let o of this.initialOptionLabels)R(o)&&o.value!==void 0&&o.label!==void 0&&e.includes(o.value)&&(this.labelRepository[o.value]=o.label)}else if(e.length>0&&this.getOptionLabelsUsing)try{let o=await this.getOptionLabelsUsing();for(let s of o)R(s)&&s.value!==void 0&&s.label!==void 0&&(this.labelRepository[s.value]=s.label)}catch(o){console.error("Error fetching option labels:",o)}let i=[];if(Array.isArray(this.state))for(let o of this.state)R(this.labelRepository[o])?i.push(this.labelRepository[o]):R(t[o])?i.push(t[o]):i.push(o);return i}createBadgeElement(t,e){let i=document.createElement("span");i.className="fi-badge fi-size-md fi-color fi-color-primary fi-text-color-600 dark:fi-text-color-200",R(t)&&i.setAttribute("data-value",t);let o=document.createElement("span");o.className="fi-badge-label-ctn";let s=document.createElement("span");s.className="fi-badge-label",this.canOptionLabelsWrap&&s.classList.add("fi-wrapped"),this.isHtmlAllowed?s.innerHTML=e:s.textContent=e,o.appendChild(s),i.appendChild(o);let r=this.createRemoveButton(t,e);return i.appendChild(r),i}createRemoveButton(t,e){let i=document.createElement("button");return i.type="button",i.className="fi-badge-delete-btn",i.innerHTML='',i.setAttribute("aria-label","Remove "+(this.isHtmlAllowed?e.replace(/<[^>]*>/g,""):e)),i.addEventListener("click",o=>{o.stopPropagation(),R(t)&&this.selectOption(t)}),i.addEventListener("keydown",o=>{(o.key===" "||o.key==="Enter")&&(o.preventDefault(),o.stopPropagation(),R(t)&&this.selectOption(t))}),i}addBadgesForSelectedOptions(t,e=this.selectedDisplay){let i=document.createElement("div");i.className="fi-select-input-value-badges-ctn",t.forEach((o,s)=>{let r=Array.isArray(this.state)?this.state[s]:null,a=this.createBadgeElement(r,o);i.appendChild(a)}),e.appendChild(i),this.isReorderable&&(i.addEventListener("click",o=>{o.stopPropagation()}),i.addEventListener("mousedown",o=>{o.stopPropagation()}),new Ui(i,{animation:150,onEnd:()=>{let o=[];i.querySelectorAll("[data-value]").forEach(s=>{o.push(s.getAttribute("data-value"))}),this.state=o,this.onStateChange(this.state)}}))}async getLabelForSingleSelection(){let t=this.labelRepository[this.state];if(bt(t)&&(t=this.getSelectedOptionLabel(this.state)),bt(t)&&R(this.initialOptionLabel)&&this.state===this.initialState)t=this.initialOptionLabel,R(this.state)&&(this.labelRepository[this.state]=t);else if(bt(t)&&this.getOptionLabelUsing)try{t=await this.getOptionLabelUsing(),R(t)&&R(this.state)&&(this.labelRepository[this.state]=t)}catch(e){console.error("Error fetching option label:",e),t=this.state}else bt(t)&&(t=this.state);return t}addSingleSelectionDisplay(t,e=this.selectedDisplay){let i=document.createElement("span");if(i.className="fi-select-input-value-label",this.isHtmlAllowed?i.innerHTML=t:i.textContent=t,e.appendChild(i),!this.canSelectPlaceholder)return;let o=document.createElement("button");o.type="button",o.className="fi-select-input-value-remove-btn",o.innerHTML='',o.setAttribute("aria-label","Clear selection"),o.addEventListener("click",s=>{s.stopPropagation(),this.selectOption("")}),o.addEventListener("keydown",s=>{(s.key===" "||s.key==="Enter")&&(s.preventDefault(),s.stopPropagation(),this.selectOption(""))}),e.appendChild(o)}getSelectedOptionLabel(t){if(R(this.labelRepository[t]))return this.labelRepository[t];let e="";for(let i of this.options)if(i.options&&Array.isArray(i.options)){for(let o of i.options)if(o.value===t){e=o.label,this.labelRepository[t]=e;break}}else if(i.value===t){e=i.label,this.labelRepository[t]=e;break}return e}setUpEventListeners(){this.buttonClickListener=()=>{this.toggleDropdown()},this.documentClickListener=t=>{!this.container.contains(t.target)&&this.isOpen&&this.closeDropdown()},this.buttonKeydownListener=t=>{this.isDisabled||this.handleSelectButtonKeydown(t)},this.dropdownKeydownListener=t=>{this.isDisabled||this.isSearchable&&document.activeElement===this.searchInput&&!["Tab","Escape"].includes(t.key)||this.handleDropdownKeydown(t)},this.selectButton.addEventListener("click",this.buttonClickListener),document.addEventListener("click",this.documentClickListener),this.selectButton.addEventListener("keydown",this.buttonKeydownListener),this.dropdown.addEventListener("keydown",this.dropdownKeydownListener),!this.isMultiple&&this.livewireId&&this.statePath&&this.getOptionLabelUsing&&(this.refreshOptionLabelListener=async t=>{if(t.detail.livewireId===this.livewireId&&t.detail.statePath===this.statePath&&R(this.state))try{delete this.labelRepository[this.state];let e=await this.getOptionLabelUsing();R(e)&&(this.labelRepository[this.state]=e);let i=this.selectedDisplay.querySelector(".fi-select-input-value-label");R(i)&&(this.isHtmlAllowed?i.innerHTML=e:i.textContent=e),this.updateOptionLabelInList(this.state,e)}catch(e){console.error("Error refreshing option label:",e)}},window.addEventListener("filament-forms::select.refreshSelectedOptionLabel",this.refreshOptionLabelListener))}updateOptionLabelInList(t,e){this.labelRepository[t]=e;let i=this.getVisibleOptions();for(let o of i)if(o.getAttribute("data-value")===String(t)){if(o.innerHTML="",this.isHtmlAllowed){let s=document.createElement("span");s.innerHTML=e,o.appendChild(s)}else o.appendChild(document.createTextNode(e));break}for(let o of this.options)if(o.options&&Array.isArray(o.options)){for(let s of o.options)if(s.value===t){s.label=e;break}}else if(o.value===t){o.label=e;break}for(let o of this.originalOptions)if(o.options&&Array.isArray(o.options)){for(let s of o.options)if(s.value===t){s.label=e;break}}else if(o.value===t){o.label=e;break}}handleSelectButtonKeydown(t){switch(t.key){case"ArrowDown":t.preventDefault(),t.stopPropagation(),this.isOpen?this.focusNextOption():this.openDropdown();break;case"ArrowUp":t.preventDefault(),t.stopPropagation(),this.isOpen?this.focusPreviousOption():this.openDropdown();break;case" ":if(t.preventDefault(),this.isOpen){if(this.selectedIndex>=0){let e=this.getVisibleOptions()[this.selectedIndex];e&&e.click()}}else this.openDropdown();break;case"Enter":break;case"Escape":this.isOpen&&(t.preventDefault(),this.closeDropdown());break;case"Tab":this.isOpen&&this.closeDropdown();break;default:if(this.isSearchable&&!t.ctrlKey&&!t.metaKey&&!t.altKey&&typeof t.key=="string"&&t.key.length===1){t.preventDefault();let e=t.key;this.isOpen||this.openDropdown(),this.searchInput&&(this.searchInput.focus(),this.searchInput.value=(this.searchInput.value||"")+e,this.searchInput.dispatchEvent(new Event("input",{bubbles:!0})))}break}}handleDropdownKeydown(t){switch(t.key){case"ArrowDown":t.preventDefault(),t.stopPropagation(),this.focusNextOption();break;case"ArrowUp":t.preventDefault(),t.stopPropagation(),this.focusPreviousOption();break;case" ":if(t.preventDefault(),this.selectedIndex>=0){let e=this.getVisibleOptions()[this.selectedIndex];e&&e.click()}break;case"Enter":if(t.preventDefault(),this.selectedIndex>=0){let e=this.getVisibleOptions()[this.selectedIndex];e&&e.click()}else{let e=this.element.closest("form");e&&e.submit()}break;case"Escape":t.preventDefault(),this.closeDropdown(),this.selectButton.focus();break;case"Tab":this.closeDropdown();break;default:if(this.isSearchable&&!t.ctrlKey&&!t.metaKey&&!t.altKey&&typeof t.key=="string"&&t.key.length===1){t.preventDefault();let e=t.key;this.searchInput&&(this.searchInput.focus(),this.searchInput.value=(this.searchInput.value||"")+e,this.searchInput.dispatchEvent(new Event("input",{bubbles:!0})))}break}}toggleDropdown(){if(!this.isDisabled){if(this.isOpen){this.closeDropdown();return}this.isMultiple&&!this.isSearchable&&!this.hasAvailableOptions()||this.openDropdown()}}hasAvailableOptions(){for(let t of this.options)if(t.options&&Array.isArray(t.options)){for(let e of t.options)if(!Array.isArray(this.state)||!this.state.includes(e.value))return!0}else if(!Array.isArray(this.state)||!this.state.includes(t.value))return!0;return!1}async openDropdown(){this.dropdown.style.display="block",this.dropdown.style.opacity="0";let t=this.selectButton.closest(".fi-fixed-positioning-context")!==null&&this.selectButton.closest(".fi-absolute-positioning-context")===null;if(this.dropdown.style.position=t?"fixed":"absolute",this.dropdown.style.width=`${this.selectButton.offsetWidth}px`,this.selectButton.setAttribute("aria-expanded","true"),this.isOpen=!0,this.positionDropdown(),this.resizeListener||(this.resizeListener=()=>{this.dropdown.style.width=`${this.selectButton.offsetWidth}px`,this.positionDropdown()},window.addEventListener("resize",this.resizeListener)),this.scrollListener||(this.scrollListener=()=>this.positionDropdown(),window.addEventListener("scroll",this.scrollListener,!0)),this.dropdown.style.opacity="1",this.isSearchable&&this.searchInput&&(this.searchInput.value="",this.searchQuery="",this.hasDynamicOptions||(this.options=JSON.parse(JSON.stringify(this.originalOptions)),this.renderOptions())),this.hasDynamicOptions&&this.getOptionsUsing){this.showLoadingState(!1);try{let e=await this.getOptionsUsing(),i=Array.isArray(e)?e:e&&Array.isArray(e.options)?e.options:[];if(this.options=i,this.originalOptions=JSON.parse(JSON.stringify(i)),this.populateLabelRepositoryFromOptions(i),this.isSearchable&&this.searchInput&&(this.searchInput.value&&this.searchInput.value.trim()!==""||this.searchQuery&&this.searchQuery.trim()!=="")){let o=(this.searchInput.value||this.searchQuery||"").trim().toLowerCase();this.hideLoadingState(),this.filterOptions(o)}else this.renderOptions()}catch(e){console.error("Error fetching options:",e),this.hideLoadingState()}}if(this.hideLoadingState(),this.isSearchable&&this.searchInput)this.searchInput.focus();else{this.selectedIndex=-1;let e=this.getVisibleOptions();if(this.isMultiple){if(Array.isArray(this.state)&&this.state.length>0){for(let i=0;i0&&(this.selectedIndex=0),this.selectedIndex>=0&&(e[this.selectedIndex].classList.add("fi-selected"),e[this.selectedIndex].focus())}}positionDropdown(){let t=this.position==="top"?"top-start":"bottom-start",e=[wi(4),Si({padding:5})];this.position!=="top"&&this.position!=="bottom"&&e.push(xi());let i=this.selectButton.closest(".fi-fixed-positioning-context")!==null&&this.selectButton.closest(".fi-absolute-positioning-context")===null;Ei(this.selectButton,this.dropdown,{placement:t,middleware:e,strategy:i?"fixed":"absolute"}).then(({x:o,y:s})=>{Object.assign(this.dropdown.style,{left:`${o}px`,top:`${s}px`})})}closeDropdown(){this.dropdown.style.display="none",this.selectButton.setAttribute("aria-expanded","false"),this.isOpen=!1,this.searchTimeout&&(clearTimeout(this.searchTimeout),this.searchTimeout=null),this.activeSearchId++,this.isSearching=!1,this.hideLoadingState(),this.resizeListener&&(window.removeEventListener("resize",this.resizeListener),this.resizeListener=null),this.scrollListener&&(window.removeEventListener("scroll",this.scrollListener,!0),this.scrollListener=null),this.getVisibleOptions().forEach(e=>{e.classList.remove("fi-selected")}),this.dropdown.removeAttribute("aria-activedescendant")}focusNextOption(){let t=this.getVisibleOptions();if(t.length!==0){if(this.selectedIndex>=0&&this.selectedIndex=0&&this.selectedIndexe.bottom?this.dropdown.scrollTop+=i.bottom-e.bottom:i.top li[role="option"]')):t=Array.from(this.optionsList.querySelectorAll(':scope > ul.fi-dropdown-list > li[role="option"]'));let e=Array.from(this.optionsList.querySelectorAll('li.fi-select-input-option-group > ul > li[role="option"]'));return[...t,...e]}getSelectedOptionLabels(){if(!Array.isArray(this.state)||this.state.length===0)return{};let t={};for(let e of this.state){let i=!1;for(let o of this.options)if(o.options&&Array.isArray(o.options)){for(let s of o.options)if(s.value===e){t[e]=s.label,i=!0;break}if(i)break}else if(o.value===e){t[e]=o.label,i=!0;break}}return t}handleSearch(t){let e=t.target.value.trim();if(this.searchQuery=e,this.searchTimeout&&clearTimeout(this.searchTimeout),e===""){this.options=JSON.parse(JSON.stringify(this.originalOptions)),this.renderOptions();return}if(!this.getSearchResultsUsing||typeof this.getSearchResultsUsing!="function"||!this.hasDynamicSearchResults){this.filterOptions(e);return}this.searchTimeout=setTimeout(async()=>{this.searchTimeout=null;let i=++this.activeSearchId;this.isSearching=!0;try{this.showLoadingState(!0);let o=await this.getSearchResultsUsing(e);if(i!==this.activeSearchId||!this.isOpen)return;let s=Array.isArray(o)?o:o&&Array.isArray(o.options)?o.options:[];this.options=s,this.populateLabelRepositoryFromOptions(s),this.hideLoadingState(),this.renderOptions(),this.isOpen&&this.positionDropdown(),this.options.length===0&&this.showNoResultsMessage()}catch(o){i===this.activeSearchId&&(console.error("Error fetching search results:",o),this.hideLoadingState(),this.options=JSON.parse(JSON.stringify(this.originalOptions)),this.renderOptions())}finally{i===this.activeSearchId&&(this.isSearching=!1)}},this.searchDebounce)}showLoadingState(t=!1){this.optionsList.parentNode===this.dropdown&&this.dropdown.removeChild(this.optionsList),this.hideLoadingState();let e=document.createElement("div");e.className="fi-select-input-message",e.textContent=t?this.searchingMessage:this.loadingMessage,this.dropdown.appendChild(e)}hideLoadingState(){let t=this.dropdown.querySelector(".fi-select-input-message");t&&t.remove()}showNoResultsMessage(){this.optionsList.parentNode===this.dropdown&&this.dropdown.removeChild(this.optionsList),this.hideLoadingState();let t=document.createElement("div");t.className="fi-select-input-message",t.textContent=this.noSearchResultsMessage,this.dropdown.appendChild(t)}filterOptions(t){let e=this.searchableOptionFields.includes("label"),i=this.searchableOptionFields.includes("value");t=t.toLowerCase();let o=[];for(let s of this.originalOptions)if(s.options&&Array.isArray(s.options)){let r=s.options.filter(a=>e&&a.label.toLowerCase().includes(t)||i&&String(a.value).toLowerCase().includes(t));r.length>0&&o.push({label:s.label,options:r})}else(e&&s.label.toLowerCase().includes(t)||i&&String(s.value).toLowerCase().includes(t))&&o.push(s);this.options=o,this.renderOptions(),this.options.length===0&&this.showNoResultsMessage(),this.isOpen&&this.positionDropdown()}selectOption(t){if(this.isDisabled)return;if(!this.isMultiple){this.state=t,this.updateSelectedDisplay(),this.renderOptions(),this.closeDropdown(),this.selectButton.focus(),this.onStateChange(this.state);return}let e=Array.isArray(this.state)?[...this.state]:[];if(e.includes(t)){let o=this.selectedDisplay.querySelector(`[data-value="${t}"]`);if(R(o)){let s=o.parentElement;R(s)&&s.children.length===1?(e=e.filter(r=>r!==t),this.state=e,this.updateSelectedDisplay()):(o.remove(),e=e.filter(r=>r!==t),this.state=e)}else e=e.filter(s=>s!==t),this.state=e,this.updateSelectedDisplay();this.renderOptions(),this.isOpen&&this.positionDropdown(),this.maintainFocusInMultipleMode(),this.onStateChange(this.state);return}if(this.maxItems&&e.length>=this.maxItems){this.maxItemsMessage&&alert(this.maxItemsMessage);return}e.push(t),this.state=e;let i=this.selectedDisplay.querySelector(".fi-select-input-value-badges-ctn");bt(i)?this.updateSelectedDisplay():this.addSingleBadge(t,i),this.renderOptions(),this.isOpen&&this.positionDropdown(),this.maintainFocusInMultipleMode(),this.onStateChange(this.state)}async addSingleBadge(t,e){let i=this.labelRepository[t];if(bt(i)&&(i=this.getSelectedOptionLabel(t),R(i)&&(this.labelRepository[t]=i)),bt(i)&&this.getOptionLabelsUsing)try{let s=await this.getOptionLabelsUsing();for(let r of s)if(R(r)&&r.value===t&&r.label!==void 0){i=r.label,this.labelRepository[t]=i;break}}catch(s){console.error("Error fetching option label:",s)}bt(i)&&(i=t);let o=this.createBadgeElement(t,i);e.appendChild(o)}maintainFocusInMultipleMode(){if(this.isSearchable&&this.searchInput){this.searchInput.focus();return}let t=this.getVisibleOptions();if(t.length!==0){if(this.selectedIndex=-1,Array.isArray(this.state)&&this.state.length>0){for(let e=0;e{e.setAttribute("disabled","disabled"),e.classList.add("fi-disabled")}),!this.isMultiple&&this.canSelectPlaceholder){let t=this.container.querySelector(".fi-select-input-value-remove-btn");t&&(t.setAttribute("disabled","disabled"),t.classList.add("fi-disabled"))}this.isSearchable&&this.searchInput&&(this.searchInput.setAttribute("disabled","disabled"),this.searchInput.classList.add("fi-disabled"))}else{if(this.selectButton.removeAttribute("disabled"),this.selectButton.removeAttribute("aria-disabled"),this.selectButton.classList.remove("fi-disabled"),this.isMultiple&&this.container.querySelectorAll(".fi-select-input-badge-remove").forEach(e=>{e.removeAttribute("disabled"),e.classList.remove("fi-disabled")}),!this.isMultiple&&this.canSelectPlaceholder){let t=this.container.querySelector(".fi-select-input-value-remove-btn");t&&(t.removeAttribute("disabled"),t.classList.add("fi-disabled"))}this.isSearchable&&this.searchInput&&(this.searchInput.removeAttribute("disabled"),this.searchInput.classList.remove("fi-disabled"))}}destroy(){this.selectButton&&this.buttonClickListener&&this.selectButton.removeEventListener("click",this.buttonClickListener),this.documentClickListener&&document.removeEventListener("click",this.documentClickListener),this.selectButton&&this.buttonKeydownListener&&this.selectButton.removeEventListener("keydown",this.buttonKeydownListener),this.dropdown&&this.dropdownKeydownListener&&this.dropdown.removeEventListener("keydown",this.dropdownKeydownListener),this.resizeListener&&(window.removeEventListener("resize",this.resizeListener),this.resizeListener=null),this.scrollListener&&(window.removeEventListener("scroll",this.scrollListener,!0),this.scrollListener=null),this.refreshOptionLabelListener&&window.removeEventListener("filament-forms::select.refreshSelectedOptionLabel",this.refreshOptionLabelListener),this.isOpen&&this.closeDropdown(),this.searchTimeout&&(clearTimeout(this.searchTimeout),this.searchTimeout=null),this.container&&this.container.remove()}};function Qn({canOptionLabelsWrap:n,canSelectPlaceholder:t,isHtmlAllowed:e,getOptionLabelUsing:i,getOptionLabelsUsing:o,getOptionsUsing:s,getSearchResultsUsing:r,initialOptionLabel:a,initialOptionLabels:l,initialState:c,isAutofocused:f,isDisabled:d,isMultiple:p,isReorderable:u,isSearchable:g,hasDynamicOptions:m,hasDynamicSearchResults:S,livewireId:O,loadingMessage:w,maxItems:D,maxItemsMessage:A,noSearchResultsMessage:C,options:F,optionsLimit:q,placeholder:J,position:T,searchDebounce:V,searchingMessage:X,searchPrompt:tt,searchableOptionFields:W,state:k,statePath:Y}){return{select:null,state:k,init(){this.select=new Ee({element:this.$refs.select,options:F,placeholder:J,state:this.state,canOptionLabelsWrap:n,canSelectPlaceholder:t,initialOptionLabel:a,initialOptionLabels:l,initialState:c,isHtmlAllowed:e,isAutofocused:f,isDisabled:d,isMultiple:p,isReorderable:u,isSearchable:g,getOptionLabelUsing:i,getOptionLabelsUsing:o,getOptionsUsing:s,getSearchResultsUsing:r,hasDynamicOptions:m,hasDynamicSearchResults:S,searchPrompt:tt,searchDebounce:V,loadingMessage:w,searchingMessage:X,noSearchResultsMessage:C,maxItems:D,maxItemsMessage:A,optionsLimit:q,position:T,searchableOptionFields:W,livewireId:O,statePath:Y,onStateChange:P=>{this.state=P}}),this.$watch("state",P=>{this.select&&this.select.state!==P&&(this.select.state=P,this.select.updateSelectedDisplay(),this.select.renderOptions())})},destroy(){this.select&&(this.select.destroy(),this.select=null)}}}export{Qn as default}; /*! Bundled license information: sortablejs/modular/sortable.esm.js: (**! * Sortable 1.15.6 * @author RubaXa * @author owenm * @license MIT *) */