diff --git a/dist/flux-lite.min.js b/dist/flux-lite.min.js index 6ea2c41..0ef1dda 100644 --- a/dist/flux-lite.min.js +++ b/dist/flux-lite.min.js @@ -1 +1 @@ -(()=>{function Z(i){let t=i({css:(s,...n)=>s.raw[0]+n.join("")});if(document.adoptedStyleSheets===void 0){let s=document.createElement("style");s.textContent=t,document.head.appendChild(s);return}let e=new CSSStyleSheet;e.replaceSync(t),document.adoptedStyleSheets=[...document.adoptedStyleSheets,e]}function we(i,t){let e=i;for(;e;){if(t(e))return e;e=e.parentElement}}function B(i,t){let e=document.createTreeWalker(i,NodeFilter.SHOW_ELEMENT,t?{acceptNode:s=>{let n,o;return t(s,{skip:()=>n=!0,reject:()=>o=!0}),n?NodeFilter.FILTER_SKIP:o?NodeFilter.FILTER_REJECT:NodeFilter.FILTER_ACCEPT}}:{});return new zt(e)}var zt=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 e=this.next(t);return e||(this.walker.currentNode=this.walker.root,this.first())}prev(t){return this.walker.currentNode=t,this.walker.previousSibling()}prevOrLast(t){let e=this.prev(t);return e||(this.walker.currentNode=this.walker.root,this.last())}closest(t,e){let s=this.from(t).walker;for(;s.currentNode;){if(e(s.currentNode))return s.currentNode;s.parentNode()}}contains(t){return this.find(e=>e===t)}find(t){return this.walk((e,s)=>{t(e)&&s(e)})}findOrFirst(t){return this.find(t)||(this.walker.currentNode=this.walker.root),this.first()}each(t){this.walk(e=>t(e))}some(t){return!!this.find(t)}every(t){let e=!0;return this.walk(s=>{t(s)||(e=!1)}),e}map(t){let e=[];return this.walk(s=>e.push(t(s))),e}filter(t){let e=[];return this.walk(s=>t(s)&&e.push(s)),e}walk(t){let e,s=this.walker,n;for(;s.nextNode()&&(e=s.currentNode,t(e,o=>n=o),n===void 0););return n}};function T(i,t){customElements.define(`ui-${i}`,t)}function w(i,t,e,s={}){return i.addEventListener(t,e,s),{off:()=>i.removeEventListener(t,e),pause:n=>{i.removeEventListener(t,e),n(),i.addEventListener(t,e)}}}function xe(i){return["a[href]","area[href]","input:not([disabled])","select:not([disabled])","textarea:not([disabled])","button:not([disabled])","iframe","object","embed","[tabindex]","[contenteditable]"].some(e=>i.matches(e))&&i.tabIndex>=0}function ei(i,t){let e;return function(){let s=this,n=arguments;e||(i.apply(s,n),e=!0,setTimeout(()=>e=!1,t))}}var Mt="pointer";document.addEventListener("keydown",()=>Mt="keyboard",{capture:!0});document.addEventListener("pointerdown",i=>{Mt=i.pointerType==="mouse"?"mouse":"touch"},{capture:!0});function jt(){return Mt==="keyboard"}function ii(){return Mt==="touch"}function Ft(i,t){let e="",s=ci(()=>{e=""},300);i.addEventListener("keydown",n=>{n.key.length===1&&/[a-zA-Z]/.test(n.key)&&(e+=n.key,t(e),n.stopPropagation()),s()})}function si(i,t){return"lofi-"+(t?t+"-":"")+Math.random().toString(16).slice(2)}function V(i,t){let e=i.hasAttribute("id")?i.getAttribute("id"):si(i,t);return h(i,"id",e),i._x_bindings||(i._x_bindings={}),i._x_bindings.id||(i._x_bindings.id=e),e}function J(){let i=!1;return t=>(...e)=>{i||(i=!0,t(...e),i=!1)}}function ft(i,t,{gain:e,lose:s,focusable:n,useSafeArea:o}){let r=!1;n&&document.addEventListener("focusin",f=>{jt()&&(i.contains(f.target)||t.contains(f.target)?(r=!0,e()):(r=!1,s()))});let a=()=>{},c=()=>{},u=()=>{r=!1,s(),a(),c()},p=()=>{r=!1,a(),c()};return i.addEventListener("pointerenter",f=>{ii()||r||(r=!0,e(),setTimeout(()=>{let{safeArea:v,redraw:m,remove:l}=o?ni(i,t,f.clientX,f.clientY):ai();a=l;let d,g=ei(b=>{let x=t.getBoundingClientRect(),A=i.getBoundingClientRect(),_;switch(v.contains(b.target)&&oi(A,x,b.clientX,b.clientY)?_="safeArea":t.contains(b.target)?_="panel":i.contains(b.target)?_="trigger":_="outside",d&&clearTimeout(d),_){case"outside":u();break;case"trigger":m(b.clientX,b.clientY);break;case"panel":a();break;case"safeArea":m(b.clientX,b.clientY),d=setTimeout(()=>{u()},300);break;default:break}},100);document.addEventListener("pointermove",g),c=()=>document.removeEventListener("pointermove",g)}))}),{clear:p}}function ni(i,t,e,s){let n=document.createElement("div"),o=t.getBoundingClientRect(),r=i.getBoundingClientRect();n.style.position="fixed",h(n,"data-safe-area","");let a=(c,u)=>{if(o.top===0&&o.bottom===0)return;let p;o.leftr.right&&(p="right"),o.topr.bottom&&o.top>u&&(p="down"),p===void 0&&(p="right");let f,v,m,l,d,g,b,x,A=10;switch(p){case"left":f=o.right,v=Math.max(o.right,c)+5,m=v-f,l=Math.min(r.top,o.top)-A,d=Math.max(r.bottom,o.bottom)+A,g=d-l,b=u-l,x=`polygon(0% 0%, 100% ${b}px, 0% 100%)`;break;case"right":f=Math.min(o.left,c)-5,v=o.left,m=v-f,l=Math.min(r.top,o.top)-A,d=Math.max(r.bottom,o.bottom)+A,g=d-l,b=u-l,x=`polygon(0% ${b}px, 100% 0%, 100% 100%)`;break;case"up":f=Math.min(c,o.left)-A,v=Math.max(c,o.right)+A,m=v-f,l=o.bottom,d=Math.max(o.bottom,u)+5,g=d-l,b=c-f,x=`polygon(0% 0%, 100% 0%, ${b}px 100%)`;break;case"down":f=Math.min(c,o.left)-A,v=Math.max(c,o.right)+A,m=v-f,l=Math.min(o.top,u)-5,d=o.top,g=d-l,b=c-f,x=`polygon(${b}px 0%, 100% 100%, 0% 100%)`;break}n.style.left=`${f}px`,n.style.top=`${l}px`,n.style.width=`${m}px`,n.style.height=`${g}px`,n.style.clipPath=x};return{safeArea:n,redraw:(c,u)=>{n.isConnected||i.appendChild(n),a(c,u)},remove:()=>{n.remove()}}}function oi(i,t,e,s){return!ri(i,e,s)&&!li(t,e,s)}function ri(i,t,e){return i.left<=t&&t<=i.right&&i.top<=e&&e<=i.bottom}function li(i,t,e){return i.left<=t&&t<=i.right&&i.top<=e&&e<=i.bottom}function h(i,t,e){i._durableAttributeObserver===void 0&&(i._durableAttributeObserver=Ae(i,[t])),i._durableAttributeObserver.hasAttribute(t)||i._durableAttributeObserver.addAttribute(t),i._durableAttributeObserver.pause(()=>{i.setAttribute(t,e)})}function y(i,t){i._durableAttributeObserver===void 0&&(i._durableAttributeObserver=Ae(i,[t])),i._durableAttributeObserver.hasAttribute(t)||i._durableAttributeObserver.addAttribute(t),i._durableAttributeObserver.pause(()=>{i.removeAttribute(t)})}function Ae(i,t){let e=n=>{n.forEach(o=>{o.oldValue===null?i._durableAttributeObserver.pause(()=>y(i,o.attributeName)):i._durableAttributeObserver.pause(()=>h(i,o.attributeName,o.oldValue))})},s=new MutationObserver(n=>e(n));return s.observe(i,{attributeFilter:t,attributeOldValue:!0}),{attributes:t,hasAttribute(n){return this.attributes.includes(n)},addAttribute(n){this.attributes.includes(n)||this.attributes.push(n),s.observe(i,{attributeFilter:this.attributes,attributeOldValue:!0})},releaseAttribute(n){this.hasAttribute(n)&&s.observe(i,{attributeFilter:this.attributes,attributeOldValue:!0})},pause(n){e(s.takeRecords()),s.disconnect(),n(),s.observe(i,{attributeFilter:this.attributes,attributeOldValue:!0})}}}function ai(){return{safeArea:{contains:()=>!1},redraw:()=>{},remove:()=>{}}}function ci(i,t){let e;return(...s)=>{clearTimeout(e),e=setTimeout(()=>{i(...s)},t)}}var k=class extends HTMLElement{constructor(){super(),this.boot?.()}connectedCallback(){queueMicrotask(()=>{this.mount?.()})}mixin(t,e={}){return new t(this,e)}appendMixin(t,e={}){return new t(this,e)}use(t){let e;return this.mixins.forEach(s=>{s instanceof t&&(e=s)}),e}uses(t){let e;return this.mixins.forEach(s=>{s instanceof t&&(e=!0)}),!!e}on(t,e){return w(this,t,e)}root(t,e={}){if(t===void 0)return this.__root;let s=document.createElement(t);for(let o in e)setAttribute(s,o,e[o]);let n=this.attachShadow({mode:"open"});return s.appendChild(document.createElement("slot")),n.appendChild(s),this.__root=s,this.__root}},Dt=class extends k{};var C=class{constructor(t,e={}){this.el=t,this.grouped=e.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=e,this.boot?.({options:s=>{let n=s;Object.entries(this.opts).forEach(([o,r])=>{r!==void 0&&(n[o]=r)}),this.opts=n}}),queueMicrotask(()=>{this.mount?.()})}options(){return this.opts}hasGroup(){return!!this.group()}group(){if(this.grouped!==!1)return we(this.el,t=>t[this.groupedByType.name])?.use(this.groupedByType)}on(t,e){return w(this.el,t,e)}},q=class extends C{constructor(t,e={}){super(t,e)}walker(){return B(this.el,(t,{skip:e,reject:s})=>{if(t[this.constructor.name]&&t!==this.el)return s();if(!t[this.groupOfType.name]||!t.mixins.get(this.groupOfType.name).grouped)return e()})}};var H=class extends C{boot({options:t}){this.initialState=this.el.value,this.getterFunc=()=>{},this.setterFunc=e=>this.initialState=e,Object.defineProperty(this.el,"value",{get:()=>this.getterFunc(),set:e=>{this.setterFunc(e)}})}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 j=new Map,M=class extends C{boot({options:t}){t({trigger:null,scope:null});let e=this.options().scope||"global";h(this.el,"popover","manual"),this.trigger=this.options().trigger,this.onChanges=[],this.state=!1,w(this.el,"beforetoggle",s=>{let n=this.state;if(this.state=s.newState==="open",this.state){ui(this.el,e);let o=new AbortController,r=document.activeElement;setTimeout(()=>{hi(this.el,r,o),fi(this.el,r,o),di(this.el,r,o)}),this.el.addEventListener("beforetoggle",a=>{a.newState==="closed"&&(o.abort(),r.focus())},{signal:o.signal})}n!==this.state&&this.onChanges.forEach(o=>o(this.state,n))}),w(this.el,"toggle",s=>{if(s.newState==="open")j.has(e)||j.set(e,new Set),j.get(e).add(this.el);else if(s.newState==="closed"){if(!j.has(e))return;j.get(e).delete(this.el),j.get(e).size===0&&j.delete(e)}})}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 ui(i,t){j.has(t)&&j.get(t).forEach(e=>{i.contains(e)||e.contains(i)||e.hidePopover()})}function hi(i,t,e){document.addEventListener("click",s=>{i.contains(s.target)||t===s.target||i.hidePopover()},{signal:e.signal})}function fi(i,t,e){document.addEventListener("focusin",s=>{i.contains(s.target)||t===s.target||(e.abort(),i.hidePopover())},{capture:!0,signal:e.signal})}function di(i,t,e){document.addEventListener("keydown",s=>{s.key==="Escape"&&i.hidePopover()},{signal:e.signal})}var $=Math.min,P=Math.max,At=Math.round,yt=Math.floor,U=i=>({x:i,y:i}),pi={left:"right",right:"left",bottom:"top",top:"bottom"},bi={start:"end",end:"start"};function Ut(i,t,e){return P(i,$(t,e))}function dt(i,t){return typeof i=="function"?i(t):i}function Y(i){return i.split("-")[0]}function pt(i){return i.split("-")[1]}function Yt(i){return i==="x"?"y":"x"}function Xt(i){return i==="y"?"height":"width"}function tt(i){return["top","bottom"].includes(Y(i))?"y":"x"}function Kt(i){return Yt(tt(i))}function ye(i,t,e){e===void 0&&(e=!1);let s=pt(i),n=Kt(i),o=Xt(n),r=n==="x"?s===(e?"end":"start")?"right":"left":s==="start"?"bottom":"top";return t.reference[o]>t.floating[o]&&(r=xt(r)),[r,xt(r)]}function _e(i){let t=xt(i);return[Nt(i),t,Nt(t)]}function Nt(i){return i.replace(/start|end/g,t=>bi[t])}function mi(i,t,e){let s=["left","right"],n=["right","left"],o=["top","bottom"],r=["bottom","top"];switch(i){case"top":case"bottom":return e?t?n:s:t?s:n;case"left":case"right":return t?o:r;default:return[]}}function Se(i,t,e,s){let n=pt(i),o=mi(Y(i),e==="start",s);return n&&(o=o.map(r=>r+"-"+n),t&&(o=o.concat(o.map(Nt)))),o}function xt(i){return i.replace(/left|right|bottom|top/g,t=>pi[t])}function gi(i){return{top:0,right:0,bottom:0,left:0,...i}}function ke(i){return typeof i!="number"?gi(i):{top:i,right:i,bottom:i,left:i}}function ot(i){let{x:t,y:e,width:s,height:n}=i;return{width:s,height:n,top:e,left:t,right:t+s,bottom:e+n,x:t,y:e}}function Ee(i,t,e){let{reference:s,floating:n}=i,o=tt(t),r=Kt(t),a=Xt(r),c=Y(t),u=o==="y",p=s.x+s.width/2-n.width/2,f=s.y+s.height/2-n.height/2,v=s[a]/2-n[a]/2,m;switch(c){case"top":m={x:p,y:s.y-n.height};break;case"bottom":m={x:p,y:s.y+s.height};break;case"right":m={x:s.x+s.width,y:f};break;case"left":m={x:s.x-n.width,y:f};break;default:m={x:s.x,y:s.y}}switch(pt(t)){case"start":m[r]-=v*(e&&u?-1:1);break;case"end":m[r]+=v*(e&&u?-1:1);break}return m}var Ce=async(i,t,e)=>{let{placement:s="bottom",strategy:n="absolute",middleware:o=[],platform:r}=e,a=o.filter(Boolean),c=await(r.isRTL==null?void 0:r.isRTL(t)),u=await r.getElementRects({reference:i,floating:t,strategy:n}),{x:p,y:f}=Ee(u,s,c),v=s,m={},l=0;for(let d=0;dnt<=0)){var vt,me;let nt=(((vt=o.flip)==null?void 0:vt.index)||0)+1,ve=Rt[nt];if(ve)return{data:{index:nt,overflows:K},reset:{placement:ve}};let wt=(me=K.filter(ht=>ht.overflows[0]<=0).sort((ht,G)=>ht.overflows[1]-G.overflows[1])[0])==null?void 0:me.placement;if(!wt)switch(m){case"bestFit":{var ge;let ht=(ge=K.filter(G=>{if(I){let Q=tt(G.placement);return Q===x||Q==="y"}return!0}).map(G=>[G.placement,G.overflows.filter(Q=>Q>0).reduce((Q,ti)=>Q+ti,0)]).sort((G,Q)=>G[1]-Q[1])[0])==null?void 0:ge[0];ht&&(wt=ht);break}case"initialPlacement":wt=a;break}if(n!==wt)return{reset:{placement:wt}}}return{}}}};async function vi(i,t){let{placement:e,platform:s,elements:n}=i,o=await(s.isRTL==null?void 0:s.isRTL(n.floating)),r=Y(e),a=pt(e),c=tt(e)==="y",u=["left","top"].includes(r)?-1:1,p=o&&c?-1:1,f=dt(t,i),{mainAxis:v,crossAxis:m,alignmentAxis:l}=typeof f=="number"?{mainAxis:f,crossAxis:0,alignmentAxis:null}:{mainAxis:0,crossAxis:0,alignmentAxis:null,...f};return a&&typeof l=="number"&&(m=a==="end"?l*-1:l),c?{x:m*p,y:v*u}:{x:v*u,y:m*p}}var Te=function(i){return i===void 0&&(i=0),{name:"offset",options:i,async fn(t){var e,s;let{x:n,y:o,placement:r,middlewareData:a}=t,c=await vi(t,i);return r===((e=a.offset)==null?void 0:e.placement)&&(s=a.arrow)!=null&&s.alignmentOffset?{}:{x:n+c.x,y:o+c.y,data:{...c,placement:r}}}}},Pe=function(i){return i===void 0&&(i={}),{name:"shift",options:i,async fn(t){let{x:e,y:s,placement:n}=t,{mainAxis:o=!0,crossAxis:r=!1,limiter:a={fn:g=>{let{x:b,y:x}=g;return{x:b,y:x}}},...c}=dt(i,t),u={x:e,y:s},p=await Wt(t,c),f=tt(Y(n)),v=Yt(f),m=u[v],l=u[f];if(o){let g=v==="y"?"top":"left",b=v==="y"?"bottom":"right",x=m+p[g],A=m-p[b];m=Ut(x,m,A)}if(r){let g=f==="y"?"top":"left",b=f==="y"?"bottom":"right",x=l+p[g],A=l-p[b];l=Ut(x,l,A)}let d=a.fn({...t,[v]:m,[f]:l});return{...d,data:{x:d.x-e,y:d.y-s}}}}};var Le=function(i){return i===void 0&&(i={}),{name:"size",options:i,async fn(t){let{placement:e,rects:s,platform:n,elements:o}=t,{apply:r=()=>{},...a}=dt(i,t),c=await Wt(t,a),u=Y(e),p=pt(e),f=tt(e)==="y",{width:v,height:m}=s.floating,l,d;u==="top"||u==="bottom"?(l=u,d=p===(await(n.isRTL==null?void 0:n.isRTL(o.floating))?"start":"end")?"left":"right"):(d=u,l=p==="end"?"top":"bottom");let g=m-c.top-c.bottom,b=v-c.left-c.right,x=$(m-c[l],g),A=$(v-c[d],b),_=!t.middlewareData.shift,S=x,I=A;if(f?I=p||_?$(A,b):b:S=p||_?$(x,g):g,_&&!p){let ut=P(c.left,0),st=P(c.right,0),K=P(c.top,0),vt=P(c.bottom,0);f?I=v-2*(ut!==0||st!==0?ut+st:P(c.left,c.right)):S=m-2*(K!==0||vt!==0?K+vt:P(c.top,c.bottom))}await r({...t,availableWidth:I,availableHeight:S});let Rt=await n.getDimensions(o.floating);return v!==Rt.width||m!==Rt.height?{reset:{rects:!0}}:{}}}};function rt(i){return Me(i)?(i.nodeName||"").toLowerCase():"#document"}function R(i){var t;return(i==null||(t=i.ownerDocument)==null?void 0:t.defaultView)||window}function z(i){var t;return(t=(Me(i)?i.ownerDocument:i.document)||window.document)==null?void 0:t.documentElement}function Me(i){return i instanceof Node||i instanceof R(i).Node}function F(i){return i instanceof Element||i instanceof R(i).Element}function W(i){return i instanceof HTMLElement||i instanceof R(i).HTMLElement}function Re(i){return typeof ShadowRoot>"u"?!1:i instanceof ShadowRoot||i instanceof R(i).ShadowRoot}function mt(i){let{overflow:t,overflowX:e,overflowY:s,display:n}=D(i);return/auto|scroll|overlay|hidden|clip/.test(t+s+e)&&!["inline","contents"].includes(n)}function Fe(i){return["table","td","th"].includes(rt(i))}function _t(i){return[":popover-open",":modal"].some(t=>{try{return i.matches(t)}catch{return!1}})}function It(i){let t=Bt(),e=F(i)?D(i):i;return e.transform!=="none"||e.perspective!=="none"||(e.containerType?e.containerType!=="normal":!1)||!t&&(e.backdropFilter?e.backdropFilter!=="none":!1)||!t&&(e.filter?e.filter!=="none":!1)||["transform","perspective","filter"].some(s=>(e.willChange||"").includes(s))||["paint","layout","strict","content"].some(s=>(e.contain||"").includes(s))}function De(i){let t=X(i);for(;W(t)&&!lt(t);){if(It(t))return t;if(_t(t))return null;t=X(t)}return null}function Bt(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function lt(i){return["html","body","#document"].includes(rt(i))}function D(i){return R(i).getComputedStyle(i)}function St(i){return F(i)?{scrollLeft:i.scrollLeft,scrollTop:i.scrollTop}:{scrollLeft:i.scrollX,scrollTop:i.scrollY}}function X(i){if(rt(i)==="html")return i;let t=i.assignedSlot||i.parentNode||Re(i)&&i.host||z(i);return Re(t)?t.host:t}function Ne(i){let t=X(i);return lt(t)?i.ownerDocument?i.ownerDocument.body:i.body:W(t)&&mt(t)?t:Ne(t)}function bt(i,t,e){var s;t===void 0&&(t=[]),e===void 0&&(e=!0);let n=Ne(i),o=n===((s=i.ownerDocument)==null?void 0:s.body),r=R(n);if(o){let a=Vt(r);return t.concat(r,r.visualViewport||[],mt(n)?n:[],a&&e?bt(a):[])}return t.concat(n,bt(n,[],e))}function Vt(i){return i.parent&&Object.getPrototypeOf(i.parent)?i.frameElement:null}function Be(i){let t=D(i),e=parseFloat(t.width)||0,s=parseFloat(t.height)||0,n=W(i),o=n?i.offsetWidth:e,r=n?i.offsetHeight:s,a=At(e)!==o||At(s)!==r;return a&&(e=o,s=r),{width:e,height:s,$:a}}function Qt(i){return F(i)?i:i.contextElement}function gt(i){let t=Qt(i);if(!W(t))return U(1);let e=t.getBoundingClientRect(),{width:s,height:n,$:o}=Be(t),r=(o?At(e.width):e.width)/s,a=(o?At(e.height):e.height)/n;return(!r||!Number.isFinite(r))&&(r=1),(!a||!Number.isFinite(a))&&(a=1),{x:r,y:a}}var wi=U(0);function Ve(i){let t=R(i);return!Bt()||!t.visualViewport?wi:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function xi(i,t,e){return t===void 0&&(t=!1),!e||t&&e!==R(i)?!1:t}function at(i,t,e,s){t===void 0&&(t=!1),e===void 0&&(e=!1);let n=i.getBoundingClientRect(),o=Qt(i),r=U(1);t&&(s?F(s)&&(r=gt(s)):r=gt(i));let a=xi(o,e,s)?Ve(o):U(0),c=(n.left+a.x)/r.x,u=(n.top+a.y)/r.y,p=n.width/r.x,f=n.height/r.y;if(o){let v=R(o),m=s&&F(s)?R(s):s,l=v,d=Vt(l);for(;d&&s&&m!==l;){let g=gt(d),b=d.getBoundingClientRect(),x=D(d),A=b.left+(d.clientLeft+parseFloat(x.paddingLeft))*g.x,_=b.top+(d.clientTop+parseFloat(x.paddingTop))*g.y;c*=g.x,u*=g.y,p*=g.x,f*=g.y,c+=A,u+=_,l=R(d),d=Vt(l)}}return ot({width:p,height:f,x:c,y:u})}function Ai(i){let{elements:t,rect:e,offsetParent:s,strategy:n}=i,o=n==="fixed",r=z(s),a=t?_t(t.floating):!1;if(s===r||a&&o)return e;let c={scrollLeft:0,scrollTop:0},u=U(1),p=U(0),f=W(s);if((f||!f&&!o)&&((rt(s)!=="body"||mt(r))&&(c=St(s)),W(s))){let v=at(s);u=gt(s),p.x=v.x+s.clientLeft,p.y=v.y+s.clientTop}return{width:e.width*u.x,height:e.height*u.y,x:e.x*u.x-c.scrollLeft*u.x+p.x,y:e.y*u.y-c.scrollTop*u.y+p.y}}function yi(i){return Array.from(i.getClientRects())}function qe(i){return at(z(i)).left+St(i).scrollLeft}function _i(i){let t=z(i),e=St(i),s=i.ownerDocument.body,n=P(t.scrollWidth,t.clientWidth,s.scrollWidth,s.clientWidth),o=P(t.scrollHeight,t.clientHeight,s.scrollHeight,s.clientHeight),r=-e.scrollLeft+qe(i),a=-e.scrollTop;return D(s).direction==="rtl"&&(r+=P(t.clientWidth,s.clientWidth)-n),{width:n,height:o,x:r,y:a}}function Si(i,t){let e=R(i),s=z(i),n=e.visualViewport,o=s.clientWidth,r=s.clientHeight,a=0,c=0;if(n){o=n.width,r=n.height;let u=Bt();(!u||u&&t==="fixed")&&(a=n.offsetLeft,c=n.offsetTop)}return{width:o,height:r,x:a,y:c}}function ki(i,t){let e=at(i,!0,t==="fixed"),s=e.top+i.clientTop,n=e.left+i.clientLeft,o=W(i)?gt(i):U(1),r=i.clientWidth*o.x,a=i.clientHeight*o.y,c=n*o.x,u=s*o.y;return{width:r,height:a,x:c,y:u}}function We(i,t,e){let s;if(t==="viewport")s=Si(i,e);else if(t==="document")s=_i(z(i));else if(F(t))s=ki(t,e);else{let n=Ve(i);s={...t,x:t.x-n.x,y:t.y-n.y}}return ot(s)}function He(i,t){let e=X(i);return e===t||!F(e)||lt(e)?!1:D(e).position==="fixed"||He(e,t)}function Ei(i,t){let e=t.get(i);if(e)return e;let s=bt(i,[],!1).filter(a=>F(a)&&rt(a)!=="body"),n=null,o=D(i).position==="fixed",r=o?X(i):i;for(;F(r)&&!lt(r);){let a=D(r),c=It(r);!c&&a.position==="fixed"&&(n=null),(o?!c&&!n:!c&&a.position==="static"&&!!n&&["absolute","fixed"].includes(n.position)||mt(r)&&!c&&He(i,r))?s=s.filter(p=>p!==r):n=a,r=X(r)}return t.set(i,s),s}function Ci(i){let{element:t,boundary:e,rootBoundary:s,strategy:n}=i,r=[...e==="clippingAncestors"?_t(t)?[]:Ei(t,this._c):[].concat(e),s],a=r[0],c=r.reduce((u,p)=>{let f=We(t,p,n);return u.top=P(f.top,u.top),u.right=$(f.right,u.right),u.bottom=$(f.bottom,u.bottom),u.left=P(f.left,u.left),u},We(t,a,n));return{width:c.right-c.left,height:c.bottom-c.top,x:c.left,y:c.top}}function Oi(i){let{width:t,height:e}=Be(i);return{width:t,height:e}}function Ti(i,t,e){let s=W(t),n=z(t),o=e==="fixed",r=at(i,!0,o,t),a={scrollLeft:0,scrollTop:0},c=U(0);if(s||!s&&!o)if((rt(t)!=="body"||mt(n))&&(a=St(t)),s){let f=at(t,!0,o,t);c.x=f.x+t.clientLeft,c.y=f.y+t.clientTop}else n&&(c.x=qe(n));let u=r.left+a.scrollLeft-c.x,p=r.top+a.scrollTop-c.y;return{x:u,y:p,width:r.width,height:r.height}}function Gt(i){return D(i).position==="static"}function Ie(i,t){return!W(i)||D(i).position==="fixed"?null:t?t(i):i.offsetParent}function $e(i,t){let e=R(i);if(_t(i))return e;if(!W(i)){let n=X(i);for(;n&&!lt(n);){if(F(n)&&!Gt(n))return n;n=X(n)}return e}let s=Ie(i,t);for(;s&&Fe(s)&&Gt(s);)s=Ie(s,t);return s&<(s)&&Gt(s)&&!It(s)?e:s||De(i)||e}var Pi=async function(i){let t=this.getOffsetParent||$e,e=this.getDimensions,s=await e(i.floating);return{reference:Ti(i.reference,await t(i.floating),i.strategy),floating:{x:0,y:0,width:s.width,height:s.height}}};function Li(i){return D(i).direction==="rtl"}var Ri={convertOffsetParentRelativeRectToViewportRelativeRect:Ai,getDocumentElement:z,getClippingRect:Ci,getOffsetParent:$e,getElementRects:Pi,getClientRects:yi,getDimensions:Oi,getScale:gt,isElement:F,isRTL:Li};function Mi(i,t){let e=null,s,n=z(i);function o(){var a;clearTimeout(s),(a=e)==null||a.disconnect(),e=null}function r(a,c){a===void 0&&(a=!1),c===void 0&&(c=1),o();let{left:u,top:p,width:f,height:v}=i.getBoundingClientRect();if(a||t(),!f||!v)return;let m=yt(p),l=yt(n.clientWidth-(u+f)),d=yt(n.clientHeight-(p+v)),g=yt(u),x={rootMargin:-m+"px "+-l+"px "+-d+"px "+-g+"px",threshold:P(0,$(1,c))||1},A=!0;function _(S){let I=S[0].intersectionRatio;if(I!==c){if(!A)return r();I?r(!1,I):s=setTimeout(()=>{r(!1,1e-7)},1e3)}A=!1}try{e=new IntersectionObserver(_,{...x,root:n.ownerDocument})}catch{e=new IntersectionObserver(_,x)}e.observe(i)}return r(!0),o}function ze(i,t,e,s){s===void 0&&(s={});let{ancestorScroll:n=!0,ancestorResize:o=!0,elementResize:r=typeof ResizeObserver=="function",layoutShift:a=typeof IntersectionObserver=="function",animationFrame:c=!1}=s,u=Qt(i),p=n||o?[...u?bt(u):[],...bt(t)]:[];p.forEach(b=>{n&&b.addEventListener("scroll",e,{passive:!0}),o&&b.addEventListener("resize",e)});let f=u&&a?Mi(u,e):null,v=-1,m=null;r&&(m=new ResizeObserver(b=>{let[x]=b;x&&x.target===u&&m&&(m.unobserve(t),cancelAnimationFrame(v),v=requestAnimationFrame(()=>{var A;(A=m)==null||A.observe(t)})),e()}),u&&!c&&m.observe(u),m.observe(t));let l,d=c?at(i):null;c&&g();function g(){let b=at(i);d&&(b.x!==d.x||b.y!==d.y||b.width!==d.width||b.height!==d.height)&&e(),d=b,l=requestAnimationFrame(g)}return e(),()=>{var b;p.forEach(x=>{n&&x.removeEventListener("scroll",e),o&&x.removeEventListener("resize",e)}),f?.(),(b=m)==null||b.disconnect(),m=null,c&&cancelAnimationFrame(l)}}var je=Te;var Ue=Pe,Ye=Oe,Xe=Le;var Ke=(i,t,e)=>{let s=new Map,n={platform:Ri,...e},o={...n.platform,_c:s};return Ce(i,t,{...n,platform:o})};var N=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[e,s]=Ni(this.el),n=Fi(this.el,this.options().reference,e,{position:this.options().position,gap:this.options().gap,offset:this.options().offset,matchWidth:this.options().matchWidth}),o=()=>{};this.reposition=(...r)=>{this.options().auto?o=ze(this.options().reference,this.el,n,{ancestorScroll:!0,ancestorResize:!0,elementResize:!0,layoutShift:!0,animationFrame:!0}):n(...r)},this.cleanup=()=>{o(),s()}}};function Fi(i,t,e,{position:s,offset:n,gap:o,matchWidth:r}){return(a=null,c=null)=>{Ke(t,i,{placement:Di(s),middleware:[Ye(),Ue({padding:5,crossAxis:!0}),je({mainAxis:Number(o),alignmentAxis:Number(n)}),r?Xe({apply({rects:u,elements:p}){Object.assign(p.floating.style,{width:`${u.reference.width}px`})}}):void 0]}).then(({x:u,y:p})=>{e(a||u,c||p)})}}function Di(i){return i.split(" ").join("-")}function Ni(i){let t=(o,r)=>{Object.assign(i.style,{position:"absolute",inset:`${r}px auto auto ${o}px`})},e,s,n=new MutationObserver(()=>t(e,s));return[(o,r)=>{e=o,s=r,n.disconnect(),t(e,s),n.observe(i,{attributeFilter:["style"]})},()=>{n.disconnect()}]}var Zt=class extends k{boot(){let t=this.trigger(),e=this.overlay();if(t){if(!e)return console.warn("ui-dropdown: no [popover] overlay found",this)}else return console.warn("ui-dropdown: no trigger element found",this);this._disabled=this.hasAttribute("disabled"),this._controllable=new H(this),e._popoverable=new M(e),e._anchorable=new N(e,{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}),e._popoverable.onChange(()=>{e._popoverable.getState()?e._anchorable.reposition():e._anchorable.cleanup()}),this._controllable.initial(o=>e._popoverable.setState(o)),this._controllable.getter(()=>e._popoverable.getState());let s=J();this._controllable.setter(o=>e._popoverable.setState(o)),e._popoverable.onChange(s(()=>this._controllable.dispatch())),this.hasAttribute("hover")&&ft(t,e,{gain(){e._popoverable.setState(!0)},lose(){e._popoverable.setState(!1)},focusable:!0}),w(t,"click",()=>e._popoverable.toggle()),e._popoverable.getState()?(h(this,"data-open",""),h(t,"data-open",""),h(e,"data-open","")):(y(this,"data-open"),y(t,"data-open"),y(e,"data-open")),e._popoverable.onChange(()=>{e._popoverable.getState()?(h(this,"data-open",""),h(t,"data-open",""),h(e,"data-open","")):(y(this,"data-open"),y(t,"data-open"),y(e,"data-open"))});let n=V(e,"dropdown");h(t,"aria-haspopup","true"),h(t,"aria-controls",n),h(t,"aria-expanded",e._popoverable.getState()?"true":"false"),e._popoverable.onChange(()=>{h(t,"aria-expanded",e._popoverable.getState()?"true":"false")}),e._popoverable.onChange(()=>{e._popoverable.getState()?e.onPopoverShow?.():e.onPopoverHide?.()})}trigger(){return this.querySelector("button")}overlay(){return this.lastElementChild?.matches("[popover]")&&this.lastElementChild}};T("dropdown",Zt);var Jt=class extends k{boot(){let t=this.hasAttribute("label")?"label":"description",e=this.button(),s=this.overlay();if(e){if(!s)return}else return console.warn("ui-tooltip: no trigger element found",this);this._disabled=this.hasAttribute("disabled"),s._popoverable=new M(s,{scope:"tooltip"}),s._anchorable=new N(s,{reference:e,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}),s._popoverable.onChange(()=>s._anchorable.reposition()),this._disabled||ft(e,s,{gain(){s._popoverable.setState(!0)},lose(){s._popoverable.setState(!1)},focusable:!0,useSafeArea:!1});let n=V(s,"tooltip"),o=this.hasAttribute("interactive"),r=this.hasAttribute("label")||e.textContent.trim()==="";o?(h(e,"aria-controls",n),h(e,"aria-expanded","false"),s._popoverable.onChange(()=>{s._popoverable.getState()?h(e,"aria-expanded","true"):h(e,"aria-expanded","false")})):(r?h(e,"aria-labelledby",n):h(e,"aria-describedby",n),h(s,"aria-hidden","true")),h(s,"role","tooltip")}button(){return this.firstElementChild}overlay(){return this.lastElementChild!==this.button()&&this.lastElementChild}};T("tooltip",Jt);var et=class extends q{groupOfType=E;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,e=!1){if(t.ungrouped)return;let s=t.value,n=t.isSelected(),o=this.options().multiple;n?o?this.state.add(s):this.state=s:o?this.state.delete(s):this.state=null,e||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(s=>s+"")):t=t+"",this.state=this.options().multiple?new Set(t):t;let e=this.options().multiple?t:[t];this.walker().each(s=>{let n=s.use(E);if(n.ungrouped)return;let o=e.includes(n.value);o&&!n.isSelected()?n.surgicallySelect():!o&&n.isSelected()&&n.surgicallyDeselect()}),this.onChanges.forEach(s=>s())}selected(){return this.walker().find(t=>t.use(E).isSelected()).use(E)}selecteds(){return this.walker().filter(t=>t.use(E).isSelected()).map(t=>t.use(E))}selectFirst(){this.walker().first()?.use(E).select()}selectAll(){this.walker().filter(t=>!t.use(E).isSelected()).map(t=>t.use(E).select())}deselectAll(){this.walker().filter(t=>t.use(E).isSelected()).map(t=>t.use(E).deselect())}allAreSelected(){return this.walker().filter(t=>t.use(E).isSelected()).length===this.walker().filter(t=>!0).length}noneAreSelected(){return this.state===null||this.state?.size===0}selectableByValue(t){return this.walker().find(e=>e.use(E).value===t)?.use(E)}deselectOthers(t){this.walker().each(e=>{e!==t&&e.use(E).surgicallyDeselect()})}selectedTextValue(){return this.options().multiple?Array.from(this.state).map(t=>this.convertValueStringToElementText(t)).join(", "):this.convertValueStringToElementText(this.state)}convertValueStringToElementText(t){let e=this.findByValue(t);return e?e.label||e.value:t}findByValue(t){return this.selecteds().find(e=>e.value===t)}walker(){return B(this.el,(t,{skip:e,reject:s})=>{if(t[this.constructor.name]&&t!==this.el)return s();if(!t[this.groupOfType.name]||t.mixins.get(this.groupOfType.name).ungrouped)return e()})}},E=class extends C{boot({options:t}){this.groupedByType=et,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 e=this.options().selectedInitially;this.group()&&this.group().hasValue(this.value)&&(e=!0),this.multiple=this.hasGroup()?this.group().options().multiple:!1,this.toggleable=this.options().toggleable||this.multiple,this.onSelects=[],this.onUnselects=[],this.onChanges=[],e?this.select(!0):(this.state=e,this.surgicallyDeselect(!0))}mount(){this.el.hasAttribute(this.options().ariaAttr)||h(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 e=!this.isSelected();this.toggleable||this.group()?.deselectOthers(this.el),this.state=!0,h(this.el,this.options().ariaAttr,"true"),h(this.el,this.options().dataAttr,""),e&&(t||(this.onSelects.forEach(s=>s()),this.onChanges.forEach(s=>s())),this.group()?.changed(this,t))}surgicallySelect(){let t=!this.isSelected();this.state=!0,h(this.el,this.options().ariaAttr,"true"),h(this.el,this.options().dataAttr,""),t&&(this.onSelects.forEach(e=>e()),this.onChanges.forEach(e=>e()))}deselect(t=!0){let e=this.isSelected();this.state=!1,h(this.el,this.options().ariaAttr,"false"),y(this.el,this.options().dataAttr),e&&(this.onUnselects.forEach(s=>s()),this.onChanges.forEach(s=>s()),t&&this.group()?.changed(this))}surgicallyDeselect(t=!1){let e=this.isSelected();this.state=!1,h(this.el,this.options().ariaAttr,"false"),y(this.el,this.options().dataAttr),e&&!t&&(this.onUnselects.forEach(s=>s()),this.onChanges.forEach(s=>s()))}getValue(){return this.value}getLabel(){return this.label}};var kt=class extends q{groupOfType=L;boot({options:t}){t({wrap:!1,ensureTabbable:!0})}mount(){this.options().ensureTabbable&&this.ensureTabbable()}focusFirst(){let t;t=t||this.walker().find(e=>e.hasAttribute("autofocus")),t=t||this.walker().find(e=>e.getAttribute("tabindex")==="0"),t=t||this.walker().find(e=>e.getAttribute("tabindex")==="-1"),t=t||this.walker().find(e=>xe(e)),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 e=this.walker().find(s=>s.textContent.toLowerCase().trim().startsWith(t.toLowerCase()));e?.use(L).tabbable(),e?.use(L).focus()}moveFocus(t){let e=this.walker().find(n=>n.use(L).isTabbable());t(e)?.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(e=>{e!==t&&e.use(L).untabbable()})}walker(){return B(this.el,(t,{skip:e,reject:s})=>{if(t[this.constructor.name]&&t!==this.el)return s();if(!t[this.groupOfType.name])return e();if(t.hasAttribute("disabled"))return s()})}},L=class extends C{groupedByType=kt;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(()=>{jt()&&h(this.el,"data-focus","")})),this.on("blur",t.enabled(()=>{y(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(e=>{this.untabbable()}))}focus(t=!0){this.group()?.untabbleOthers(this.el),this.tabbable(),t&&this.pauseFocusListener(()=>{this.el.focus({focusVisible:!1})})}tabbable(){h(this.el,"tabindex","0"),this.options().tabbableAttr&&h(this.el,this.options().tabbableAttr,"")}untabbable(){h(this.el,"tabindex","-1"),this.options().tabbableAttr&&y(this.el,this.options().tabbableAttr)}isTabbable(){return this.el.getAttribute("tabindex")==="0"}};var it=class extends C{boot({options:t}){this.onChanges=[],Object.defineProperty(this.el,"disabled",{get:()=>this.el.hasAttribute("disabled"),set:s=>{s?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(s=>{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(...e)=>{if(!this.el.disabled)return t(...e)}}disabled(t){return(...e)=>{if(this.el.disabled)return t(...e)}}};var Et=class extends q{groupOfType=O;boot({options:t}){t({wrap:!1,filter:!1}),this.onChanges=[]}onChange(t){this.onChanges.push(t)}activated(t){this.onChanges.forEach(e=>e())}activateFirst(){this.filterAwareWalker().first()?.use(O).activate()}activateBySearch(t){this.filterAwareWalker().find(s=>s.textContent.toLowerCase().trim().startsWith(t.toLowerCase()))?.use(O).activate()}activateSelectedOrFirst(t){if(!t||(s=>s.matches("ui-option")?getComputedStyle(s).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 e;this.options.wrap?e=this.filterAwareWalker().prevOrLast(t):e=this.filterAwareWalker().prev(t),e?.use(O).activate()}activateNext(){let t=this.getActive();if(!t){this.filterAwareWalker().first()?.use(O).activate();return}let e;this.options.wrap?e=this.filterAwareWalker().nextOrFirst(t):e=this.filterAwareWalker().next(t),e?.use(O).activate()}getActive(){return this.walker().find(t=>t.use(O).isActive())}clearActive(){this.getActive()?.use(O).deactivate()}filterAwareWalker(){let t=e=>e.matches("ui-option")?getComputedStyle(e).display==="none":!1;return B(this.el,(e,{skip:s,reject:n})=>{if(e[this.constructor.name]&&e!==this.el)return n();if(!e[this.groupOfType.name])return s();if(e.hasAttribute("disabled")||t(e))return n()})}},O=class i extends C{groupedByType=Et;mount(){this.el.addEventListener("mouseenter",()=>{this.activate()}),this.el.addEventListener("mouseleave",()=>{this.deactivate()})}activate(){this.group()&&this.group().walker().each(t=>t.use(i).deactivate(!1)),h(this.el,"data-active",""),this.el.scrollIntoView({block:"nearest"}),this.group()&&this.group().activated(this.el)}deactivate(t=!0){y(this.el,"data-active"),t&&this.group()&&this.group().activated(this.el)}isActive(){return this.el.hasAttribute("data-active")}};var Ct=class extends q{groupOfType=ct;boot({options:t}){t({}),this.onChanges=[],this.lastSearch=""}onChange(t){this.onChanges.push(t)}filter(t){t===""?this.walker().each(e=>{e.use(ct).unfilter()}):this.walker().each(e=>{this.matches(e,t)?e.use(ct).unfilter():e.use(ct).filter()}),this.lastSearch!==t&&this.onChanges.forEach(e=>e()),this.lastSearch=t}matches(t,e){return t.textContent.toLowerCase().trim().includes(e.toLowerCase().trim())}hasResults(){return this.walker().some(t=>!t.use(ct).isFiltered())}},ct=class extends C{groupedByType=Ct;boot({options:t}){t({mirror:null,keep:!1}),this.onChanges=[]}filter(){this.options().keep||(h(this.el,"data-hidden",""),this.options().mirror&&h(this.options().mirror,"data-hidden",""))}unfilter(){y(this.el,"data-hidden"),this.options().mirror&&y(this.options().mirror,"data-hidden","")}isFiltered(){return this.el.hasAttribute("data-hidden")}};var qt=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(e=>{queueMicrotask(()=>this.render())}).observe(t,{childList:!0})})}render(t){if(this.multiple){let e=this.picker.value,s=Array.from(this.selecteds.keys()).filter(r=>!e.includes(r)),n=e.filter(r=>!this.selecteds.has(r));s.forEach(r=>this.selecteds.delete(r));let o=new Map;for(let r of n){let a=this.picker._selectable.findByValue(r);if(!a){if(t)return setTimeout(()=>this.render());throw`Could not find option for value "${r}"`}o.set(r,a)}o.forEach((r,a)=>this.selecteds.set(a,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 a=!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 e=this.picker.value;if(Array.from(this.selecteds.keys()).includes(e))return;this.selecteds.clear();let s=this.picker._selectable.findByValue(e);if(s)this.selecteds.set(e,s);else if(!["",null,void 0].includes(e)){if(t)return setTimeout(()=>{console.log("retrying..."),this.render()});throw`Could not find option for value "${e}"`}this.templates.placeholder?.clearPlaceholder?.(),this.templates.option?.clearOption?.(),this.selecteds.size>0?this.renderOption():this.renderPlaceholder()}}renderOptions({hasOverflowed:t,renderOverflow:e}){let s=document.createElement("div");s.style.display="contents";let n=Ot(this.templates.options,{default:s});this.templates.options.after(n),this.templates.options.clearOptions=()=>{n.remove(),this.templates.options.clearOptions=()=>{}};let o=0,r=!1;for(let[c,u]of this.selecteds){let p=new DocumentFragment;p.append(...u.el.cloneNode(!0).childNodes);let f=Ot(this.templates.option,{text:u.el.textContent.trim(),default:p,value:c});if(f.setAttribute("data-value",c),f.setAttribute("data-appended",""),f.deselect=()=>u.deselect(),s.appendChild(f),o++,t(o)){r=!0,s.removeChild(f),o--;break}}let a=new DocumentFragment;a.append(...s.childNodes),s.replaceWith(a),r&&e(this.selecteds.size-o)}renderOption(){for(let[t,e]of this.selecteds){let s=new DocumentFragment;s.append(...e.el.cloneNode(!0).childNodes);let n=Ot(this.templates.option,{text:e.el.textContent.trim(),default:s,value:t});n.setAttribute("data-value",t),n.setAttribute("data-appended",t),n.deselect=()=>e.deselect(),this.templates.option.after(n),this.templates.option.clearOption=()=>{n.remove(),this.templates.option.clearOption=()=>{}}}}renderPlaceholder(){if(!this.templates.placeholder)return;let t=Ot(this.templates.placeholder);this.templates.placeholder.after(t),this.templates.placeholder.clearPlaceholder=()=>{t.remove(),this.templates.placeholder.clearPlaceholder=()=>{}}}renderOverflow(t,e){if(!this.templates.overflow)return;let s=Ot(this.templates.overflow,{remainder:e,count:this.selecteds.size});s.setAttribute("data-appended",""),this.templates.overflow.after(s),this.templates.overflow.clearOverflow=()=>{s.remove(),this.templates.placeholder.clearOverflow=()=>{}}}};function Ot(i,t={}){let e=i.content.cloneNode(!0);return Object.entries(t).forEach(([s,n])=>{(s==="default"?e.querySelectorAll("slot:not([name])"):e.querySelectorAll(`slot[name="${s}"]`)).forEach(r=>r.replaceWith(typeof n=="string"?document.createTextNode(n):n))}),e.firstElementChild}var Lt=class extends Dt{boot(){let t=this.list();this._controllable=new H(this),this._selectable=new et(t,{multiple:this.hasAttribute("multiple")}),this._controllable.initial(s=>s&&this._selectable.setState(s)),this._controllable.getter(()=>this._selectable.getState());let e=J();this._controllable.setter(e(s=>{this._selectable.setState(s)})),this._selectable.onChange(e(()=>{this._controllable.dispatch(),this.dispatchEvent(new CustomEvent("select",{bubbles:!1}))}))}mount(){this._disableable=new it(this);let t=this.input(),e=this.button(),s=this.list(),n=this.hasAttribute("multiple"),o=this.hasAttribute("autocomplete"),r=this.hasAttribute("autocomplete")&&this.getAttribute("autocomplete").trim().split(" ").includes("strict"),a=this.querySelector("ui-options")||this,c=Ii(a,"options");this._activatable=new Et(a,{filter:"data-hidden"}),!t&&!e&&this._disableable.onInitAndChange(l=>{l?this.removeAttribute("tabindex"):this.setAttribute("tabindex","0")}),this.hasAttribute("filter")&&this.getAttribute("filter")!=="manual"&&(this._filterable=new Ct(s),this._filterable.onChange(()=>{this._activatable.clearActive(),this._filterable.hasResults()&&this._activatable.activateFirst()}),this.addEventListener("close",()=>{this._filterable&&this._filterable.filter("")}));let u=this.querySelector("[popover]:not(ui-tooltip > [popover])"),p=u?.querySelector("input"),f=this.querySelector("input");f=u?.contains(f)?null:f;let v=this.querySelector("button");if(v=u?.contains(v)?null:v,!(u||f))Tt(this,this._activatable),Pt(this,this,this._activatable),Ge(this,this._activatable,this._selectable);else if(!u&&f){let l=f;this._disableable.onInitAndChange(d=>{d?l&&h(l,"disabled",""):l&&y(l,"disabled")}),re(this,l,this._selectable,this._popoverable),Ge(l,this._activatable,this._selectable),Je(o,r,this,l,this._selectable,this._popoverable),oe(l),ne(l),this._filterable&&se(l,this._filterable),Ze(l,this._activatable),Tt(l,this._activatable),Pt(this,l,this._activatable),Ht(this,this._activatable)}else if(u&&f){let l=f;h(l,"role","combobox"),h(l,"aria-controls",c);let d=u;this._popoverable=new M(d),this._anchorable=new N(d,{reference:l,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}),Je(o,r,this,l,this._selectable,this._popoverable),this._disableable.onInitAndChange(g=>{g?l&&h(l,"disabled",""):l&&y(l,"disabled")}),this.querySelectorAll("button").forEach(g=>{d.contains(g)||(h(g,"tabindex","-1"),h(g,"aria-controls",c),h(g,"aria-haspopup","listbox"),$t(g,this._popoverable),w(g,"click",()=>{this._popoverable.toggle(),l.focus()}))}),re(this,l,this._selectable,this._popoverable),te(this,l,d,this._popoverable,this._anchorable),$t(l,this._popoverable),oe(l),ne(l),this._filterable&&se(l,this._filterable),Ze(l,this._activatable),qi(l,this._popoverable),ie(l,this._popoverable,this._activatable,this._selectable),Bi(l,this._popoverable),Tt(l,this._activatable),Pt(this,l,this._activatable),Ht(this,this._activatable),ee(this._popoverable,this._activatable,this._selectable),le(this,this._selectable,this._popoverable,n)}else if(u&&p){let l=v,d=p,g=u;h(l,"role","combobox"),h(d,"role","combobox"),h(l,"aria-controls",c),this._disableable.onInitAndChange(b=>{b?(l&&h(l,"disabled",""),d&&h(d,"disabled","")):(l&&y(l,"disabled"),d&&y(d,"disabled"))}),this._popoverable=new M(g),this._anchorable=new N(g,{reference:l,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}),oe(d),ne(d),this._filterable&&se(d,this._filterable),Vi(d,this._popoverable),te(this,l,g,this._popoverable,this._anchorable),$t(l,this._popoverable),re(this,d,this._selectable,this._popoverable),ie(l,this._popoverable,this._activatable,this._selectable),Qe(l,this._popoverable),Tt(d,this._activatable),Pt(this,d,this._activatable),Ht(this,this._activatable),ee(this._popoverable,this._activatable,this._selectable),le(this,this._selectable,this._popoverable,n)}else if(u){let l=v,d=u;h(l,"role","combobox"),h(l,"aria-controls",c),this._disableable.onInitAndChange(g=>{g?(l&&h(l,"disabled",""),t&&h(t,"disabled","")):(l&&y(l,"disabled"),t&&y(t,"disabled"))}),this._popoverable=new M(d),this._anchorable=new N(d,{reference:l,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}),te(this,l,d,this._popoverable,this._anchorable),$t(l,this._popoverable),ie(l,this._popoverable,this._activatable,this._selectable),Qe(l,this._popoverable),Tt(l,this._activatable),Wi(l,this._activatable),Pt(this,l,this._activatable),Ht(this,this._activatable),ee(this._popoverable,this._activatable,this._selectable),le(this,this._selectable,this._popoverable,n)}new MutationObserver(()=>{setTimeout(()=>{if(!this._popoverable||this._popoverable.getState()){let l=this._selectable.selecteds()[0]?.el;queueMicrotask(()=>{this._activatable.activateSelectedOrFirst(l)})}else this._activatable.clearActive()})}).observe(s,{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})))}},ae=class extends k{boot(){h(this,"data-hidden","")}mount(){queueMicrotask(()=>{let t=this.closest("ui-autocomplete, ui-combobox, ui-select"),e=this.closest("ui-options");if(!e)return;let s=a=>getComputedStyle(a).display==="none",n=()=>{let a;CSS.supports("selector(&)")?a=Array.from(e.querySelectorAll("& > ui-option")).filter(c=>!s(c)).length===0:a=Array.from(e.querySelectorAll(":scope > ui-option")).filter(c=>!s(c)).length===0,a?y(this,"data-hidden"):h(this,"data-hidden","")};n();let o=t._filterable;o&&o.onChange(n),new MutationObserver(a=>{setTimeout(()=>n())}).observe(e,{childList:!0})})}};T("selected",qt);T("select",Lt);T("empty",ae);Z(({css:i})=>i`ui-select { display: block; }`);Z(({css:i})=>i`ui-selected-option { display: contents; }`);Z(({css:i})=>i`ui-empty { display: block; cursor: default; }`);function Tt(i,t){w(i,"keydown",e=>{["ArrowDown","ArrowUp","Escape"].includes(e.key)&&(e.key==="ArrowDown"?(t.activateNext(),e.preventDefault(),e.stopPropagation()):e.key==="ArrowUp"&&(t.activatePrev(),e.preventDefault(),e.stopPropagation()))})}function Wi(i,t){Ft(i,e=>{t.activateBySearch(e)})}function Pt(i,t,e){w(t,"keydown",s=>{if(s.key==="Enter"){let n=e.getActive();if(s.preventDefault(),s.stopPropagation(),!n)return;n.click(),i.dispatchEvent(new CustomEvent("action",{bubbles:!1,cancelable:!1}))}})}function Ht(i,t,e=!1){w(i,e?"pointerdown":"click",s=>{if(s.target.closest("ui-option")){let n=s.target.closest("ui-option");if(n._disabled)return;n._selectable?.trigger(),i.dispatchEvent(new CustomEvent("action",{bubbles:!1,cancelable:!1})),s.preventDefault(),s.stopPropagation()}})}function Ge(i,t,e){w(i,"focus",()=>{let s=e.selecteds()[0]?.el;t.activateSelectedOrFirst(s)}),w(i,"blur",()=>{t.clearActive()})}function Ii(i){let t=V(i,"options");return h(i,"role","listbox"),t}function $t(i,t){h(i,"aria-haspopup","listbox");let e=()=>{h(i,"aria-expanded",t.getState()?"true":"false"),t.getState()?h(i,"data-open",""):y(i,"data-open","")};t.onChange(()=>{e()}),e()}function te(i,t,e,s,n){let o=()=>{Array.from([i,e]).forEach(r=>{s.getState()?h(r,"data-open",""):y(r,"data-open","")}),s.getState()&&n.reposition()};s.onChange(()=>o()),o(),s.onChange(()=>{s.getState()?i.dispatchEvent(new Event("open",{bubbles:!1,cancelable:!1})):i.dispatchEvent(new Event("close",{bubbles:!1,cancelable:!1}))})}function ee(i,t,e){i.onChange(()=>{if(i.getState()){let s=e.selecteds()[0]?.el;queueMicrotask(()=>{t.activateSelectedOrFirst(s)})}else t.clearActive()})}function ie(i,t){w(i,"keydown",e=>{["ArrowDown","ArrowUp","Escape"].includes(e.key)&&(e.key==="ArrowDown"||e.key==="ArrowUp"?t.getState()||(t.setState(!0),e.preventDefault(),e.stopImmediatePropagation()):e.key==="Escape"&&t.getState()&&t.setState(!1))})}function Bi(i,t){w(i,"click",()=>{t.getState()||(t.setState(!0),i.focus())})}function Qe(i,t){w(i,"click",()=>{t.setState(!t.getState()),i.focus()})}function Vi(i,t){t.onChange(()=>{t.getState()&&setTimeout(()=>i.focus())})}function se(i,t){t&&w(i,"input",e=>{t.filter(e.target.value)})}function ne(i){w(i,"focus",()=>i.select())}function oe(i){w(i,"change",t=>t.stopPropagation()),w(i,"input",t=>t.stopPropagation())}function qi(i,t){w(i,"keydown",e=>{(/^[a-zA-Z0-9]$/.test(e.key)||e.key==="Backspace")&&(t.getState()||t.setState(!0))})}function re(i,t,e,s){if(!i.hasAttribute("clear"))return;let o=f=>{t.value=f,t.dispatchEvent(new Event("input",{bubbles:!1}))},r=i.getAttribute("clear"),a=r===""||r.split(" ").includes("action"),c=r===""||r.split(" ").includes("select"),u=r===""||r.split(" ").includes("close"),p=r===""||r.split(" ").includes("esc");r==="none"&&(a=c=u=p=!1),a?i.addEventListener("action",f=>{o("")}):c&&e.onChange(()=>{queueMicrotask(()=>o(""))}),u&&s.onChange(()=>{s.getState()||o("")}),p&&w(t,"keydown",f=>{f.key==="Escape"&&o("")})}function le(i,t,e,s){let n=!s,o=!s;if(i.hasAttribute("close")){let r=i.getAttribute("close");n=r===""||r.split(" ").includes("action"),o=r.split(" ").includes("select"),r==="none"&&(n=o=!1)}n?i.addEventListener("action",r=>{e.setState(!1)}):o&&t.onChange(()=>{e.setState(!1)})}function Ze(i,t){t.onChange(()=>{let e=t.getActive();e?h(i,"aria-activedescendant",e.id):y(i,"aria-activedescendant")})}function Je(i,t,e,s,n,o){if(!i){h(s,"autocomplete","off"),h(s,"aria-autocomplete","none");return}let r=a=>{s.value=a,s.dispatchEvent(new Event("input",{bubbles:!1}))};h(s,"autocomplete","off"),h(s,"aria-autocomplete","list"),queueMicrotask(()=>{n.onInitAndChange(()=>{s.value=n.selectedTextValue()})}),e.addEventListener("action",a=>{r(n.selectedTextValue())}),t&&o.onChange(()=>{o.getState()||r(n.selectedTextValue())})}var ce=class i extends k{boot(){if(this._focusable=new kt(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())}),Ft(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",e=>{e.key==="ArrowDown"&&(this.fromArrowDown=!0,this.showPopover(),e.preventDefault(),e.stopPropagation())})}h(this,"role","menu"),h(this,"tabindex","-1")}mount(){this.initializeMenuItems(),new MutationObserver(e=>{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||Hi(t)})}walker(){return B(this,(t,{skip:e,reject:s})=>{if(t instanceof i||t instanceof Lt)return s();if(!["a","button"].includes(t.localName))return e()})}},ue=class extends k{boot(){}},he=class extends k{boot(){this._disabled=this.hasAttribute("disabled"),this._disableable=new it(this);let t=this;if(this._disabled&&(h(t,"disabled",""),h(t,"aria-disabled","true")),V(t,"menu-checkbox"),h(t,"role","menuitemcheckbox"),this._disabled)return;t._focusable=new L(t,{disableable:this._disableable,hover:!0,tabbableAttr:"data-active"}),t._selectable=new E(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 H(this),this._controllable.initial(s=>s&&t._selectable.setState(s)),this._controllable.getter(()=>t._selectable.getState());let e=J();this._controllable.setter(e(s=>{this._selectable.setState(s)})),this._selectable.onChange(e(()=>{this._controllable.dispatch()})),w(t,"click",()=>{this.dispatchEvent(new CustomEvent("lofi-close-popovers",{bubbles:!0})),t._selectable.press()}),be(t)}},fe=class extends k{boot(){this._disabled=this.hasAttribute("disabled"),this._disableable=new it(this);let t=this;this._disabled&&(h(t,"disabled",""),h(t,"aria-disabled","true")),V(t,"menu-radio"),h(t,"role","menuitemradio"),!this._disabled&&(t._focusable=new L(t,{disableable:this._disableable,hover:!0,tabbableAttr:"data-active"}),t._selectable=new E(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()}),be(t))}},de=class extends k{boot(){this._selectable=new et(this),this._controllable=new H(this),h(this,"role","group"),this._controllable.initial(e=>e&&this._selectable.setState(e)),this._controllable.getter(()=>this._selectable.getState());let t=J();this._controllable.setter(t(e=>{this._selectable.setState(e)})),this._selectable.onChange(t(()=>{this._controllable.dispatch()}))}},pe=class extends k{boot(){this._selectable=new et(this,{multiple:!0}),this._controllable=new H(this),h(this,"role","group"),this._controllable.initial(e=>e&&this._selectable.setState(e)),this._controllable.getter(()=>this._selectable.getState());let t=J();this._controllable.setter(t(e=>{this._selectable.setState(e)})),this._selectable.onChange(t(()=>{this._controllable.dispatch()}))}};Z(({css:i})=>i`ui-menu[popover]:popover-open { display: block; }`);Z(({css:i})=>i`ui-menu[popover].\:popover-open { display: block; }`);Z(({css:i})=>i`ui-menu-checkbox, ui-menu-radio { cursor: default; display: contents; }`);T("menu",ce);T("submenu",ue);T("menu-checkbox",he);T("menu-radio",fe);T("menu-radio-group",de);T("menu-checkbox-group",pe);function be(i){w(i,"keydown",t=>{t.key==="Enter"&&(i.click(),t.preventDefault(),t.stopPropagation())}),w(i,"keydown",t=>{t.key===" "&&(t.preventDefault(),t.stopPropagation())}),w(i,"keyup",t=>{t.key===" "&&(i.click(),t.preventDefault(),t.stopPropagation())})}function Hi(i){i._disableable=new it(i),i._disabled=i.hasAttribute("disabled");let t=i.querySelector("a"),e=i,s=i.parentElement.matches("ui-submenu")&&i.parentElement.querySelector("ui-menu[popover]"),n=t||e;if(i._disabled&&(h(n,"disabled",""),h(n,"aria-disabled","true")),V(n,"menu-item"),h(n,"role","menuitem"),!i._disabled)if(n._focusable=new L(n,{disableable:i._disableable,hover:!0,tabbableAttr:"data-active"}),!s)i.hasAttribute("disabled")||w(i,"click",()=>{i.dispatchEvent(new CustomEvent("lofi-close-popovers",{bubbles:!0}))}),be(e);else{s._popoverable=new M(s,{trigger:e}),s._anchorable=new N(s,{reference:e,position:s.hasAttribute("position")?s.getAttribute("position"):"right start",gap:s.hasAttribute("gap")?s.getAttribute("gap"):"-5"}),e.addEventListener("click",r=>{s._popoverable.setState(!0)});let{clear:o}=ft(e,s,{gain(){s._popoverable.setState(!0)},lose(){s._popoverable.setState(!1)},focusable:!1});s._popoverable.onChange(()=>{s._popoverable.getState()||(o(),s._focusable.wipeTabbables()),s._anchorable.reposition()}),w(e,"keydown",r=>{r.key==="Enter"&&(s._popoverable.setState(!0),setTimeout(()=>s._focusable.focusFirst()))}),w(e,"keydown",r=>{r.key==="ArrowRight"&&(s._popoverable.setState(!0),setTimeout(()=>s._focusable.focusFirst()))}),w(s,"keydown",r=>{r.key==="ArrowLeft"&&(s._popoverable.setState(!1),e.focus(),r.stopPropagation())})}}})(); +(()=>{function Z(i){let t=i({css:(s,...n)=>s.raw[0]+n.join("")});if(document.adoptedStyleSheets===void 0){let s=document.createElement("style");s.textContent=t,document.head.appendChild(s);return}let e=new CSSStyleSheet;e.replaceSync(t),document.adoptedStyleSheets=[...document.adoptedStyleSheets,e]}function _e(i,t){let e=i;for(;e;){if(t(e))return e;e=e.parentElement}}function B(i,t){let e=document.createTreeWalker(i,NodeFilter.SHOW_ELEMENT,t?{acceptNode:s=>{let n,o;return t(s,{skip:()=>n=!0,reject:()=>o=!0}),n?NodeFilter.FILTER_SKIP:o?NodeFilter.FILTER_REJECT:NodeFilter.FILTER_ACCEPT}}:{});return new Ut(e)}var Ut=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 e=this.next(t);return e||(this.walker.currentNode=this.walker.root,this.first())}prev(t){return this.walker.currentNode=t,this.walker.previousSibling()}prevOrLast(t){let e=this.prev(t);return e||(this.walker.currentNode=this.walker.root,this.last())}closest(t,e){let s=this.from(t).walker;for(;s.currentNode;){if(e(s.currentNode))return s.currentNode;s.parentNode()}}contains(t){return this.find(e=>e===t)}find(t){return this.walk((e,s)=>{t(e)&&s(e)})}findOrFirst(t){return this.find(t)||(this.walker.currentNode=this.walker.root),this.first()}each(t){this.walk(e=>t(e))}some(t){return!!this.find(t)}every(t){let e=!0;return this.walk(s=>{t(s)||(e=!1)}),e}map(t){let e=[];return this.walk(s=>e.push(t(s))),e}filter(t){let e=[];return this.walk(s=>t(s)&&e.push(s)),e}walk(t){let e,s=this.walker,n;for(;s.nextNode()&&(e=s.currentNode,t(e,o=>n=o),n===void 0););return n}};function T(i,t){customElements.define(`ui-${i}`,t)}function w(i,t,e,s={}){return i.addEventListener(t,e,s),{off:()=>i.removeEventListener(t,e),pause:n=>{i.removeEventListener(t,e),n(),i.addEventListener(t,e)}}}function Se(i){return["a[href]","area[href]","input:not([disabled])","select:not([disabled])","textarea:not([disabled])","button:not([disabled])","iframe","object","embed","[tabindex]","[contenteditable]"].some(e=>i.matches(e))&&i.tabIndex>=0}function oi(i,t){let e;return function(){let s=this,n=arguments;e||(i.apply(s,n),e=!0,setTimeout(()=>e=!1,t))}}var Ft="pointer";document.addEventListener("keydown",()=>Ft="keyboard",{capture:!0});document.addEventListener("pointerdown",i=>{Ft=i.pointerType==="mouse"?"mouse":"touch"},{capture:!0});function Yt(){return Ft==="keyboard"}function ri(){return Ft==="touch"}function Dt(i,t){let e="",s=di(()=>{e=""},300);i.addEventListener("keydown",n=>{n.key.length===1&&/[a-zA-Z]/.test(n.key)&&(e+=n.key,t(e),n.stopPropagation()),s()})}function li(i,t){return"lofi-"+(t?t+"-":"")+Math.random().toString(16).slice(2)}function V(i,t){let e=i.hasAttribute("id")?i.getAttribute("id"):li(i,t);return h(i,"id",e),i._x_bindings||(i._x_bindings={}),i._x_bindings.id||(i._x_bindings.id=e),e}function J(){let i=!1;return t=>(...e)=>{i||(i=!0,t(...e),i=!1)}}function ft(i,t,{gain:e,lose:s,focusable:n,useSafeArea:o}){let r=!1;n&&document.addEventListener("focusin",f=>{Yt()&&(i.contains(f.target)||t.contains(f.target)?(r=!0,e()):(r=!1,s()))});let a=()=>{},c=()=>{},u=()=>{r=!1,s(),a(),c()},p=()=>{r=!1,a(),c()};return i.addEventListener("pointerenter",f=>{ri()||r||(r=!0,e(),setTimeout(()=>{let{safeArea:v,redraw:m,remove:l}=o?ai(i,t,f.clientX,f.clientY):fi();a=l;let d,g=oi(b=>{let x=t.getBoundingClientRect(),A=i.getBoundingClientRect(),_;switch(v.contains(b.target)&&ci(A,x,b.clientX,b.clientY)?_="safeArea":t.contains(b.target)?_="panel":i.contains(b.target)?_="trigger":_="outside",d&&clearTimeout(d),_){case"outside":u();break;case"trigger":m(b.clientX,b.clientY);break;case"panel":a();break;case"safeArea":m(b.clientX,b.clientY),d=setTimeout(()=>{u()},300);break;default:break}},100);document.addEventListener("pointermove",g),c=()=>document.removeEventListener("pointermove",g)}))}),{clear:p}}function ai(i,t,e,s){let n=document.createElement("div"),o=t.getBoundingClientRect(),r=i.getBoundingClientRect();n.style.position="fixed",h(n,"data-safe-area","");let a=(c,u)=>{if(o.top===0&&o.bottom===0)return;let p;o.leftr.right&&(p="right"),o.topr.bottom&&o.top>u&&(p="down"),p===void 0&&(p="right");let f,v,m,l,d,g,b,x,A=10;switch(p){case"left":f=o.right,v=Math.max(o.right,c)+5,m=v-f,l=Math.min(r.top,o.top)-A,d=Math.max(r.bottom,o.bottom)+A,g=d-l,b=u-l,x=`polygon(0% 0%, 100% ${b}px, 0% 100%)`;break;case"right":f=Math.min(o.left,c)-5,v=o.left,m=v-f,l=Math.min(r.top,o.top)-A,d=Math.max(r.bottom,o.bottom)+A,g=d-l,b=u-l,x=`polygon(0% ${b}px, 100% 0%, 100% 100%)`;break;case"up":f=Math.min(c,o.left)-A,v=Math.max(c,o.right)+A,m=v-f,l=o.bottom,d=Math.max(o.bottom,u)+5,g=d-l,b=c-f,x=`polygon(0% 0%, 100% 0%, ${b}px 100%)`;break;case"down":f=Math.min(c,o.left)-A,v=Math.max(c,o.right)+A,m=v-f,l=Math.min(o.top,u)-5,d=o.top,g=d-l,b=c-f,x=`polygon(${b}px 0%, 100% 100%, 0% 100%)`;break}n.style.left=`${f}px`,n.style.top=`${l}px`,n.style.width=`${m}px`,n.style.height=`${g}px`,n.style.clipPath=x};return{safeArea:n,redraw:(c,u)=>{n.isConnected||i.appendChild(n),a(c,u)},remove:()=>{n.remove()}}}function ci(i,t,e,s){return!ui(i,e,s)&&!hi(t,e,s)}function ui(i,t,e){return i.left<=t&&t<=i.right&&i.top<=e&&e<=i.bottom}function hi(i,t,e){return i.left<=t&&t<=i.right&&i.top<=e&&e<=i.bottom}function h(i,t,e){i._durableAttributeObserver===void 0&&(i._durableAttributeObserver=ke(i,[t])),i._durableAttributeObserver.hasAttribute(t)||i._durableAttributeObserver.addAttribute(t),i._durableAttributeObserver.pause(()=>{i.setAttribute(t,e)})}function y(i,t){i._durableAttributeObserver===void 0&&(i._durableAttributeObserver=ke(i,[t])),i._durableAttributeObserver.hasAttribute(t)||i._durableAttributeObserver.addAttribute(t),i._durableAttributeObserver.pause(()=>{i.removeAttribute(t)})}function ke(i,t){let e=n=>{n.forEach(o=>{o.oldValue===null?i._durableAttributeObserver.pause(()=>y(i,o.attributeName)):i._durableAttributeObserver.pause(()=>h(i,o.attributeName,o.oldValue))})},s=new MutationObserver(n=>e(n));return s.observe(i,{attributeFilter:t,attributeOldValue:!0}),{attributes:t,hasAttribute(n){return this.attributes.includes(n)},addAttribute(n){this.attributes.includes(n)||this.attributes.push(n),s.observe(i,{attributeFilter:this.attributes,attributeOldValue:!0})},releaseAttribute(n){this.hasAttribute(n)&&s.observe(i,{attributeFilter:this.attributes,attributeOldValue:!0})},pause(n){e(s.takeRecords()),s.disconnect(),n(),s.observe(i,{attributeFilter:this.attributes,attributeOldValue:!0})}}}function fi(){return{safeArea:{contains:()=>!1},redraw:()=>{},remove:()=>{}}}function di(i,t){let e;return(...s)=>{clearTimeout(e),e=setTimeout(()=>{i(...s)},t)}}var Rt=0;function Nt(i=!1){if(i)return{lock:()=>{},unlock:()=>{}};let t=()=>{};return{lock(){Rt++,!(Rt>1)&&(t=pi(ye(document.documentElement,"paddingRight",`${window.innerWidth-document.documentElement.clientWidth}px`),ye(document.documentElement,"overflow","hidden")))},unlock(){Rt=Math.max(0,Rt-1),t()}}}function ye(i,t,e){let s=i.style[t];return i.style[t]=e,()=>{i.style[t]=s}}function pi(...i){return(...t)=>{for(let e of i)e(...t)}}var k=class extends HTMLElement{constructor(){super(),this.boot?.()}connectedCallback(){queueMicrotask(()=>{this.mount?.()})}mixin(t,e={}){return new t(this,e)}appendMixin(t,e={}){return new t(this,e)}use(t){let e;return this.mixins.forEach(s=>{s instanceof t&&(e=s)}),e}uses(t){let e;return this.mixins.forEach(s=>{s instanceof t&&(e=!0)}),!!e}on(t,e){return w(this,t,e)}root(t,e={}){if(t===void 0)return this.__root;let s=document.createElement(t);for(let o in e)setAttribute(s,o,e[o]);let n=this.attachShadow({mode:"open"});return s.appendChild(document.createElement("slot")),n.appendChild(s),this.__root=s,this.__root}},Wt=class extends k{};var C=class{constructor(t,e={}){this.el=t,this.grouped=e.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=e,this.boot?.({options:s=>{let n=s;Object.entries(this.opts).forEach(([o,r])=>{r!==void 0&&(n[o]=r)}),this.opts=n}}),queueMicrotask(()=>{this.mount?.()})}options(){return this.opts}hasGroup(){return!!this.group()}group(){if(this.grouped!==!1)return _e(this.el,t=>t[this.groupedByType.name])?.use(this.groupedByType)}on(t,e){return w(this.el,t,e)}},q=class extends C{constructor(t,e={}){super(t,e)}walker(){return B(this.el,(t,{skip:e,reject:s})=>{if(t[this.constructor.name]&&t!==this.el)return s();if(!t[this.groupOfType.name]||!t.mixins.get(this.groupOfType.name).grouped)return e()})}};var $=class extends C{boot({options:t}){this.initialState=this.el.value,this.getterFunc=()=>{},this.setterFunc=e=>this.initialState=e,Object.defineProperty(this.el,"value",{get:()=>this.getterFunc(),set:e=>{this.setterFunc(e)}})}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 j=new Map,R=class extends C{boot({options:t}){t({trigger:null,scope:null});let e=this.options().scope||"global";h(this.el,"popover","manual"),this.trigger=this.options().trigger,this.onChanges=[],this.state=!1,w(this.el,"beforetoggle",s=>{let n=this.state;if(this.state=s.newState==="open",this.state){bi(this.el,e);let o=new AbortController,r=document.activeElement;setTimeout(()=>{mi(this.el,r,o),gi(this.el,r,o),vi(this.el,r,o)}),this.el.addEventListener("beforetoggle",a=>{a.newState==="closed"&&(o.abort(),r.focus())},{signal:o.signal})}n!==this.state&&this.onChanges.forEach(o=>o(this.state,n))}),w(this.el,"toggle",s=>{if(s.newState==="open")j.has(e)||j.set(e,new Set),j.get(e).add(this.el);else if(s.newState==="closed"){if(!j.has(e))return;j.get(e).delete(this.el),j.get(e).size===0&&j.delete(e)}})}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 bi(i,t){j.has(t)&&j.get(t).forEach(e=>{i.contains(e)||e.contains(i)||e.hidePopover()})}function mi(i,t,e){document.addEventListener("click",s=>{i.contains(s.target)||t===s.target||i.hidePopover()},{signal:e.signal})}function gi(i,t,e){document.addEventListener("focusin",s=>{i.contains(s.target)||t===s.target||(e.abort(),i.hidePopover())},{capture:!0,signal:e.signal})}function vi(i,t,e){document.addEventListener("keydown",s=>{s.key==="Escape"&&i.hidePopover()},{signal:e.signal})}var H=Math.min,P=Math.max,At=Math.round,yt=Math.floor,U=i=>({x:i,y:i}),wi={left:"right",right:"left",bottom:"top",top:"bottom"},xi={start:"end",end:"start"};function Xt(i,t,e){return P(i,H(t,e))}function dt(i,t){return typeof i=="function"?i(t):i}function Y(i){return i.split("-")[0]}function pt(i){return i.split("-")[1]}function Kt(i){return i==="x"?"y":"x"}function Gt(i){return i==="y"?"height":"width"}function tt(i){return["top","bottom"].includes(Y(i))?"y":"x"}function Qt(i){return Kt(tt(i))}function Ee(i,t,e){e===void 0&&(e=!1);let s=pt(i),n=Qt(i),o=Gt(n),r=n==="x"?s===(e?"end":"start")?"right":"left":s==="start"?"bottom":"top";return t.reference[o]>t.floating[o]&&(r=xt(r)),[r,xt(r)]}function Ce(i){let t=xt(i);return[It(i),t,It(t)]}function It(i){return i.replace(/start|end/g,t=>xi[t])}function Ai(i,t,e){let s=["left","right"],n=["right","left"],o=["top","bottom"],r=["bottom","top"];switch(i){case"top":case"bottom":return e?t?n:s:t?s:n;case"left":case"right":return t?o:r;default:return[]}}function Oe(i,t,e,s){let n=pt(i),o=Ai(Y(i),e==="start",s);return n&&(o=o.map(r=>r+"-"+n),t&&(o=o.concat(o.map(It)))),o}function xt(i){return i.replace(/left|right|bottom|top/g,t=>wi[t])}function yi(i){return{top:0,right:0,bottom:0,left:0,...i}}function Te(i){return typeof i!="number"?yi(i):{top:i,right:i,bottom:i,left:i}}function ot(i){let{x:t,y:e,width:s,height:n}=i;return{width:s,height:n,top:e,left:t,right:t+s,bottom:e+n,x:t,y:e}}function Pe(i,t,e){let{reference:s,floating:n}=i,o=tt(t),r=Qt(t),a=Gt(r),c=Y(t),u=o==="y",p=s.x+s.width/2-n.width/2,f=s.y+s.height/2-n.height/2,v=s[a]/2-n[a]/2,m;switch(c){case"top":m={x:p,y:s.y-n.height};break;case"bottom":m={x:p,y:s.y+s.height};break;case"right":m={x:s.x+s.width,y:f};break;case"left":m={x:s.x-n.width,y:f};break;default:m={x:s.x,y:s.y}}switch(pt(t)){case"start":m[r]-=v*(e&&u?-1:1);break;case"end":m[r]+=v*(e&&u?-1:1);break}return m}var Le=async(i,t,e)=>{let{placement:s="bottom",strategy:n="absolute",middleware:o=[],platform:r}=e,a=o.filter(Boolean),c=await(r.isRTL==null?void 0:r.isRTL(t)),u=await r.getElementRects({reference:i,floating:t,strategy:n}),{x:p,y:f}=Pe(u,s,c),v=s,m={},l=0;for(let d=0;dnt<=0)){var vt,we;let nt=(((vt=o.flip)==null?void 0:vt.index)||0)+1,Ae=Mt[nt];if(Ae)return{data:{index:nt,overflows:K},reset:{placement:Ae}};let wt=(we=K.filter(ht=>ht.overflows[0]<=0).sort((ht,G)=>ht.overflows[1]-G.overflows[1])[0])==null?void 0:we.placement;if(!wt)switch(m){case"bestFit":{var xe;let ht=(xe=K.filter(G=>{if(I){let Q=tt(G.placement);return Q===x||Q==="y"}return!0}).map(G=>[G.placement,G.overflows.filter(Q=>Q>0).reduce((Q,ni)=>Q+ni,0)]).sort((G,Q)=>G[1]-Q[1])[0])==null?void 0:xe[0];ht&&(wt=ht);break}case"initialPlacement":wt=a;break}if(n!==wt)return{reset:{placement:wt}}}return{}}}};async function _i(i,t){let{placement:e,platform:s,elements:n}=i,o=await(s.isRTL==null?void 0:s.isRTL(n.floating)),r=Y(e),a=pt(e),c=tt(e)==="y",u=["left","top"].includes(r)?-1:1,p=o&&c?-1:1,f=dt(t,i),{mainAxis:v,crossAxis:m,alignmentAxis:l}=typeof f=="number"?{mainAxis:f,crossAxis:0,alignmentAxis:null}:{mainAxis:0,crossAxis:0,alignmentAxis:null,...f};return a&&typeof l=="number"&&(m=a==="end"?l*-1:l),c?{x:m*p,y:v*u}:{x:v*u,y:m*p}}var Re=function(i){return i===void 0&&(i=0),{name:"offset",options:i,async fn(t){var e,s;let{x:n,y:o,placement:r,middlewareData:a}=t,c=await _i(t,i);return r===((e=a.offset)==null?void 0:e.placement)&&(s=a.arrow)!=null&&s.alignmentOffset?{}:{x:n+c.x,y:o+c.y,data:{...c,placement:r}}}}},Fe=function(i){return i===void 0&&(i={}),{name:"shift",options:i,async fn(t){let{x:e,y:s,placement:n}=t,{mainAxis:o=!0,crossAxis:r=!1,limiter:a={fn:g=>{let{x:b,y:x}=g;return{x:b,y:x}}},...c}=dt(i,t),u={x:e,y:s},p=await Bt(t,c),f=tt(Y(n)),v=Kt(f),m=u[v],l=u[f];if(o){let g=v==="y"?"top":"left",b=v==="y"?"bottom":"right",x=m+p[g],A=m-p[b];m=Xt(x,m,A)}if(r){let g=f==="y"?"top":"left",b=f==="y"?"bottom":"right",x=l+p[g],A=l-p[b];l=Xt(x,l,A)}let d=a.fn({...t,[v]:m,[f]:l});return{...d,data:{x:d.x-e,y:d.y-s}}}}};var De=function(i){return i===void 0&&(i={}),{name:"size",options:i,async fn(t){let{placement:e,rects:s,platform:n,elements:o}=t,{apply:r=()=>{},...a}=dt(i,t),c=await Bt(t,a),u=Y(e),p=pt(e),f=tt(e)==="y",{width:v,height:m}=s.floating,l,d;u==="top"||u==="bottom"?(l=u,d=p===(await(n.isRTL==null?void 0:n.isRTL(o.floating))?"start":"end")?"left":"right"):(d=u,l=p==="end"?"top":"bottom");let g=m-c.top-c.bottom,b=v-c.left-c.right,x=H(m-c[l],g),A=H(v-c[d],b),_=!t.middlewareData.shift,S=x,I=A;if(f?I=p||_?H(A,b):b:S=p||_?H(x,g):g,_&&!p){let ut=P(c.left,0),st=P(c.right,0),K=P(c.top,0),vt=P(c.bottom,0);f?I=v-2*(ut!==0||st!==0?ut+st:P(c.left,c.right)):S=m-2*(K!==0||vt!==0?K+vt:P(c.top,c.bottom))}await r({...t,availableWidth:I,availableHeight:S});let Mt=await n.getDimensions(o.floating);return v!==Mt.width||m!==Mt.height?{reset:{rects:!0}}:{}}}};function rt(i){return We(i)?(i.nodeName||"").toLowerCase():"#document"}function M(i){var t;return(i==null||(t=i.ownerDocument)==null?void 0:t.defaultView)||window}function z(i){var t;return(t=(We(i)?i.ownerDocument:i.document)||window.document)==null?void 0:t.documentElement}function We(i){return i instanceof Node||i instanceof M(i).Node}function F(i){return i instanceof Element||i instanceof M(i).Element}function W(i){return i instanceof HTMLElement||i instanceof M(i).HTMLElement}function Ne(i){return typeof ShadowRoot>"u"?!1:i instanceof ShadowRoot||i instanceof M(i).ShadowRoot}function mt(i){let{overflow:t,overflowX:e,overflowY:s,display:n}=D(i);return/auto|scroll|overlay|hidden|clip/.test(t+s+e)&&!["inline","contents"].includes(n)}function Ie(i){return["table","td","th"].includes(rt(i))}function _t(i){return[":popover-open",":modal"].some(t=>{try{return i.matches(t)}catch{return!1}})}function Vt(i){let t=qt(),e=F(i)?D(i):i;return e.transform!=="none"||e.perspective!=="none"||(e.containerType?e.containerType!=="normal":!1)||!t&&(e.backdropFilter?e.backdropFilter!=="none":!1)||!t&&(e.filter?e.filter!=="none":!1)||["transform","perspective","filter"].some(s=>(e.willChange||"").includes(s))||["paint","layout","strict","content"].some(s=>(e.contain||"").includes(s))}function Be(i){let t=X(i);for(;W(t)&&!lt(t);){if(Vt(t))return t;if(_t(t))return null;t=X(t)}return null}function qt(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function lt(i){return["html","body","#document"].includes(rt(i))}function D(i){return M(i).getComputedStyle(i)}function St(i){return F(i)?{scrollLeft:i.scrollLeft,scrollTop:i.scrollTop}:{scrollLeft:i.scrollX,scrollTop:i.scrollY}}function X(i){if(rt(i)==="html")return i;let t=i.assignedSlot||i.parentNode||Ne(i)&&i.host||z(i);return Ne(t)?t.host:t}function Ve(i){let t=X(i);return lt(t)?i.ownerDocument?i.ownerDocument.body:i.body:W(t)&&mt(t)?t:Ve(t)}function bt(i,t,e){var s;t===void 0&&(t=[]),e===void 0&&(e=!0);let n=Ve(i),o=n===((s=i.ownerDocument)==null?void 0:s.body),r=M(n);if(o){let a=$t(r);return t.concat(r,r.visualViewport||[],mt(n)?n:[],a&&e?bt(a):[])}return t.concat(n,bt(n,[],e))}function $t(i){return i.parent&&Object.getPrototypeOf(i.parent)?i.frameElement:null}function He(i){let t=D(i),e=parseFloat(t.width)||0,s=parseFloat(t.height)||0,n=W(i),o=n?i.offsetWidth:e,r=n?i.offsetHeight:s,a=At(e)!==o||At(s)!==r;return a&&(e=o,s=r),{width:e,height:s,$:a}}function Jt(i){return F(i)?i:i.contextElement}function gt(i){let t=Jt(i);if(!W(t))return U(1);let e=t.getBoundingClientRect(),{width:s,height:n,$:o}=He(t),r=(o?At(e.width):e.width)/s,a=(o?At(e.height):e.height)/n;return(!r||!Number.isFinite(r))&&(r=1),(!a||!Number.isFinite(a))&&(a=1),{x:r,y:a}}var Si=U(0);function ze(i){let t=M(i);return!qt()||!t.visualViewport?Si:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function ki(i,t,e){return t===void 0&&(t=!1),!e||t&&e!==M(i)?!1:t}function at(i,t,e,s){t===void 0&&(t=!1),e===void 0&&(e=!1);let n=i.getBoundingClientRect(),o=Jt(i),r=U(1);t&&(s?F(s)&&(r=gt(s)):r=gt(i));let a=ki(o,e,s)?ze(o):U(0),c=(n.left+a.x)/r.x,u=(n.top+a.y)/r.y,p=n.width/r.x,f=n.height/r.y;if(o){let v=M(o),m=s&&F(s)?M(s):s,l=v,d=$t(l);for(;d&&s&&m!==l;){let g=gt(d),b=d.getBoundingClientRect(),x=D(d),A=b.left+(d.clientLeft+parseFloat(x.paddingLeft))*g.x,_=b.top+(d.clientTop+parseFloat(x.paddingTop))*g.y;c*=g.x,u*=g.y,p*=g.x,f*=g.y,c+=A,u+=_,l=M(d),d=$t(l)}}return ot({width:p,height:f,x:c,y:u})}function Ei(i){let{elements:t,rect:e,offsetParent:s,strategy:n}=i,o=n==="fixed",r=z(s),a=t?_t(t.floating):!1;if(s===r||a&&o)return e;let c={scrollLeft:0,scrollTop:0},u=U(1),p=U(0),f=W(s);if((f||!f&&!o)&&((rt(s)!=="body"||mt(r))&&(c=St(s)),W(s))){let v=at(s);u=gt(s),p.x=v.x+s.clientLeft,p.y=v.y+s.clientTop}return{width:e.width*u.x,height:e.height*u.y,x:e.x*u.x-c.scrollLeft*u.x+p.x,y:e.y*u.y-c.scrollTop*u.y+p.y}}function Ci(i){return Array.from(i.getClientRects())}function je(i){return at(z(i)).left+St(i).scrollLeft}function Oi(i){let t=z(i),e=St(i),s=i.ownerDocument.body,n=P(t.scrollWidth,t.clientWidth,s.scrollWidth,s.clientWidth),o=P(t.scrollHeight,t.clientHeight,s.scrollHeight,s.clientHeight),r=-e.scrollLeft+je(i),a=-e.scrollTop;return D(s).direction==="rtl"&&(r+=P(t.clientWidth,s.clientWidth)-n),{width:n,height:o,x:r,y:a}}function Ti(i,t){let e=M(i),s=z(i),n=e.visualViewport,o=s.clientWidth,r=s.clientHeight,a=0,c=0;if(n){o=n.width,r=n.height;let u=qt();(!u||u&&t==="fixed")&&(a=n.offsetLeft,c=n.offsetTop)}return{width:o,height:r,x:a,y:c}}function Pi(i,t){let e=at(i,!0,t==="fixed"),s=e.top+i.clientTop,n=e.left+i.clientLeft,o=W(i)?gt(i):U(1),r=i.clientWidth*o.x,a=i.clientHeight*o.y,c=n*o.x,u=s*o.y;return{width:r,height:a,x:c,y:u}}function qe(i,t,e){let s;if(t==="viewport")s=Ti(i,e);else if(t==="document")s=Oi(z(i));else if(F(t))s=Pi(t,e);else{let n=ze(i);s={...t,x:t.x-n.x,y:t.y-n.y}}return ot(s)}function Ue(i,t){let e=X(i);return e===t||!F(e)||lt(e)?!1:D(e).position==="fixed"||Ue(e,t)}function Li(i,t){let e=t.get(i);if(e)return e;let s=bt(i,[],!1).filter(a=>F(a)&&rt(a)!=="body"),n=null,o=D(i).position==="fixed",r=o?X(i):i;for(;F(r)&&!lt(r);){let a=D(r),c=Vt(r);!c&&a.position==="fixed"&&(n=null),(o?!c&&!n:!c&&a.position==="static"&&!!n&&["absolute","fixed"].includes(n.position)||mt(r)&&!c&&Ue(i,r))?s=s.filter(p=>p!==r):n=a,r=X(r)}return t.set(i,s),s}function Mi(i){let{element:t,boundary:e,rootBoundary:s,strategy:n}=i,r=[...e==="clippingAncestors"?_t(t)?[]:Li(t,this._c):[].concat(e),s],a=r[0],c=r.reduce((u,p)=>{let f=qe(t,p,n);return u.top=P(f.top,u.top),u.right=H(f.right,u.right),u.bottom=H(f.bottom,u.bottom),u.left=P(f.left,u.left),u},qe(t,a,n));return{width:c.right-c.left,height:c.bottom-c.top,x:c.left,y:c.top}}function Ri(i){let{width:t,height:e}=He(i);return{width:t,height:e}}function Fi(i,t,e){let s=W(t),n=z(t),o=e==="fixed",r=at(i,!0,o,t),a={scrollLeft:0,scrollTop:0},c=U(0);if(s||!s&&!o)if((rt(t)!=="body"||mt(n))&&(a=St(t)),s){let f=at(t,!0,o,t);c.x=f.x+t.clientLeft,c.y=f.y+t.clientTop}else n&&(c.x=je(n));let u=r.left+a.scrollLeft-c.x,p=r.top+a.scrollTop-c.y;return{x:u,y:p,width:r.width,height:r.height}}function Zt(i){return D(i).position==="static"}function $e(i,t){return!W(i)||D(i).position==="fixed"?null:t?t(i):i.offsetParent}function Ye(i,t){let e=M(i);if(_t(i))return e;if(!W(i)){let n=X(i);for(;n&&!lt(n);){if(F(n)&&!Zt(n))return n;n=X(n)}return e}let s=$e(i,t);for(;s&&Ie(s)&&Zt(s);)s=$e(s,t);return s&<(s)&&Zt(s)&&!Vt(s)?e:s||Be(i)||e}var Di=async function(i){let t=this.getOffsetParent||Ye,e=this.getDimensions,s=await e(i.floating);return{reference:Fi(i.reference,await t(i.floating),i.strategy),floating:{x:0,y:0,width:s.width,height:s.height}}};function Ni(i){return D(i).direction==="rtl"}var Wi={convertOffsetParentRelativeRectToViewportRelativeRect:Ei,getDocumentElement:z,getClippingRect:Mi,getOffsetParent:Ye,getElementRects:Di,getClientRects:Ci,getDimensions:Ri,getScale:gt,isElement:F,isRTL:Ni};function Ii(i,t){let e=null,s,n=z(i);function o(){var a;clearTimeout(s),(a=e)==null||a.disconnect(),e=null}function r(a,c){a===void 0&&(a=!1),c===void 0&&(c=1),o();let{left:u,top:p,width:f,height:v}=i.getBoundingClientRect();if(a||t(),!f||!v)return;let m=yt(p),l=yt(n.clientWidth-(u+f)),d=yt(n.clientHeight-(p+v)),g=yt(u),x={rootMargin:-m+"px "+-l+"px "+-d+"px "+-g+"px",threshold:P(0,H(1,c))||1},A=!0;function _(S){let I=S[0].intersectionRatio;if(I!==c){if(!A)return r();I?r(!1,I):s=setTimeout(()=>{r(!1,1e-7)},1e3)}A=!1}try{e=new IntersectionObserver(_,{...x,root:n.ownerDocument})}catch{e=new IntersectionObserver(_,x)}e.observe(i)}return r(!0),o}function Xe(i,t,e,s){s===void 0&&(s={});let{ancestorScroll:n=!0,ancestorResize:o=!0,elementResize:r=typeof ResizeObserver=="function",layoutShift:a=typeof IntersectionObserver=="function",animationFrame:c=!1}=s,u=Jt(i),p=n||o?[...u?bt(u):[],...bt(t)]:[];p.forEach(b=>{n&&b.addEventListener("scroll",e,{passive:!0}),o&&b.addEventListener("resize",e)});let f=u&&a?Ii(u,e):null,v=-1,m=null;r&&(m=new ResizeObserver(b=>{let[x]=b;x&&x.target===u&&m&&(m.unobserve(t),cancelAnimationFrame(v),v=requestAnimationFrame(()=>{var A;(A=m)==null||A.observe(t)})),e()}),u&&!c&&m.observe(u),m.observe(t));let l,d=c?at(i):null;c&&g();function g(){let b=at(i);d&&(b.x!==d.x||b.y!==d.y||b.width!==d.width||b.height!==d.height)&&e(),d=b,l=requestAnimationFrame(g)}return e(),()=>{var b;p.forEach(x=>{n&&x.removeEventListener("scroll",e),o&&x.removeEventListener("resize",e)}),f?.(),(b=m)==null||b.disconnect(),m=null,c&&cancelAnimationFrame(l)}}var Ke=Re;var Ge=Fe,Qe=Me,Ze=De;var Je=(i,t,e)=>{let s=new Map,n={platform:Wi,...e},o={...n.platform,_c:s};return Le(i,t,{...n,platform:o})};var N=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[e,s]=qi(this.el),n=Bi(this.el,this.options().reference,e,{position:this.options().position,gap:this.options().gap,offset:this.options().offset,matchWidth:this.options().matchWidth}),o=()=>{};this.reposition=(...r)=>{this.options().auto?o=Xe(this.options().reference,this.el,n):n(...r)},this.cleanup=()=>{o(),s()}}};function Bi(i,t,e,{position:s,offset:n,gap:o,matchWidth:r}){return(a=null,c=null)=>{Je(t,i,{placement:Vi(s),middleware:[Qe(),Ge({padding:5,crossAxis:!0}),Ke({mainAxis:Number(o),alignmentAxis:Number(n)}),r?Ze({apply({rects:u,elements:p}){Object.assign(p.floating.style,{width:`${u.reference.width}px`})}}):void 0]}).then(({x:u,y:p})=>{e(a||u,c||p)})}}function Vi(i){return i.split(" ").join("-")}function qi(i){let t=(o,r)=>{Object.assign(i.style,{position:"absolute",inset:`${r}px auto auto ${o}px`})},e,s,n=new MutationObserver(()=>t(e,s));return[(o,r)=>{e=o,s=r,n.disconnect(),t(e,s),n.observe(i,{attributeFilter:["style"]})},()=>{n.disconnect()}]}var te=class extends k{boot(){let t=this.trigger(),e=this.overlay();if(t){if(!e)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),e._popoverable=new R(e),e._anchorable=new N(e,{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}),e._popoverable.onChange(()=>{e._popoverable.getState()?e._anchorable.reposition():e._anchorable.cleanup()}),["ui-menu","ui-context"].includes(e.localName)){let{lock:o,unlock:r}=Nt();e._popoverable.onChange(()=>{e._popoverable.getState()?o():r()})}this._controllable.initial(o=>e._popoverable.setState(o)),this._controllable.getter(()=>e._popoverable.getState());let s=J();this._controllable.setter(o=>e._popoverable.setState(o)),e._popoverable.onChange(s(()=>this._controllable.dispatch())),this.hasAttribute("hover")&&ft(t,e,{gain(){e._popoverable.setState(!0)},lose(){e._popoverable.setState(!1)},focusable:!0}),w(t,"click",()=>e._popoverable.toggle()),e._popoverable.getState()?(h(this,"data-open",""),h(t,"data-open",""),h(e,"data-open","")):(y(this,"data-open"),y(t,"data-open"),y(e,"data-open")),e._popoverable.onChange(()=>{e._popoverable.getState()?(h(this,"data-open",""),h(t,"data-open",""),h(e,"data-open","")):(y(this,"data-open"),y(t,"data-open"),y(e,"data-open"))});let n=V(e,"dropdown");h(t,"aria-haspopup","true"),h(t,"aria-controls",n),h(t,"aria-expanded",e._popoverable.getState()?"true":"false"),e._popoverable.onChange(()=>{h(t,"aria-expanded",e._popoverable.getState()?"true":"false")}),e._popoverable.onChange(()=>{e._popoverable.getState()?e.onPopoverShow?.():e.onPopoverHide?.()})}trigger(){return this.querySelector("button")}overlay(){return this.lastElementChild?.matches("[popover]")&&this.lastElementChild}};T("dropdown",te);var ee=class extends k{boot(){let t=this.hasAttribute("label")?"label":"description",e=this.button(),s=this.overlay();if(e){if(!s)return}else return console.warn("ui-tooltip: no trigger element found",this);this._disabled=this.hasAttribute("disabled"),s._popoverable=new R(s,{scope:"tooltip"}),s._anchorable=new N(s,{reference:e,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}),s._popoverable.onChange(()=>s._anchorable.reposition()),this._disabled||ft(e,s,{gain(){s._popoverable.setState(!0)},lose(){s._popoverable.setState(!1)},focusable:!0,useSafeArea:!1});let n=V(s,"tooltip"),o=this.hasAttribute("interactive"),r=this.hasAttribute("label")||e.textContent.trim()==="";o?(h(e,"aria-controls",n),h(e,"aria-expanded","false"),s._popoverable.onChange(()=>{s._popoverable.getState()?h(e,"aria-expanded","true"):h(e,"aria-expanded","false")})):(r?h(e,"aria-labelledby",n):h(e,"aria-describedby",n),h(s,"aria-hidden","true")),h(s,"role","tooltip")}button(){return this.firstElementChild}overlay(){return this.lastElementChild!==this.button()&&this.lastElementChild}};T("tooltip",ee);var et=class extends q{groupOfType=E;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,e=!1){if(t.ungrouped)return;let s=t.value,n=t.isSelected(),o=this.options().multiple;n?o?this.state.add(s):this.state=s:o?this.state.delete(s):this.state=null,e||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(s=>s+"")):t=t+"",this.state=this.options().multiple?new Set(t):t;let e=this.options().multiple?t:[t];this.walker().each(s=>{let n=s.use(E);if(n.ungrouped)return;let o=e.includes(n.value);o&&!n.isSelected()?n.surgicallySelect():!o&&n.isSelected()&&n.surgicallyDeselect()}),this.onChanges.forEach(s=>s())}selected(){return this.walker().find(t=>t.use(E).isSelected()).use(E)}selecteds(){return this.walker().filter(t=>t.use(E).isSelected()).map(t=>t.use(E))}selectFirst(){this.walker().first()?.use(E).select()}selectAll(){this.walker().filter(t=>!t.use(E).isSelected()).map(t=>t.use(E).select())}deselectAll(){this.walker().filter(t=>t.use(E).isSelected()).map(t=>t.use(E).deselect())}allAreSelected(){return this.walker().filter(t=>t.use(E).isSelected()).length===this.walker().filter(t=>!0).length}noneAreSelected(){return this.state===null||this.state?.size===0}selectableByValue(t){return this.walker().find(e=>e.use(E).value===t)?.use(E)}deselectOthers(t){this.walker().each(e=>{e!==t&&e.use(E).surgicallyDeselect()})}selectedTextValue(){return this.options().multiple?Array.from(this.state).map(t=>this.convertValueStringToElementText(t)).join(", "):this.convertValueStringToElementText(this.state)}convertValueStringToElementText(t){let e=this.findByValue(t);return e?e.label||e.value:t}findByValue(t){return this.selecteds().find(e=>e.value===t)}walker(){return B(this.el,(t,{skip:e,reject:s})=>{if(t[this.constructor.name]&&t!==this.el)return s();if(!t[this.groupOfType.name]||t.mixins.get(this.groupOfType.name).ungrouped)return e()})}},E=class extends C{boot({options:t}){this.groupedByType=et,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 e=this.options().selectedInitially;this.group()&&this.group().hasValue(this.value)&&(e=!0),this.multiple=this.hasGroup()?this.group().options().multiple:!1,this.toggleable=this.options().toggleable||this.multiple,this.onSelects=[],this.onUnselects=[],this.onChanges=[],e?this.select(!0):(this.state=e,this.surgicallyDeselect(!0))}mount(){this.el.hasAttribute(this.options().ariaAttr)||h(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 e=!this.isSelected();this.toggleable||this.group()?.deselectOthers(this.el),this.state=!0,h(this.el,this.options().ariaAttr,"true"),h(this.el,this.options().dataAttr,""),e&&(t||(this.onSelects.forEach(s=>s()),this.onChanges.forEach(s=>s())),this.group()?.changed(this,t))}surgicallySelect(){let t=!this.isSelected();this.state=!0,h(this.el,this.options().ariaAttr,"true"),h(this.el,this.options().dataAttr,""),t&&(this.onSelects.forEach(e=>e()),this.onChanges.forEach(e=>e()))}deselect(t=!0){let e=this.isSelected();this.state=!1,h(this.el,this.options().ariaAttr,"false"),y(this.el,this.options().dataAttr),e&&(this.onUnselects.forEach(s=>s()),this.onChanges.forEach(s=>s()),t&&this.group()?.changed(this))}surgicallyDeselect(t=!1){let e=this.isSelected();this.state=!1,h(this.el,this.options().ariaAttr,"false"),y(this.el,this.options().dataAttr),e&&!t&&(this.onUnselects.forEach(s=>s()),this.onChanges.forEach(s=>s()))}getValue(){return this.value}getLabel(){return this.label}};var kt=class extends q{groupOfType=L;boot({options:t}){t({wrap:!1,ensureTabbable:!0})}mount(){this.options().ensureTabbable&&this.ensureTabbable()}focusFirst(){let t;t=t||this.walker().find(e=>e.hasAttribute("autofocus")),t=t||this.walker().find(e=>e.getAttribute("tabindex")==="0"),t=t||this.walker().find(e=>e.getAttribute("tabindex")==="-1"),t=t||this.walker().find(e=>Se(e)),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 e=this.walker().find(s=>s.textContent.toLowerCase().trim().startsWith(t.toLowerCase()));e?.use(L).tabbable(),e?.use(L).focus()}moveFocus(t){let e=this.walker().find(n=>n.use(L).isTabbable());t(e)?.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(e=>{e!==t&&e.use(L).untabbable()})}walker(){return B(this.el,(t,{skip:e,reject:s})=>{if(t[this.constructor.name]&&t!==this.el)return s();if(!t[this.groupOfType.name])return e();if(t.hasAttribute("disabled"))return s()})}},L=class extends C{groupedByType=kt;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(()=>{Yt()&&h(this.el,"data-focus","")})),this.on("blur",t.enabled(()=>{y(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(e=>{this.untabbable()}))}focus(t=!0){this.group()?.untabbleOthers(this.el),this.tabbable(),t&&this.pauseFocusListener(()=>{this.el.focus({focusVisible:!1})})}tabbable(){h(this.el,"tabindex","0"),this.options().tabbableAttr&&h(this.el,this.options().tabbableAttr,"")}untabbable(){h(this.el,"tabindex","-1"),this.options().tabbableAttr&&y(this.el,this.options().tabbableAttr)}isTabbable(){return this.el.getAttribute("tabindex")==="0"}};var it=class extends C{boot({options:t}){this.onChanges=[],Object.defineProperty(this.el,"disabled",{get:()=>this.el.hasAttribute("disabled"),set:s=>{s?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(s=>{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(...e)=>{if(!this.el.disabled)return t(...e)}}disabled(t){return(...e)=>{if(this.el.disabled)return t(...e)}}};var Et=class extends q{groupOfType=O;boot({options:t}){t({wrap:!1,filter:!1}),this.onChanges=[]}onChange(t){this.onChanges.push(t)}activated(t){this.onChanges.forEach(e=>e())}activateFirst(){this.filterAwareWalker().first()?.use(O).activate()}activateBySearch(t){this.filterAwareWalker().find(s=>s.textContent.toLowerCase().trim().startsWith(t.toLowerCase()))?.use(O).activate()}activateSelectedOrFirst(t){if(!t||(s=>s.matches("ui-option")?getComputedStyle(s).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 e;this.options.wrap?e=this.filterAwareWalker().prevOrLast(t):e=this.filterAwareWalker().prev(t),e?.use(O).activate()}activateNext(){let t=this.getActive();if(!t){this.filterAwareWalker().first()?.use(O).activate();return}let e;this.options.wrap?e=this.filterAwareWalker().nextOrFirst(t):e=this.filterAwareWalker().next(t),e?.use(O).activate()}getActive(){return this.walker().find(t=>t.use(O).isActive())}clearActive(){this.getActive()?.use(O).deactivate()}filterAwareWalker(){let t=e=>e.matches("ui-option")?getComputedStyle(e).display==="none":!1;return B(this.el,(e,{skip:s,reject:n})=>{if(e[this.constructor.name]&&e!==this.el)return n();if(!e[this.groupOfType.name])return s();if(e.hasAttribute("disabled")||t(e))return n()})}},O=class i extends C{groupedByType=Et;mount(){this.el.addEventListener("mouseenter",()=>{this.activate()}),this.el.addEventListener("mouseleave",()=>{this.deactivate()})}activate(){this.group()&&this.group().walker().each(t=>t.use(i).deactivate(!1)),h(this.el,"data-active",""),this.el.scrollIntoView({block:"nearest"}),this.group()&&this.group().activated(this.el)}deactivate(t=!0){y(this.el,"data-active"),t&&this.group()&&this.group().activated(this.el)}isActive(){return this.el.hasAttribute("data-active")}};var Ct=class extends q{groupOfType=ct;boot({options:t}){t({}),this.onChanges=[],this.lastSearch=""}onChange(t){this.onChanges.push(t)}filter(t){t===""?this.walker().each(e=>{e.use(ct).unfilter()}):this.walker().each(e=>{this.matches(e,t)?e.use(ct).unfilter():e.use(ct).filter()}),this.lastSearch!==t&&this.onChanges.forEach(e=>e()),this.lastSearch=t}matches(t,e){return t.textContent.toLowerCase().trim().includes(e.toLowerCase().trim())}hasResults(){return this.walker().some(t=>!t.use(ct).isFiltered())}},ct=class extends C{groupedByType=Ct;boot({options:t}){t({mirror:null,keep:!1}),this.onChanges=[]}filter(){this.options().keep||(h(this.el,"data-hidden",""),this.options().mirror&&h(this.options().mirror,"data-hidden",""))}unfilter(){y(this.el,"data-hidden"),this.options().mirror&&y(this.options().mirror,"data-hidden","")}isFiltered(){return this.el.hasAttribute("data-hidden")}};var Ht=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(e=>{queueMicrotask(()=>this.render())}).observe(t,{childList:!0})})}render(t){if(this.multiple){let e=this.picker.value,s=Array.from(this.selecteds.keys()).filter(r=>!e.includes(r)),n=e.filter(r=>!this.selecteds.has(r));s.forEach(r=>this.selecteds.delete(r));let o=new Map;for(let r of n){let a=this.picker._selectable.findByValue(r);if(!a){if(t)return setTimeout(()=>this.render());throw`Could not find option for value "${r}"`}o.set(r,a)}o.forEach((r,a)=>this.selecteds.set(a,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 a=!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 e=this.picker.value;if(Array.from(this.selecteds.keys()).includes(e))return;this.selecteds.clear();let s=this.picker._selectable.findByValue(e);if(s)this.selecteds.set(e,s);else if(!["",null,void 0].includes(e)){if(t)return setTimeout(()=>{console.log("retrying..."),this.render()});throw`Could not find option for value "${e}"`}this.templates.placeholder?.clearPlaceholder?.(),this.templates.option?.clearOption?.(),this.selecteds.size>0?this.renderOption():this.renderPlaceholder()}}renderOptions({hasOverflowed:t,renderOverflow:e}){let s=document.createElement("div");s.style.display="contents";let n=Ot(this.templates.options,{default:s});this.templates.options.after(n),this.templates.options.clearOptions=()=>{n.remove(),this.templates.options.clearOptions=()=>{}};let o=0,r=!1;for(let[c,u]of this.selecteds){let p=new DocumentFragment;p.append(...u.el.cloneNode(!0).childNodes);let f=Ot(this.templates.option,{text:u.el.textContent.trim(),default:p,value:c});if(f.setAttribute("data-value",c),f.setAttribute("data-appended",""),f.deselect=()=>u.deselect(),s.appendChild(f),o++,t(o)){r=!0,s.removeChild(f),o--;break}}let a=new DocumentFragment;a.append(...s.childNodes),s.replaceWith(a),r&&e(this.selecteds.size-o)}renderOption(){for(let[t,e]of this.selecteds){let s=new DocumentFragment;s.append(...e.el.cloneNode(!0).childNodes);let n=Ot(this.templates.option,{text:e.el.textContent.trim(),default:s,value:t});n.setAttribute("data-value",t),n.setAttribute("data-appended",t),n.deselect=()=>e.deselect(),this.templates.option.after(n),this.templates.option.clearOption=()=>{n.remove(),this.templates.option.clearOption=()=>{}}}}renderPlaceholder(){if(!this.templates.placeholder)return;let t=Ot(this.templates.placeholder);this.templates.placeholder.after(t),this.templates.placeholder.clearPlaceholder=()=>{t.remove(),this.templates.placeholder.clearPlaceholder=()=>{}}}renderOverflow(t,e){if(!this.templates.overflow)return;let s=Ot(this.templates.overflow,{remainder:e,count:this.selecteds.size});s.setAttribute("data-appended",""),this.templates.overflow.after(s),this.templates.overflow.clearOverflow=()=>{s.remove(),this.templates.placeholder.clearOverflow=()=>{}}}};function Ot(i,t={}){let e=i.content.cloneNode(!0);return Object.entries(t).forEach(([s,n])=>{(s==="default"?e.querySelectorAll("slot:not([name])"):e.querySelectorAll(`slot[name="${s}"]`)).forEach(r=>r.replaceWith(typeof n=="string"?document.createTextNode(n):n))}),e.firstElementChild}var Lt=class extends Wt{boot(){let t=this.list();this._controllable=new $(this),this._selectable=new et(t,{multiple:this.hasAttribute("multiple")}),this._controllable.initial(s=>s&&this._selectable.setState(s)),this._controllable.getter(()=>this._selectable.getState());let e=J();this._controllable.setter(e(s=>{this._selectable.setState(s)})),this._selectable.onChange(e(()=>{this._controllable.dispatch(),this.dispatchEvent(new CustomEvent("select",{bubbles:!1}))}))}mount(){this._disableable=new it(this);let t=this.input(),e=this.button(),s=this.list(),n=this.hasAttribute("multiple"),o=this.hasAttribute("autocomplete"),r=this.hasAttribute("autocomplete")&&this.getAttribute("autocomplete").trim().split(" ").includes("strict"),a=this.querySelector("ui-options")||this,c=Hi(a,"options");this._activatable=new Et(a,{filter:"data-hidden"}),!t&&!e&&this._disableable.onInitAndChange(l=>{l?this.removeAttribute("tabindex"):this.setAttribute("tabindex","0")}),this.hasAttribute("filter")&&this.getAttribute("filter")!=="manual"&&(this._filterable=new Ct(s),this._filterable.onChange(()=>{this._activatable.clearActive(),this._filterable.hasResults()&&this._activatable.activateFirst()}),this.addEventListener("close",()=>{this._filterable&&this._filterable.filter("")}));let u=this.querySelector("[popover]:not(ui-tooltip > [popover])"),p=u?.querySelector("input"),f=this.querySelector("input");f=u?.contains(f)?null:f;let v=this.querySelector("button");if(v=u?.contains(v)?null:v,!(u||f))Tt(this,this._activatable),Pt(this,this,this._activatable),ti(this,this._activatable,this._selectable);else if(!u&&f){let l=f;this._disableable.onInitAndChange(d=>{d?l&&h(l,"disabled",""):l&&y(l,"disabled")}),ae(this,l,this._selectable,this._popoverable),ti(l,this._activatable,this._selectable),si(o,r,this,l,this._selectable,this._popoverable),le(l),re(l),this._filterable&&oe(l,this._filterable),ii(l,this._activatable),Tt(l,this._activatable),Pt(this,l,this._activatable),zt(this,this._activatable)}else if(u&&f){let l=f;h(l,"role","combobox"),h(l,"aria-controls",c);let d=u;this._popoverable=new R(d),this._anchorable=new N(d,{reference:l,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}),si(o,r,this,l,this._selectable,this._popoverable),this._disableable.onInitAndChange(g=>{g?l&&h(l,"disabled",""):l&&y(l,"disabled")}),this.querySelectorAll("button").forEach(g=>{d.contains(g)||(h(g,"tabindex","-1"),h(g,"aria-controls",c),h(g,"aria-haspopup","listbox"),jt(g,this._popoverable),w(g,"click",()=>{this._popoverable.toggle(),l.focus()}))}),ae(this,l,this._selectable,this._popoverable),ie(this,l,d,this._popoverable,this._anchorable),ue(this,this._popoverable),jt(l,this._popoverable),le(l),re(l),this._filterable&&oe(l,this._filterable),ii(l,this._activatable),Ui(l,this._popoverable),ne(l,this._popoverable,this._activatable,this._selectable),zi(l,this._popoverable),Tt(l,this._activatable),Pt(this,l,this._activatable),zt(this,this._activatable),se(this._popoverable,this._activatable,this._selectable),ce(this,this._selectable,this._popoverable,n)}else if(u&&p){let l=v,d=p,g=u;h(l,"role","combobox"),h(d,"role","combobox"),h(l,"aria-controls",c),this._disableable.onInitAndChange(b=>{b?(l&&h(l,"disabled",""),d&&h(d,"disabled","")):(l&&y(l,"disabled"),d&&y(d,"disabled"))}),this._popoverable=new R(g),this._anchorable=new N(g,{reference:l,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}),le(d),re(d),this._filterable&&oe(d,this._filterable),ji(d,this._popoverable),ie(this,l,g,this._popoverable,this._anchorable),ue(this,this._popoverable),jt(l,this._popoverable),ae(this,d,this._selectable,this._popoverable),ne(l,this._popoverable,this._activatable,this._selectable),ei(l,this._popoverable),Tt(d,this._activatable),Pt(this,d,this._activatable),zt(this,this._activatable),se(this._popoverable,this._activatable,this._selectable),ce(this,this._selectable,this._popoverable,n)}else if(u){let l=v,d=u;h(l,"role","combobox"),h(l,"aria-controls",c),this._disableable.onInitAndChange(g=>{g?(l&&h(l,"disabled",""),t&&h(t,"disabled","")):(l&&y(l,"disabled"),t&&y(t,"disabled"))}),this._popoverable=new R(d),this._anchorable=new N(d,{reference:l,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}),ie(this,l,d,this._popoverable,this._anchorable),ue(this,this._popoverable),jt(l,this._popoverable),ne(l,this._popoverable,this._activatable,this._selectable),ei(l,this._popoverable),Tt(l,this._activatable),$i(l,this._activatable),Pt(this,l,this._activatable),zt(this,this._activatable),se(this._popoverable,this._activatable,this._selectable),ce(this,this._selectable,this._popoverable,n)}new MutationObserver(()=>{setTimeout(()=>{if(!this._popoverable||this._popoverable.getState()){let l=this._selectable.selecteds()[0]?.el;queueMicrotask(()=>{this._activatable.activateSelectedOrFirst(l)})}else this._activatable.clearActive()})}).observe(s,{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})))}},he=class extends k{boot(){h(this,"data-hidden","")}mount(){queueMicrotask(()=>{let t=this.closest("ui-autocomplete, ui-combobox, ui-select"),e=this.closest("ui-options");if(!e)return;let s=a=>getComputedStyle(a).display==="none",n=()=>{let a;CSS.supports("selector(&)")?a=Array.from(e.querySelectorAll("& > ui-option")).filter(c=>!s(c)).length===0:a=Array.from(e.querySelectorAll(":scope > ui-option")).filter(c=>!s(c)).length===0,a?y(this,"data-hidden"):h(this,"data-hidden","")};n();let o=t._filterable;o&&o.onChange(n),new MutationObserver(a=>{setTimeout(()=>n())}).observe(e,{childList:!0})})}};T("selected",Ht);T("select",Lt);T("empty",he);Z(({css:i})=>i`ui-select { display: block; }`);Z(({css:i})=>i`ui-selected-option { display: contents; }`);Z(({css:i})=>i`ui-empty { display: block; cursor: default; }`);function Tt(i,t){w(i,"keydown",e=>{["ArrowDown","ArrowUp","Escape"].includes(e.key)&&(e.key==="ArrowDown"?(t.activateNext(),e.preventDefault(),e.stopPropagation()):e.key==="ArrowUp"&&(t.activatePrev(),e.preventDefault(),e.stopPropagation()))})}function $i(i,t){Dt(i,e=>{t.activateBySearch(e)})}function Pt(i,t,e){w(t,"keydown",s=>{if(s.key==="Enter"){let n=e.getActive();if(s.preventDefault(),s.stopPropagation(),!n)return;n.click(),i.dispatchEvent(new CustomEvent("action",{bubbles:!1,cancelable:!1}))}})}function zt(i,t,e=!1){w(i,e?"pointerdown":"click",s=>{if(s.target.closest("ui-option")){let n=s.target.closest("ui-option");if(n._disabled)return;n._selectable?.trigger(),i.dispatchEvent(new CustomEvent("action",{bubbles:!1,cancelable:!1})),s.preventDefault(),s.stopPropagation()}})}function ti(i,t,e){w(i,"focus",()=>{let s=e.selecteds()[0]?.el;t.activateSelectedOrFirst(s)}),w(i,"blur",()=>{t.clearActive()})}function Hi(i){let t=V(i,"options");return h(i,"role","listbox"),t}function jt(i,t){h(i,"aria-haspopup","listbox");let e=()=>{h(i,"aria-expanded",t.getState()?"true":"false"),t.getState()?h(i,"data-open",""):y(i,"data-open","")};t.onChange(()=>{e()}),e()}function ie(i,t,e,s,n){let o=()=>{Array.from([i,e]).forEach(r=>{s.getState()?h(r,"data-open",""):y(r,"data-open","")}),s.getState()&&n.reposition()};s.onChange(()=>o()),o(),s.onChange(()=>{s.getState()?i.dispatchEvent(new Event("open",{bubbles:!1,cancelable:!1})):i.dispatchEvent(new Event("close",{bubbles:!1,cancelable:!1}))})}function se(i,t,e){i.onChange(()=>{if(i.getState()){let s=e.selecteds()[0]?.el;queueMicrotask(()=>{t.activateSelectedOrFirst(s)})}else t.clearActive()})}function ne(i,t){w(i,"keydown",e=>{["ArrowDown","ArrowUp","Escape"].includes(e.key)&&(e.key==="ArrowDown"||e.key==="ArrowUp"?t.getState()||(t.setState(!0),e.preventDefault(),e.stopImmediatePropagation()):e.key==="Escape"&&t.getState()&&t.setState(!1))})}function zi(i,t){w(i,"click",()=>{t.getState()||(t.setState(!0),i.focus())})}function ei(i,t){w(i,"click",()=>{t.setState(!t.getState()),i.focus()})}function ji(i,t){t.onChange(()=>{t.getState()&&setTimeout(()=>i.focus())})}function oe(i,t){t&&w(i,"input",e=>{t.filter(e.target.value)})}function re(i){w(i,"focus",()=>i.select())}function le(i){w(i,"change",t=>t.stopPropagation()),w(i,"input",t=>t.stopPropagation())}function Ui(i,t){w(i,"keydown",e=>{(/^[a-zA-Z0-9]$/.test(e.key)||e.key==="Backspace")&&(t.getState()||t.setState(!0))})}function ae(i,t,e,s){if(!i.hasAttribute("clear"))return;let o=f=>{t.value=f,t.dispatchEvent(new Event("input",{bubbles:!1}))},r=i.getAttribute("clear"),a=r===""||r.split(" ").includes("action"),c=r===""||r.split(" ").includes("select"),u=r===""||r.split(" ").includes("close"),p=r===""||r.split(" ").includes("esc");r==="none"&&(a=c=u=p=!1),a?i.addEventListener("action",f=>{o("")}):c&&e.onChange(()=>{queueMicrotask(()=>o(""))}),u&&s.onChange(()=>{s.getState()||o("")}),p&&w(t,"keydown",f=>{f.key==="Escape"&&o("")})}function ce(i,t,e,s){let n=!s,o=!s;if(i.hasAttribute("close")){let r=i.getAttribute("close");n=r===""||r.split(" ").includes("action"),o=r.split(" ").includes("select"),r==="none"&&(n=o=!1)}n?i.addEventListener("action",r=>{e.setState(!1)}):o&&t.onChange(()=>{e.setState(!1)})}function ii(i,t){t.onChange(()=>{let e=t.getActive();e?h(i,"aria-activedescendant",e.id):y(i,"aria-activedescendant")})}function si(i,t,e,s,n,o){if(!i){h(s,"autocomplete","off"),h(s,"aria-autocomplete","none");return}let r=a=>{s.value=a,s.dispatchEvent(new Event("input",{bubbles:!1}))};h(s,"autocomplete","off"),h(s,"aria-autocomplete","list"),queueMicrotask(()=>{n.onInitAndChange(()=>{s.value=n.selectedTextValue()})}),e.addEventListener("action",a=>{r(n.selectedTextValue())}),t&&o.onChange(()=>{o.getState()||r(n.selectedTextValue())})}function ue(i,t){let{lock:e,unlock:s}=Nt();t.onChange(()=>{t.getState()?e():s()})}var fe=class i extends k{boot(){if(this._focusable=new kt(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())}),Dt(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",e=>{e.key==="ArrowDown"&&(this.fromArrowDown=!0,this.showPopover(),e.preventDefault(),e.stopPropagation())})}h(this,"role","menu"),h(this,"tabindex","-1")}mount(){this.initializeMenuItems(),new MutationObserver(e=>{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||Yi(t)})}walker(){return B(this,(t,{skip:e,reject:s})=>{if(t instanceof i||t instanceof Lt)return s();if(!["a","button"].includes(t.localName))return e()})}},de=class extends k{boot(){}},pe=class extends k{boot(){this._disabled=this.hasAttribute("disabled"),this._disableable=new it(this);let t=this;if(this._disabled&&(h(t,"disabled",""),h(t,"aria-disabled","true")),V(t,"menu-checkbox"),h(t,"role","menuitemcheckbox"),this._disabled)return;t._focusable=new L(t,{disableable:this._disableable,hover:!0,tabbableAttr:"data-active"}),t._selectable=new E(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(s=>s&&t._selectable.setState(s)),this._controllable.getter(()=>t._selectable.getState());let e=J();this._controllable.setter(e(s=>{this._selectable.setState(s)})),this._selectable.onChange(e(()=>{this._controllable.dispatch()})),w(t,"click",()=>{this.dispatchEvent(new CustomEvent("lofi-close-popovers",{bubbles:!0})),t._selectable.press()}),ve(t)}},be=class extends k{boot(){this._disabled=this.hasAttribute("disabled"),this._disableable=new it(this);let t=this;this._disabled&&(h(t,"disabled",""),h(t,"aria-disabled","true")),V(t,"menu-radio"),h(t,"role","menuitemradio"),!this._disabled&&(t._focusable=new L(t,{disableable:this._disableable,hover:!0,tabbableAttr:"data-active"}),t._selectable=new E(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()}),ve(t))}},me=class extends k{boot(){this._selectable=new et(this),this._controllable=new $(this),h(this,"role","group"),this._controllable.initial(e=>e&&this._selectable.setState(e)),this._controllable.getter(()=>this._selectable.getState());let t=J();this._controllable.setter(t(e=>{this._selectable.setState(e)})),this._selectable.onChange(t(()=>{this._controllable.dispatch()}))}},ge=class extends k{boot(){this._selectable=new et(this,{multiple:!0}),this._controllable=new $(this),h(this,"role","group"),this._controllable.initial(e=>e&&this._selectable.setState(e)),this._controllable.getter(()=>this._selectable.getState());let t=J();this._controllable.setter(t(e=>{this._selectable.setState(e)})),this._selectable.onChange(t(()=>{this._controllable.dispatch()}))}};Z(({css:i})=>i`ui-menu[popover]:popover-open { display: block; }`);Z(({css:i})=>i`ui-menu[popover].\:popover-open { display: block; }`);Z(({css:i})=>i`ui-menu-checkbox, ui-menu-radio { cursor: default; display: contents; }`);T("menu",fe);T("submenu",de);T("menu-checkbox",pe);T("menu-radio",be);T("menu-radio-group",me);T("menu-checkbox-group",ge);function ve(i){w(i,"keydown",t=>{t.key==="Enter"&&(i.click(),t.preventDefault(),t.stopPropagation())}),w(i,"keydown",t=>{t.key===" "&&(t.preventDefault(),t.stopPropagation())}),w(i,"keyup",t=>{t.key===" "&&(i.click(),t.preventDefault(),t.stopPropagation())})}function Yi(i){i._disableable=new it(i),i._disabled=i.hasAttribute("disabled");let t=i.querySelector("a"),e=i,s=i.parentElement.matches("ui-submenu")&&i.parentElement.querySelector("ui-menu[popover]"),n=t||e;if(i._disabled&&(h(n,"disabled",""),h(n,"aria-disabled","true")),V(n,"menu-item"),h(n,"role","menuitem"),!i._disabled)if(n._focusable=new L(n,{disableable:i._disableable,hover:!0,tabbableAttr:"data-active"}),!s)i.hasAttribute("disabled")||w(i,"click",()=>{i.dispatchEvent(new CustomEvent("lofi-close-popovers",{bubbles:!0}))}),ve(e);else{s._popoverable=new R(s,{trigger:e}),s._anchorable=new N(s,{reference:e,position:s.hasAttribute("position")?s.getAttribute("position"):"right start",gap:s.hasAttribute("gap")?s.getAttribute("gap"):"-5"}),e.addEventListener("click",r=>{s._popoverable.setState(!0)});let{clear:o}=ft(e,s,{gain(){s._popoverable.setState(!0)},lose(){s._popoverable.setState(!1)},focusable:!1});s._popoverable.onChange(()=>{s._popoverable.getState()||(o(),s._focusable.wipeTabbables()),s._anchorable.reposition()}),w(e,"keydown",r=>{r.key==="Enter"&&(s._popoverable.setState(!0),setTimeout(()=>s._focusable.focusFirst()))}),w(e,"keydown",r=>{r.key==="ArrowRight"&&(s._popoverable.setState(!0),setTimeout(()=>s._focusable.focusFirst()))}),w(s,"keydown",r=>{r.key==="ArrowLeft"&&(s._popoverable.setState(!1),e.focus(),r.stopPropagation())})}}})(); diff --git a/dist/manifest.json b/dist/manifest.json index c1c9c0a..94021f4 100644 --- a/dist/manifest.json +++ b/dist/manifest.json @@ -1,4 +1,4 @@ { - "/flux.js": "79511b07", + "/flux.js": "4c114991", "/flux.css": "0e2b9c8b" } \ No newline at end of file