diff --git a/dist/flux-lite.min.js b/dist/flux-lite.min.js index 20c1dfe..961aff7 100644 --- a/dist/flux-lite.min.js +++ b/dist/flux-lite.min.js @@ -122,4 +122,4 @@ ${e?"@layer popover-polyfill {":""} } } ${e?"}":""} -`}var ye=null;function Ot(e){let t=Fo();if(ye===null)try{ye=new CSSStyleSheet,ye.replaceSync(t)}catch{ye=!1}if(ye===!1){let i=document.createElement("style");i.textContent=t,e instanceof Document?e.head.prepend(i):e.prepend(i)}else e.adoptedStyleSheets=[ye,...e.adoptedStyleSheets]}function _i(){if(typeof window>"u")return;window.ToggleEvent=window.ToggleEvent||st;function e(a){return a?.includes(":popover-open")&&(a=a.replace(Ro,"$1.\\:popover-open")),a}ce(Document.prototype,"querySelector",e),ce(Document.prototype,"querySelectorAll",e),ce(Element.prototype,"querySelector",e),ce(Element.prototype,"querySelectorAll",e),ce(Element.prototype,"matches",e),ce(Element.prototype,"closest",e),ce(DocumentFragment.prototype,"querySelectorAll",e),Object.defineProperties(HTMLElement.prototype,{popover:{enumerable:!0,configurable:!0,get(){if(!this.hasAttribute("popover"))return null;let a=(this.getAttribute("popover")||"").toLowerCase();return a===""||a=="auto"?"auto":"manual"},set(a){this.setAttribute("popover",a)}},showPopover:{enumerable:!0,configurable:!0,value(){Tt(this)}},hidePopover:{enumerable:!0,configurable:!0,value(){Me(this,!0,!0)}},togglePopover:{enumerable:!0,configurable:!0,value(a){Re.get(this)==="showing"&&a===void 0||a===!1?Me(this,!0,!0):(a===void 0||a===!0)&&Tt(this)}}});let t=Element.prototype.attachShadow;t&&Object.defineProperties(Element.prototype,{attachShadow:{enumerable:!0,configurable:!0,writable:!0,value(a){let l=t.call(this,a);return Ot(l),l}}});let i=HTMLElement.prototype.attachInternals;i&&Object.defineProperties(HTMLElement.prototype,{attachInternals:{enumerable:!0,configurable:!0,writable:!0,value(){let a=i.call(this);return a.shadowRoot&&Ot(a.shadowRoot),a}}});let o=new WeakMap;function n(a){Object.defineProperties(a.prototype,{popoverTargetElement:{enumerable:!0,configurable:!0,set(l){if(l===null)this.removeAttribute("popovertarget"),o.delete(this);else if(l instanceof Element)this.setAttribute("popovertarget",""),o.set(this,l);else throw new TypeError("popoverTargetElement must be an element or null")},get(){if(this.localName!=="button"&&this.localName!=="input"||this.localName==="input"&&this.type!=="reset"&&this.type!=="image"&&this.type!=="button"||this.disabled||this.form&&this.type==="submit")return null;let l=o.get(this);if(l&&l.isConnected)return l;if(l&&!l.isConnected)return o.delete(this),null;let h=Ae(this),f=this.getAttribute("popovertarget");return(h instanceof Document||h instanceof yi)&&f&&h.getElementById(f)||null}},popoverTargetAction:{enumerable:!0,configurable:!0,get(){let l=(this.getAttribute("popovertargetaction")||"").toLowerCase();return l==="show"||l==="hide"?l:"toggle"},set(l){this.setAttribute("popovertargetaction",l)}}})}n(HTMLButtonElement),n(HTMLInputElement);let s=a=>{let l=a.composedPath(),h=l[0];if(!(h instanceof Element)||h?.shadowRoot)return;let f=Ae(h);if(!(f instanceof yi||f instanceof Document))return;let m=l.find(b=>b.matches?.("[popovertargetaction],[popovertarget]"));if(m){_o(m),a.preventDefault();return}},r=a=>{let l=a.key,h=a.target;!a.defaultPrevented&&h&&(l==="Escape"||l==="Esc")&&rt(h.ownerDocument,!0,!0)};(a=>{a.addEventListener("click",s),a.addEventListener("keydown",r),a.addEventListener("pointerdown",wi),a.addEventListener("pointerup",wi)})(document),Ot(document)}function W(e){let t=e({css:(o,...n)=>o.raw[0]+n.join("")});if(document.adoptedStyleSheets===void 0){let o=document.createElement("style");o.textContent=t,document.head.appendChild(o);return}let i=new CSSStyleSheet;i.replaceSync(t),document.adoptedStyleSheets=[...document.adoptedStyleSheets,i]}function Oi(e,t){let i=e;for(;i;){if(t(i))return i;i=i.parentElement}}function B(e,t){let i=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,t?{acceptNode:o=>{let n,s;return t(o,{skip:()=>n=!0,reject:()=>s=!0}),n?NodeFilter.FILTER_SKIP:s?NodeFilter.FILTER_REJECT:NodeFilter.FILTER_ACCEPT}}:{});return new Lt(i)}var Lt=class{constructor(t){this.walker=t}from(t){return this.walker.currentNode=t,this}first(){return this.walker.firstChild()}last(){return this.walker.lastChild()}next(t){return this.walker.currentNode=t,this.walker.nextSibling()}nextOrFirst(t){let i=this.next(t);return i||(this.walker.currentNode=this.walker.root,this.first())}prev(t){return this.walker.currentNode=t,this.walker.previousSibling()}prevOrLast(t){let i=this.prev(t);return i||(this.walker.currentNode=this.walker.root,this.last())}closest(t,i){let o=this.from(t).walker;for(;o.currentNode;){if(i(o.currentNode))return o.currentNode;o.parentNode()}}contains(t){return this.find(i=>i===t)}find(t){return this.walk((i,o)=>{t(i)&&o(i)})}findOrFirst(t){return this.find(t)||(this.walker.currentNode=this.walker.root),this.first()}each(t){this.walk(i=>t(i))}some(t){return!!this.find(t)}every(t){let i=!0;return this.walk(o=>{t(o)||(i=!1)}),i}map(t){let i=[];return this.walk(o=>i.push(t(o))),i}filter(t){let i=[];return this.walk(o=>t(o)&&i.push(o)),i}walk(t){let i,o=this.walker,n;for(;o.nextNode()&&(i=o.currentNode,t(i,s=>n=s),n===void 0););return n}};function T(e,t){customElements.define(`ui-${e}`,t)}function w(e,t,i,o={}){return e.addEventListener(t,i,o),{off:()=>e.removeEventListener(t,i),pause:n=>{e.removeEventListener(t,i),n(),e.addEventListener(t,i)}}}function Ti(e){return["a[href]","area[href]","input:not([disabled])","select:not([disabled])","textarea:not([disabled])","button:not([disabled])","iframe","object","embed","[tabindex]","[contenteditable]"].some(i=>e.matches(i))&&e.tabIndex>=0}function Io(e,t){let i;return function(){let o=this,n=arguments;i||(e.apply(o,n),i=!0,setTimeout(()=>i=!1,t))}}var lt="pointer";document.addEventListener("keydown",()=>lt="keyboard",{capture:!0});document.addEventListener("pointerdown",e=>{lt=e.pointerType==="mouse"?"mouse":"touch"},{capture:!0});function Mt(){return lt==="keyboard"}function No(){return lt==="touch"}function ct(e,t){let i="",o=zo(()=>{i=""},300);e.addEventListener("keydown",n=>{n.key.length===1&&/[a-zA-Z]/.test(n.key)&&(i+=n.key,t(i),n.stopPropagation()),o()})}function Ho(e,t){return"lofi-"+(t?t+"-":"")+Math.random().toString(16).slice(2)}function q(e,t){let i=e.hasAttribute("id")?e.getAttribute("id"):Ho(e,t);return p(e,"id",i),e._x_bindings||(e._x_bindings={}),e._x_bindings.id||(e._x_bindings.id=i),i}function te(){let e=!1;return t=>(...i)=>{e||(e=!0,t(...i),e=!1)}}function xe(e,t,{gain:i,lose:o,focusable:n,useSafeArea:s}){let r=!1;n&&document.addEventListener("focusin",f=>{Mt()&&(e.contains(f.target)||t.contains(f.target)?(r=!0,i()):(r=!1,o()))});let c=()=>{},a=()=>{},l=()=>{r=!1,o(),c(),a()},h=()=>{r=!1,c(),a()};return e.addEventListener("pointerenter",f=>{No()||r||(r=!0,i(),setTimeout(()=>{let{safeArea:m,redraw:b,remove:u}=s?Wo(e,t,f.clientX,f.clientY):$o();c=u;let d,v=Io(g=>{let y=t.getBoundingClientRect(),A=e.getBoundingClientRect(),S;switch(m.contains(g.target)&&Bo(A,y,g.clientX,g.clientY)?S="safeArea":t.contains(g.target)?S="panel":e.contains(g.target)?S="trigger":S="outside",d&&clearTimeout(d),S){case"outside":l();break;case"trigger":b(g.clientX,g.clientY);break;case"panel":c();break;case"safeArea":b(g.clientX,g.clientY),d=setTimeout(()=>{l()},300);break;default:break}},100);document.addEventListener("pointermove",v),a=()=>document.removeEventListener("pointermove",v)}))}),{clear:h}}function Wo(e,t,i,o){let n=document.createElement("div"),s=t.getBoundingClientRect(),r=e.getBoundingClientRect();n.style.position="fixed",p(n,"data-safe-area","");let c=(a,l)=>{if(s.top===0&&s.bottom===0)return;let h;s.leftr.right&&(h="right"),s.topr.bottom&&s.top>l&&(h="down"),h===void 0&&(h="right");let f,m,b,u,d,v,g,y,A=10;switch(h){case"left":f=s.right,m=Math.max(s.right,a)+5,b=m-f,u=Math.min(r.top,s.top)-A,d=Math.max(r.bottom,s.bottom)+A,v=d-u,g=l-u,y=`polygon(0% 0%, 100% ${g}px, 0% 100%)`;break;case"right":f=Math.min(s.left,a)-5,m=s.left,b=m-f,u=Math.min(r.top,s.top)-A,d=Math.max(r.bottom,s.bottom)+A,v=d-u,g=l-u,y=`polygon(0% ${g}px, 100% 0%, 100% 100%)`;break;case"up":f=Math.min(a,s.left)-A,m=Math.max(a,s.right)+A,b=m-f,u=s.bottom,d=Math.max(s.bottom,l)+5,v=d-u,g=a-f,y=`polygon(0% 0%, 100% 0%, ${g}px 100%)`;break;case"down":f=Math.min(a,s.left)-A,m=Math.max(a,s.right)+A,b=m-f,u=Math.min(s.top,l)-5,d=s.top,v=d-u,g=a-f,y=`polygon(${g}px 0%, 100% 100%, 0% 100%)`;break}n.style.left=`${f}px`,n.style.top=`${u}px`,n.style.width=`${b}px`,n.style.height=`${v}px`,n.style.clipPath=y};return{safeArea:n,redraw:(a,l)=>{n.isConnected||e.appendChild(n),c(a,l)},remove:()=>{n.remove()}}}function Bo(e,t,i,o){return!qo(e,i,o)&&!Vo(t,i,o)}function qo(e,t,i){return e.left<=t&&t<=e.right&&e.top<=i&&i<=e.bottom}function Vo(e,t,i){return e.left<=t&&t<=e.right&&e.top<=i&&i<=e.bottom}function p(e,t,i){e._durableAttributeObserver===void 0&&(e._durableAttributeObserver=Pi(e,[t])),e._durableAttributeObserver.hasAttribute(t)||e._durableAttributeObserver.addAttribute(t),e._durableAttributeObserver.pause(()=>{e.setAttribute(t,i)})}function x(e,t){e._durableAttributeObserver===void 0&&(e._durableAttributeObserver=Pi(e,[t])),e._durableAttributeObserver.hasAttribute(t)||e._durableAttributeObserver.addAttribute(t),e._durableAttributeObserver.pause(()=>{e.removeAttribute(t)})}function Pi(e,t){let i=n=>{n.forEach(s=>{s.oldValue===null?e._durableAttributeObserver.pause(()=>x(e,s.attributeName)):e._durableAttributeObserver.pause(()=>p(e,s.attributeName,s.oldValue))})},o=new MutationObserver(n=>i(n));return o.observe(e,{attributeFilter:t,attributeOldValue:!0}),{attributes:t,hasAttribute(n){return this.attributes.includes(n)},addAttribute(n){this.attributes.includes(n)||this.attributes.push(n),o.observe(e,{attributeFilter:this.attributes,attributeOldValue:!0})},releaseAttribute(n){this.hasAttribute(n)&&o.observe(e,{attributeFilter:this.attributes,attributeOldValue:!0})},pause(n){i(o.takeRecords()),o.disconnect(),n(),o.observe(e,{attributeFilter:this.attributes,attributeOldValue:!0})}}}function $o(){return{safeArea:{contains:()=>!1},redraw:()=>{},remove:()=>{}}}function zo(e,t){let i;return(...o)=>{clearTimeout(i),i=setTimeout(()=>{e(...o)},t)}}var at=0;function ut(e=!1){if(e)return{lock:()=>{},unlock:()=>{}};let t=()=>{};return{lock(){at++,!(at>1)&&(t=jo(Ci(document.documentElement,"paddingRight",`${window.innerWidth-document.documentElement.clientWidth}px`),Ci(document.documentElement,"overflow","hidden")))},unlock(){at=Math.max(0,at-1),t()}}}function Ci(e,t,i){let o=e.style[t];return e.style[t]=i,()=>{e.style[t]=o}}function jo(...e){return(...t)=>{for(let i of e)i(...t)}}var k=class extends HTMLElement{constructor(){super(),this.boot?.()}connectedCallback(){queueMicrotask(()=>{this.mount?.()})}mixin(t,i={}){return new t(this,i)}appendMixin(t,i={}){return new t(this,i)}use(t){let i;return this.mixins.forEach(o=>{o instanceof t&&(i=o)}),i}uses(t){let i;return this.mixins.forEach(o=>{o instanceof t&&(i=!0)}),!!i}on(t,i){return w(this,t,i)}root(t,i={}){if(t===void 0)return this.__root;let o=document.createElement(t);for(let s in i)setAttribute(o,s,i[s]);let n=this.attachShadow({mode:"open"});return o.appendChild(document.createElement("slot")),n.appendChild(o),this.__root=o,this.__root}},ft=class extends k{};var C=class{constructor(t,i={}){this.el=t,this.grouped=i.grouped===void 0,this.el.mixins=this.el.mixins?this.el.mixins:new Map,this.el.mixins.set(this.constructor.name,this),this.el[this.constructor.name]=!0,this.el.use||(this.el.use=k.prototype.use.bind(this.el)),this.opts=i,this.boot?.({options:o=>{let n=o;Object.entries(this.opts).forEach(([s,r])=>{r!==void 0&&(n[s]=r)}),this.opts=n}}),queueMicrotask(()=>{this.mount?.()})}options(){return this.opts}hasGroup(){return!!this.group()}group(){if(this.grouped!==!1)return Oi(this.el,t=>t[this.groupedByType.name])?.use(this.groupedByType)}on(t,i){return w(this.el,t,i)}},V=class extends C{constructor(t,i={}){super(t,i)}walker(){return B(this.el,(t,{skip:i,reject:o})=>{if(t[this.constructor.name]&&t!==this.el)return o();if(!t[this.groupOfType.name]||!t.mixins.get(this.groupOfType.name).grouped)return i()})}};var $=class extends C{boot({options:t}){this.initialState=this.el.value,this.getterFunc=()=>{},this.setterFunc=i=>this.initialState=i,Object.defineProperty(this.el,"value",{get:()=>this.getterFunc(),set:i=>{this.setterFunc(i)}})}initial(t){t(this.initialState)}getter(t){this.getterFunc=t}setter(t){this.setterFunc=t}dispatch(){this.el.dispatchEvent(new Event("input",{bubbles:!1,cancelable:!0})),this.el.dispatchEvent(new Event("change",{bubbles:!1,cancelable:!0}))}};var K=new Map,R=class extends C{boot({options:t}){t({trigger:null,scope:null});let i=this.options().scope||"global";p(this.el,"popover","manual"),this.trigger=this.options().trigger,this.onChanges=[],this.state=!1,w(this.el,"beforetoggle",o=>{let n=this.state;if(this.state=o.newState==="open",this.state){Uo(this.el,i);let s=new AbortController,r=document.activeElement;setTimeout(()=>{Yo(this.el,r,s),Ko(this.el,r,s),Xo(this.el,r,s)}),this.el.addEventListener("beforetoggle",c=>{c.newState==="closed"&&(s.abort(),r.focus())},{signal:s.signal})}n!==this.state&&this.onChanges.forEach(s=>s(this.state,n))}),w(this.el,"toggle",o=>{if(o.newState==="open")K.has(i)||K.set(i,new Set),K.get(i).add(this.el);else if(o.newState==="closed"){if(!K.has(i))return;K.get(i).delete(this.el),K.get(i).size===0&&K.delete(i)}})}onChange(t){this.onChanges.push(t)}setState(t){t?this.show():this.hide()}getState(){return this.state}toggle(){this.el.togglePopover()}show(){this.el.showPopover()}hide(){this.el.hidePopover()}};function Uo(e,t){K.has(t)&&K.get(t).forEach(i=>{e.contains(i)||i.contains(e)||i.hidePopover()})}function Yo(e,t,i){document.addEventListener("click",o=>{e.contains(o.target)||t===o.target||e.hidePopover()},{signal:i.signal})}function Ko(e,t,i){document.addEventListener("focusin",o=>{e.contains(o.target)||t===o.target||(i.abort(),e.hidePopover())},{capture:!0,signal:i.signal})}function Xo(e,t,i){document.addEventListener("keydown",o=>{o.key==="Escape"&&e.hidePopover()},{signal:i.signal})}var z=Math.min,P=Math.max,Fe=Math.round,Ie=Math.floor,X=e=>({x:e,y:e}),Go={left:"right",right:"left",bottom:"top",top:"bottom"},Qo={start:"end",end:"start"};function Rt(e,t,i){return P(e,z(t,i))}function Se(e,t){return typeof e=="function"?e(t):e}function G(e){return e.split("-")[0]}function Ee(e){return e.split("-")[1]}function Dt(e){return e==="x"?"y":"x"}function Ft(e){return e==="y"?"height":"width"}function ie(e){return["top","bottom"].includes(G(e))?"y":"x"}function It(e){return Dt(ie(e))}function Li(e,t,i){i===void 0&&(i=!1);let o=Ee(e),n=It(e),s=Ft(n),r=n==="x"?o===(i?"end":"start")?"right":"left":o==="start"?"bottom":"top";return t.reference[s]>t.floating[s]&&(r=De(r)),[r,De(r)]}function Mi(e){let t=De(e);return[ht(e),t,ht(t)]}function ht(e){return e.replace(/start|end/g,t=>Qo[t])}function Jo(e,t,i){let o=["left","right"],n=["right","left"],s=["top","bottom"],r=["bottom","top"];switch(e){case"top":case"bottom":return i?t?n:o:t?o:n;case"left":case"right":return t?s:r;default:return[]}}function Ri(e,t,i,o){let n=Ee(e),s=Jo(G(e),i==="start",o);return n&&(s=s.map(r=>r+"-"+n),t&&(s=s.concat(s.map(ht)))),s}function De(e){return e.replace(/left|right|bottom|top/g,t=>Go[t])}function Zo(e){return{top:0,right:0,bottom:0,left:0,...e}}function Di(e){return typeof e!="number"?Zo(e):{top:e,right:e,bottom:e,left:e}}function fe(e){let{x:t,y:i,width:o,height:n}=e;return{width:o,height:n,top:i,left:t,right:t+o,bottom:i+n,x:t,y:i}}function Fi(e,t,i){let{reference:o,floating:n}=e,s=ie(t),r=It(t),c=Ft(r),a=G(t),l=s==="y",h=o.x+o.width/2-n.width/2,f=o.y+o.height/2-n.height/2,m=o[c]/2-n[c]/2,b;switch(a){case"top":b={x:h,y:o.y-n.height};break;case"bottom":b={x:h,y:o.y+o.height};break;case"right":b={x:o.x+o.width,y:f};break;case"left":b={x:o.x-n.width,y:f};break;default:b={x:o.x,y:o.y}}switch(Ee(t)){case"start":b[r]-=m*(i&&l?-1:1);break;case"end":b[r]+=m*(i&&l?-1:1);break}return b}var Ii=async(e,t,i)=>{let{placement:o="bottom",strategy:n="absolute",middleware:s=[],platform:r}=i,c=s.filter(Boolean),a=await(r.isRTL==null?void 0:r.isRTL(t)),l=await r.getElementRects({reference:e,floating:t,strategy:n}),{x:h,y:f}=Fi(l,o,a),m=o,b={},u=0;for(let d=0;dre<=0)){var Oe,si;let re=(((Oe=s.flip)==null?void 0:Oe.index)||0)+1,ai=Ue[re];if(ai)return{data:{index:re,overflows:J},reset:{placement:ai}};let Te=(si=J.filter(ge=>ge.overflows[0]<=0).sort((ge,Z)=>ge.overflows[1]-Z.overflows[1])[0])==null?void 0:si.placement;if(!Te)switch(b){case"bestFit":{var ri;let ge=(ri=J.filter(Z=>{if(H){let ee=ie(Z.placement);return ee===y||ee==="y"}return!0}).map(Z=>[Z.placement,Z.overflows.filter(ee=>ee>0).reduce((ee,uo)=>ee+uo,0)]).sort((Z,ee)=>Z[1]-ee[1])[0])==null?void 0:ri[0];ge&&(Te=ge);break}case"initialPlacement":Te=c;break}if(n!==Te)return{reset:{placement:Te}}}return{}}}};async function en(e,t){let{placement:i,platform:o,elements:n}=e,s=await(o.isRTL==null?void 0:o.isRTL(n.floating)),r=G(i),c=Ee(i),a=ie(i)==="y",l=["left","top"].includes(r)?-1:1,h=s&&a?-1:1,f=Se(t,e),{mainAxis:m,crossAxis:b,alignmentAxis:u}=typeof f=="number"?{mainAxis:f,crossAxis:0,alignmentAxis:null}:{mainAxis:0,crossAxis:0,alignmentAxis:null,...f};return c&&typeof u=="number"&&(b=c==="end"?u*-1:u),a?{x:b*h,y:m*l}:{x:m*l,y:b*h}}var Hi=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var i,o;let{x:n,y:s,placement:r,middlewareData:c}=t,a=await en(t,e);return r===((i=c.offset)==null?void 0:i.placement)&&(o=c.arrow)!=null&&o.alignmentOffset?{}:{x:n+a.x,y:s+a.y,data:{...a,placement:r}}}}},Wi=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){let{x:i,y:o,placement:n}=t,{mainAxis:s=!0,crossAxis:r=!1,limiter:c={fn:v=>{let{x:g,y}=v;return{x:g,y}}},...a}=Se(e,t),l={x:i,y:o},h=await pt(t,a),f=ie(G(n)),m=Dt(f),b=l[m],u=l[f];if(s){let v=m==="y"?"top":"left",g=m==="y"?"bottom":"right",y=b+h[v],A=b-h[g];b=Rt(y,b,A)}if(r){let v=f==="y"?"top":"left",g=f==="y"?"bottom":"right",y=u+h[v],A=u-h[g];u=Rt(y,u,A)}let d=c.fn({...t,[m]:b,[f]:u});return{...d,data:{x:d.x-i,y:d.y-o}}}}};var Bi=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){let{placement:i,rects:o,platform:n,elements:s}=t,{apply:r=()=>{},...c}=Se(e,t),a=await pt(t,c),l=G(i),h=Ee(i),f=ie(i)==="y",{width:m,height:b}=o.floating,u,d;l==="top"||l==="bottom"?(u=l,d=h===(await(n.isRTL==null?void 0:n.isRTL(s.floating))?"start":"end")?"left":"right"):(d=l,u=h==="end"?"top":"bottom");let v=b-a.top-a.bottom,g=m-a.left-a.right,y=z(b-a[u],v),A=z(m-a[d],g),S=!t.middlewareData.shift,E=y,H=A;if(f?H=h||S?z(A,g):g:E=h||S?z(y,v):v,S&&!h){let me=P(a.left,0),se=P(a.right,0),J=P(a.top,0),Oe=P(a.bottom,0);f?H=m-2*(me!==0||se!==0?me+se:P(a.left,a.right)):E=b-2*(J!==0||Oe!==0?J+Oe:P(a.top,a.bottom))}await r({...t,availableWidth:H,availableHeight:E});let Ue=await n.getDimensions(s.floating);return m!==Ue.width||b!==Ue.height?{reset:{rects:!0}}:{}}}};function he(e){return Vi(e)?(e.nodeName||"").toLowerCase():"#document"}function M(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function j(e){var t;return(t=(Vi(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function Vi(e){return e instanceof Node||e instanceof M(e).Node}function D(e){return e instanceof Element||e instanceof M(e).Element}function N(e){return e instanceof HTMLElement||e instanceof M(e).HTMLElement}function qi(e){return typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof M(e).ShadowRoot}function _e(e){let{overflow:t,overflowX:i,overflowY:o,display:n}=F(e);return/auto|scroll|overlay|hidden|clip/.test(t+o+i)&&!["inline","contents"].includes(n)}function $i(e){return["table","td","th"].includes(he(e))}function Ne(e){return[":popover-open",":modal"].some(t=>{try{return e.matches(t)}catch{return!1}})}function dt(e){let t=bt(),i=D(e)?F(e):e;return i.transform!=="none"||i.perspective!=="none"||(i.containerType?i.containerType!=="normal":!1)||!t&&(i.backdropFilter?i.backdropFilter!=="none":!1)||!t&&(i.filter?i.filter!=="none":!1)||["transform","perspective","filter"].some(o=>(i.willChange||"").includes(o))||["paint","layout","strict","content"].some(o=>(i.contain||"").includes(o))}function zi(e){let t=Q(e);for(;N(t)&&!pe(t);){if(dt(t))return t;if(Ne(t))return null;t=Q(t)}return null}function bt(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function pe(e){return["html","body","#document"].includes(he(e))}function F(e){return M(e).getComputedStyle(e)}function He(e){return D(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Q(e){if(he(e)==="html")return e;let t=e.assignedSlot||e.parentNode||qi(e)&&e.host||j(e);return qi(t)?t.host:t}function ji(e){let t=Q(e);return pe(t)?e.ownerDocument?e.ownerDocument.body:e.body:N(t)&&_e(t)?t:ji(t)}function ke(e,t,i){var o;t===void 0&&(t=[]),i===void 0&&(i=!0);let n=ji(e),s=n===((o=e.ownerDocument)==null?void 0:o.body),r=M(n);if(s){let c=mt(r);return t.concat(r,r.visualViewport||[],_e(n)?n:[],c&&i?ke(c):[])}return t.concat(n,ke(n,[],i))}function mt(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function Ki(e){let t=F(e),i=parseFloat(t.width)||0,o=parseFloat(t.height)||0,n=N(e),s=n?e.offsetWidth:i,r=n?e.offsetHeight:o,c=Fe(i)!==s||Fe(o)!==r;return c&&(i=s,o=r),{width:i,height:o,$:c}}function Ht(e){return D(e)?e:e.contextElement}function Ce(e){let t=Ht(e);if(!N(t))return X(1);let i=t.getBoundingClientRect(),{width:o,height:n,$:s}=Ki(t),r=(s?Fe(i.width):i.width)/o,c=(s?Fe(i.height):i.height)/n;return(!r||!Number.isFinite(r))&&(r=1),(!c||!Number.isFinite(c))&&(c=1),{x:r,y:c}}var tn=X(0);function Xi(e){let t=M(e);return!bt()||!t.visualViewport?tn:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function on(e,t,i){return t===void 0&&(t=!1),!i||t&&i!==M(e)?!1:t}function de(e,t,i,o){t===void 0&&(t=!1),i===void 0&&(i=!1);let n=e.getBoundingClientRect(),s=Ht(e),r=X(1);t&&(o?D(o)&&(r=Ce(o)):r=Ce(e));let c=on(s,i,o)?Xi(s):X(0),a=(n.left+c.x)/r.x,l=(n.top+c.y)/r.y,h=n.width/r.x,f=n.height/r.y;if(s){let m=M(s),b=o&&D(o)?M(o):o,u=m,d=mt(u);for(;d&&o&&b!==u;){let v=Ce(d),g=d.getBoundingClientRect(),y=F(d),A=g.left+(d.clientLeft+parseFloat(y.paddingLeft))*v.x,S=g.top+(d.clientTop+parseFloat(y.paddingTop))*v.y;a*=v.x,l*=v.y,h*=v.x,f*=v.y,a+=A,l+=S,u=M(d),d=mt(u)}}return fe({width:h,height:f,x:a,y:l})}function nn(e){let{elements:t,rect:i,offsetParent:o,strategy:n}=e,s=n==="fixed",r=j(o),c=t?Ne(t.floating):!1;if(o===r||c&&s)return i;let a={scrollLeft:0,scrollTop:0},l=X(1),h=X(0),f=N(o);if((f||!f&&!s)&&((he(o)!=="body"||_e(r))&&(a=He(o)),N(o))){let m=de(o);l=Ce(o),h.x=m.x+o.clientLeft,h.y=m.y+o.clientTop}return{width:i.width*l.x,height:i.height*l.y,x:i.x*l.x-a.scrollLeft*l.x+h.x,y:i.y*l.y-a.scrollTop*l.y+h.y}}function sn(e){return Array.from(e.getClientRects())}function Gi(e){return de(j(e)).left+He(e).scrollLeft}function rn(e){let t=j(e),i=He(e),o=e.ownerDocument.body,n=P(t.scrollWidth,t.clientWidth,o.scrollWidth,o.clientWidth),s=P(t.scrollHeight,t.clientHeight,o.scrollHeight,o.clientHeight),r=-i.scrollLeft+Gi(e),c=-i.scrollTop;return F(o).direction==="rtl"&&(r+=P(t.clientWidth,o.clientWidth)-n),{width:n,height:s,x:r,y:c}}function an(e,t){let i=M(e),o=j(e),n=i.visualViewport,s=o.clientWidth,r=o.clientHeight,c=0,a=0;if(n){s=n.width,r=n.height;let l=bt();(!l||l&&t==="fixed")&&(c=n.offsetLeft,a=n.offsetTop)}return{width:s,height:r,x:c,y:a}}function ln(e,t){let i=de(e,!0,t==="fixed"),o=i.top+e.clientTop,n=i.left+e.clientLeft,s=N(e)?Ce(e):X(1),r=e.clientWidth*s.x,c=e.clientHeight*s.y,a=n*s.x,l=o*s.y;return{width:r,height:c,x:a,y:l}}function Ui(e,t,i){let o;if(t==="viewport")o=an(e,i);else if(t==="document")o=rn(j(e));else if(D(t))o=ln(t,i);else{let n=Xi(e);o={...t,x:t.x-n.x,y:t.y-n.y}}return fe(o)}function Qi(e,t){let i=Q(e);return i===t||!D(i)||pe(i)?!1:F(i).position==="fixed"||Qi(i,t)}function cn(e,t){let i=t.get(e);if(i)return i;let o=ke(e,[],!1).filter(c=>D(c)&&he(c)!=="body"),n=null,s=F(e).position==="fixed",r=s?Q(e):e;for(;D(r)&&!pe(r);){let c=F(r),a=dt(r);!a&&c.position==="fixed"&&(n=null),(s?!a&&!n:!a&&c.position==="static"&&!!n&&["absolute","fixed"].includes(n.position)||_e(r)&&!a&&Qi(e,r))?o=o.filter(h=>h!==r):n=c,r=Q(r)}return t.set(e,o),o}function un(e){let{element:t,boundary:i,rootBoundary:o,strategy:n}=e,r=[...i==="clippingAncestors"?Ne(t)?[]:cn(t,this._c):[].concat(i),o],c=r[0],a=r.reduce((l,h)=>{let f=Ui(t,h,n);return l.top=P(f.top,l.top),l.right=z(f.right,l.right),l.bottom=z(f.bottom,l.bottom),l.left=P(f.left,l.left),l},Ui(t,c,n));return{width:a.right-a.left,height:a.bottom-a.top,x:a.left,y:a.top}}function fn(e){let{width:t,height:i}=Ki(e);return{width:t,height:i}}function hn(e,t,i){let o=N(t),n=j(t),s=i==="fixed",r=de(e,!0,s,t),c={scrollLeft:0,scrollTop:0},a=X(0);if(o||!o&&!s)if((he(t)!=="body"||_e(n))&&(c=He(t)),o){let f=de(t,!0,s,t);a.x=f.x+t.clientLeft,a.y=f.y+t.clientTop}else n&&(a.x=Gi(n));let l=r.left+c.scrollLeft-a.x,h=r.top+c.scrollTop-a.y;return{x:l,y:h,width:r.width,height:r.height}}function Nt(e){return F(e).position==="static"}function Yi(e,t){return!N(e)||F(e).position==="fixed"?null:t?t(e):e.offsetParent}function Ji(e,t){let i=M(e);if(Ne(e))return i;if(!N(e)){let n=Q(e);for(;n&&!pe(n);){if(D(n)&&!Nt(n))return n;n=Q(n)}return i}let o=Yi(e,t);for(;o&&$i(o)&&Nt(o);)o=Yi(o,t);return o&&pe(o)&&Nt(o)&&!dt(o)?i:o||zi(e)||i}var pn=async function(e){let t=this.getOffsetParent||Ji,i=this.getDimensions,o=await i(e.floating);return{reference:hn(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:o.width,height:o.height}}};function dn(e){return F(e).direction==="rtl"}var bn={convertOffsetParentRelativeRectToViewportRelativeRect:nn,getDocumentElement:j,getClippingRect:un,getOffsetParent:Ji,getElementRects:pn,getClientRects:sn,getDimensions:fn,getScale:Ce,isElement:D,isRTL:dn};function mn(e,t){let i=null,o,n=j(e);function s(){var c;clearTimeout(o),(c=i)==null||c.disconnect(),i=null}function r(c,a){c===void 0&&(c=!1),a===void 0&&(a=1),s();let{left:l,top:h,width:f,height:m}=e.getBoundingClientRect();if(c||t(),!f||!m)return;let b=Ie(h),u=Ie(n.clientWidth-(l+f)),d=Ie(n.clientHeight-(h+m)),v=Ie(l),y={rootMargin:-b+"px "+-u+"px "+-d+"px "+-v+"px",threshold:P(0,z(1,a))||1},A=!0;function S(E){let H=E[0].intersectionRatio;if(H!==a){if(!A)return r();H?r(!1,H):o=setTimeout(()=>{r(!1,1e-7)},1e3)}A=!1}try{i=new IntersectionObserver(S,{...y,root:n.ownerDocument})}catch{i=new IntersectionObserver(S,y)}i.observe(e)}return r(!0),s}function Zi(e,t,i,o){o===void 0&&(o={});let{ancestorScroll:n=!0,ancestorResize:s=!0,elementResize:r=typeof ResizeObserver=="function",layoutShift:c=typeof IntersectionObserver=="function",animationFrame:a=!1}=o,l=Ht(e),h=n||s?[...l?ke(l):[],...ke(t)]:[];h.forEach(g=>{n&&g.addEventListener("scroll",i,{passive:!0}),s&&g.addEventListener("resize",i)});let f=l&&c?mn(l,i):null,m=-1,b=null;r&&(b=new ResizeObserver(g=>{let[y]=g;y&&y.target===l&&b&&(b.unobserve(t),cancelAnimationFrame(m),m=requestAnimationFrame(()=>{var A;(A=b)==null||A.observe(t)})),i()}),l&&!a&&b.observe(l),b.observe(t));let u,d=a?de(e):null;a&&v();function v(){let g=de(e);d&&(g.x!==d.x||g.y!==d.y||g.width!==d.width||g.height!==d.height)&&i(),d=g,u=requestAnimationFrame(v)}return i(),()=>{var g;h.forEach(y=>{n&&y.removeEventListener("scroll",i),s&&y.removeEventListener("resize",i)}),f?.(),(g=b)==null||g.disconnect(),b=null,a&&cancelAnimationFrame(u)}}var eo=Hi;var to=Wi,io=Ni,oo=Bi;var no=(e,t,i)=>{let o=new Map,n={platform:bn,...i},s={...n.platform,_c:o};return Ii(e,t,{...n,platform:s})};var I=class extends C{boot({options:t}){if(t({reference:null,auto:!0,position:"bottom start",gap:"5",offset:"0",matchWidth:!1}),this.options().reference===null||this.options().position===null)return;let[i,o]=wn(this.el),n=gn(this.el,this.options().reference,i,{position:this.options().position,gap:this.options().gap,offset:this.options().offset,matchWidth:this.options().matchWidth}),s=()=>{};this.reposition=(...r)=>{this.options().auto?s=Zi(this.options().reference,this.el,n):n(...r)},this.cleanup=()=>{s(),o()}}};function gn(e,t,i,{position:o,offset:n,gap:s,matchWidth:r}){return(c=null,a=null)=>{no(t,e,{placement:vn(o),middleware:[io(),to({padding:5,crossAxis:!0}),eo({mainAxis:Number(s),alignmentAxis:Number(n)}),r?oo({apply({rects:l,elements:h}){Object.assign(h.floating.style,{width:`${l.reference.width}px`})}}):void 0]}).then(({x:l,y:h})=>{i(c||l,a||h)})}}function vn(e){return e.split(" ").join("-")}function wn(e){let t=(s,r)=>{Object.assign(e.style,{position:"absolute",inset:`${r}px auto auto ${s}px`})},i,o,n=new MutationObserver(()=>t(i,o));return[(s,r)=>{i=s,o=r,n.disconnect(),t(i,o),n.observe(e,{attributeFilter:["style"]})},()=>{n.disconnect()}]}var Wt=class extends k{boot(){let t=this.trigger(),i=this.overlay();if(t){if(!i)return console.warn("ui-dropdown: no [popover] overlay found",this)}else return console.warn("ui-dropdown: no trigger element found",this);if(this._disabled=this.hasAttribute("disabled"),this._controllable=new $(this),i._popoverable=new R(i),i._anchorable=new I(i,{reference:t,position:this.hasAttribute("position")?this.getAttribute("position"):void 0,gap:this.hasAttribute("gap")?this.getAttribute("gap"):void 0,offset:this.hasAttribute("offset")?this.getAttribute("offset"):void 0}),i._popoverable.onChange(()=>{i._popoverable.getState()?i._anchorable.reposition():i._anchorable.cleanup()}),["ui-menu","ui-context"].includes(i.localName)){let{lock:s,unlock:r}=ut();i._popoverable.onChange(()=>{i._popoverable.getState()?s():r()})}this._controllable.initial(s=>i._popoverable.setState(s)),this._controllable.getter(()=>i._popoverable.getState());let o=te();this._controllable.setter(s=>i._popoverable.setState(s)),i._popoverable.onChange(o(()=>this._controllable.dispatch())),this.hasAttribute("hover")&&xe(t,i,{gain(){i._popoverable.setState(!0)},lose(){i._popoverable.setState(!1)},focusable:!0}),w(t,"click",()=>i._popoverable.toggle()),i._popoverable.getState()?(p(this,"data-open",""),p(t,"data-open",""),p(i,"data-open","")):(x(this,"data-open"),x(t,"data-open"),x(i,"data-open")),i._popoverable.onChange(()=>{i._popoverable.getState()?(p(this,"data-open",""),p(t,"data-open",""),p(i,"data-open","")):(x(this,"data-open"),x(t,"data-open"),x(i,"data-open"))});let n=q(i,"dropdown");p(t,"aria-haspopup","true"),p(t,"aria-controls",n),p(t,"aria-expanded",i._popoverable.getState()?"true":"false"),i._popoverable.onChange(()=>{p(t,"aria-expanded",i._popoverable.getState()?"true":"false")}),i._popoverable.onChange(()=>{i._popoverable.getState()?i.onPopoverShow?.():i.onPopoverHide?.()})}trigger(){return this.querySelector("button")}overlay(){return this.lastElementChild?.matches("[popover]")&&this.lastElementChild}};T("dropdown",Wt);var Bt=class extends k{boot(){let t=this.hasAttribute("label")?"label":"description",i=this.button(),o=this.overlay();if(i){if(!o)return}else return console.warn("ui-tooltip: no trigger element found",this);this._disabled=this.hasAttribute("disabled"),o._popoverable=new R(o,{scope:"tooltip"}),o._anchorable=new I(o,{reference:i,position:this.hasAttribute("position")?this.getAttribute("position"):void 0,gap:this.hasAttribute("gap")?this.getAttribute("gap"):void 0,offset:this.hasAttribute("offset")?this.getAttribute("offset"):void 0}),o._popoverable.onChange(()=>o._anchorable.reposition()),this._disabled||xe(i,o,{gain(){o._popoverable.setState(!0)},lose(){o._popoverable.setState(!1)},focusable:!0,useSafeArea:!1});let n=q(o,"tooltip"),s=this.hasAttribute("interactive"),r=this.hasAttribute("label")||i.textContent.trim()==="";s?(p(i,"aria-controls",n),p(i,"aria-expanded","false"),o._popoverable.onChange(()=>{o._popoverable.getState()?p(i,"aria-expanded","true"):p(i,"aria-expanded","false")})):(r?p(i,"aria-labelledby",n):p(i,"aria-describedby",n),p(o,"aria-hidden","true")),p(o,"role","tooltip")}button(){return this.firstElementChild}overlay(){return this.lastElementChild!==this.button()&&this.lastElementChild}};T("tooltip",Bt);var oe=class extends V{groupOfType=_;boot({options:t}){t({multiple:!1}),this.state=this.options().multiple?new Set:null,this.onChanges=[]}onInitAndChange(t){t(),this.onChanges.push(t)}onChange(t){this.onChanges.push(t)}changed(t,i=!1){if(t.ungrouped)return;let o=t.value,n=t.isSelected(),s=this.options().multiple;n?s?this.state.add(o):this.state=o:s?this.state.delete(o):this.state=null,i||this.onChanges.forEach(r=>r())}getState(){return this.options().multiple?Array.from(this.state):this.state}hasValue(t){return this.options().multiple?this.state.has(t):this.state===t}setState(t){t===null&&(t=this.multiple?[]:""),this.options().multiple?(Array.isArray(t)||(t=[t]),t=t.map(o=>o+"")):t=t+"",this.state=this.options().multiple?new Set(t):t;let i=this.options().multiple?t:[t];this.walker().each(o=>{let n=o.use(_);if(n.ungrouped)return;let s=i.includes(n.value);s&&!n.isSelected()?n.surgicallySelect():!s&&n.isSelected()&&n.surgicallyDeselect()}),this.onChanges.forEach(o=>o())}selected(){return this.walker().find(t=>t.use(_).isSelected()).use(_)}selecteds(){return this.walker().filter(t=>t.use(_).isSelected()).map(t=>t.use(_))}selectFirst(){this.walker().first()?.use(_).select()}selectAll(){this.walker().filter(t=>!t.use(_).isSelected()).map(t=>t.use(_).select())}deselectAll(){this.walker().filter(t=>t.use(_).isSelected()).map(t=>t.use(_).deselect())}allAreSelected(){return this.walker().filter(t=>t.use(_).isSelected()).length===this.walker().filter(t=>!0).length}noneAreSelected(){return this.state===null||this.state?.size===0}selectableByValue(t){return this.walker().find(i=>i.use(_).value===t)?.use(_)}deselectOthers(t){this.walker().each(i=>{i!==t&&i.use(_).surgicallyDeselect()})}selectedTextValue(){return this.options().multiple?Array.from(this.state).map(t=>this.convertValueStringToElementText(t)).join(", "):this.convertValueStringToElementText(this.state)}convertValueStringToElementText(t){let i=this.findByValue(t);return i?i.label||i.value:t}findByValue(t){return this.selecteds().find(i=>i.value===t)}walker(){return B(this.el,(t,{skip:i,reject:o})=>{if(t[this.constructor.name]&&t!==this.el)return o();if(!t[this.groupOfType.name]||t.mixins.get(this.groupOfType.name).ungrouped)return i()})}},_=class extends C{boot({options:t}){this.groupedByType=oe,t({ungrouped:!1,togglable:!1,value:void 0,label:void 0,selectedInitially:!1,dataAttr:"data-selected",ariaAttr:"aria-selected"}),this.ungrouped=this.options().ungrouped,this.value=this.options().value===void 0?this.el.value:this.options().value,this.value=this.value+"",this.label=this.options().label;let i=this.options().selectedInitially;this.group()&&this.group().hasValue(this.value)&&(i=!0),this.multiple=this.hasGroup()?this.group().options().multiple:!1,this.toggleable=this.options().toggleable||this.multiple,this.onSelects=[],this.onUnselects=[],this.onChanges=[],i?this.select(!0):(this.state=i,this.surgicallyDeselect(!0))}mount(){this.el.hasAttribute(this.options().ariaAttr)||p(this.el,this.options().ariaAttr,"false")}onChange(t){this.onChanges.push(t)}onSelect(t){this.onSelects.push(t)}onUnselect(t){this.onUnselects.push(t)}setState(t){t?this.select():this.deselect()}getState(){return this.state}press(){this.toggleable?this.toggle():this.select()}trigger(){this.toggleable?this.toggle():this.select()}toggle(){this.isSelected()?this.deselect():this.select()}isSelected(){return this.state}select(t=!1){let i=!this.isSelected();this.toggleable||this.group()?.deselectOthers(this.el),this.state=!0,p(this.el,this.options().ariaAttr,"true"),p(this.el,this.options().dataAttr,""),i&&(t||(this.onSelects.forEach(o=>o()),this.onChanges.forEach(o=>o())),this.group()?.changed(this,t))}surgicallySelect(){let t=!this.isSelected();this.state=!0,p(this.el,this.options().ariaAttr,"true"),p(this.el,this.options().dataAttr,""),t&&(this.onSelects.forEach(i=>i()),this.onChanges.forEach(i=>i()))}deselect(t=!0){let i=this.isSelected();this.state=!1,p(this.el,this.options().ariaAttr,"false"),x(this.el,this.options().dataAttr),i&&(this.onUnselects.forEach(o=>o()),this.onChanges.forEach(o=>o()),t&&this.group()?.changed(this))}surgicallyDeselect(t=!1){let i=this.isSelected();this.state=!1,p(this.el,this.options().ariaAttr,"false"),x(this.el,this.options().dataAttr),i&&!t&&(this.onUnselects.forEach(o=>o()),this.onChanges.forEach(o=>o()))}getValue(){return this.value}getLabel(){return this.label}};var We=class extends V{groupOfType=L;boot({options:t}){t({wrap:!1,ensureTabbable:!0})}mount(){this.options().ensureTabbable&&this.ensureTabbable()}focusFirst(){let t;t=t||this.walker().find(i=>i.hasAttribute("autofocus")),t=t||this.walker().find(i=>i.getAttribute("tabindex")==="0"),t=t||this.walker().find(i=>i.getAttribute("tabindex")==="-1"),t=t||this.walker().find(i=>Ti(i)),t?.focus()}focusPrev(){this.moveFocus(t=>this.options().wrap?this.walker().prevOrLast(t):this.walker().prev(t))}focusNext(){this.moveFocus(t=>this.options().wrap?this.walker().nextOrFirst(t):this.walker().next(t))}focusBySearch(t){let i=this.walker().find(o=>o.textContent.toLowerCase().trim().startsWith(t.toLowerCase()));i?.use(L).tabbable(),i?.use(L).focus()}moveFocus(t){let i=this.walker().find(n=>n.use(L).isTabbable());t(i)?.use(L).focus()}ensureTabbable(){this.walker().findOrFirst(t=>{t.use(L).isTabbable()})?.use(L).tabbable()}wipeTabbables(){this.walker().each(t=>{t.use(L).untabbable()})}untabbleOthers(t){this.walker().each(i=>{i!==t&&i.use(L).untabbable()})}walker(){return B(this.el,(t,{skip:i,reject:o})=>{if(t[this.constructor.name]&&t!==this.el)return o();if(!t[this.groupOfType.name])return i();if(t.hasAttribute("disabled"))return o()})}},L=class extends C{groupedByType=We;boot({options:t}){t({hover:!1,disableable:null,tabbable:!1,tabbableAttr:null})}mount(){let t=this.options().disableable;if(!t)throw"Focusable requires a Disableable instance...";this.el.hasAttribute("tabindex")||(this.options().tabbable?this.tabbable():this.untabbable()),this.pauseFocusListener=this.on("focus",t.enabled(()=>{this.focus(!1)})).pause,this.on("focus",t.enabled(()=>{Mt()&&p(this.el,"data-focus","")})),this.on("blur",t.enabled(()=>{x(this.el,"data-focus")})),this.options().hover&&this.on("pointerenter",t.enabled(()=>{this.group()?.untabbleOthers(this.el),this.tabbable()})),this.options().hover&&this.on("pointerleave",t.enabled(i=>{this.untabbable()}))}focus(t=!0){this.group()?.untabbleOthers(this.el),this.tabbable(),t&&this.pauseFocusListener(()=>{this.el.focus({focusVisible:!1})})}tabbable(){p(this.el,"tabindex","0"),this.options().tabbableAttr&&p(this.el,this.options().tabbableAttr,"")}untabbable(){p(this.el,"tabindex","-1"),this.options().tabbableAttr&&x(this.el,this.options().tabbableAttr)}isTabbable(){return this.el.getAttribute("tabindex")==="0"}};var ne=class extends C{boot({options:t}){this.onChanges=[],Object.defineProperty(this.el,"disabled",{get:()=>this.el.hasAttribute("disabled"),set:o=>{o?this.el.setAttribute("disabled",""):this.el.removeAttribute("disabled")}}),this.el.hasAttribute("disabled")?this.el.disabled=!0:this.el.closest("[disabled]")&&(this.el.disabled=!0),new MutationObserver(o=>{this.onChanges.forEach(n=>n(this.el.disabled))}).observe(this.el,{attributeFilter:["disabled"]})}onChange(t){this.onChanges.push(t)}onInitAndChange(t){t(this.el.disabled),this.onChanges.push(t)}enabled(t){return(...i)=>{if(!this.el.disabled)return t(...i)}}disabled(t){return(...i)=>{if(this.el.disabled)return t(...i)}}};var Be=class extends V{groupOfType=O;boot({options:t}){t({wrap:!1,filter:!1}),this.onChanges=[]}onChange(t){this.onChanges.push(t)}activated(t){this.onChanges.forEach(i=>i())}activateFirst(){this.filterAwareWalker().first()?.use(O).activate()}activateBySearch(t){this.filterAwareWalker().find(o=>o.textContent.toLowerCase().trim().startsWith(t.toLowerCase()))?.use(O).activate()}activateSelectedOrFirst(t){if(!t||(o=>o.matches("ui-option")?getComputedStyle(o).display==="none":!1)(t)){this.filterAwareWalker().first()?.use(O).activate();return}t?.use(O).activate()}activateActiveOrFirst(){let t=this.getActive();if(!t){this.filterAwareWalker().first()?.use(O).activate();return}t?.use(O).activate()}activateActiveOrLast(){let t=this.getActive();if(!t){this.filterAwareWalker().last()?.use(O).activate();return}t?.use(O).activate()}activatePrev(){let t=this.getActive();if(!t){this.filterAwareWalker().last()?.use(O).activate();return}let i;this.options.wrap?i=this.filterAwareWalker().prevOrLast(t):i=this.filterAwareWalker().prev(t),i?.use(O).activate()}activateNext(){let t=this.getActive();if(!t){this.filterAwareWalker().first()?.use(O).activate();return}let i;this.options.wrap?i=this.filterAwareWalker().nextOrFirst(t):i=this.filterAwareWalker().next(t),i?.use(O).activate()}getActive(){return this.walker().find(t=>t.use(O).isActive())}clearActive(){this.getActive()?.use(O).deactivate()}filterAwareWalker(){let t=i=>i.matches("ui-option")?getComputedStyle(i).display==="none":!1;return B(this.el,(i,{skip:o,reject:n})=>{if(i[this.constructor.name]&&i!==this.el)return n();if(!i[this.groupOfType.name])return o();if(i.hasAttribute("disabled")||t(i))return n()})}},O=class e extends C{groupedByType=Be;mount(){this.el.addEventListener("mouseenter",()=>{this.activate()}),this.el.addEventListener("mouseleave",()=>{this.deactivate()})}activate(){this.group()&&this.group().walker().each(t=>t.use(e).deactivate(!1)),p(this.el,"data-active",""),this.el.scrollIntoView({block:"nearest"}),this.group()&&this.group().activated(this.el)}deactivate(t=!0){x(this.el,"data-active"),t&&this.group()&&this.group().activated(this.el)}isActive(){return this.el.hasAttribute("data-active")}};var qe=class extends V{groupOfType=be;boot({options:t}){t({}),this.onChanges=[],this.lastSearch=""}onChange(t){this.onChanges.push(t)}filter(t){t===""?this.walker().each(i=>{i.use(be).unfilter()}):this.walker().each(i=>{this.matches(i,t)?i.use(be).unfilter():i.use(be).filter()}),this.lastSearch!==t&&this.onChanges.forEach(i=>i()),this.lastSearch=t}matches(t,i){return t.textContent.toLowerCase().trim().includes(i.toLowerCase().trim())}hasResults(){return this.walker().some(t=>!t.use(be).isFiltered())}},be=class extends C{groupedByType=qe;boot({options:t}){t({mirror:null,keep:!1}),this.onChanges=[]}filter(){this.options().keep||(p(this.el,"data-hidden",""),this.options().mirror&&p(this.options().mirror,"data-hidden",""))}unfilter(){x(this.el,"data-hidden"),this.options().mirror&&x(this.options().mirror,"data-hidden","")}isFiltered(){return this.el.hasAttribute("data-hidden")}};var gt=class extends k{boot(){if(this.querySelectorAll("[data-appended]").forEach(t=>t.remove()),!this.querySelector("template")){let t=document.createElement("template");t.setAttribute("name","placeholder"),t.innerHTML=""+this.innerHTML+"",this.innerHTML="",this.appendChild(t)}if(!this.querySelector('template[name="options"]')){let t=document.createElement("template");t.setAttribute("name","options"),t.innerHTML="
",this.appendChild(t)}if(!this.querySelector('template[name="option"]')){let t=document.createElement("template");t.setAttribute("name","option"),t.innerHTML="
",this.appendChild(t)}this.templates={placeholder:this.querySelector('template[name="placeholder"]'),overflow:this.querySelector('template[name="overflow"]'),options:this.querySelector('template[name="options"]'),option:this.querySelector('template[name="option"]')},this.templates.options.elsByValue=new Map,this.max=this.templates.overflow?.getAttribute("max")?this.templates.overflow.getAttribute("max"):1/0,this.selecteds=new Map,this.picker=this.closest("ui-select"),this.multiple=this.picker.hasAttribute("multiple")}mount(){queueMicrotask(()=>{this.picker._selectable.onInitAndChange(()=>{this.render(!0)});let t=this.picker.list();t&&new MutationObserver(i=>{queueMicrotask(()=>this.render())}).observe(t,{childList:!0})})}render(t){if(this.multiple){let i=this.picker.value,o=Array.from(this.selecteds.keys()).filter(r=>!i.includes(r)),n=i.filter(r=>!this.selecteds.has(r));o.forEach(r=>this.selecteds.delete(r));let s=new Map;for(let r of n){let c=this.picker._selectable.findByValue(r);if(!c){if(t)return setTimeout(()=>this.render());throw`Could not find option for value "${r}"`}s.set(r,c)}s.forEach((r,c)=>this.selecteds.set(c,r)),this.templates.placeholder?.clearPlaceholder?.(),this.templates.overflow?.clearOverflow?.(),this.templates.options?.clearOptions?.(),this.selecteds.size>0?this.renderOptions({hasOverflowed:r=>{if(this.max==="auto"){let c=!1;if(this.renderOverflow(this.selecteds.size,this.selecteds.size-r),this.clientWidthparseInt(this.max)},renderOverflow:r=>{this.templates?.overflow?.getAttribute("mode")!=="append"&&this.templates.options?.clearOptions?.(),this.renderOverflow(this.selecteds.size,r)}}):this.renderPlaceholder()}else{let i=this.picker.value;if(Array.from(this.selecteds.keys()).includes(i))return;this.selecteds.clear();let o=this.picker._selectable.findByValue(i);if(o)this.selecteds.set(i,o);else if(!["",null,void 0].includes(i)){if(t)return setTimeout(()=>{console.log("retrying..."),this.render()});throw`Could not find option for value "${i}"`}this.templates.placeholder?.clearPlaceholder?.(),this.templates.option?.clearOption?.(),this.selecteds.size>0?this.renderOption():this.renderPlaceholder()}}renderOptions({hasOverflowed:t,renderOverflow:i}){let o=document.createElement("div");o.style.display="contents";let n=Ve(this.templates.options,{default:o});this.templates.options.after(n),this.templates.options.clearOptions=()=>{n.remove(),this.templates.options.clearOptions=()=>{}};let s=0,r=!1;for(let[a,l]of this.selecteds){let h=new DocumentFragment;h.append(...l.el.cloneNode(!0).childNodes);let f=Ve(this.templates.option,{text:l.el.textContent.trim(),default:h,value:a});if(f.setAttribute("data-value",a),f.setAttribute("data-appended",""),f.deselect=()=>l.deselect(),o.appendChild(f),s++,t(s)){r=!0,o.removeChild(f),s--;break}}let c=new DocumentFragment;c.append(...o.childNodes),o.replaceWith(c),r&&i(this.selecteds.size-s)}renderOption(){for(let[t,i]of this.selecteds){let o=new DocumentFragment;o.append(...i.el.cloneNode(!0).childNodes);let n=Ve(this.templates.option,{text:i.el.textContent.trim(),default:o,value:t});n.setAttribute("data-value",t),n.setAttribute("data-appended",t),n.deselect=()=>i.deselect(),this.templates.option.after(n),this.templates.option.clearOption=()=>{n.remove(),this.templates.option.clearOption=()=>{}}}}renderPlaceholder(){if(!this.templates.placeholder)return;let t=Ve(this.templates.placeholder);this.templates.placeholder.after(t),this.templates.placeholder.clearPlaceholder=()=>{t.remove(),this.templates.placeholder.clearPlaceholder=()=>{}}}renderOverflow(t,i){if(!this.templates.overflow)return;let o=Ve(this.templates.overflow,{remainder:i,count:this.selecteds.size});o.setAttribute("data-appended",""),this.templates.overflow.after(o),this.templates.overflow.clearOverflow=()=>{o.remove(),this.templates.placeholder.clearOverflow=()=>{}}}};function Ve(e,t={}){let i=e.content.cloneNode(!0);return Object.entries(t).forEach(([o,n])=>{(o==="default"?i.querySelectorAll("slot:not([name])"):i.querySelectorAll(`slot[name="${o}"]`)).forEach(r=>r.replaceWith(typeof n=="string"?document.createTextNode(n):n))}),i.firstElementChild}var je=class extends ft{boot(){let t=this.list();this._controllable=new $(this),this._selectable=new oe(t,{multiple:this.hasAttribute("multiple")}),this._controllable.initial(o=>o&&this._selectable.setState(o)),this._controllable.getter(()=>this._selectable.getState());let i=te();this._controllable.setter(i(o=>{this._selectable.setState(o)})),this._selectable.onChange(i(()=>{this._controllable.dispatch(),this.dispatchEvent(new CustomEvent("select",{bubbles:!1}))}))}mount(){this._disableable=new ne(this);let t=this.input(),i=this.button(),o=this.list(),n=this.hasAttribute("multiple"),s=this.hasAttribute("autocomplete"),r=this.hasAttribute("autocomplete")&&this.getAttribute("autocomplete").trim().split(" ").includes("strict"),c=this.querySelector("ui-options")||this,a=yn(c,"options");this._activatable=new Be(c,{filter:"data-hidden"}),!t&&!i&&this._disableable.onInitAndChange(u=>{u?this.removeAttribute("tabindex"):this.setAttribute("tabindex","0")}),this.hasAttribute("filter")&&this.getAttribute("filter")!=="manual"&&(this._filterable=new qe(o),this._filterable.onChange(()=>{this._activatable.clearActive(),this._filterable.hasResults()&&this._activatable.activateFirst()}),this.addEventListener("close",()=>{this._filterable&&this._filterable.filter("")}));let l=this.querySelector("[popover]:not(ui-tooltip > [popover])"),h=l?.querySelector("input"),f=this.querySelector("input");f=l?.contains(f)?null:f;let m=this.querySelector("button");if(m=l?.contains(m)?null:m,!(l||f))$e(this,this._activatable),ze(this,this,this._activatable),ro(this,this._activatable,this._selectable);else if(!l&&f){let u=f;this._disableable.onInitAndChange(d=>{d?u&&p(u,"disabled",""):u&&x(u,"disabled")}),Yt(this,u,this._selectable,this._popoverable),ro(u,this._activatable,this._selectable),co(s,r,this,u,this._selectable,this._popoverable),Ut(u),jt(u),this._filterable&&zt(u,this._filterable),lo(u,this._activatable),$e(u,this._activatable),ze(this,u,this._activatable),vt(this,this._activatable)}else if(l&&f){let u=f;p(u,"role","combobox"),p(u,"aria-controls",a);let d=l;this._popoverable=new R(d),this._anchorable=new I(d,{reference:u,matchWidth:!0,position:this.hasAttribute("position")?this.getAttribute("position"):void 0,gap:this.hasAttribute("gap")?this.getAttribute("gap"):void 0,offset:this.hasAttribute("offset")?this.getAttribute("offset"):void 0}),co(s,r,this,u,this._selectable,this._popoverable),this._disableable.onInitAndChange(v=>{v?u&&p(u,"disabled",""):u&&x(u,"disabled")}),this.querySelectorAll("button").forEach(v=>{d.contains(v)||(p(v,"tabindex","-1"),p(v,"aria-controls",a),p(v,"aria-haspopup","listbox"),wt(v,this._popoverable),w(v,"click",()=>{this._popoverable.toggle(),u.focus()}))}),Yt(this,u,this._selectable,this._popoverable),qt(this,u,d,this._popoverable,this._anchorable),Xt(this,this._popoverable),wt(u,this._popoverable),Ut(u),jt(u),this._filterable&&zt(u,this._filterable),lo(u,this._activatable),Sn(u,this._popoverable),$t(u,this._popoverable,this._activatable,this._selectable),An(u,this._popoverable),$e(u,this._activatable),ze(this,u,this._activatable),vt(this,this._activatable),Vt(this._popoverable,this._activatable,this._selectable),Kt(this,this._selectable,this._popoverable,n)}else if(l&&h){let u=m,d=h,v=l;p(u,"role","combobox"),p(d,"role","combobox"),p(u,"aria-controls",a),this._disableable.onInitAndChange(g=>{g?(u&&p(u,"disabled",""),d&&p(d,"disabled","")):(u&&x(u,"disabled"),d&&x(d,"disabled"))}),this._popoverable=new R(v),this._anchorable=new I(v,{reference:u,matchWidth:!0,position:this.hasAttribute("position")?this.getAttribute("position"):void 0,gap:this.hasAttribute("gap")?this.getAttribute("gap"):void 0,offset:this.hasAttribute("offset")?this.getAttribute("offset"):void 0}),Ut(d),jt(d),this._filterable&&zt(d,this._filterable),xn(d,this._popoverable),qt(this,u,v,this._popoverable,this._anchorable),Xt(this,this._popoverable),wt(u,this._popoverable),Yt(this,d,this._selectable,this._popoverable),$t(u,this._popoverable,this._activatable,this._selectable),ao(u,this._popoverable),$e(d,this._activatable),so(u,this._activatable,this._popoverable),ze(this,d,this._activatable),vt(this,this._activatable),Vt(this._popoverable,this._activatable,this._selectable),Kt(this,this._selectable,this._popoverable,n)}else if(l){let u=m,d=l;p(u,"role","combobox"),p(u,"aria-controls",a),this._disableable.onInitAndChange(v=>{v?(u&&p(u,"disabled",""),t&&p(t,"disabled","")):(u&&x(u,"disabled"),t&&x(t,"disabled"))}),this._popoverable=new R(d),this._anchorable=new I(d,{reference:u,matchWidth:!0,position:this.hasAttribute("position")?this.getAttribute("position"):void 0,gap:this.hasAttribute("gap")?this.getAttribute("gap"):void 0,offset:this.hasAttribute("offset")?this.getAttribute("offset"):void 0}),qt(this,u,d,this._popoverable,this._anchorable),Xt(this,this._popoverable),wt(u,this._popoverable),$t(u,this._popoverable,this._activatable,this._selectable),ao(u,this._popoverable),$e(u,this._activatable),so(u,this._activatable,this._popoverable),ze(this,u,this._activatable),vt(this,this._activatable),Vt(this._popoverable,this._activatable,this._selectable),Kt(this,this._selectable,this._popoverable,n)}new MutationObserver(()=>{setTimeout(()=>{if(!this._popoverable||this._popoverable.getState()){let u=this._selectable.selecteds()[0]?.el;queueMicrotask(()=>{this._activatable.activateSelectedOrFirst(u)})}else this._activatable.clearActive()})}).observe(o,{childList:!0})}button(){return this.querySelector("button:has(+ [popover])")}input(){return this.querySelector("input")}list(){return this.querySelector("ui-options")||this}clear(){this.input()&&(this.input().value="",this.input().dispatchEvent(new Event("input",{bubbles:!1})))}open(){this._popoverable.setState(!0)}close(){this._popoverable.setState(!1)}deselectLast(){!this.hasAttribute("multiple")&&this.value!==null&&(this.value=null,this.dispatchEvent(new Event("input",{bubbles:!1})),this.dispatchEvent(new Event("change",{bubbles:!1}))),this.hasAttribute("multiple")&&this.value.length!==0&&(this.value=this.value.slice(0,-1),this.dispatchEvent(new Event("input",{bubbles:!1})),this.dispatchEvent(new Event("change",{bubbles:!1})))}},Gt=class extends k{boot(){p(this,"data-hidden","")}mount(){queueMicrotask(()=>{let t=this.closest("ui-autocomplete, ui-combobox, ui-select"),i=this.closest("ui-options");if(!i)return;let o=c=>getComputedStyle(c).display==="none",n=()=>{let c;CSS.supports("selector(&)")?c=Array.from(i.querySelectorAll("& > ui-option")).filter(a=>!o(a)).length===0:c=Array.from(i.querySelectorAll(":scope > ui-option")).filter(a=>!o(a)).length===0,c?x(this,"data-hidden"):p(this,"data-hidden","")};n();let s=t._filterable;s&&s.onChange(n),new MutationObserver(c=>{setTimeout(()=>n())}).observe(i,{childList:!0})})}};T("selected",gt);T("select",je);T("empty",Gt);W(({css:e})=>e`ui-select { display: block; }`);W(({css:e})=>e`ui-selected-option { display: contents; }`);W(({css:e})=>e`ui-empty { display: block; cursor: default; }`);function $e(e,t){w(e,"keydown",i=>{["ArrowDown","ArrowUp","Escape"].includes(i.key)&&(i.key==="ArrowDown"?(t.activateNext(),i.preventDefault(),i.stopPropagation()):i.key==="ArrowUp"&&(t.activatePrev(),i.preventDefault(),i.stopPropagation()))})}function so(e,t,i){ct(e,o=>{t.activateBySearch(o),i.getState()||t.getActive()?.click()})}function ze(e,t,i){w(t,"keydown",o=>{if(o.key==="Enter"){let n=i.getActive();if(o.preventDefault(),o.stopPropagation(),!n)return;n.click(),e.dispatchEvent(new CustomEvent("action",{bubbles:!1,cancelable:!1}))}})}function vt(e,t,i=!1){w(e,i?"pointerdown":"click",o=>{if(o.target.closest("ui-option")){let n=o.target.closest("ui-option");if(n._disabled)return;n._selectable?.trigger(),e.dispatchEvent(new CustomEvent("action",{bubbles:!1,cancelable:!1})),o.preventDefault(),o.stopPropagation()}})}function ro(e,t,i){w(e,"focus",()=>{let o=i.selecteds()[0]?.el;t.activateSelectedOrFirst(o)}),w(e,"blur",()=>{t.clearActive()})}function yn(e){let t=q(e,"options");return p(e,"role","listbox"),t}function wt(e,t){p(e,"aria-haspopup","listbox");let i=()=>{p(e,"aria-expanded",t.getState()?"true":"false"),t.getState()?p(e,"data-open",""):x(e,"data-open","")};t.onChange(()=>{i()}),i()}function qt(e,t,i,o,n){let s=()=>{Array.from([e,i]).forEach(r=>{o.getState()?p(r,"data-open",""):x(r,"data-open","")}),o.getState()&&n.reposition()};o.onChange(()=>s()),s(),o.onChange(()=>{o.getState()?e.dispatchEvent(new Event("open",{bubbles:!1,cancelable:!1})):e.dispatchEvent(new Event("close",{bubbles:!1,cancelable:!1}))})}function Vt(e,t,i){e.onChange(()=>{if(e.getState()){let o=i.selecteds()[0]?.el;queueMicrotask(()=>{t.activateSelectedOrFirst(o)})}else t.clearActive()})}function $t(e,t){w(e,"keydown",i=>{["ArrowDown","ArrowUp","Escape"].includes(i.key)&&(i.key==="ArrowDown"||i.key==="ArrowUp"?t.getState()||(t.setState(!0),i.preventDefault(),i.stopImmediatePropagation()):i.key==="Escape"&&t.getState()&&t.setState(!1))})}function An(e,t){w(e,"click",()=>{t.getState()||(t.setState(!0),e.focus())})}function ao(e,t){w(e,"click",()=>{t.setState(!t.getState()),e.focus()})}function xn(e,t){t.onChange(()=>{t.getState()&&setTimeout(()=>e.focus())})}function zt(e,t){t&&w(e,"input",i=>{t.filter(i.target.value)})}function jt(e){w(e,"focus",()=>e.select())}function Ut(e){w(e,"change",t=>t.stopPropagation()),w(e,"input",t=>t.stopPropagation())}function Sn(e,t){w(e,"keydown",i=>{(/^[a-zA-Z0-9]$/.test(i.key)||i.key==="Backspace")&&(t.getState()||t.setState(!0))})}function Yt(e,t,i,o){if(!e.hasAttribute("clear"))return;let s=f=>{t.value=f,t.dispatchEvent(new Event("input",{bubbles:!1}))},r=e.getAttribute("clear"),c=r===""||r.split(" ").includes("action"),a=r===""||r.split(" ").includes("select"),l=r===""||r.split(" ").includes("close"),h=r===""||r.split(" ").includes("esc");r==="none"&&(c=a=l=h=!1),c?e.addEventListener("action",f=>{s("")}):a&&i.onChange(()=>{queueMicrotask(()=>s(""))}),l&&o.onChange(()=>{o.getState()||s("")}),h&&w(t,"keydown",f=>{f.key==="Escape"&&s("")})}function Kt(e,t,i,o){let n=!o,s=!o;if(e.hasAttribute("close")){let r=e.getAttribute("close");n=r===""||r.split(" ").includes("action"),s=r.split(" ").includes("select"),r==="none"&&(n=s=!1)}n?e.addEventListener("action",r=>{i.setState(!1)}):s&&t.onChange(()=>{i.setState(!1)})}function lo(e,t){t.onChange(()=>{let i=t.getActive();i?p(e,"aria-activedescendant",i.id):x(e,"aria-activedescendant")})}function co(e,t,i,o,n,s){if(!e){p(o,"autocomplete","off"),p(o,"aria-autocomplete","none");return}let r=c=>{o.value=c,o.dispatchEvent(new Event("input",{bubbles:!1}))};p(o,"autocomplete","off"),p(o,"aria-autocomplete","list"),queueMicrotask(()=>{n.onInitAndChange(()=>{o.value=n.selectedTextValue()})}),i.addEventListener("action",c=>{r(n.selectedTextValue())}),t&&s.onChange(()=>{s.getState()||r(n.selectedTextValue())})}function Xt(e,t){let{lock:i,unlock:o}=ut();t.onChange(()=>{t.getState()?i():o()})}var Qt=class e extends k{boot(){if(this._focusable=new We(this,{wrap:!1,ensureTabbable:!1}),w(this,"keydown",t=>{["ArrowDown"].includes(t.key)?(t.target===this?this._focusable.focusFirst():this._focusable.focusNext(),t.preventDefault(),t.stopPropagation()):["ArrowUp"].includes(t.key)&&(t.target===this?this._focusable.focusFirst():this._focusable.focusPrev(),t.preventDefault(),t.stopPropagation())}),ct(this,t=>this._focusable.focusBySearch(t)),this.hasAttribute("popover")&&this.addEventListener("lofi-close-popovers",()=>{setTimeout(()=>this.hidePopover(),50)}),this.parentElement.localName==="ui-dropdown"){let t=this.parentElement;w(t.trigger(),"keydown",i=>{i.key==="ArrowDown"&&(this.fromArrowDown=!0,this.showPopover(),i.preventDefault(),i.stopPropagation())})}p(this,"role","menu"),p(this,"tabindex","-1")}mount(){this.initializeMenuItems(),new MutationObserver(i=>{this.initializeMenuItems()}).observe(this,{childList:!0,subtree:!0})}onPopoverShow(){queueMicrotask(()=>{this.fromArrowDown?(this._focusable.focusFirst(),this.fromArrowDown=!1):this.focus()})}onPopoverHide(){this._focusable.wipeTabbables()}initializeMenuItems(){this.walker().each(t=>{t._disableable||En(t)})}walker(){return B(this,(t,{skip:i,reject:o})=>{if(t instanceof e||t instanceof je)return o();if(!["a","button"].includes(t.localName))return i()})}},Jt=class extends k{boot(){}},Zt=class extends k{boot(){this._disabled=this.hasAttribute("disabled"),this._disableable=new ne(this);let t=this;if(this._disabled&&(p(t,"disabled",""),p(t,"aria-disabled","true")),q(t,"menu-checkbox"),p(t,"role","menuitemcheckbox"),this._disabled)return;t._focusable=new L(t,{disableable:this._disableable,hover:!0,tabbableAttr:"data-active"}),t._selectable=new _(t,{toggleable:!0,value:this.hasAttribute("value")?this.getAttribute("value"):t.textContent.trim(),label:this.hasAttribute("label")?this.getAttribute("label"):t.textContent.trim(),dataAttr:"data-checked",ariaAttr:"aria-checked",selectedInitially:this.hasAttribute("checked")}),this._controllable=new $(this),this._controllable.initial(o=>o&&t._selectable.setState(o)),this._controllable.getter(()=>t._selectable.getState());let i=te();this._controllable.setter(i(o=>{this._selectable.setState(o)})),this._selectable.onChange(i(()=>{this._controllable.dispatch()})),w(t,"click",()=>{this.dispatchEvent(new CustomEvent("lofi-close-popovers",{bubbles:!0})),t._selectable.press()}),oi(t)}},ei=class extends k{boot(){this._disabled=this.hasAttribute("disabled"),this._disableable=new ne(this);let t=this;this._disabled&&(p(t,"disabled",""),p(t,"aria-disabled","true")),q(t,"menu-radio"),p(t,"role","menuitemradio"),!this._disabled&&(t._focusable=new L(t,{disableable:this._disableable,hover:!0,tabbableAttr:"data-active"}),t._selectable=new _(t,{toggleable:!1,value:this.hasAttribute("value")?this.getAttribute("value"):t.textContent.trim(),label:this.hasAttribute("label")?this.getAttribute("label"):t.textContent.trim(),dataAttr:"data-checked",ariaAttr:"aria-checked",selectedInitially:this.hasAttribute("checked")}),w(t,"click",()=>{this.dispatchEvent(new CustomEvent("lofi-close-popovers",{bubbles:!0})),t._selectable.press()}),oi(t))}},ti=class extends k{boot(){this._selectable=new oe(this),this._controllable=new $(this),p(this,"role","group"),this._controllable.initial(i=>i&&this._selectable.setState(i)),this._controllable.getter(()=>this._selectable.getState());let t=te();this._controllable.setter(t(i=>{this._selectable.setState(i)})),this._selectable.onChange(t(()=>{this._controllable.dispatch()}))}},ii=class extends k{boot(){this._selectable=new oe(this,{multiple:!0}),this._controllable=new $(this),p(this,"role","group"),this._controllable.initial(i=>i&&this._selectable.setState(i)),this._controllable.getter(()=>this._selectable.getState());let t=te();this._controllable.setter(t(i=>{this._selectable.setState(i)})),this._selectable.onChange(t(()=>{this._controllable.dispatch()}))}};W(({css:e})=>e`ui-menu[popover]:popover-open { display: block; }`);W(({css:e})=>e`ui-menu[popover].\:popover-open { display: block; }`);W(({css:e})=>e`ui-menu-checkbox, ui-menu-radio { cursor: default; display: contents; }`);T("menu",Qt);T("submenu",Jt);T("menu-checkbox",Zt);T("menu-radio",ei);T("menu-radio-group",ti);T("menu-checkbox-group",ii);function oi(e){w(e,"keydown",t=>{t.key==="Enter"&&(e.click(),t.preventDefault(),t.stopPropagation())}),w(e,"keydown",t=>{t.key===" "&&(t.preventDefault(),t.stopPropagation())}),w(e,"keyup",t=>{t.key===" "&&(e.click(),t.preventDefault(),t.stopPropagation())})}function En(e){e._disableable=new ne(e),e._disabled=e.hasAttribute("disabled");let t=e.querySelector("a"),i=e,o=e.parentElement.matches("ui-submenu")&&e.parentElement.querySelector("ui-menu[popover]"),n=t||i;if(e._disabled&&(p(n,"disabled",""),p(n,"aria-disabled","true")),q(n,"menu-item"),p(n,"role","menuitem"),!e._disabled)if(n._focusable=new L(n,{disableable:e._disableable,hover:!0,tabbableAttr:"data-active"}),!o)e.hasAttribute("disabled")||w(e,"click",()=>{e.dispatchEvent(new CustomEvent("lofi-close-popovers",{bubbles:!0}))}),oi(i);else{o._popoverable=new R(o,{trigger:i}),o._anchorable=new I(o,{reference:i,position:o.hasAttribute("position")?o.getAttribute("position"):"right start",gap:o.hasAttribute("gap")?o.getAttribute("gap"):"-5"}),i.addEventListener("click",r=>{o._popoverable.setState(!0)});let{clear:s}=xe(i,o,{gain(){o._popoverable.setState(!0)},lose(){o._popoverable.setState(!1)},focusable:!1});o._popoverable.onChange(()=>{o._popoverable.getState()||(s(),o._focusable.wipeTabbables()),o._anchorable.reposition()}),w(i,"keydown",r=>{r.key==="Enter"&&(o._popoverable.setState(!0),setTimeout(()=>o._focusable.focusFirst()))}),w(i,"keydown",r=>{r.key==="ArrowRight"&&(o._popoverable.setState(!0),setTimeout(()=>o._focusable.focusFirst()))}),w(o,"keydown",r=>{r.key==="ArrowLeft"&&(o._popoverable.setState(!1),i.focus(),r.stopPropagation())})}}var yt=kn();yt&&W(({css:e})=>e`:root:has(.dark) { color-scheme: dark; }`);document.addEventListener("alpine:init",()=>{let e=Alpine.reactive({toast(...i){let o={slots:{},dataset:{}};typeof i[0]=="string"&&(o.slots.text=i.shift()),typeof i[0]=="string"&&(o.slots.heading=o.slots.text,o.slots.text=i.shift());let n=i.shift()||{};n.text&&(o.slots.text=n.text),n.heading&&(o.slots.heading=n.heading),n.variant&&(o.dataset.variant=n.variant),n.position&&(o.dataset.position=n.position),document.dispatchEvent(new CustomEvent("toast-show",{detail:o}))},modal(i){return{show(){document.dispatchEvent(new CustomEvent("modal-show",{detail:{name:i}}))},close(){document.dispatchEvent(new CustomEvent("modal-close",{detail:{name:i}}))}}},modals(){return{close(){document.dispatchEvent(new CustomEvent("modal-close",{detail:{}}))}}},appearance:window.localStorage.getItem("flux.appearance")||"system",systemAppearanceChanged:1,get dark(){return JSON.stringify(e.systemAppearanceChanged),e.appearance==="system"?window.matchMedia("(prefers-color-scheme: dark)").matches:e.appearance==="dark"},set dark(i){let o=this.dark;i!==o&&(i?e.appearance="dark":e.appearance="light")}});window.Flux=e,Alpine.magic("flux",()=>e),yt&&Alpine.effect(()=>{ni(e.appearance)}),yt&&document.addEventListener("livewire:navigated",()=>{ni(e.appearance)});let t=window.matchMedia("(prefers-color-scheme: dark)");yt&&t.addEventListener("change",()=>{e.systemAppearanceChanged++,ni(e.appearance)})});function ni(e){let t=()=>document.documentElement.classList.add("dark"),i=()=>document.documentElement.classList.remove("dark");if(e==="system"){let o=window.matchMedia("(prefers-color-scheme: dark)");window.localStorage.removeItem("flux.appearance"),o.matches?t():i()}else e==="dark"?(window.localStorage.setItem("flux.appearance","dark"),t()):e==="light"&&(window.localStorage.setItem("flux.appearance","light"),i())}function kn(){let e=document.createElement("div");e.setAttribute("data-flux-dark-mode-beacon",""),document.body.appendChild(e);let t=getComputedStyle(e).display==="none";e.classList.add("dark:[&[data-flux-dark-mode-beacon]]:hidden"),e.classList.add("dark");let i=getComputedStyle(e).display==="none",o=!t&&i;return e.remove(),o}!Ei()&&!ki()&&_i();})(); +`}var ye=null;function Ot(e){let t=Fo();if(ye===null)try{ye=new CSSStyleSheet,ye.replaceSync(t)}catch{ye=!1}if(ye===!1){let i=document.createElement("style");i.textContent=t,e instanceof Document?e.head.prepend(i):e.prepend(i)}else e.adoptedStyleSheets=[ye,...e.adoptedStyleSheets]}function _i(){if(typeof window>"u")return;window.ToggleEvent=window.ToggleEvent||st;function e(a){return a?.includes(":popover-open")&&(a=a.replace(Ro,"$1.\\:popover-open")),a}ce(Document.prototype,"querySelector",e),ce(Document.prototype,"querySelectorAll",e),ce(Element.prototype,"querySelector",e),ce(Element.prototype,"querySelectorAll",e),ce(Element.prototype,"matches",e),ce(Element.prototype,"closest",e),ce(DocumentFragment.prototype,"querySelectorAll",e),Object.defineProperties(HTMLElement.prototype,{popover:{enumerable:!0,configurable:!0,get(){if(!this.hasAttribute("popover"))return null;let a=(this.getAttribute("popover")||"").toLowerCase();return a===""||a=="auto"?"auto":"manual"},set(a){this.setAttribute("popover",a)}},showPopover:{enumerable:!0,configurable:!0,value(){Tt(this)}},hidePopover:{enumerable:!0,configurable:!0,value(){Me(this,!0,!0)}},togglePopover:{enumerable:!0,configurable:!0,value(a){Re.get(this)==="showing"&&a===void 0||a===!1?Me(this,!0,!0):(a===void 0||a===!0)&&Tt(this)}}});let t=Element.prototype.attachShadow;t&&Object.defineProperties(Element.prototype,{attachShadow:{enumerable:!0,configurable:!0,writable:!0,value(a){let l=t.call(this,a);return Ot(l),l}}});let i=HTMLElement.prototype.attachInternals;i&&Object.defineProperties(HTMLElement.prototype,{attachInternals:{enumerable:!0,configurable:!0,writable:!0,value(){let a=i.call(this);return a.shadowRoot&&Ot(a.shadowRoot),a}}});let o=new WeakMap;function n(a){Object.defineProperties(a.prototype,{popoverTargetElement:{enumerable:!0,configurable:!0,set(l){if(l===null)this.removeAttribute("popovertarget"),o.delete(this);else if(l instanceof Element)this.setAttribute("popovertarget",""),o.set(this,l);else throw new TypeError("popoverTargetElement must be an element or null")},get(){if(this.localName!=="button"&&this.localName!=="input"||this.localName==="input"&&this.type!=="reset"&&this.type!=="image"&&this.type!=="button"||this.disabled||this.form&&this.type==="submit")return null;let l=o.get(this);if(l&&l.isConnected)return l;if(l&&!l.isConnected)return o.delete(this),null;let h=Ae(this),f=this.getAttribute("popovertarget");return(h instanceof Document||h instanceof yi)&&f&&h.getElementById(f)||null}},popoverTargetAction:{enumerable:!0,configurable:!0,get(){let l=(this.getAttribute("popovertargetaction")||"").toLowerCase();return l==="show"||l==="hide"?l:"toggle"},set(l){this.setAttribute("popovertargetaction",l)}}})}n(HTMLButtonElement),n(HTMLInputElement);let s=a=>{let l=a.composedPath(),h=l[0];if(!(h instanceof Element)||h?.shadowRoot)return;let f=Ae(h);if(!(f instanceof yi||f instanceof Document))return;let m=l.find(b=>b.matches?.("[popovertargetaction],[popovertarget]"));if(m){_o(m),a.preventDefault();return}},r=a=>{let l=a.key,h=a.target;!a.defaultPrevented&&h&&(l==="Escape"||l==="Esc")&&rt(h.ownerDocument,!0,!0)};(a=>{a.addEventListener("click",s),a.addEventListener("keydown",r),a.addEventListener("pointerdown",wi),a.addEventListener("pointerup",wi)})(document),Ot(document)}function W(e){let t=e({css:(o,...n)=>o.raw[0]+n.join("")});if(document.adoptedStyleSheets===void 0){let o=document.createElement("style");o.textContent=t,document.head.appendChild(o);return}let i=new CSSStyleSheet;i.replaceSync(t),document.adoptedStyleSheets=[...document.adoptedStyleSheets,i]}function Oi(e,t){let i=e;for(;i;){if(t(i))return i;i=i.parentElement}}function B(e,t){let i=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,t?{acceptNode:o=>{let n,s;return t(o,{skip:()=>n=!0,reject:()=>s=!0}),n?NodeFilter.FILTER_SKIP:s?NodeFilter.FILTER_REJECT:NodeFilter.FILTER_ACCEPT}}:{});return new Lt(i)}var Lt=class{constructor(t){this.walker=t}from(t){return this.walker.currentNode=t,this}first(){return this.walker.firstChild()}last(){return this.walker.lastChild()}next(t){return this.walker.currentNode=t,this.walker.nextSibling()}nextOrFirst(t){let i=this.next(t);return i||(this.walker.currentNode=this.walker.root,this.first())}prev(t){return this.walker.currentNode=t,this.walker.previousSibling()}prevOrLast(t){let i=this.prev(t);return i||(this.walker.currentNode=this.walker.root,this.last())}closest(t,i){let o=this.from(t).walker;for(;o.currentNode;){if(i(o.currentNode))return o.currentNode;o.parentNode()}}contains(t){return this.find(i=>i===t)}find(t){return this.walk((i,o)=>{t(i)&&o(i)})}findOrFirst(t){return this.find(t)||(this.walker.currentNode=this.walker.root),this.first()}each(t){this.walk(i=>t(i))}some(t){return!!this.find(t)}every(t){let i=!0;return this.walk(o=>{t(o)||(i=!1)}),i}map(t){let i=[];return this.walk(o=>i.push(t(o))),i}filter(t){let i=[];return this.walk(o=>t(o)&&i.push(o)),i}walk(t){let i,o=this.walker,n;for(;o.nextNode()&&(i=o.currentNode,t(i,s=>n=s),n===void 0););return n}};function T(e,t){customElements.define(`ui-${e}`,t)}function w(e,t,i,o={}){return e.addEventListener(t,i,o),{off:()=>e.removeEventListener(t,i),pause:n=>{e.removeEventListener(t,i),n(),e.addEventListener(t,i)}}}function Ti(e){return["a[href]","area[href]","input:not([disabled])","select:not([disabled])","textarea:not([disabled])","button:not([disabled])","iframe","object","embed","[tabindex]","[contenteditable]"].some(i=>e.matches(i))&&e.tabIndex>=0}function Io(e,t){let i;return function(){let o=this,n=arguments;i||(e.apply(o,n),i=!0,setTimeout(()=>i=!1,t))}}var lt="pointer";document.addEventListener("keydown",()=>lt="keyboard",{capture:!0});document.addEventListener("pointerdown",e=>{lt=e.pointerType==="mouse"?"mouse":"touch"},{capture:!0});function Mt(){return lt==="keyboard"}function No(){return lt==="touch"}function ct(e,t){let i="",o=zo(()=>{i=""},300);e.addEventListener("keydown",n=>{n.key.length===1&&/[a-zA-Z]/.test(n.key)&&(i+=n.key,t(i),n.stopPropagation()),o()})}function Ho(e,t){return"lofi-"+(t?t+"-":"")+Math.random().toString(16).slice(2)}function q(e,t){let i=e.hasAttribute("id")?e.getAttribute("id"):Ho(e,t);return p(e,"id",i),e._x_bindings||(e._x_bindings={}),e._x_bindings.id||(e._x_bindings.id=i),i}function te(){let e=!1;return t=>(...i)=>{e||(e=!0,t(...i),e=!1)}}function xe(e,t,{gain:i,lose:o,focusable:n,useSafeArea:s}){let r=!1;n&&document.addEventListener("focusin",f=>{Mt()&&(e.contains(f.target)||t.contains(f.target)?(r=!0,i()):(r=!1,o()))});let c=()=>{},a=()=>{},l=()=>{r=!1,o(),c(),a()},h=()=>{r=!1,c(),a()};return e.addEventListener("pointerenter",f=>{No()||r||(r=!0,i(),setTimeout(()=>{let{safeArea:m,redraw:b,remove:u}=s?Wo(e,t,f.clientX,f.clientY):$o();c=u;let d,v=Io(g=>{let y=t.getBoundingClientRect(),A=e.getBoundingClientRect(),S;switch(m.contains(g.target)&&Bo(A,y,g.clientX,g.clientY)?S="safeArea":t.contains(g.target)?S="panel":e.contains(g.target)?S="trigger":S="outside",d&&clearTimeout(d),S){case"outside":l();break;case"trigger":b(g.clientX,g.clientY);break;case"panel":c();break;case"safeArea":b(g.clientX,g.clientY),d=setTimeout(()=>{l()},300);break;default:break}},100);document.addEventListener("pointermove",v),a=()=>document.removeEventListener("pointermove",v)}))}),{clear:h}}function Wo(e,t,i,o){let n=document.createElement("div"),s=t.getBoundingClientRect(),r=e.getBoundingClientRect();n.style.position="fixed",p(n,"data-safe-area","");let c=(a,l)=>{if(s.top===0&&s.bottom===0)return;let h;s.leftr.right&&(h="right"),s.topr.bottom&&s.top>l&&(h="down"),h===void 0&&(h="right");let f,m,b,u,d,v,g,y,A=10;switch(h){case"left":f=s.right,m=Math.max(s.right,a)+5,b=m-f,u=Math.min(r.top,s.top)-A,d=Math.max(r.bottom,s.bottom)+A,v=d-u,g=l-u,y=`polygon(0% 0%, 100% ${g}px, 0% 100%)`;break;case"right":f=Math.min(s.left,a)-5,m=s.left,b=m-f,u=Math.min(r.top,s.top)-A,d=Math.max(r.bottom,s.bottom)+A,v=d-u,g=l-u,y=`polygon(0% ${g}px, 100% 0%, 100% 100%)`;break;case"up":f=Math.min(a,s.left)-A,m=Math.max(a,s.right)+A,b=m-f,u=s.bottom,d=Math.max(s.bottom,l)+5,v=d-u,g=a-f,y=`polygon(0% 0%, 100% 0%, ${g}px 100%)`;break;case"down":f=Math.min(a,s.left)-A,m=Math.max(a,s.right)+A,b=m-f,u=Math.min(s.top,l)-5,d=s.top,v=d-u,g=a-f,y=`polygon(${g}px 0%, 100% 100%, 0% 100%)`;break}n.style.left=`${f}px`,n.style.top=`${u}px`,n.style.width=`${b}px`,n.style.height=`${v}px`,n.style.clipPath=y};return{safeArea:n,redraw:(a,l)=>{n.isConnected||e.appendChild(n),c(a,l)},remove:()=>{n.remove()}}}function Bo(e,t,i,o){return!qo(e,i,o)&&!Vo(t,i,o)}function qo(e,t,i){return e.left<=t&&t<=e.right&&e.top<=i&&i<=e.bottom}function Vo(e,t,i){return e.left<=t&&t<=e.right&&e.top<=i&&i<=e.bottom}function p(e,t,i){e._durableAttributeObserver===void 0&&(e._durableAttributeObserver=Pi(e,[t])),e._durableAttributeObserver.hasAttribute(t)||e._durableAttributeObserver.addAttribute(t),e._durableAttributeObserver.pause(()=>{e.setAttribute(t,i)})}function x(e,t){e._durableAttributeObserver===void 0&&(e._durableAttributeObserver=Pi(e,[t])),e._durableAttributeObserver.hasAttribute(t)||e._durableAttributeObserver.addAttribute(t),e._durableAttributeObserver.pause(()=>{e.removeAttribute(t)})}function Pi(e,t){let i=n=>{n.forEach(s=>{s.oldValue===null?e._durableAttributeObserver.pause(()=>x(e,s.attributeName)):e._durableAttributeObserver.pause(()=>p(e,s.attributeName,s.oldValue))})},o=new MutationObserver(n=>i(n));return o.observe(e,{attributeFilter:t,attributeOldValue:!0}),{attributes:t,hasAttribute(n){return this.attributes.includes(n)},addAttribute(n){this.attributes.includes(n)||this.attributes.push(n),o.observe(e,{attributeFilter:this.attributes,attributeOldValue:!0})},releaseAttribute(n){this.hasAttribute(n)&&o.observe(e,{attributeFilter:this.attributes,attributeOldValue:!0})},pause(n){i(o.takeRecords()),o.disconnect(),n(),o.observe(e,{attributeFilter:this.attributes,attributeOldValue:!0})}}}function $o(){return{safeArea:{contains:()=>!1},redraw:()=>{},remove:()=>{}}}function zo(e,t){let i;return(...o)=>{clearTimeout(i),i=setTimeout(()=>{e(...o)},t)}}var at=0;function ut(e=!1){if(e)return{lock:()=>{},unlock:()=>{}};let t=()=>{};return{lock(){at++,!(at>1)&&(t=jo(Ci(document.documentElement,"paddingRight",`${window.innerWidth-document.documentElement.clientWidth}px`),Ci(document.documentElement,"overflow","hidden")))},unlock(){at=Math.max(0,at-1),t()}}}function Ci(e,t,i){let o=e.style[t];return e.style[t]=i,()=>{e.style[t]=o}}function jo(...e){return(...t)=>{for(let i of e)i(...t)}}var k=class extends HTMLElement{constructor(){super(),this.boot?.()}connectedCallback(){queueMicrotask(()=>{this.mount?.()})}mixin(t,i={}){return new t(this,i)}appendMixin(t,i={}){return new t(this,i)}use(t){let i;return this.mixins.forEach(o=>{o instanceof t&&(i=o)}),i}uses(t){let i;return this.mixins.forEach(o=>{o instanceof t&&(i=!0)}),!!i}on(t,i){return w(this,t,i)}root(t,i={}){if(t===void 0)return this.__root;let o=document.createElement(t);for(let s in i)setAttribute(o,s,i[s]);let n=this.attachShadow({mode:"open"});return o.appendChild(document.createElement("slot")),n.appendChild(o),this.__root=o,this.__root}},ft=class extends k{};var C=class{constructor(t,i={}){this.el=t,this.grouped=i.grouped===void 0,this.el.mixins=this.el.mixins?this.el.mixins:new Map,this.el.mixins.set(this.constructor.name,this),this.el[this.constructor.name]=!0,this.el.use||(this.el.use=k.prototype.use.bind(this.el)),this.opts=i,this.boot?.({options:o=>{let n=o;Object.entries(this.opts).forEach(([s,r])=>{r!==void 0&&(n[s]=r)}),this.opts=n}}),queueMicrotask(()=>{this.mount?.()})}options(){return this.opts}hasGroup(){return!!this.group()}group(){if(this.grouped!==!1)return Oi(this.el,t=>t[this.groupedByType.name])?.use(this.groupedByType)}on(t,i){return w(this.el,t,i)}},V=class extends C{constructor(t,i={}){super(t,i)}walker(){return B(this.el,(t,{skip:i,reject:o})=>{if(t[this.constructor.name]&&t!==this.el)return o();if(!t[this.groupOfType.name]||!t.mixins.get(this.groupOfType.name).grouped)return i()})}};var $=class extends C{boot({options:t}){this.initialState=this.el.value,this.getterFunc=()=>{},this.setterFunc=i=>this.initialState=i,Object.defineProperty(this.el,"value",{get:()=>this.getterFunc(),set:i=>{this.setterFunc(i)}})}initial(t){t(this.initialState)}getter(t){this.getterFunc=t}setter(t){this.setterFunc=t}dispatch(){this.el.dispatchEvent(new Event("input",{bubbles:!1,cancelable:!0})),this.el.dispatchEvent(new Event("change",{bubbles:!1,cancelable:!0}))}};var K=new Map,R=class extends C{boot({options:t}){t({trigger:null,scope:null});let i=this.options().scope||"global";p(this.el,"popover","manual"),this.trigger=this.options().trigger,this.onChanges=[],this.state=!1,w(this.el,"beforetoggle",o=>{let n=this.state;if(this.state=o.newState==="open",this.state){Uo(this.el,i);let s=new AbortController,r=document.activeElement;setTimeout(()=>{Yo(this.el,r,s),Ko(this.el,r,s),Xo(this.el,r,s)}),this.el.addEventListener("beforetoggle",c=>{c.newState==="closed"&&(s.abort(),r.focus())},{signal:s.signal})}n!==this.state&&this.onChanges.forEach(s=>s(this.state,n))}),w(this.el,"toggle",o=>{if(o.newState==="open")K.has(i)||K.set(i,new Set),K.get(i).add(this.el);else if(o.newState==="closed"){if(!K.has(i))return;K.get(i).delete(this.el),K.get(i).size===0&&K.delete(i)}})}onChange(t){this.onChanges.push(t)}setState(t){t?this.show():this.hide()}getState(){return this.state}toggle(){this.el.togglePopover()}show(){this.el.showPopover()}hide(){this.el.hidePopover()}};function Uo(e,t){K.has(t)&&K.get(t).forEach(i=>{e.contains(i)||i.contains(e)||i.hidePopover()})}function Yo(e,t,i){document.addEventListener("click",o=>{e.contains(o.target)||t===o.target||e.hidePopover()},{signal:i.signal})}function Ko(e,t,i){document.addEventListener("focusin",o=>{e.contains(o.target)||t===o.target||(i.abort(),e.hidePopover())},{capture:!0,signal:i.signal})}function Xo(e,t,i){document.addEventListener("keydown",o=>{o.key==="Escape"&&e.hidePopover()},{signal:i.signal})}var z=Math.min,P=Math.max,Fe=Math.round,Ie=Math.floor,X=e=>({x:e,y:e}),Go={left:"right",right:"left",bottom:"top",top:"bottom"},Qo={start:"end",end:"start"};function Rt(e,t,i){return P(e,z(t,i))}function Se(e,t){return typeof e=="function"?e(t):e}function G(e){return e.split("-")[0]}function Ee(e){return e.split("-")[1]}function Dt(e){return e==="x"?"y":"x"}function Ft(e){return e==="y"?"height":"width"}function ie(e){return["top","bottom"].includes(G(e))?"y":"x"}function It(e){return Dt(ie(e))}function Li(e,t,i){i===void 0&&(i=!1);let o=Ee(e),n=It(e),s=Ft(n),r=n==="x"?o===(i?"end":"start")?"right":"left":o==="start"?"bottom":"top";return t.reference[s]>t.floating[s]&&(r=De(r)),[r,De(r)]}function Mi(e){let t=De(e);return[ht(e),t,ht(t)]}function ht(e){return e.replace(/start|end/g,t=>Qo[t])}function Jo(e,t,i){let o=["left","right"],n=["right","left"],s=["top","bottom"],r=["bottom","top"];switch(e){case"top":case"bottom":return i?t?n:o:t?o:n;case"left":case"right":return t?s:r;default:return[]}}function Ri(e,t,i,o){let n=Ee(e),s=Jo(G(e),i==="start",o);return n&&(s=s.map(r=>r+"-"+n),t&&(s=s.concat(s.map(ht)))),s}function De(e){return e.replace(/left|right|bottom|top/g,t=>Go[t])}function Zo(e){return{top:0,right:0,bottom:0,left:0,...e}}function Di(e){return typeof e!="number"?Zo(e):{top:e,right:e,bottom:e,left:e}}function fe(e){let{x:t,y:i,width:o,height:n}=e;return{width:o,height:n,top:i,left:t,right:t+o,bottom:i+n,x:t,y:i}}function Fi(e,t,i){let{reference:o,floating:n}=e,s=ie(t),r=It(t),c=Ft(r),a=G(t),l=s==="y",h=o.x+o.width/2-n.width/2,f=o.y+o.height/2-n.height/2,m=o[c]/2-n[c]/2,b;switch(a){case"top":b={x:h,y:o.y-n.height};break;case"bottom":b={x:h,y:o.y+o.height};break;case"right":b={x:o.x+o.width,y:f};break;case"left":b={x:o.x-n.width,y:f};break;default:b={x:o.x,y:o.y}}switch(Ee(t)){case"start":b[r]-=m*(i&&l?-1:1);break;case"end":b[r]+=m*(i&&l?-1:1);break}return b}var Ii=async(e,t,i)=>{let{placement:o="bottom",strategy:n="absolute",middleware:s=[],platform:r}=i,c=s.filter(Boolean),a=await(r.isRTL==null?void 0:r.isRTL(t)),l=await r.getElementRects({reference:e,floating:t,strategy:n}),{x:h,y:f}=Fi(l,o,a),m=o,b={},u=0;for(let d=0;dre<=0)){var Oe,si;let re=(((Oe=s.flip)==null?void 0:Oe.index)||0)+1,ai=Ue[re];if(ai)return{data:{index:re,overflows:J},reset:{placement:ai}};let Te=(si=J.filter(ge=>ge.overflows[0]<=0).sort((ge,Z)=>ge.overflows[1]-Z.overflows[1])[0])==null?void 0:si.placement;if(!Te)switch(b){case"bestFit":{var ri;let ge=(ri=J.filter(Z=>{if(H){let ee=ie(Z.placement);return ee===y||ee==="y"}return!0}).map(Z=>[Z.placement,Z.overflows.filter(ee=>ee>0).reduce((ee,uo)=>ee+uo,0)]).sort((Z,ee)=>Z[1]-ee[1])[0])==null?void 0:ri[0];ge&&(Te=ge);break}case"initialPlacement":Te=c;break}if(n!==Te)return{reset:{placement:Te}}}return{}}}};async function en(e,t){let{placement:i,platform:o,elements:n}=e,s=await(o.isRTL==null?void 0:o.isRTL(n.floating)),r=G(i),c=Ee(i),a=ie(i)==="y",l=["left","top"].includes(r)?-1:1,h=s&&a?-1:1,f=Se(t,e),{mainAxis:m,crossAxis:b,alignmentAxis:u}=typeof f=="number"?{mainAxis:f,crossAxis:0,alignmentAxis:null}:{mainAxis:0,crossAxis:0,alignmentAxis:null,...f};return c&&typeof u=="number"&&(b=c==="end"?u*-1:u),a?{x:b*h,y:m*l}:{x:m*l,y:b*h}}var Hi=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var i,o;let{x:n,y:s,placement:r,middlewareData:c}=t,a=await en(t,e);return r===((i=c.offset)==null?void 0:i.placement)&&(o=c.arrow)!=null&&o.alignmentOffset?{}:{x:n+a.x,y:s+a.y,data:{...a,placement:r}}}}},Wi=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){let{x:i,y:o,placement:n}=t,{mainAxis:s=!0,crossAxis:r=!1,limiter:c={fn:v=>{let{x:g,y}=v;return{x:g,y}}},...a}=Se(e,t),l={x:i,y:o},h=await pt(t,a),f=ie(G(n)),m=Dt(f),b=l[m],u=l[f];if(s){let v=m==="y"?"top":"left",g=m==="y"?"bottom":"right",y=b+h[v],A=b-h[g];b=Rt(y,b,A)}if(r){let v=f==="y"?"top":"left",g=f==="y"?"bottom":"right",y=u+h[v],A=u-h[g];u=Rt(y,u,A)}let d=c.fn({...t,[m]:b,[f]:u});return{...d,data:{x:d.x-i,y:d.y-o}}}}};var Bi=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){let{placement:i,rects:o,platform:n,elements:s}=t,{apply:r=()=>{},...c}=Se(e,t),a=await pt(t,c),l=G(i),h=Ee(i),f=ie(i)==="y",{width:m,height:b}=o.floating,u,d;l==="top"||l==="bottom"?(u=l,d=h===(await(n.isRTL==null?void 0:n.isRTL(s.floating))?"start":"end")?"left":"right"):(d=l,u=h==="end"?"top":"bottom");let v=b-a.top-a.bottom,g=m-a.left-a.right,y=z(b-a[u],v),A=z(m-a[d],g),S=!t.middlewareData.shift,E=y,H=A;if(f?H=h||S?z(A,g):g:E=h||S?z(y,v):v,S&&!h){let me=P(a.left,0),se=P(a.right,0),J=P(a.top,0),Oe=P(a.bottom,0);f?H=m-2*(me!==0||se!==0?me+se:P(a.left,a.right)):E=b-2*(J!==0||Oe!==0?J+Oe:P(a.top,a.bottom))}await r({...t,availableWidth:H,availableHeight:E});let Ue=await n.getDimensions(s.floating);return m!==Ue.width||b!==Ue.height?{reset:{rects:!0}}:{}}}};function he(e){return Vi(e)?(e.nodeName||"").toLowerCase():"#document"}function M(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function j(e){var t;return(t=(Vi(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function Vi(e){return e instanceof Node||e instanceof M(e).Node}function D(e){return e instanceof Element||e instanceof M(e).Element}function N(e){return e instanceof HTMLElement||e instanceof M(e).HTMLElement}function qi(e){return typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof M(e).ShadowRoot}function _e(e){let{overflow:t,overflowX:i,overflowY:o,display:n}=F(e);return/auto|scroll|overlay|hidden|clip/.test(t+o+i)&&!["inline","contents"].includes(n)}function $i(e){return["table","td","th"].includes(he(e))}function Ne(e){return[":popover-open",":modal"].some(t=>{try{return e.matches(t)}catch{return!1}})}function dt(e){let t=bt(),i=D(e)?F(e):e;return i.transform!=="none"||i.perspective!=="none"||(i.containerType?i.containerType!=="normal":!1)||!t&&(i.backdropFilter?i.backdropFilter!=="none":!1)||!t&&(i.filter?i.filter!=="none":!1)||["transform","perspective","filter"].some(o=>(i.willChange||"").includes(o))||["paint","layout","strict","content"].some(o=>(i.contain||"").includes(o))}function zi(e){let t=Q(e);for(;N(t)&&!pe(t);){if(dt(t))return t;if(Ne(t))return null;t=Q(t)}return null}function bt(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function pe(e){return["html","body","#document"].includes(he(e))}function F(e){return M(e).getComputedStyle(e)}function He(e){return D(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Q(e){if(he(e)==="html")return e;let t=e.assignedSlot||e.parentNode||qi(e)&&e.host||j(e);return qi(t)?t.host:t}function ji(e){let t=Q(e);return pe(t)?e.ownerDocument?e.ownerDocument.body:e.body:N(t)&&_e(t)?t:ji(t)}function ke(e,t,i){var o;t===void 0&&(t=[]),i===void 0&&(i=!0);let n=ji(e),s=n===((o=e.ownerDocument)==null?void 0:o.body),r=M(n);if(s){let c=mt(r);return t.concat(r,r.visualViewport||[],_e(n)?n:[],c&&i?ke(c):[])}return t.concat(n,ke(n,[],i))}function mt(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function Ki(e){let t=F(e),i=parseFloat(t.width)||0,o=parseFloat(t.height)||0,n=N(e),s=n?e.offsetWidth:i,r=n?e.offsetHeight:o,c=Fe(i)!==s||Fe(o)!==r;return c&&(i=s,o=r),{width:i,height:o,$:c}}function Ht(e){return D(e)?e:e.contextElement}function Ce(e){let t=Ht(e);if(!N(t))return X(1);let i=t.getBoundingClientRect(),{width:o,height:n,$:s}=Ki(t),r=(s?Fe(i.width):i.width)/o,c=(s?Fe(i.height):i.height)/n;return(!r||!Number.isFinite(r))&&(r=1),(!c||!Number.isFinite(c))&&(c=1),{x:r,y:c}}var tn=X(0);function Xi(e){let t=M(e);return!bt()||!t.visualViewport?tn:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function on(e,t,i){return t===void 0&&(t=!1),!i||t&&i!==M(e)?!1:t}function de(e,t,i,o){t===void 0&&(t=!1),i===void 0&&(i=!1);let n=e.getBoundingClientRect(),s=Ht(e),r=X(1);t&&(o?D(o)&&(r=Ce(o)):r=Ce(e));let c=on(s,i,o)?Xi(s):X(0),a=(n.left+c.x)/r.x,l=(n.top+c.y)/r.y,h=n.width/r.x,f=n.height/r.y;if(s){let m=M(s),b=o&&D(o)?M(o):o,u=m,d=mt(u);for(;d&&o&&b!==u;){let v=Ce(d),g=d.getBoundingClientRect(),y=F(d),A=g.left+(d.clientLeft+parseFloat(y.paddingLeft))*v.x,S=g.top+(d.clientTop+parseFloat(y.paddingTop))*v.y;a*=v.x,l*=v.y,h*=v.x,f*=v.y,a+=A,l+=S,u=M(d),d=mt(u)}}return fe({width:h,height:f,x:a,y:l})}function nn(e){let{elements:t,rect:i,offsetParent:o,strategy:n}=e,s=n==="fixed",r=j(o),c=t?Ne(t.floating):!1;if(o===r||c&&s)return i;let a={scrollLeft:0,scrollTop:0},l=X(1),h=X(0),f=N(o);if((f||!f&&!s)&&((he(o)!=="body"||_e(r))&&(a=He(o)),N(o))){let m=de(o);l=Ce(o),h.x=m.x+o.clientLeft,h.y=m.y+o.clientTop}return{width:i.width*l.x,height:i.height*l.y,x:i.x*l.x-a.scrollLeft*l.x+h.x,y:i.y*l.y-a.scrollTop*l.y+h.y}}function sn(e){return Array.from(e.getClientRects())}function Gi(e){return de(j(e)).left+He(e).scrollLeft}function rn(e){let t=j(e),i=He(e),o=e.ownerDocument.body,n=P(t.scrollWidth,t.clientWidth,o.scrollWidth,o.clientWidth),s=P(t.scrollHeight,t.clientHeight,o.scrollHeight,o.clientHeight),r=-i.scrollLeft+Gi(e),c=-i.scrollTop;return F(o).direction==="rtl"&&(r+=P(t.clientWidth,o.clientWidth)-n),{width:n,height:s,x:r,y:c}}function an(e,t){let i=M(e),o=j(e),n=i.visualViewport,s=o.clientWidth,r=o.clientHeight,c=0,a=0;if(n){s=n.width,r=n.height;let l=bt();(!l||l&&t==="fixed")&&(c=n.offsetLeft,a=n.offsetTop)}return{width:s,height:r,x:c,y:a}}function ln(e,t){let i=de(e,!0,t==="fixed"),o=i.top+e.clientTop,n=i.left+e.clientLeft,s=N(e)?Ce(e):X(1),r=e.clientWidth*s.x,c=e.clientHeight*s.y,a=n*s.x,l=o*s.y;return{width:r,height:c,x:a,y:l}}function Ui(e,t,i){let o;if(t==="viewport")o=an(e,i);else if(t==="document")o=rn(j(e));else if(D(t))o=ln(t,i);else{let n=Xi(e);o={...t,x:t.x-n.x,y:t.y-n.y}}return fe(o)}function Qi(e,t){let i=Q(e);return i===t||!D(i)||pe(i)?!1:F(i).position==="fixed"||Qi(i,t)}function cn(e,t){let i=t.get(e);if(i)return i;let o=ke(e,[],!1).filter(c=>D(c)&&he(c)!=="body"),n=null,s=F(e).position==="fixed",r=s?Q(e):e;for(;D(r)&&!pe(r);){let c=F(r),a=dt(r);!a&&c.position==="fixed"&&(n=null),(s?!a&&!n:!a&&c.position==="static"&&!!n&&["absolute","fixed"].includes(n.position)||_e(r)&&!a&&Qi(e,r))?o=o.filter(h=>h!==r):n=c,r=Q(r)}return t.set(e,o),o}function un(e){let{element:t,boundary:i,rootBoundary:o,strategy:n}=e,r=[...i==="clippingAncestors"?Ne(t)?[]:cn(t,this._c):[].concat(i),o],c=r[0],a=r.reduce((l,h)=>{let f=Ui(t,h,n);return l.top=P(f.top,l.top),l.right=z(f.right,l.right),l.bottom=z(f.bottom,l.bottom),l.left=P(f.left,l.left),l},Ui(t,c,n));return{width:a.right-a.left,height:a.bottom-a.top,x:a.left,y:a.top}}function fn(e){let{width:t,height:i}=Ki(e);return{width:t,height:i}}function hn(e,t,i){let o=N(t),n=j(t),s=i==="fixed",r=de(e,!0,s,t),c={scrollLeft:0,scrollTop:0},a=X(0);if(o||!o&&!s)if((he(t)!=="body"||_e(n))&&(c=He(t)),o){let f=de(t,!0,s,t);a.x=f.x+t.clientLeft,a.y=f.y+t.clientTop}else n&&(a.x=Gi(n));let l=r.left+c.scrollLeft-a.x,h=r.top+c.scrollTop-a.y;return{x:l,y:h,width:r.width,height:r.height}}function Nt(e){return F(e).position==="static"}function Yi(e,t){return!N(e)||F(e).position==="fixed"?null:t?t(e):e.offsetParent}function Ji(e,t){let i=M(e);if(Ne(e))return i;if(!N(e)){let n=Q(e);for(;n&&!pe(n);){if(D(n)&&!Nt(n))return n;n=Q(n)}return i}let o=Yi(e,t);for(;o&&$i(o)&&Nt(o);)o=Yi(o,t);return o&&pe(o)&&Nt(o)&&!dt(o)?i:o||zi(e)||i}var pn=async function(e){let t=this.getOffsetParent||Ji,i=this.getDimensions,o=await i(e.floating);return{reference:hn(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:o.width,height:o.height}}};function dn(e){return F(e).direction==="rtl"}var bn={convertOffsetParentRelativeRectToViewportRelativeRect:nn,getDocumentElement:j,getClippingRect:un,getOffsetParent:Ji,getElementRects:pn,getClientRects:sn,getDimensions:fn,getScale:Ce,isElement:D,isRTL:dn};function mn(e,t){let i=null,o,n=j(e);function s(){var c;clearTimeout(o),(c=i)==null||c.disconnect(),i=null}function r(c,a){c===void 0&&(c=!1),a===void 0&&(a=1),s();let{left:l,top:h,width:f,height:m}=e.getBoundingClientRect();if(c||t(),!f||!m)return;let b=Ie(h),u=Ie(n.clientWidth-(l+f)),d=Ie(n.clientHeight-(h+m)),v=Ie(l),y={rootMargin:-b+"px "+-u+"px "+-d+"px "+-v+"px",threshold:P(0,z(1,a))||1},A=!0;function S(E){let H=E[0].intersectionRatio;if(H!==a){if(!A)return r();H?r(!1,H):o=setTimeout(()=>{r(!1,1e-7)},1e3)}A=!1}try{i=new IntersectionObserver(S,{...y,root:n.ownerDocument})}catch{i=new IntersectionObserver(S,y)}i.observe(e)}return r(!0),s}function Zi(e,t,i,o){o===void 0&&(o={});let{ancestorScroll:n=!0,ancestorResize:s=!0,elementResize:r=typeof ResizeObserver=="function",layoutShift:c=typeof IntersectionObserver=="function",animationFrame:a=!1}=o,l=Ht(e),h=n||s?[...l?ke(l):[],...ke(t)]:[];h.forEach(g=>{n&&g.addEventListener("scroll",i,{passive:!0}),s&&g.addEventListener("resize",i)});let f=l&&c?mn(l,i):null,m=-1,b=null;r&&(b=new ResizeObserver(g=>{let[y]=g;y&&y.target===l&&b&&(b.unobserve(t),cancelAnimationFrame(m),m=requestAnimationFrame(()=>{var A;(A=b)==null||A.observe(t)})),i()}),l&&!a&&b.observe(l),b.observe(t));let u,d=a?de(e):null;a&&v();function v(){let g=de(e);d&&(g.x!==d.x||g.y!==d.y||g.width!==d.width||g.height!==d.height)&&i(),d=g,u=requestAnimationFrame(v)}return i(),()=>{var g;h.forEach(y=>{n&&y.removeEventListener("scroll",i),s&&y.removeEventListener("resize",i)}),f?.(),(g=b)==null||g.disconnect(),b=null,a&&cancelAnimationFrame(u)}}var eo=Hi;var to=Wi,io=Ni,oo=Bi;var no=(e,t,i)=>{let o=new Map,n={platform:bn,...i},s={...n.platform,_c:o};return Ii(e,t,{...n,platform:s})};var I=class extends C{boot({options:t}){if(t({reference:null,auto:!0,position:"bottom start",gap:"5",offset:"0",matchWidth:!1}),this.options().reference===null||this.options().position===null)return;let[i,o]=wn(this.el),n=gn(this.el,this.options().reference,i,{position:this.options().position,gap:this.options().gap,offset:this.options().offset,matchWidth:this.options().matchWidth}),s=()=>{};this.reposition=(...r)=>{this.options().auto?s=Zi(this.options().reference,this.el,n):n(...r)},this.cleanup=()=>{s(),o()}}};function gn(e,t,i,{position:o,offset:n,gap:s,matchWidth:r}){return(c=null,a=null)=>{no(t,e,{placement:vn(o),middleware:[io(),to({padding:5,crossAxis:!0}),eo({mainAxis:Number(s),alignmentAxis:Number(n)}),r?oo({apply({rects:l,elements:h}){Object.assign(h.floating.style,{width:`${l.reference.width}px`})}}):void 0]}).then(({x:l,y:h})=>{i(c||l,a||h)})}}function vn(e){return e.split(" ").join("-")}function wn(e){let t=(s,r)=>{Object.assign(e.style,{position:"absolute",inset:`${r}px auto auto ${s}px`})},i,o,n=new MutationObserver(()=>t(i,o));return[(s,r)=>{i=s,o=r,n.disconnect(),t(i,o),n.observe(e,{attributeFilter:["style"]})},()=>{n.disconnect()}]}var Wt=class extends k{boot(){let t=this.trigger(),i=this.overlay();if(t){if(!i)return console.warn("ui-dropdown: no [popover] overlay found",this)}else return console.warn("ui-dropdown: no trigger element found",this);if(this._disabled=this.hasAttribute("disabled"),this._controllable=new $(this),i._popoverable=new R(i),i._anchorable=new I(i,{reference:t,position:this.hasAttribute("position")?this.getAttribute("position"):void 0,gap:this.hasAttribute("gap")?this.getAttribute("gap"):void 0,offset:this.hasAttribute("offset")?this.getAttribute("offset"):void 0}),i._popoverable.onChange(()=>{i._popoverable.getState()?i._anchorable.reposition():i._anchorable.cleanup()}),["ui-menu","ui-context"].includes(i.localName)){let{lock:s,unlock:r}=ut();i._popoverable.onChange(()=>{i._popoverable.getState()?s():r()})}this._controllable.initial(s=>i._popoverable.setState(s)),this._controllable.getter(()=>i._popoverable.getState());let o=te();this._controllable.setter(s=>i._popoverable.setState(s)),i._popoverable.onChange(o(()=>this._controllable.dispatch())),this.hasAttribute("hover")&&xe(t,i,{gain(){i._popoverable.setState(!0)},lose(){i._popoverable.setState(!1)},focusable:!0}),w(t,"click",()=>i._popoverable.toggle()),i._popoverable.getState()?(p(this,"data-open",""),p(t,"data-open",""),p(i,"data-open","")):(x(this,"data-open"),x(t,"data-open"),x(i,"data-open")),i._popoverable.onChange(()=>{i._popoverable.getState()?(p(this,"data-open",""),p(t,"data-open",""),p(i,"data-open","")):(x(this,"data-open"),x(t,"data-open"),x(i,"data-open"))});let n=q(i,"dropdown");p(t,"aria-haspopup","true"),p(t,"aria-controls",n),p(t,"aria-expanded",i._popoverable.getState()?"true":"false"),i._popoverable.onChange(()=>{p(t,"aria-expanded",i._popoverable.getState()?"true":"false")}),i._popoverable.onChange(()=>{i._popoverable.getState()?i.onPopoverShow?.():i.onPopoverHide?.()})}trigger(){return this.querySelector("button")}overlay(){return this.lastElementChild?.matches("[popover]")&&this.lastElementChild}};T("dropdown",Wt);var Bt=class extends k{boot(){let t=this.hasAttribute("label")?"label":"description",i=this.button(),o=this.overlay();if(i){if(!o)return}else return console.warn("ui-tooltip: no trigger element found",this);this._disabled=this.hasAttribute("disabled"),o._popoverable=new R(o,{scope:"tooltip"}),o._anchorable=new I(o,{reference:i,position:this.hasAttribute("position")?this.getAttribute("position"):void 0,gap:this.hasAttribute("gap")?this.getAttribute("gap"):void 0,offset:this.hasAttribute("offset")?this.getAttribute("offset"):void 0}),o._popoverable.onChange(()=>o._anchorable.reposition()),this._disabled||xe(i,o,{gain(){o._popoverable.setState(!0)},lose(){o._popoverable.setState(!1)},focusable:!0,useSafeArea:!1});let n=q(o,"tooltip"),s=this.hasAttribute("interactive"),r=this.hasAttribute("label")||i.textContent.trim()==="";s?(p(i,"aria-controls",n),p(i,"aria-expanded","false"),o._popoverable.onChange(()=>{o._popoverable.getState()?p(i,"aria-expanded","true"):p(i,"aria-expanded","false")})):(r?p(i,"aria-labelledby",n):p(i,"aria-describedby",n),p(o,"aria-hidden","true")),p(o,"role","tooltip")}button(){return this.firstElementChild}overlay(){return this.lastElementChild!==this.button()&&this.lastElementChild}};T("tooltip",Bt);var oe=class extends V{groupOfType=_;boot({options:t}){t({multiple:!1}),this.state=this.options().multiple?new Set:null,this.onChanges=[]}onInitAndChange(t){t(),this.onChanges.push(t)}onChange(t){this.onChanges.push(t)}changed(t,i=!1){if(t.ungrouped)return;let o=t.value,n=t.isSelected(),s=this.options().multiple;n?s?this.state.add(o):this.state=o:s?this.state.delete(o):this.state=null,i||this.onChanges.forEach(r=>r())}getState(){return this.options().multiple?Array.from(this.state):this.state}hasValue(t){return this.options().multiple?this.state.has(t):this.state===t}setState(t){t===null&&(t=this.multiple?[]:""),this.options().multiple?(Array.isArray(t)||(t=[t]),t=t.map(o=>o+"")):t=t+"",this.state=this.options().multiple?new Set(t):t;let i=this.options().multiple?t:[t];this.walker().each(o=>{let n=o.use(_);if(n.ungrouped)return;let s=i.includes(n.value);s&&!n.isSelected()?n.surgicallySelect():!s&&n.isSelected()&&n.surgicallyDeselect()}),this.onChanges.forEach(o=>o())}selected(){return this.walker().find(t=>t.use(_).isSelected()).use(_)}selecteds(){return this.walker().filter(t=>t.use(_).isSelected()).map(t=>t.use(_))}selectFirst(){this.walker().first()?.use(_).select()}selectAll(){this.walker().filter(t=>!t.use(_).isSelected()).map(t=>t.use(_).select())}deselectAll(){this.walker().filter(t=>t.use(_).isSelected()).map(t=>t.use(_).deselect())}allAreSelected(){return this.walker().filter(t=>t.use(_).isSelected()).length===this.walker().filter(t=>!0).length}noneAreSelected(){return this.state===null||this.state?.size===0}selectableByValue(t){return this.walker().find(i=>i.use(_).value===t)?.use(_)}deselectOthers(t){this.walker().each(i=>{i!==t&&i.use(_).surgicallyDeselect()})}selectedTextValue(){return this.options().multiple?Array.from(this.state).map(t=>this.convertValueStringToElementText(t)).join(", "):this.convertValueStringToElementText(this.state)}convertValueStringToElementText(t){let i=this.findByValue(t);return i?i.label||i.value:t}findByValue(t){return this.selecteds().find(i=>i.value===t)}walker(){return B(this.el,(t,{skip:i,reject:o})=>{if(t[this.constructor.name]&&t!==this.el)return o();if(!t[this.groupOfType.name]||t.mixins.get(this.groupOfType.name).ungrouped)return i()})}},_=class extends C{boot({options:t}){this.groupedByType=oe,t({ungrouped:!1,togglable:!1,value:void 0,label:void 0,selectedInitially:!1,dataAttr:"data-selected",ariaAttr:"aria-selected"}),this.ungrouped=this.options().ungrouped,this.value=this.options().value===void 0?this.el.value:this.options().value,this.value=this.value+"",this.label=this.options().label;let i=this.options().selectedInitially;this.group()&&this.group().hasValue(this.value)&&(i=!0),this.multiple=this.hasGroup()?this.group().options().multiple:!1,this.toggleable=this.options().toggleable||this.multiple,this.onSelects=[],this.onUnselects=[],this.onChanges=[],i?this.select(!0):(this.state=i,this.surgicallyDeselect(!0))}mount(){this.el.hasAttribute(this.options().ariaAttr)||p(this.el,this.options().ariaAttr,"false")}onChange(t){this.onChanges.push(t)}onSelect(t){this.onSelects.push(t)}onUnselect(t){this.onUnselects.push(t)}setState(t){t?this.select():this.deselect()}getState(){return this.state}press(){this.toggleable?this.toggle():this.select()}trigger(){this.toggleable?this.toggle():this.select()}toggle(){this.isSelected()?this.deselect():this.select()}isSelected(){return this.state}select(t=!1){let i=!this.isSelected();this.toggleable||this.group()?.deselectOthers(this.el),this.state=!0,p(this.el,this.options().ariaAttr,"true"),p(this.el,this.options().dataAttr,""),i&&(t||(this.onSelects.forEach(o=>o()),this.onChanges.forEach(o=>o())),this.group()?.changed(this,t))}surgicallySelect(){let t=!this.isSelected();this.state=!0,p(this.el,this.options().ariaAttr,"true"),p(this.el,this.options().dataAttr,""),t&&(this.onSelects.forEach(i=>i()),this.onChanges.forEach(i=>i()))}deselect(t=!0){let i=this.isSelected();this.state=!1,p(this.el,this.options().ariaAttr,"false"),x(this.el,this.options().dataAttr),i&&(this.onUnselects.forEach(o=>o()),this.onChanges.forEach(o=>o()),t&&this.group()?.changed(this))}surgicallyDeselect(t=!1){let i=this.isSelected();this.state=!1,p(this.el,this.options().ariaAttr,"false"),x(this.el,this.options().dataAttr),i&&!t&&(this.onUnselects.forEach(o=>o()),this.onChanges.forEach(o=>o()))}getValue(){return this.value}getLabel(){return this.label}};var We=class extends V{groupOfType=L;boot({options:t}){t({wrap:!1,ensureTabbable:!0})}mount(){this.options().ensureTabbable&&this.ensureTabbable()}focusFirst(){let t;t=t||this.walker().find(i=>i.hasAttribute("autofocus")),t=t||this.walker().find(i=>i.getAttribute("tabindex")==="0"),t=t||this.walker().find(i=>i.getAttribute("tabindex")==="-1"),t=t||this.walker().find(i=>Ti(i)),t?.focus()}focusPrev(){this.moveFocus(t=>this.options().wrap?this.walker().prevOrLast(t):this.walker().prev(t))}focusNext(){this.moveFocus(t=>this.options().wrap?this.walker().nextOrFirst(t):this.walker().next(t))}focusBySearch(t){let i=this.walker().find(o=>o.textContent.toLowerCase().trim().startsWith(t.toLowerCase()));i?.use(L).tabbable(),i?.use(L).focus()}moveFocus(t){let i=this.walker().find(n=>n.use(L).isTabbable());t(i)?.use(L).focus()}ensureTabbable(){this.walker().findOrFirst(t=>{t.use(L).isTabbable()})?.use(L).tabbable()}wipeTabbables(){this.walker().each(t=>{t.use(L).untabbable()})}untabbleOthers(t){this.walker().each(i=>{i!==t&&i.use(L).untabbable()})}walker(){return B(this.el,(t,{skip:i,reject:o})=>{if(t[this.constructor.name]&&t!==this.el)return o();if(!t[this.groupOfType.name])return i();if(t.hasAttribute("disabled"))return o()})}},L=class extends C{groupedByType=We;boot({options:t}){t({hover:!1,disableable:null,tabbable:!1,tabbableAttr:null})}mount(){let t=this.options().disableable;if(!t)throw"Focusable requires a Disableable instance...";this.el.hasAttribute("tabindex")||(this.options().tabbable?this.tabbable():this.untabbable()),this.pauseFocusListener=this.on("focus",t.enabled(()=>{this.focus(!1)})).pause,this.on("focus",t.enabled(()=>{Mt()&&p(this.el,"data-focus","")})),this.on("blur",t.enabled(()=>{x(this.el,"data-focus")})),this.options().hover&&this.on("pointerenter",t.enabled(()=>{this.group()?.untabbleOthers(this.el),this.tabbable()})),this.options().hover&&this.on("pointerleave",t.enabled(i=>{this.untabbable()}))}focus(t=!0){this.group()?.untabbleOthers(this.el),this.tabbable(),t&&this.pauseFocusListener(()=>{this.el.focus({focusVisible:!1})})}tabbable(){p(this.el,"tabindex","0"),this.options().tabbableAttr&&p(this.el,this.options().tabbableAttr,"")}untabbable(){p(this.el,"tabindex","-1"),this.options().tabbableAttr&&x(this.el,this.options().tabbableAttr)}isTabbable(){return this.el.getAttribute("tabindex")==="0"}};var ne=class extends C{boot({options:t}){this.onChanges=[],Object.defineProperty(this.el,"disabled",{get:()=>this.el.hasAttribute("disabled"),set:o=>{o?this.el.setAttribute("disabled",""):this.el.removeAttribute("disabled")}}),this.el.hasAttribute("disabled")?this.el.disabled=!0:this.el.closest("[disabled]")&&(this.el.disabled=!0),new MutationObserver(o=>{this.onChanges.forEach(n=>n(this.el.disabled))}).observe(this.el,{attributeFilter:["disabled"]})}onChange(t){this.onChanges.push(t)}onInitAndChange(t){t(this.el.disabled),this.onChanges.push(t)}enabled(t){return(...i)=>{if(!this.el.disabled)return t(...i)}}disabled(t){return(...i)=>{if(this.el.disabled)return t(...i)}}};var Be=class extends V{groupOfType=O;boot({options:t}){t({wrap:!1,filter:!1}),this.onChanges=[]}onChange(t){this.onChanges.push(t)}activated(t){this.onChanges.forEach(i=>i())}activateFirst(){this.filterAwareWalker().first()?.use(O).activate()}activateBySearch(t){this.filterAwareWalker().find(o=>o.textContent.toLowerCase().trim().startsWith(t.toLowerCase()))?.use(O).activate()}activateSelectedOrFirst(t){if(!t||(o=>o.matches("ui-option")?getComputedStyle(o).display==="none":!1)(t)){this.filterAwareWalker().first()?.use(O).activate();return}t?.use(O).activate()}activateActiveOrFirst(){let t=this.getActive();if(!t){this.filterAwareWalker().first()?.use(O).activate();return}t?.use(O).activate()}activateActiveOrLast(){let t=this.getActive();if(!t){this.filterAwareWalker().last()?.use(O).activate();return}t?.use(O).activate()}activatePrev(){let t=this.getActive();if(!t){this.filterAwareWalker().last()?.use(O).activate();return}let i;this.options.wrap?i=this.filterAwareWalker().prevOrLast(t):i=this.filterAwareWalker().prev(t),i?.use(O).activate()}activateNext(){let t=this.getActive();if(!t){this.filterAwareWalker().first()?.use(O).activate();return}let i;this.options.wrap?i=this.filterAwareWalker().nextOrFirst(t):i=this.filterAwareWalker().next(t),i?.use(O).activate()}getActive(){return this.walker().find(t=>t.use(O).isActive())}clearActive(){this.getActive()?.use(O).deactivate()}filterAwareWalker(){let t=i=>i.matches("ui-option")?getComputedStyle(i).display==="none":!1;return B(this.el,(i,{skip:o,reject:n})=>{if(i[this.constructor.name]&&i!==this.el)return n();if(!i[this.groupOfType.name])return o();if(i.hasAttribute("disabled")||t(i))return n()})}},O=class e extends C{groupedByType=Be;mount(){this.el.addEventListener("mouseenter",()=>{this.activate()}),this.el.addEventListener("mouseleave",()=>{this.deactivate()})}activate(){this.group()&&this.group().walker().each(t=>t.use(e).deactivate(!1)),p(this.el,"data-active",""),this.el.scrollIntoView({block:"nearest"}),this.group()&&this.group().activated(this.el)}deactivate(t=!0){x(this.el,"data-active"),t&&this.group()&&this.group().activated(this.el)}isActive(){return this.el.hasAttribute("data-active")}};var qe=class extends V{groupOfType=be;boot({options:t}){t({}),this.onChanges=[],this.lastSearch=""}onChange(t){this.onChanges.push(t)}filter(t){t===""?this.walker().each(i=>{i.use(be).unfilter()}):this.walker().each(i=>{this.matches(i,t)?i.use(be).unfilter():i.use(be).filter()}),this.lastSearch!==t&&this.onChanges.forEach(i=>i()),this.lastSearch=t}matches(t,i){return t.textContent.toLowerCase().trim().includes(i.toLowerCase().trim())}hasResults(){return this.walker().some(t=>!t.use(be).isFiltered())}},be=class extends C{groupedByType=qe;boot({options:t}){t({mirror:null,keep:!1}),this.onChanges=[]}filter(){this.options().keep||(p(this.el,"data-hidden",""),this.options().mirror&&p(this.options().mirror,"data-hidden",""))}unfilter(){x(this.el,"data-hidden"),this.options().mirror&&x(this.options().mirror,"data-hidden","")}isFiltered(){return this.el.hasAttribute("data-hidden")}};var gt=class extends k{boot(){if(this.querySelectorAll("[data-appended]").forEach(t=>t.remove()),!this.querySelector("template")){let t=document.createElement("template");t.setAttribute("name","placeholder"),t.innerHTML=""+this.innerHTML+"",this.innerHTML="",this.appendChild(t)}if(!this.querySelector('template[name="options"]')){let t=document.createElement("template");t.setAttribute("name","options"),t.innerHTML="
",this.appendChild(t)}if(!this.querySelector('template[name="option"]')){let t=document.createElement("template");t.setAttribute("name","option"),t.innerHTML="
",this.appendChild(t)}this.templates={placeholder:this.querySelector('template[name="placeholder"]'),overflow:this.querySelector('template[name="overflow"]'),options:this.querySelector('template[name="options"]'),option:this.querySelector('template[name="option"]')},this.templates.options.elsByValue=new Map,this.max=this.templates.overflow?.getAttribute("max")?this.templates.overflow.getAttribute("max"):1/0,this.selecteds=new Map,this.picker=this.closest("ui-select"),this.multiple=this.picker.hasAttribute("multiple")}mount(){queueMicrotask(()=>{this.picker._selectable.onInitAndChange(()=>{this.render(!0)});let t=this.picker.list();t&&new MutationObserver(i=>{queueMicrotask(()=>this.render())}).observe(t,{childList:!0})})}render(t){if(this.multiple){let i=this.picker.value,o=Array.from(this.selecteds.keys()).filter(r=>!i.includes(r)),n=i.filter(r=>!this.selecteds.has(r));o.forEach(r=>this.selecteds.delete(r));let s=new Map;for(let r of n){let c=this.picker._selectable.findByValue(r);if(!c){if(t)return setTimeout(()=>this.render());throw`Could not find option for value "${r}"`}s.set(r,c)}s.forEach((r,c)=>this.selecteds.set(c,r)),this.templates.placeholder?.clearPlaceholder?.(),this.templates.overflow?.clearOverflow?.(),this.templates.options?.clearOptions?.(),this.selecteds.size>0?this.renderOptions({hasOverflowed:r=>{if(this.max==="auto"){let c=!1;if(this.renderOverflow(this.selecteds.size,this.selecteds.size-r),this.clientWidthparseInt(this.max)},renderOverflow:r=>{this.templates?.overflow?.getAttribute("mode")!=="append"&&this.templates.options?.clearOptions?.(),this.renderOverflow(this.selecteds.size,r)}}):this.renderPlaceholder()}else{let i=this.picker.value;if(Array.from(this.selecteds.keys()).includes(i))return;this.selecteds.clear();let o=this.picker._selectable.findByValue(i);if(o)this.selecteds.set(i,o);else if(!["",null,void 0].includes(i)){if(t)return setTimeout(()=>{console.log("retrying..."),this.render()});throw`Could not find option for value "${i}"`}this.templates.placeholder?.clearPlaceholder?.(),this.templates.option?.clearOption?.(),this.selecteds.size>0?this.renderOption():this.renderPlaceholder()}}renderOptions({hasOverflowed:t,renderOverflow:i}){let o=document.createElement("div");o.style.display="contents";let n=Ve(this.templates.options,{default:o});this.templates.options.after(n),this.templates.options.clearOptions=()=>{n.remove(),this.templates.options.clearOptions=()=>{}};let s=0,r=!1;for(let[a,l]of this.selecteds){let h=new DocumentFragment;h.append(...l.el.cloneNode(!0).childNodes);let f=Ve(this.templates.option,{text:l.el.textContent.trim(),default:h,value:a});if(f.setAttribute("data-value",a),f.setAttribute("data-appended",""),f.deselect=()=>l.deselect(),o.appendChild(f),s++,t(s)){r=!0,o.removeChild(f),s--;break}}let c=new DocumentFragment;c.append(...o.childNodes),o.replaceWith(c),r&&i(this.selecteds.size-s)}renderOption(){for(let[t,i]of this.selecteds){let o=new DocumentFragment;o.append(...i.el.cloneNode(!0).childNodes);let n=Ve(this.templates.option,{text:i.el.textContent.trim(),default:o,value:t});n.setAttribute("data-value",t),n.setAttribute("data-appended",t),n.deselect=()=>i.deselect(),this.templates.option.after(n),this.templates.option.clearOption=()=>{n.remove(),this.templates.option.clearOption=()=>{}}}}renderPlaceholder(){if(!this.templates.placeholder)return;let t=Ve(this.templates.placeholder);this.templates.placeholder.after(t),this.templates.placeholder.clearPlaceholder=()=>{t.remove(),this.templates.placeholder.clearPlaceholder=()=>{}}}renderOverflow(t,i){if(!this.templates.overflow)return;let o=Ve(this.templates.overflow,{remainder:i,count:this.selecteds.size});o.setAttribute("data-appended",""),this.templates.overflow.after(o),this.templates.overflow.clearOverflow=()=>{o.remove(),this.templates.placeholder.clearOverflow=()=>{}}}};function Ve(e,t={}){let i=e.content.cloneNode(!0);return Object.entries(t).forEach(([o,n])=>{(o==="default"?i.querySelectorAll("slot:not([name])"):i.querySelectorAll(`slot[name="${o}"]`)).forEach(r=>r.replaceWith(typeof n=="string"?document.createTextNode(n):n))}),i.firstElementChild}var je=class extends ft{boot(){let t=this.list();this._controllable=new $(this),this._selectable=new oe(t,{multiple:this.hasAttribute("multiple")}),this._controllable.initial(o=>o&&this._selectable.setState(o)),this._controllable.getter(()=>this._selectable.getState());let i=te();this._controllable.setter(i(o=>{this._selectable.setState(o)})),this._selectable.onChange(i(()=>{this._controllable.dispatch(),this.dispatchEvent(new CustomEvent("select",{bubbles:!1}))}))}mount(){this._disableable=new ne(this);let t=this.input(),i=this.button(),o=this.list(),n=this.hasAttribute("multiple"),s=this.hasAttribute("autocomplete"),r=this.hasAttribute("autocomplete")&&this.getAttribute("autocomplete").trim().split(" ").includes("strict"),c=this.querySelector("ui-options")||this,a=yn(c,"options");this._activatable=new Be(c,{filter:"data-hidden"}),!t&&!i&&this._disableable.onInitAndChange(u=>{u?this.removeAttribute("tabindex"):this.setAttribute("tabindex","0")}),this.hasAttribute("filter")&&this.getAttribute("filter")!=="manual"&&(this._filterable=new qe(o),this._filterable.onChange(()=>{this._activatable.clearActive(),this._filterable.hasResults()&&this._activatable.activateFirst()}),this.addEventListener("close",()=>{this._filterable&&this._filterable.filter("")}));let l=this.querySelector("[popover]:not(ui-tooltip > [popover])"),h=l?.querySelector("input"),f=this.querySelector("input");f=l?.contains(f)?null:f;let m=this.querySelector("button");if(m=l?.contains(m)?null:m,!(l||f))$e(this,this._activatable),ze(this,this,this._activatable),ro(this,this._activatable,this._selectable);else if(!l&&f){let u=f;this._disableable.onInitAndChange(d=>{d?u&&p(u,"disabled",""):u&&x(u,"disabled")}),Yt(this,u,this._selectable,this._popoverable),ro(u,this._activatable,this._selectable),co(s,r,this,u,this._selectable,this._popoverable),Ut(u),jt(u),this._filterable&&zt(u,this._filterable),lo(u,this._activatable),$e(u,this._activatable),ze(this,u,this._activatable),vt(this,this._activatable)}else if(l&&f){let u=f;p(u,"role","combobox"),p(u,"aria-controls",a);let d=l;this._popoverable=new R(d),this._anchorable=new I(d,{reference:u,matchWidth:!0,position:this.hasAttribute("position")?this.getAttribute("position"):void 0,gap:this.hasAttribute("gap")?this.getAttribute("gap"):void 0,offset:this.hasAttribute("offset")?this.getAttribute("offset"):void 0}),co(s,r,this,u,this._selectable,this._popoverable),this._disableable.onInitAndChange(v=>{v?u&&p(u,"disabled",""):u&&x(u,"disabled")}),this.querySelectorAll("button").forEach(v=>{d.contains(v)||(p(v,"tabindex","-1"),p(v,"aria-controls",a),p(v,"aria-haspopup","listbox"),wt(v,this._popoverable),w(v,"click",()=>{this._popoverable.toggle(),u.focus()}))}),Yt(this,u,this._selectable,this._popoverable),qt(this,u,d,this._popoverable,this._anchorable),Xt(this,this._popoverable),wt(u,this._popoverable),Ut(u),jt(u),this._filterable&&zt(u,this._filterable),lo(u,this._activatable),Sn(u,this._popoverable),$t(u,this._popoverable,this._activatable,this._selectable),An(u,this._popoverable),$e(u,this._activatable),ze(this,u,this._activatable),vt(this,this._activatable),Vt(this._popoverable,this._activatable,this._selectable),Kt(this,this._selectable,this._popoverable,n)}else if(l&&h){let u=m,d=h,v=l;p(u,"role","combobox"),p(d,"role","combobox"),p(u,"aria-controls",a),this._disableable.onInitAndChange(g=>{g?(u&&p(u,"disabled",""),d&&p(d,"disabled","")):(u&&x(u,"disabled"),d&&x(d,"disabled"))}),this._popoverable=new R(v),this._anchorable=new I(v,{reference:u,matchWidth:!0,position:this.hasAttribute("position")?this.getAttribute("position"):void 0,gap:this.hasAttribute("gap")?this.getAttribute("gap"):void 0,offset:this.hasAttribute("offset")?this.getAttribute("offset"):void 0}),Ut(d),jt(d),this._filterable&&zt(d,this._filterable),xn(d,this._popoverable),qt(this,u,v,this._popoverable,this._anchorable),Xt(this,this._popoverable),wt(u,this._popoverable),Yt(this,d,this._selectable,this._popoverable),$t(u,this._popoverable,this._activatable,this._selectable),ao(u,this._popoverable),$e(d,this._activatable),so(u,this._activatable,this._popoverable),ze(this,d,this._activatable),vt(this,this._activatable),Vt(this._popoverable,this._activatable,this._selectable),Kt(this,this._selectable,this._popoverable,n)}else if(l){let u=m,d=l;p(u,"role","combobox"),p(u,"aria-controls",a),this._disableable.onInitAndChange(v=>{v?(u&&p(u,"disabled",""),t&&p(t,"disabled","")):(u&&x(u,"disabled"),t&&x(t,"disabled"))}),this._popoverable=new R(d),this._anchorable=new I(d,{reference:u,matchWidth:!0,position:this.hasAttribute("position")?this.getAttribute("position"):void 0,gap:this.hasAttribute("gap")?this.getAttribute("gap"):void 0,offset:this.hasAttribute("offset")?this.getAttribute("offset"):void 0}),qt(this,u,d,this._popoverable,this._anchorable),Xt(this,this._popoverable),wt(u,this._popoverable),$t(u,this._popoverable,this._activatable,this._selectable),ao(u,this._popoverable),$e(u,this._activatable),so(u,this._activatable,this._popoverable),ze(this,u,this._activatable),vt(this,this._activatable),Vt(this._popoverable,this._activatable,this._selectable),Kt(this,this._selectable,this._popoverable,n)}new MutationObserver(()=>{setTimeout(()=>{if(!this._popoverable||this._popoverable.getState()){let u=this._selectable.selecteds()[0]?.el;queueMicrotask(()=>{this._activatable.activateSelectedOrFirst(u)})}else this._activatable.clearActive()})}).observe(o,{childList:!0})}button(){return this.querySelector("button:has(+ [popover])")}input(){return this.querySelector("input")}list(){return this.querySelector("ui-options")||this}clear(){this.input()&&(this.input().value="",this.input().dispatchEvent(new Event("input",{bubbles:!1})))}open(){this._popoverable.setState(!0)}close(){this._popoverable.setState(!1)}deselectLast(){!this.hasAttribute("multiple")&&this.value!==null&&(this.value=null,this.dispatchEvent(new Event("input",{bubbles:!1})),this.dispatchEvent(new Event("change",{bubbles:!1}))),this.hasAttribute("multiple")&&this.value.length!==0&&(this.value=this.value.slice(0,-1),this.dispatchEvent(new Event("input",{bubbles:!1})),this.dispatchEvent(new Event("change",{bubbles:!1})))}},Gt=class extends k{boot(){p(this,"data-hidden","")}mount(){queueMicrotask(()=>{let t=this.closest("ui-autocomplete, ui-combobox, ui-select"),i=this.closest("ui-options");if(!i)return;let o=c=>getComputedStyle(c).display==="none",n=()=>{let c;CSS.supports("selector(&)")?c=Array.from(i.querySelectorAll("& > ui-option")).filter(a=>!o(a)).length===0:c=Array.from(i.querySelectorAll(":scope > ui-option")).filter(a=>!o(a)).length===0,c?x(this,"data-hidden"):p(this,"data-hidden","")};n();let s=t._filterable;s&&s.onChange(n),new MutationObserver(c=>{setTimeout(()=>n())}).observe(i,{childList:!0})})}};T("selected",gt);T("select",je);T("empty",Gt);W(({css:e})=>e`ui-select { display: block; }`);W(({css:e})=>e`ui-selected-option { display: contents; }`);W(({css:e})=>e`ui-empty { display: block; cursor: default; }`);function $e(e,t){w(e,"keydown",i=>{["ArrowDown","ArrowUp","Escape"].includes(i.key)&&(i.key==="ArrowDown"?(t.activateNext(),i.preventDefault(),i.stopPropagation()):i.key==="ArrowUp"&&(t.activatePrev(),i.preventDefault(),i.stopPropagation()))})}function so(e,t,i){ct(e,o=>{t.activateBySearch(o),i.getState()||t.getActive()?.click()})}function ze(e,t,i){w(t,"keydown",o=>{if(o.key==="Enter"){let n=i.getActive();if(o.preventDefault(),o.stopPropagation(),!n)return;n.click(),e.dispatchEvent(new CustomEvent("action",{bubbles:!1,cancelable:!1}))}})}function vt(e,t,i=!1){w(e,i?"pointerdown":"click",o=>{if(o.target.closest("ui-option")){let n=o.target.closest("ui-option");if(n._disabled)return;n._selectable?.trigger(),e.dispatchEvent(new CustomEvent("action",{bubbles:!1,cancelable:!1})),o.preventDefault(),o.stopPropagation()}})}function ro(e,t,i){w(e,"focus",()=>{let o=i.selecteds()[0]?.el;t.activateSelectedOrFirst(o)}),w(e,"blur",()=>{t.clearActive()})}function yn(e){let t=q(e,"options");return p(e,"role","listbox"),t}function wt(e,t){p(e,"aria-haspopup","listbox");let i=()=>{p(e,"aria-expanded",t.getState()?"true":"false"),t.getState()?p(e,"data-open",""):x(e,"data-open","")};t.onChange(()=>{i()}),i()}function qt(e,t,i,o,n){let s=()=>{Array.from([e,i]).forEach(r=>{o.getState()?p(r,"data-open",""):x(r,"data-open","")}),o.getState()&&n.reposition()};o.onChange(()=>s()),s(),o.onChange(()=>{o.getState()?e.dispatchEvent(new Event("open",{bubbles:!1,cancelable:!1})):e.dispatchEvent(new Event("close",{bubbles:!1,cancelable:!1}))})}function Vt(e,t,i){e.onChange(()=>{if(e.getState()){let o=i.selecteds()[0]?.el;queueMicrotask(()=>{t.activateSelectedOrFirst(o)})}else t.clearActive()})}function $t(e,t){w(e,"keydown",i=>{["ArrowDown","ArrowUp","Escape"].includes(i.key)&&(i.key==="ArrowDown"||i.key==="ArrowUp"?t.getState()||(t.setState(!0),i.preventDefault(),i.stopImmediatePropagation()):i.key==="Escape"&&t.getState()&&t.setState(!1))})}function An(e,t){w(e,"click",()=>{t.getState()||(t.setState(!0),e.focus())})}function ao(e,t){w(e,"click",()=>{t.setState(!t.getState()),e.focus()})}function xn(e,t){t.onChange(()=>{t.getState()&&setTimeout(()=>e.focus())})}function zt(e,t){t&&w(e,"input",i=>{t.filter(i.target.value)})}function jt(e){w(e,"focus",()=>e.select())}function Ut(e){w(e,"change",t=>t.stopPropagation()),w(e,"input",t=>t.stopPropagation())}function Sn(e,t){w(e,"keydown",i=>{(/^[a-zA-Z0-9]$/.test(i.key)||i.key==="Backspace")&&(t.getState()||t.setState(!0))})}function Yt(e,t,i,o){if(!e.hasAttribute("clear"))return;let s=f=>{t.value=f,t.dispatchEvent(new Event("input",{bubbles:!1}))},r=e.getAttribute("clear"),c=r===""||r.split(" ").includes("action"),a=r===""||r.split(" ").includes("select"),l=r===""||r.split(" ").includes("close"),h=r===""||r.split(" ").includes("esc");r==="none"&&(c=a=l=h=!1),c?e.addEventListener("action",f=>{s("")}):a&&i.onChange(()=>{queueMicrotask(()=>s(""))}),l&&o.onChange(()=>{o.getState()||s("")}),h&&w(t,"keydown",f=>{f.key==="Escape"&&s("")})}function Kt(e,t,i,o){let n=!o,s=!o;if(e.hasAttribute("close")){let r=e.getAttribute("close");n=r===""||r.split(" ").includes("action"),s=r.split(" ").includes("select"),r==="none"&&(n=s=!1)}n?e.addEventListener("action",r=>{i.setState(!1)}):s&&t.onChange(()=>{i.setState(!1)})}function lo(e,t){t.onChange(()=>{let i=t.getActive();i?p(e,"aria-activedescendant",i.id):x(e,"aria-activedescendant")})}function co(e,t,i,o,n,s){if(!e){p(o,"autocomplete","off"),p(o,"aria-autocomplete","none");return}let r=c=>{o.value=c,o.dispatchEvent(new Event("input",{bubbles:!1}))};p(o,"autocomplete","off"),p(o,"aria-autocomplete","list"),queueMicrotask(()=>{n.onInitAndChange(()=>{o.value=n.selectedTextValue()})}),i.addEventListener("action",c=>{r(n.selectedTextValue())}),t&&s.onChange(()=>{s.getState()||r(n.selectedTextValue())})}function Xt(e,t){let{lock:i,unlock:o}=ut();t.onChange(()=>{t.getState()?i():o()})}var Qt=class e extends k{boot(){if(this._focusable=new We(this,{wrap:!1,ensureTabbable:!1}),w(this,"keydown",t=>{["ArrowDown"].includes(t.key)?(t.target===this?this._focusable.focusFirst():this._focusable.focusNext(),t.preventDefault(),t.stopPropagation()):["ArrowUp"].includes(t.key)&&(t.target===this?this._focusable.focusFirst():this._focusable.focusPrev(),t.preventDefault(),t.stopPropagation())}),ct(this,t=>this._focusable.focusBySearch(t)),this.hasAttribute("popover")&&this.addEventListener("lofi-close-popovers",()=>{setTimeout(()=>this.hidePopover(),50)}),this.parentElement.localName==="ui-dropdown"){let t=this.parentElement;w(t.trigger(),"keydown",i=>{i.key==="ArrowDown"&&(this.fromArrowDown=!0,this.showPopover(),i.preventDefault(),i.stopPropagation())})}p(this,"role","menu"),p(this,"tabindex","-1")}mount(){this.initializeMenuItems(),new MutationObserver(i=>{this.initializeMenuItems()}).observe(this,{childList:!0,subtree:!0})}onPopoverShow(){queueMicrotask(()=>{this.fromArrowDown?(this._focusable.focusFirst(),this.fromArrowDown=!1):this.focus()})}onPopoverHide(){this._focusable.wipeTabbables()}initializeMenuItems(){this.walker().each(t=>{t._disableable||En(t)})}walker(){return B(this,(t,{skip:i,reject:o})=>{if(t instanceof e||t instanceof je)return o();if(!["a","button"].includes(t.localName))return i()})}},Jt=class extends k{boot(){}},Zt=class extends k{boot(){this._disabled=this.hasAttribute("disabled"),this._disableable=new ne(this);let t=this;if(this._disabled&&(p(t,"disabled",""),p(t,"aria-disabled","true")),q(t,"menu-checkbox"),p(t,"role","menuitemcheckbox"),this._disabled)return;t._focusable=new L(t,{disableable:this._disableable,hover:!0,tabbableAttr:"data-active"}),t._selectable=new _(t,{toggleable:!0,value:this.hasAttribute("value")?this.getAttribute("value"):t.textContent.trim(),label:this.hasAttribute("label")?this.getAttribute("label"):t.textContent.trim(),dataAttr:"data-checked",ariaAttr:"aria-checked",selectedInitially:this.hasAttribute("checked")}),this._controllable=new $(this),this._controllable.initial(o=>o&&t._selectable.setState(o)),this._controllable.getter(()=>t._selectable.getState());let i=te();this._controllable.setter(i(o=>{this._selectable.setState(o)})),this._selectable.onChange(i(()=>{this._controllable.dispatch()})),w(t,"click",()=>{this.dispatchEvent(new CustomEvent("lofi-close-popovers",{bubbles:!0})),t._selectable.press()}),oi(t)}},ei=class extends k{boot(){this._disabled=this.hasAttribute("disabled"),this._disableable=new ne(this);let t=this;this._disabled&&(p(t,"disabled",""),p(t,"aria-disabled","true")),q(t,"menu-radio"),p(t,"role","menuitemradio"),!this._disabled&&(t._focusable=new L(t,{disableable:this._disableable,hover:!0,tabbableAttr:"data-active"}),t._selectable=new _(t,{toggleable:!1,value:this.hasAttribute("value")?this.getAttribute("value"):t.textContent.trim(),label:this.hasAttribute("label")?this.getAttribute("label"):t.textContent.trim(),dataAttr:"data-checked",ariaAttr:"aria-checked",selectedInitially:this.hasAttribute("checked")}),w(t,"click",()=>{this.dispatchEvent(new CustomEvent("lofi-close-popovers",{bubbles:!0})),t._selectable.press()}),oi(t))}},ti=class extends k{boot(){this._selectable=new oe(this),this._controllable=new $(this),p(this,"role","group"),this._controllable.initial(i=>i&&this._selectable.setState(i)),this._controllable.getter(()=>this._selectable.getState());let t=te();this._controllable.setter(t(i=>{this._selectable.setState(i)})),this._selectable.onChange(t(()=>{this._controllable.dispatch()}))}},ii=class extends k{boot(){this._selectable=new oe(this,{multiple:!0}),this._controllable=new $(this),p(this,"role","group"),this._controllable.initial(i=>i&&this._selectable.setState(i)),this._controllable.getter(()=>this._selectable.getState());let t=te();this._controllable.setter(t(i=>{this._selectable.setState(i)})),this._selectable.onChange(t(()=>{this._controllable.dispatch()}))}};W(({css:e})=>e`ui-menu[popover]:popover-open { display: block; }`);W(({css:e})=>e`ui-menu[popover].\:popover-open { display: block; }`);W(({css:e})=>e`ui-menu-checkbox, ui-menu-radio { cursor: default; display: contents; }`);T("menu",Qt);T("submenu",Jt);T("menu-checkbox",Zt);T("menu-radio",ei);T("menu-radio-group",ti);T("menu-checkbox-group",ii);function oi(e){w(e,"keydown",t=>{t.key==="Enter"&&(e.click(),t.preventDefault(),t.stopPropagation())}),w(e,"keydown",t=>{t.key===" "&&(t.preventDefault(),t.stopPropagation())}),w(e,"keyup",t=>{t.key===" "&&(e.click(),t.preventDefault(),t.stopPropagation())})}function En(e){e._disableable=new ne(e),e._disabled=e.hasAttribute("disabled");let t=e.querySelector("a"),i=e,o=e.parentElement.matches("ui-submenu")&&e.parentElement.querySelector("ui-menu[popover]"),n=t||i;if(e._disabled&&(p(n,"disabled",""),p(n,"aria-disabled","true")),q(n,"menu-item"),p(n,"role","menuitem"),!e._disabled)if(n._focusable=new L(n,{disableable:e._disableable,hover:!0,tabbableAttr:"data-active"}),!o)e.hasAttribute("disabled")||w(e,"click",()=>{e.dispatchEvent(new CustomEvent("lofi-close-popovers",{bubbles:!0}))}),oi(i);else{o._popoverable=new R(o,{trigger:i}),o._anchorable=new I(o,{reference:i,position:o.hasAttribute("position")?o.getAttribute("position"):"right start",gap:o.hasAttribute("gap")?o.getAttribute("gap"):"-5"}),i.addEventListener("click",r=>{o._popoverable.setState(!0)});let{clear:s}=xe(i,o,{gain(){o._popoverable.setState(!0)},lose(){o._popoverable.setState(!1)},focusable:!1});o._popoverable.onChange(()=>{o._popoverable.getState()||(s(),o._focusable.wipeTabbables()),o._anchorable.reposition()}),w(i,"keydown",r=>{r.key==="Enter"&&(o._popoverable.setState(!0),setTimeout(()=>o._focusable.focusFirst()))}),w(i,"keydown",r=>{r.key==="ArrowRight"&&(o._popoverable.setState(!0),setTimeout(()=>o._focusable.focusFirst()))}),w(o,"keydown",r=>{r.key==="ArrowLeft"&&(o._popoverable.setState(!1),i.focus(),r.stopPropagation())})}}var yt=kn();yt&&W(({css:e})=>e`:root.dark { color-scheme: dark; }`);document.addEventListener("alpine:init",()=>{let e=Alpine.reactive({toast(...i){let o={slots:{},dataset:{}};typeof i[0]=="string"&&(o.slots.text=i.shift()),typeof i[0]=="string"&&(o.slots.heading=o.slots.text,o.slots.text=i.shift());let n=i.shift()||{};n.text&&(o.slots.text=n.text),n.heading&&(o.slots.heading=n.heading),n.variant&&(o.dataset.variant=n.variant),n.position&&(o.dataset.position=n.position),document.dispatchEvent(new CustomEvent("toast-show",{detail:o}))},modal(i){return{show(){document.dispatchEvent(new CustomEvent("modal-show",{detail:{name:i}}))},close(){document.dispatchEvent(new CustomEvent("modal-close",{detail:{name:i}}))}}},modals(){return{close(){document.dispatchEvent(new CustomEvent("modal-close",{detail:{}}))}}},appearance:window.localStorage.getItem("flux.appearance")||"system",systemAppearanceChanged:1,get dark(){return JSON.stringify(e.systemAppearanceChanged),e.appearance==="system"?window.matchMedia("(prefers-color-scheme: dark)").matches:e.appearance==="dark"},set dark(i){let o=this.dark;i!==o&&(i?e.appearance="dark":e.appearance="light")}});window.Flux=e,Alpine.magic("flux",()=>e),yt&&Alpine.effect(()=>{ni(e.appearance)}),yt&&document.addEventListener("livewire:navigated",()=>{ni(e.appearance)});let t=window.matchMedia("(prefers-color-scheme: dark)");yt&&t.addEventListener("change",()=>{e.systemAppearanceChanged++,ni(e.appearance)})});function ni(e){let t=()=>document.documentElement.classList.add("dark"),i=()=>document.documentElement.classList.remove("dark");if(e==="system"){let o=window.matchMedia("(prefers-color-scheme: dark)");window.localStorage.removeItem("flux.appearance"),o.matches?t():i()}else e==="dark"?(window.localStorage.setItem("flux.appearance","dark"),t()):e==="light"&&(window.localStorage.setItem("flux.appearance","light"),i())}function kn(){let e=document.createElement("div");e.setAttribute("data-flux-dark-mode-beacon",""),document.body.appendChild(e);let t=getComputedStyle(e).display==="none";e.classList.add("dark:[&[data-flux-dark-mode-beacon]]:hidden"),e.classList.add("dark");let i=getComputedStyle(e).display==="none",o=!t&&i;return e.remove(),o}!Ei()&&!ki()&&_i();})(); diff --git a/dist/manifest.json b/dist/manifest.json index 5346cae..eca1338 100644 --- a/dist/manifest.json +++ b/dist/manifest.json @@ -1,4 +1,4 @@ { - "/flux.js": "0c4e58f5", + "/flux.js": "15cf1484", "/flux.css": "4eb69270" } \ No newline at end of file