(()=>{var ht=class extends Event{oldState;newState;constructor(t,{oldState:e="",newState:i="",...s}={}){super(t,s),this.oldState=String(e||""),this.newState=String(i||"")}},Vi=new WeakMap;function ji(t,e,i){Vi.set(t,setTimeout(()=>{Vi.has(t)&&t.dispatchEvent(new ht("toggle",{cancelable:!1,oldState:e,newState:i}))},0))}var Bt=globalThis.ShadowRoot||function(){},zs=globalThis.HTMLDialogElement||function(){},rt=new WeakMap,te=new WeakMap,ze=new WeakMap;function lt(t){return ze.get(t)||"hidden"}var at=new WeakMap;function js(t){let e=t.popoverTargetElement;if(!(e instanceof HTMLElement))return;let i=lt(e);t.popoverTargetAction==="show"&&i==="showing"||t.popoverTargetAction==="hide"&&i==="hidden"||(i==="showing"?$e(e,!0,!0):me(e,!1)&&(at.set(e,t),Vt(e)))}function me(t,e){return!(t.popover!=="auto"&&t.popover!=="manual"||!t.isConnected||e&<(t)!=="showing"||!e&<(t)!=="hidden"||t instanceof zs&&t.hasAttribute("open")||document.fullscreenElement===t)}function Bi(t){return t?Array.from(te.get(t.ownerDocument)||[]).indexOf(t)+1:0}function Ks(t){let e=Ki(t),i=Us(t);return Bi(e)>Bi(i)?e:i}function ct(t){let e=te.get(t);for(let i of e||[])if(!i.isConnected)e.delete(i);else return i;return null}function Te(t){return typeof t.getRootNode=="function"?t.getRootNode():t.parentNode?Te(t.parentNode):t}function Ki(t){for(;t;){if(t instanceof HTMLElement&&t.popover==="auto"&&ze.get(t)==="showing")return t;if(t=t instanceof Element&&t.assignedSlot||t.parentElement||Te(t),t instanceof Bt&&(t=t.host),t instanceof Document)return}}function Us(t){for(;t;){let e=t.popoverTargetElement;if(e instanceof HTMLElement)return e;if(t=t.parentElement||Te(t),t instanceof Bt&&(t=t.host),t instanceof Document)return}}function Gs(t){let e=new Map,i=0;for(let n of te.get(t.ownerDocument)||[])e.set(n,i),i+=1;e.set(t,i),i+=1;let s=null;function o(n){let r=Ki(n);if(r===null)return null;let c=e.get(r);(s===null||e.get(s)"u")return;window.ToggleEvent=window.ToggleEvent||ht;function t(l){return l?.includes(":popover-open")&&(l=l.replace(Zs,"$1.\\:popover-open")),l}be(Document.prototype,"querySelector",t),be(Document.prototype,"querySelectorAll",t),be(Element.prototype,"querySelector",t),be(Element.prototype,"querySelectorAll",t),be(Element.prototype,"matches",t),be(Element.prototype,"closest",t),be(DocumentFragment.prototype,"querySelectorAll",t),Object.defineProperties(HTMLElement.prototype,{popover:{enumerable:!0,configurable:!0,get(){if(!this.hasAttribute("popover"))return null;let l=(this.getAttribute("popover")||"").toLowerCase();return l===""||l=="auto"?"auto":"manual"},set(l){l===null?this.removeAttribute("popover"):this.setAttribute("popover",l)}},showPopover:{enumerable:!0,configurable:!0,value(){Vt(this)}},hidePopover:{enumerable:!0,configurable:!0,value(){$e(this,!0,!0)}},togglePopover:{enumerable:!0,configurable:!0,value(l){ze.get(this)==="showing"&&l===void 0||l===!1?$e(this,!0,!0):(l===void 0||l===!0)&&Vt(this)}}});let e=Element.prototype.attachShadow;e&&Object.defineProperties(Element.prototype,{attachShadow:{enumerable:!0,configurable:!0,writable:!0,value(l){let a=e.call(this,l);return Wt(a),a}}});let i=HTMLElement.prototype.attachInternals;i&&Object.defineProperties(HTMLElement.prototype,{attachInternals:{enumerable:!0,configurable:!0,writable:!0,value(){let l=i.call(this);return l.shadowRoot&&Wt(l.shadowRoot),l}}});let s=new WeakMap;function o(l){Object.defineProperties(l.prototype,{popoverTargetElement:{enumerable:!0,configurable:!0,set(a){if(a===null)this.removeAttribute("popovertarget"),s.delete(this);else if(a instanceof Element)this.setAttribute("popovertarget",""),s.set(this,a);else throw new TypeError("popoverTargetElement must be an element or null")},get(){if(this.localName!=="button"&&this.localName!=="input"||this.localName==="input"&&this.type!=="reset"&&this.type!=="image"&&this.type!=="button"||this.disabled||this.form&&this.type==="submit")return null;let a=s.get(this);if(a&&a.isConnected)return a;if(a&&!a.isConnected)return s.delete(this),null;let f=Te(this),d=this.getAttribute("popovertarget");return(f instanceof Document||f instanceof zi)&&d&&f.getElementById(d)||null}},popoverTargetAction:{enumerable:!0,configurable:!0,get(){let a=(this.getAttribute("popovertargetaction")||"").toLowerCase();return a==="show"||a==="hide"?a:"toggle"},set(a){this.setAttribute("popovertargetaction",a)}}})}o(HTMLButtonElement),o(HTMLInputElement);let n=l=>{let a=l.composedPath(),f=a[0];if(!(f instanceof Element)||f?.shadowRoot)return;let d=Te(f);if(!(d instanceof zi||d instanceof Document))return;let m=a.find(g=>g.matches?.("[popovertargetaction],[popovertarget]"));if(m){js(m),l.preventDefault();return}},r=l=>{let a=l.key,f=l.target;!l.defaultPrevented&&f&&(a==="Escape"||a==="Esc")&&dt(f.ownerDocument,!0,!0)};(l=>{l.addEventListener("click",n),l.addEventListener("keydown",r),l.addEventListener("pointerdown",$i),l.addEventListener("pointerup",$i)})(document),Wt(document)}Qs()||io();var vt=class extends Event{oldState;newState;constructor(t,{oldState:e="",newState:i="",...s}={}){super(t,s),this.oldState=String(e||""),this.newState=String(i||"")}},Gi=new WeakMap;function Zi(t,e,i){Gi.set(t,setTimeout(()=>{Gi.has(t)&&t.dispatchEvent(new vt("toggle",{cancelable:!1,oldState:e,newState:i}))},0))}var Kt=globalThis.ShadowRoot||function(){},so=globalThis.HTMLDialogElement||function(){},ft=new WeakMap,ie=new WeakMap,Ke=new WeakMap;function pt(t){return Ke.get(t)||"hidden"}var bt=new WeakMap;function oo(t){let e=t.popoverTargetElement;if(!(e instanceof HTMLElement))return;let i=pt(e);t.popoverTargetAction==="show"&&i==="showing"||t.popoverTargetAction==="hide"&&i==="hidden"||(i==="showing"?je(e,!0,!0):ve(e,!1)&&(bt.set(e,t),jt(e)))}function ve(t,e){return!(t.popover!=="auto"&&t.popover!=="manual"||!t.isConnected||e&&pt(t)!=="showing"||!e&&pt(t)!=="hidden"||t instanceof so&&t.hasAttribute("open")||document.fullscreenElement===t)}function Yi(t){return t?Array.from(ie.get(t.ownerDocument)||[]).indexOf(t)+1:0}function no(t){let e=es(t),i=ro(t);return Yi(e)>Yi(i)?e:i}function mt(t){let e=ie.get(t);for(let i of e||[])if(!i.isConnected)e.delete(i);else return i;return null}function Pe(t){return typeof t.getRootNode=="function"?t.getRootNode():t.parentNode?Pe(t.parentNode):t}function es(t){for(;t;){if(t instanceof HTMLElement&&t.popover==="auto"&&Ke.get(t)==="showing")return t;if(t=t instanceof Element&&t.assignedSlot||t.parentElement||Pe(t),t instanceof Kt&&(t=t.host),t instanceof Document)return}}function ro(t){for(;t;){let e=t.popoverTargetElement;if(e instanceof HTMLElement)return e;if(t=t.parentElement||Pe(t),t instanceof Kt&&(t=t.host),t instanceof Document)return}}function lo(t){let e=new Map,i=0;for(let n of ie.get(t.ownerDocument)||[])e.set(n,i),i+=1;e.set(t,i),i+=1;let s=null;function o(n){let r=es(n);if(r===null)return null;let c=e.get(r);(s===null||e.get(s)"u")return;window.ToggleEvent=window.ToggleEvent||vt;function t(l){return l?.includes(":popover-open")&&(l=l.replace(ho,"$1.\\:popover-open")),l}ge(Document.prototype,"querySelector",t),ge(Document.prototype,"querySelectorAll",t),ge(Element.prototype,"querySelector",t),ge(Element.prototype,"querySelectorAll",t),ge(Element.prototype,"matches",t),ge(Element.prototype,"closest",t),ge(DocumentFragment.prototype,"querySelectorAll",t),Object.defineProperties(HTMLElement.prototype,{popover:{enumerable:!0,configurable:!0,get(){if(!this.hasAttribute("popover"))return null;let l=(this.getAttribute("popover")||"").toLowerCase();return l===""||l=="auto"?"auto":"manual"},set(l){l===null?this.removeAttribute("popover"):this.setAttribute("popover",l)}},showPopover:{enumerable:!0,configurable:!0,value(){jt(this)}},hidePopover:{enumerable:!0,configurable:!0,value(){je(this,!0,!0)}},togglePopover:{enumerable:!0,configurable:!0,value(l){Ke.get(this)==="showing"&&l===void 0||l===!1?je(this,!0,!0):(l===void 0||l===!0)&&jt(this)}}});let e=Element.prototype.attachShadow;e&&Object.defineProperties(Element.prototype,{attachShadow:{enumerable:!0,configurable:!0,writable:!0,value(l){let a=e.call(this,l);return zt(a),a}}});let i=HTMLElement.prototype.attachInternals;i&&Object.defineProperties(HTMLElement.prototype,{attachInternals:{enumerable:!0,configurable:!0,writable:!0,value(){let l=i.call(this);return l.shadowRoot&&zt(l.shadowRoot),l}}});let s=new WeakMap;function o(l){Object.defineProperties(l.prototype,{popoverTargetElement:{enumerable:!0,configurable:!0,set(a){if(a===null)this.removeAttribute("popovertarget"),s.delete(this);else if(a instanceof Element)this.setAttribute("popovertarget",""),s.set(this,a);else throw new TypeError("popoverTargetElement must be an element or null")},get(){if(this.localName!=="button"&&this.localName!=="input"||this.localName==="input"&&this.type!=="reset"&&this.type!=="image"&&this.type!=="button"||this.disabled||this.form&&this.type==="submit")return null;let a=s.get(this);if(a&&a.isConnected)return a;if(a&&!a.isConnected)return s.delete(this),null;let f=Pe(this),d=this.getAttribute("popovertarget");return(f instanceof Document||f instanceof Qi)&&d&&f.getElementById(d)||null}},popoverTargetAction:{enumerable:!0,configurable:!0,get(){let a=(this.getAttribute("popovertargetaction")||"").toLowerCase();return a==="show"||a==="hide"?a:"toggle"},set(a){this.setAttribute("popovertargetaction",a)}}})}o(HTMLButtonElement),o(HTMLInputElement);let n=l=>{let a=l.composedPath(),f=a[0];if(!(f instanceof Element)||f?.shadowRoot)return;let d=Pe(f);if(!(d instanceof Qi||d instanceof Document))return;let m=a.find(g=>g.matches?.("[popovertargetaction],[popovertarget]"));if(m){oo(m),l.preventDefault();return}},r=l=>{let a=l.key,f=l.target;!l.defaultPrevented&&f&&(a==="Escape"||a==="Esc")&&wt(f.ownerDocument,!0,!0)};(l=>{l.addEventListener("click",n),l.addEventListener("keydown",r),l.addEventListener("pointerdown",Ji),l.addEventListener("pointerup",Ji)})(document),zt(document)}function T(t){let e=t({css:(s,...o)=>`@layer base { ${s.raw[0]+o.join("")} }`});if(document.adoptedStyleSheets===void 0){let s=document.createElement("style");s.textContent=e,document.head.appendChild(s);return}let i=new CSSStyleSheet;i.replaceSync(e),document.adoptedStyleSheets=[...document.adoptedStyleSheets,i]}function At(t,e){let i=t;for(;i;){if(e(i))return i;i=i.parentElement}}function I(t,e){let i=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,e?{acceptNode:s=>{let o,n;return e(s,{skip:()=>o=!0,reject:()=>n=!0}),o?NodeFilter.FILTER_SKIP:n?NodeFilter.FILTER_REJECT:NodeFilter.FILTER_ACCEPT}}:{});return new Ut(i)}var Ut=class{constructor(e){this.walker=e}from(e){return this.walker.currentNode=e,this}first(){return this.walker.firstChild()}last(){return this.walker.lastChild()}next(e){return this.walker.currentNode=e,this.walker.nextSibling()}nextOrFirst(e){let i=this.next(e);return i||(this.walker.currentNode=this.walker.root,this.first())}prev(e){return this.walker.currentNode=e,this.walker.previousSibling()}prevOrLast(e){let i=this.prev(e);return i||(this.walker.currentNode=this.walker.root,this.last())}closest(e,i){let s=this.from(e).walker;for(;s.currentNode;){if(i(s.currentNode))return s.currentNode;s.parentNode()}}contains(e){return this.find(i=>i===e)}find(e){return this.walk((i,s)=>{e(i)&&s(i)})}findOrFirst(e){return this.find(e)||(this.walker.currentNode=this.walker.root),this.first()}each(e){this.walk(i=>e(i))}some(e){return!!this.find(e)}every(e){let i=!0;return this.walk(s=>{e(s)||(i=!1)}),i}map(e){let i=[];return this.walk(s=>i.push(e(s))),i}filter(e){let i=[];return this.walk(s=>e(s)&&i.push(s)),i}walk(e){let i,s=this.walker,o;for(;s.nextNode()&&(i=s.currentNode,e(i,n=>o=n),o===void 0););return o}};function A(t,e){customElements.define(`ui-${t}`,e)}function p(t,e,i,s={}){return t.addEventListener(e,i,s),{off:()=>t.removeEventListener(e,i),pause:o=>{t.removeEventListener(e,i),o(),t.addEventListener(e,i)}}}function rs(t){return["a[href]","area[href]","input:not([disabled])","select:not([disabled])","textarea:not([disabled])","button:not([disabled])","iframe","object","embed","[tabindex]","[contenteditable]"].some(i=>t.matches(i))&&t.tabIndex>=0}function bo(t,e){let i;return function(){let s=this,o=arguments;i||(t.apply(s,o),i=!0,setTimeout(()=>i=!1,e))}}var Ue="pointer";document.addEventListener("keydown",()=>Ue="keyboard",{capture:!0});document.addEventListener("pointerdown",t=>{Ue=t.pointerType==="mouse"?"mouse":"touch"},{capture:!0});document.addEventListener("pointermove",t=>{Ue=t.pointerType==="mouse"?"mouse":"touch"},{capture:!0});function we(){return Ue==="keyboard"}function mo(){return Ue==="touch"}function xt(t,e){let i="",s=_o(()=>{i=""},300);t.addEventListener("keydown",o=>{o.key.length===1&&/[a-zA-Z]/.test(o.key)&&(i+=o.key,e(i),o.stopPropagation()),s()})}function go(t,e){return"lofi-"+(e?e+"-":"")+Math.random().toString(16).slice(2)}function N(t,e){let i=t.hasAttribute("id")?t.getAttribute("id"):go(t,e);return u(t,"id",i),t._x_bindings||(t._x_bindings={}),t._x_bindings.id||(t._x_bindings.id=i),i}function D(){let t=!1;return e=>(...i)=>{t||(t=!0,e(...i),t=!1)}}function Me(t,e,{gain:i,lose:s,focusable:o,useSafeArea:n}){let r=!1,c=v=>{we()&&(t.contains(v.target)||e.contains(v.target)?(r=!0,i()):(r=!1,s()))};o&&document.addEventListener("focusin",c);let l=()=>{document.removeEventListener("focusin",c)},a=()=>{},f=()=>{},d=()=>{r=!1,s(),a(),f()},m=()=>{r=!1,a(),f()},g=v=>{mo()||r||(r=!0,i(),setTimeout(()=>{let{safeArea:y,redraw:E,remove:_}=n?vo(t,e,v.clientX,v.clientY):Eo();a=_;let L,O=bo(R=>{let z=e.getBoundingClientRect(),ee=t.getBoundingClientRect(),q;switch(y.contains(R.target)&&wo(ee,z,R.clientX,R.clientY)?q="safeArea":e.contains(R.target)?q="panel":t.contains(R.target)?q="trigger":q="outside",L&&clearTimeout(L),q){case"outside":d();break;case"trigger":E(R.clientX,R.clientY);break;case"panel":a();break;case"safeArea":E(R.clientX,R.clientY),L=setTimeout(()=>{d()},300);break;default:break}},100);document.addEventListener("pointermove",O),f=()=>document.removeEventListener("pointermove",O)}))};t.addEventListener("pointerenter",g);let h=()=>{t.removeEventListener("pointerenter",g)};return{clear:m,remove:()=>{m(),h(),l()}}}function vo(t,e,i,s){let o=document.createElement("div"),n=e.getBoundingClientRect(),r=t.getBoundingClientRect();o.style.position="fixed",u(o,"data-safe-area","");let c=(l,a)=>{if(n.top===0&&n.bottom===0)return;let f;n.leftr.right&&(f="right"),n.topr.bottom&&n.top>a&&(f="down"),f===void 0&&(f="right");let d,m,g,h,b,v,y,E,_=10;switch(f){case"left":d=n.right,m=Math.max(n.right,l)+5,g=m-d,h=Math.min(r.top,n.top)-_,b=Math.max(r.bottom,n.bottom)+_,v=b-h,y=a-h,E=`polygon(0% 0%, 100% ${y}px, 0% 100%)`;break;case"right":d=Math.min(n.left,l)-5,m=n.left,g=m-d,h=Math.min(r.top,n.top)-_,b=Math.max(r.bottom,n.bottom)+_,v=b-h,y=a-h,E=`polygon(0% ${y}px, 100% 0%, 100% 100%)`;break;case"up":d=Math.min(l,n.left)-_,m=Math.max(l,n.right)+_,g=m-d,h=n.bottom,b=Math.max(n.bottom,a)+5,v=b-h,y=l-d,E=`polygon(0% 0%, 100% 0%, ${y}px 100%)`;break;case"down":d=Math.min(l,n.left)-_,m=Math.max(l,n.right)+_,g=m-d,h=Math.min(n.top,a)-5,b=n.top,v=b-h,y=l-d,E=`polygon(${y}px 0%, 100% 100%, 0% 100%)`;break}o.style.left=`${d}px`,o.style.top=`${h}px`,o.style.width=`${g}px`,o.style.height=`${v}px`,o.style.clipPath=E};return{safeArea:o,redraw:(l,a)=>{o.isConnected||t.appendChild(o),c(l,a)},remove:()=>{o.remove()}}}function wo(t,e,i,s){return!yo(t,i,s)&&!Ao(e,i,s)}function yo(t,e,i){return t.left<=e&&e<=t.right&&t.top<=i&&i<=t.bottom}function Ao(t,e,i){return t.left<=e&&e<=t.right&&t.top<=i&&i<=t.bottom}function u(t,e,i){t._durableAttributeObserver===void 0&&(t._durableAttributeObserver=ls(t,[e])),t._durableAttributeObserver.hasAttribute(e)||t._durableAttributeObserver.addAttribute(e),t._durableAttributeObserver.pause(()=>{t.setAttribute(e,i)})}function se(t,e){w(t,e),xo(t,e)}function w(t,e){t._durableAttributeObserver===void 0&&(t._durableAttributeObserver=ls(t,[e])),t._durableAttributeObserver.hasAttribute(e)||t._durableAttributeObserver.addAttribute(e),t._durableAttributeObserver.pause(()=>{t.removeAttribute(e)})}function xo(t,e){t?._durableAttributeObserver?.hasAttribute(e)&&t._durableAttributeObserver.releaseAttribute(e)}function ls(t,e){let i=o=>{o.forEach(n=>{n.oldValue===null?t._durableAttributeObserver.pause(()=>w(t,n.attributeName)):t._durableAttributeObserver.pause(()=>u(t,n.attributeName,n.oldValue))})},s=new MutationObserver(o=>i(o));return s.observe(t,{attributeFilter:e,attributeOldValue:!0}),{attributes:e,hasAttribute(o){return this.attributes.includes(o)},addAttribute(o){this.attributes.includes(o)||this.attributes.push(o),s.observe(t,{attributeFilter:this.attributes,attributeOldValue:!0})},releaseAttribute(o){this.hasAttribute(o)&&s.observe(t,{attributeFilter:this.attributes,attributeOldValue:!0})},pause(o){i(s.takeRecords()),s.disconnect(),o(),s.observe(t,{attributeFilter:this.attributes,attributeOldValue:!0})}}}function Eo(){return{safeArea:{contains:()=>!1},redraw:()=>{},remove:()=>{}}}function _o(t,e){let i;return(...s)=>{clearTimeout(i),i=setTimeout(()=>{t(...s)},e)}}var Le=0,De=!1;T(({css:t})=>t`[data-flux-allow-scroll] { pointer-events: auto; }`);function oe(t=null,e=!1,i=[]){if(e)return{lock:()=>{},unlock:()=>{}};let s=(n=!1)=>{ns(document.documentElement);let r={overflow:"hidden",...n?{pointerEvents:"none"}:{}};window.CSS&&CSS.supports&&CSS.supports("scrollbar-gutter: stable")?document.documentElement.scrollHeight>document.documentElement.clientHeight&&window.getComputedStyle(document.documentElement).overflowY!=="hidden"&&(r.scrollbarGutter="stable"):r.paddingRight=`calc(${window.innerWidth-document.documentElement.clientWidth}px + ${window.getComputedStyle(document.documentElement).paddingRight})`,So(document.documentElement,r),n&&(u(t,"data-flux-allow-scroll",""),i.forEach(c=>{u(c,"data-flux-allow-scroll","")}),De=!0)},o=(n=!1)=>{ns(document.documentElement),n&&(se(t,"data-flux-allow-scroll"),i.forEach(r=>{w(r,"data-flux-allow-scroll")}),De=!1)};return{lock(){Le++,!(Le>1&&t!==null&&De)&&s(t!==null&&!De)},unlock(){Le=Math.max(0,Le-1),!(Le>0&&t!==null&&!De)&&(o(t!==null&&De),Le>0&&s(!1))}}}function So(t,e){let i=JSON.parse(t.getAttribute("data-flux-scroll-unlock")||"{}");Object.entries(e).forEach(([s,o])=>{i[s]===void 0&&(i[s]=t.style[s],t.style[s]=o)}),t.setAttribute("data-flux-scroll-unlock",JSON.stringify(i))}function ns(t){let e=JSON.parse(t.getAttribute("data-flux-scroll-unlock")||"{}");Object.entries(e).forEach(([i,s])=>{t.style[i]=s}),t.removeAttribute("data-flux-scroll-unlock")}function Gt(t,e,i){let s=t.style[e];return t.style[e]=i,()=>{t.style[e]=s}}function he(){return document.documentElement.dir==="rtl"}function as(){return/^((?!chrome|android).)*safari/i.test(navigator.userAgent)&&!navigator.userAgent.includes("CriOS")&&!navigator.userAgent.includes("FxiOS")}var yt=class{constructor(){this.subscribers=[]}subscribe(e,i){this.subscribers.push({reason:e,callback:i})}notify(e,i){this.subscribers.forEach(({reason:s,callback:o})=>{e===s&&o(i)})}};var x=class extends HTMLElement{wasDisconnected=!1;constructor(){super(),this.boot?.()}connectedCallback(){if(this.wasDisconnected){this.wasDisconnected=!1;return}queueMicrotask(()=>{this.mount?.()})}disconnectedCallback(){this.wasDisconnected=!0,queueMicrotask(()=>{this.wasDisconnected&&this.unmount?.(),this.wasDisconnected=!1})}mixin(e,i={}){return new e(this,i)}appendMixin(e,i={}){return new e(this,i)}use(e){let i;return this.mixins.forEach(s=>{s instanceof e&&(i=s)}),i}uses(e){let i;return this.mixins.forEach(s=>{s instanceof e&&(i=!0)}),!!i}on(e,i){return p(this,e,i)}root(e,i={}){if(e===void 0)return this.__root;let s=document.createElement(e);for(let n in i)setAttribute(s,n,i[n]);let o=this.attachShadow({mode:"open"});return s.appendChild(document.createElement("slot")),o.appendChild(s),this.__root=s,this.__root}},F=class extends x{};var k=class{constructor(e,i={}){this.el=e,this.grouped=i.grouped===void 0,this.el.mixins=this.el.mixins?this.el.mixins:new Map,this.el.mixins.set(this.constructor.name,this),this.el[this.constructor.name]=!0,this.el.use||(this.el.use=x.prototype.use.bind(this.el)),this.opts=i,this.boot?.({options:s=>{let o=s;Object.entries(this.opts).forEach(([n,r])=>{r!==void 0&&(o[n]=r)}),this.opts=o}}),queueMicrotask(()=>{this.mount?.()})}options(){return this.opts}hasGroup(){return!!this.group()}group(){if(this.grouped!==!1)return At(this.el,e=>e[this.groupedByType.name])?.use(this.groupedByType)}on(e,i){return p(this.el,e,i)}},Z=class extends k{constructor(e,i={}){super(e,i)}walker(){return I(this.el,(e,{skip:i,reject:s})=>{if(e[this.constructor.name]&&e!==this.el)return s();if(!e[this.groupOfType.name]||!e.mixins.get(this.groupOfType.name).grouped)return i()})}};var M=class extends k{boot({options:e}){e({bubbles:!1}),this.initialState=this.el.value,this.getterFunc=()=>{},this.setterFunc=i=>this.initialState=i,Object.defineProperty(this.el,"value",{get:()=>this.getterFunc(),set:i=>{this.setterFunc(i)}})}initial(e){e(this.initialState)}getter(e){this.getterFunc=e}setter(e){this.setterFunc=e}dispatch(){this.el.dispatchEvent(new Event("input",{bubbles:this.options().bubbles,cancelable:!0})),this.el.dispatchEvent(new Event("change",{bubbles:this.options().bubbles,cancelable:!0}))}};var Ge=null;document.addEventListener("mousedown",t=>Ge=t);var Et=class extends k{boot({options:e}){e({clickOutside:!0,triggers:[]}),this.onChanges=[],this.state=!1,this.stopDialogFromFocusingTheFirstElement();let i=this.options().triggers;new MutationObserver(o=>{o.forEach(n=>{n.attributeName==="open"&&(this.el.hasAttribute("open")?this.state=!0:this.state=!1)}),this.onChanges.forEach(n=>n())}).observe(this.el,{attributeFilter:["open"]}),this.options().clickOutside&&this.el.addEventListener("click",o=>{if(o.target!==this.el){Ge=null;return}Ge&&cs(this.el,Ge)&&cs(this.el,o)&&(this.cancel(),o.preventDefault(),o.stopPropagation()),Ge=null}),this.el.hasAttribute("open")&&(this.state=!0,this.hide(),this.show())}onChange(e){this.onChanges.push(e)}show(){this.el.isConnected&&this.el.showModal()}hide(){this.el.close()}toggle(){this.state?this.hide():this.show()}cancel(){let e=new Event("cancel",{bubbles:!1,cancelable:!0});this.el.dispatchEvent(e),e.defaultPrevented||this.hide()}getState(){return this.state}setState(e){e?this.show():this.hide()}stopDialogFromFocusingTheFirstElement(){let e=document.createElement("div");e.setAttribute("data-flux-focus-placeholder",""),e.setAttribute("data-appended",""),e.setAttribute("tabindex","0"),this.el.prepend(e),this.onChange(()=>{u(e,"style",this.state?"display: none":"display: block"),this.state&&as()&&!this.el.hasAttribute("autofocus")&&this.el.querySelectorAll("[autofocus]").length===0&&setTimeout(()=>{this.el.setAttribute("tabindex","-1"),this.el.focus(),this.el.blur()})})}};function cs(t,e){let i=t.getBoundingClientRect(),s=e.clientX,o=e.clientY;return!(s>=i.left&&s<=i.right&&o>=i.top&&o<=i.bottom)}var _t=class extends k{boot(){this.onCloses=[]}onClose(e){this.onCloses.push(e)}close(){this.onCloses.forEach(e=>e())}};var Yt=class extends x{boot(){this.querySelectorAll("[data-appended]").forEach(c=>c.remove()),this._controllable=new M(this,{disabled:this.hasAttribute("disabled")});let e=this.button(),i=this.dialog();if(!i)return;i._dialogable=new Et(i,{clickOutside:!this.hasAttribute("disable-click-outside")}),i._closeable=new _t(i),i._closeable.onClose(()=>i._dialogable.hide()),this._controllable.initial(c=>c&&i._dialogable.show()),this._controllable.getter(()=>i._dialogable.getState());let s=D();this._controllable.setter(s(c=>{i._dialogable.setState(c)})),i._dialogable.onChange(s(()=>{this._controllable.dispatch()}));let o=()=>{i._dialogable.getState()?(u(this,"data-open",""),e?.setAttribute("data-open",""),u(i,"data-open","")):(w(this,"data-open"),e?.removeAttribute("data-open"),w(i,"data-open"))};i._dialogable.onChange(()=>o()),o();let{lock:n,unlock:r}=oe();i._dialogable.onChange(()=>{i._dialogable.getState()?n():r()}),e&&p(e,"click",c=>{i._dialogable.show()})}unmount(){if(this.dialog()?._dialogable?.getState()){let{unlock:e}=oe();e()}}button(){let e=this.querySelector("button,ui-button");if(!this.dialog()?.contains(e))return e}dialog(){return this.querySelector("dialog")}showModal(){let e=this.dialog();e&&e.showModal()}};T(({css:t})=>t`dialog, ::backdrop { margin: auto; }`);A("modal",Yt);var St=class extends k{boot({options:e}){this.onChanges=[],this.state=!1}onChange(e){this.onChanges.push(e)}getState(){return this.state}setState(e){let i=this.state;this.state=!!e,this.state!==i&&this.onChanges.forEach(s=>s())}};var Xt=class extends x{boot(){let e=this.button(),i=this.details();if(e){if(!i)return console.warn("ui-disclosure: no panel element found",this)}else return console.warn("ui-disclosure: no trigger element found",this);this._disabled=this.hasAttribute("disabled"),this._controllable=new M(this,{disabled:this._disabled}),i._disclosable=new St(i),this._controllable.initial(n=>n&&i._disclosable.setState(!0)),this._controllable.getter(()=>i._disclosable.getState()),this._controllable.setter(n=>i._disclosable.setState(n)),i._disclosable.onChange(()=>{this.dispatchEvent(new CustomEvent("lofi-disclosable-change",{bubbles:!0})),this._controllable.dispatch()});let s=()=>{i._disclosable.getState()?(u(this,"data-open",""),u(e,"data-open",""),u(i,"data-open","")):(w(this,"data-open"),w(e,"data-open"),w(i,"data-open"))};i._disclosable.onChange(()=>s()),s(),this._disabled||p(e,"click",n=>{i._disclosable.setState(!i._disclosable.getState())});let o=N(i,"disclosure");u(e,"aria-controls",o),u(e,"aria-expanded","false"),i._disclosable.onChange(()=>{i._disclosable.getState()?u(e,"aria-expanded","true"):u(e,"aria-expanded","false")}),this.hasAttribute("open")&&i._disclosable.setState(!0)}button(){return this.querySelector("button,ui-button")}details(){return this.lastElementChild}},Jt=class t extends x{boot(){this.exclusive=this.hasAttribute("exclusive"),this.exclusive&&p(this,"lofi-disclosable-change",e=>{e.stopPropagation(),e.target.localName==="ui-disclosure"&&e.target.value&&this.disclosureWalker().each(i=>{i!==e.target&&(i.value=!1)})})}disclosureWalker(){return I(this,(e,{skip:i,reject:s})=>{if(e instanceof t&&e!==this||e.localName!=="ui-disclosure")return s()})}};T(({css:t})=>t`ui-disclosure { display: block; }`);A("disclosure",Xt);A("disclosure-group",Jt);var j=class extends Z{groupOfType=S;boot({options:e}){e({multiple:!1}),this.state=this.options().multiple?new Set:null,this.onChanges=[]}onInitAndChange(e){e(),this.onChanges.push(e)}onChange(e){this.onChanges.push(e)}changed(e,i=!1){if(e.ungrouped)return;let s=e.value,o=e.isSelected(),n=this.options().multiple;o?n?this.state.add(s):this.state=s:n?this.state.delete(s):this.state=null,i||this.onChanges.forEach(r=>r(e))}deselectByValue(e,i=!1){this.options().multiple?this.state.delete(e):this.state=null,i||this.onChanges.forEach(s=>s())}getState(){return this.options().multiple?Array.from(this.state):this.state}hasValue(e){return this.options().multiple?this.state.has(e):this.state===e}setState(e){(e===null||e==="")&&(e=this.options().multiple?[]:""),this.options().multiple?(Array.isArray(e)||(e=[e]),e=e.map(s=>s+"")):e=e+"",this.state=this.options().multiple?new Set(e):e;let i=this.options().multiple?e:[e];this.walker().each(s=>{let o=s.use(S);if(o.ungrouped)return;let n=i.includes(o.value);n&&!o.isSelected()?o.surgicallySelect():!n&&o.isSelected()&&o.surgicallyDeselect()}),this.onChanges.forEach(s=>s())}selected(){return this.walker().find(e=>e.use(S).isSelected()).use(S)}selecteds(){return this.walker().filter(e=>e.use(S).isSelected()).map(e=>e.use(S))}selectFirst(){this.walker().first()?.use(S).select()}selectAll(){this.walker().filter(e=>!e.use(S).isSelected()).map(e=>e.use(S).select())}deselectAll(){this.walker().filter(e=>e.use(S).isSelected()).map(e=>e.use(S).deselect())}allAreSelected(){let e=this.walker().filter(i=>!0);return e.length>0&&this.walker().filter(i=>i.use(S).isSelected()).length===e.length}noneAreSelected(){return this.state===null||this.state?.size===0}isEmpty(){return this.noneAreSelected()}isNotEmpty(){return!this.isEmpty()}selectableByValue(e){return this.walker().find(i=>i.use(S).value===e)?.use(S)}deselectOthers(e){this.walker().each(i=>{i!==e&&i.use(S).surgicallyDeselect()})}selectedTextValue(){return this.options().multiple?Array.from(this.state).map(e=>this.convertValueStringToElementText(e)).join(", "):this.convertValueStringToElementText(this.state)}convertValueStringToElementText(e){let i=this.findByValue(e);return i?i.selectedLabel||i.label||i.value:e}findByValue(e){return this.selecteds().find(i=>i.value===e)}walker(){return I(this.el,(e,{skip:i,reject:s})=>{if(e[this.constructor.name]&&e!==this.el)return s();if(!e[this.groupOfType.name]||e.mixins.get(this.groupOfType.name).ungrouped)return i()})}},S=class extends k{boot({options:e}){this.groupedByType=j,e({ungrouped:!1,togglable:!1,value:void 0,label:void 0,selectedLabel: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,this.selectedLabel=this.options().selectedLabel;let i=this.options().selectedInitially;this.onSelects=[],this.onUnselects=[],this.onChanges=[];let s=()=>{this.group()&&this.group().hasValue(this.value)&&(i=!0),this.multiple=this.hasGroup()?this.group().options().multiple:!1,this.toggleable=this.options().toggleable||this.multiple,i?this.select(!0):(this.state=i,this.surgicallyDeselect(!0))};s(),!this.hasGroup()&&!this.el.isConnected&&queueMicrotask(()=>{this.hasGroup()&&s()})}mount(){this.el.hasAttribute(this.options().ariaAttr)||u(this.el,this.options().ariaAttr,"false")}onInitAndChange(e){e(),this.onChanges.push(e)}onChange(e){this.onChanges.push(e)}onSelect(e){this.onSelects.push(e)}onUnselect(e){this.onUnselects.push(e)}setState(e){e?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(e=!1){let i=!this.isSelected();this.toggleable||this.group()?.deselectOthers(this.el),this.state=!0,u(this.el,this.options().ariaAttr,"true"),u(this.el,this.options().dataAttr,""),i&&(e||(this.onSelects.forEach(s=>s()),this.onChanges.forEach(s=>s())),this.group()?.changed(this,e))}surgicallySelect(){let e=!this.isSelected();this.state=!0,u(this.el,this.options().ariaAttr,"true"),u(this.el,this.options().dataAttr,""),e&&(this.onSelects.forEach(i=>i()),this.onChanges.forEach(i=>i()))}deselect(e=!0){let i=this.isSelected();this.state=!1,u(this.el,this.options().ariaAttr,"false"),w(this.el,this.options().dataAttr),i&&(this.onUnselects.forEach(s=>s()),this.onChanges.forEach(s=>s()),e&&this.group()?.changed(this))}surgicallyDeselect(e=!1){let i=this.isSelected();this.state=!1,u(this.el,this.options().ariaAttr,"false"),w(this.el,this.options().dataAttr),i&&!e&&(this.onUnselects.forEach(s=>s()),this.onChanges.forEach(s=>s()))}getValue(){return this.value}getLabel(){return this.label}getSelectedLabel(){return this.selectedLabel}};var P=class extends k{boot({options:e}){e({disableWithParent:!0}),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.options().disableWithParent&&this.el.parentElement?.closest("[disabled]")&&(this.el.disabled=!0),new MutationObserver(s=>{this.onChanges.forEach(o=>o(this.el.disabled))}).observe(this.el,{attributeFilter:["disabled"]})}onChange(e){this.onChanges.push(e)}onInitAndChange(e){e(this.el.disabled),this.onChanges.push(e)}enabled(e){return(...i)=>{if(!this.el.disabled)return e(...i)}}disabled(e){return(...i)=>{if(this.el.disabled)return e(...i)}}isDisabled(){return this.el.disabled}};var $=class extends k{boot({options:e}){e({name:void 0,value:void 0,includeWhenEmpty:!0,shouldUpdateValue:!0}),this.name=this.options().name,this.value=this.options().value===void 0?this.el.value:this.options().value,this.state=!1,this.observer=new MutationObserver(()=>{this.renderHiddenInputs()}),this.observer.observe(this.el,{childList:!0})}mount(){this.renderHiddenInputs()}update(e){this.options().shouldUpdateValue?this.value=e:this.state=!!e,this.renderHiddenInputs()}valueIsEmpty(){return this.value===void 0||this.value===null||this.value===""}renderHiddenInputs(){if(this.observer.disconnect(),!this.name)return;let e=this.el.children,i=[];for(let o=0;oo.remove());let s;this.options().shouldUpdateValue?s=!this.valueIsEmpty()||this.options().includeWhenEmpty?this.generateInputs(this.name,this.value):[]:s=this.state||this.options().includeWhenEmpty?this.generateInputs(this.name,this.value):[],s.forEach(o=>{this.el.append(o)}),this.observer.observe(this.el,{childList:!0})}generateInputs(e,i,s=[]){if(this.isObjectOrArray(i))for(let o in i)s=s.concat(this.generateInputs(`${e}[${o}]`,i[o]));else{let o=document.createElement("input");return o.setAttribute("type","hidden"),o.setAttribute("name",e),o.setAttribute("value",i===null?"":""+i),o.setAttribute("data-flux-hidden",""),o.setAttribute("data-appended",""),[o]}return s}isObjectOrArray(e){return typeof e=="object"&&e!==null}submitEnclosingForm(){let e=this.getAssociatedForm();e&&e.requestSubmit()}getAssociatedForm(){let e=this.el.getAttribute("form");return e?document.getElementById(e)||null:this.el.closest("form")}};var Qt=class t extends F{boot(){this._disableable=new P(this);let e=[];this._disableable.onInitAndChange(i=>{i?this.walker().each(s=>{s.hasAttribute("disabled")||(s.setAttribute("disabled",""),e.push(()=>s.removeAttribute("disabled")))}):(e.forEach(s=>s()),e=[])}),this._selectable=new j(this,{multiple:!0}),this._controllable=new M(this,{disabled:this._disabled,bubbles:!0}),this.walker().each(i=>{i.addEventListener("input",s=>s.stopPropagation()),i.addEventListener("change",s=>s.stopPropagation())}),this._submittable=new $(this,{name:this.getAttribute("name"),value:this.getAttribute("value"),includeWhenEmpty:!1}),this._controllable.initial(i=>i&&this._selectable.setState(i)),this._controllable.getter(()=>this._selectable.getState()),this._detangled=D(),this._controllable.setter(this._detangled(i=>{this._selectable.setState(i)})),this._selectable.onChange(this._detangled(()=>{this._controllable.dispatch()})),this._selectable.onInitAndChange(()=>{this._submittable.update(this._selectable.getState())}),u(this,"role","group"),queueMicrotask(()=>{this._submittable.update(this._selectable.getState())})}initCheckAll(e){let i=D();e._selectable.onChange(i(()=>{e.indeterminate?(this.selectAll(),e.checked=!0,e.indeterminate=!1):e.checked?(this.selectAll(),e.checked=!0,e.indeterminate=!1):(this.deselectAll(),e.checked=!1,e.indeterminate=!1)}));let s=()=>{this._selectable.allAreSelected()?(e.indeterminate=!1,e._selectable.select()):this._selectable.noneAreSelected()?(e.indeterminate=!1,e._selectable.deselect()):e.indeterminate=!0};this._selectable.onChange(i(()=>{s()})),s()}selectAll(){this.walker().filter(e=>!e.use(S).isSelected()).map(e=>e.use(S).select())}deselectAll(){this.walker().filter(e=>e.use(S).isSelected()).map(e=>e.use(S).deselect())}walker(){return I(this,(e,{skip:i,reject:s})=>{if(e instanceof t)return s();if(e.localName!=="ui-checkbox")return i()})}},Zt=class extends F{boot(){let e=this;this.isIndeterminate=!1,this._disableable=new P(this),this.hasAttribute("all")?(this._selectable=new S(e,{ungrouped:!0,toggleable:!0,value:this.hasAttribute("value")?this.getAttribute("value"):Math.random().toString(36).substring(2,10),label:this.hasAttribute("label")?this.getAttribute("label"):null,selectedInitially:this.hasAttribute("checked"),dataAttr:"data-checked",ariaAttr:"aria-checked"}),queueMicrotask(()=>{this.closest("ui-checkbox-group")?.initCheckAll(this)})):(this._selectable=new S(e,{toggleable:!0,dataAttr:"data-checked",ariaAttr:"aria-checked",value:this.hasAttribute("value")?this.getAttribute("value"):Math.random().toString(36).substring(2,10),label:this.hasAttribute("label")?this.getAttribute("label"):null,selectedInitially:this.hasAttribute("checked")}),this._submittable=new $(this,{name:this.getAttribute("name"),value:this.getAttribute("value")??"on",includeWhenEmpty:!1,shouldUpdateValue:!1}),this._selectable.onChange(()=>{this.indeterminate&&(this.indeterminate=!1)}),this._selectable.onInitAndChange(()=>{this._submittable.update(this._selectable.isSelected())}),this.value=this._selectable.getValue(),queueMicrotask(()=>{this._submittable.update(this._selectable.isSelected())})),this._detangled=D(),this._selectable.onChange(this._detangled(()=>{this.dispatchEvent(new Event("input",{bubbles:!0,cancelable:!0})),this.dispatchEvent(new Event("change",{bubbles:!0,cancelable:!0}))})),u(e,"role","checkbox"),this._disableable.onInitAndChange(i=>{i?w(e,"tabindex","0"):u(e,"tabindex","0")}),p(e,"click",this._disableable.disabled(i=>{i.preventDefault(),i.stopPropagation()}),{capture:!0}),p(e,"click",this._disableable.enabled(i=>{this._selectable.press()})),p(e,"keydown",this._disableable.enabled(i=>{i.key==="Enter"&&this.closest("form")?.requestSubmit()})),p(e,"keydown",this._disableable.enabled(i=>{i.key===" "&&(i.preventDefault(),i.stopPropagation())})),p(e,"keyup",this._disableable.enabled(i=>{i.key===" "&&(this._selectable.press(),i.preventDefault(),i.stopPropagation())})),ko(e)}get checked(){return this._selectable.isSelected()}set checked(e){let i=this.closest("ui-checkbox-group")?._detangled||(s=>s);this._detangled(i(()=>{e?this._selectable.select():this._selectable.deselect()}))()}get indeterminate(){return this.isIndeterminate}set indeterminate(e){this.isIndeterminate=!!e,this.isIndeterminate?u(this,"data-indeterminate",""):w(this,"data-indeterminate")}};A("checkbox-group",Qt);A("checkbox",Zt);T(({css:t})=>t`ui-checkbox-group { display: block; }`);T(({css:t})=>t`ui-checkbox { display: inline-block; user-select: none; }`);function ko(t){t.closest("label")?.addEventListener("click",e=>{t.contains(e.target)||t._selectable.press()})}var ne=new Map,K=class extends k{boot({options:e}){e({triggers:[],scope:null});let i=this.options().scope||"global";u(this.el,"popover","manual"),this.triggers=this.options().triggers,this.onChanges=[],this.state=!1,p(this.el,"beforetoggle",s=>{let o=this.state;if(this.state=s.newState==="open",this.state){Co(this.el,i);let n=new AbortController,r=document.activeElement,c=[...this.triggers,r];setTimeout(()=>{To(this.el,c,n),Oo(this.el,c,n),Po(this.el,c,n)}),this.el.addEventListener("beforetoggle",l=>{l.newState==="closed"&&(n.abort(),r?.focus())},{signal:n.signal})}o!==this.state&&this.onChanges.forEach(n=>n(this.state,o))}),p(this.el,"toggle",s=>{if(s.newState==="open")ne.has(i)||ne.set(i,new Set),ne.get(i).add(this.el);else if(s.newState==="closed"){if(!ne.has(i))return;ne.get(i).delete(this.el),ne.get(i).size===0&&ne.delete(i)}})}onChange(e){this.onChanges.push(e)}setState(e){e?this.show():this.hide()}getState(){return this.state}toggle(){this.el.isConnected&&this.el.togglePopover()}show(){this.el.isConnected&&this.el.showPopover()}hide(){this.el.isConnected&&this.el.hidePopover()}};function Co(t,e){ne.has(e)&&ne.get(e).forEach(i=>{t.contains(i)||i.contains(t)||i.hidePopover()})}function To(t,e,i){document.addEventListener("click",s=>{t.contains(s.target)||e.includes(s.target)||t.hidePopover()},{signal:i.signal})}function Oo(t,e,i){document.addEventListener("focusin",s=>{t.contains(s.target)||e.includes(s.target)||(i.abort(),t.hidePopover())},{capture:!0,signal:i.signal})}function Po(t,e,i){document.addEventListener("keydown",s=>{s.key==="Escape"&&t.hidePopover()},{signal:i.signal})}var de=Math.min,V=Math.max,Xe=Math.round,Je=Math.floor,X=t=>({x:t,y:t}),Lo={left:"right",right:"left",bottom:"top",top:"bottom"},Do={start:"end",end:"start"};function ei(t,e,i){return V(t,de(e,i))}function Ie(t,e){return typeof t=="function"?t(e):t}function re(t){return t.split("-")[0]}function Re(t){return t.split("-")[1]}function ti(t){return t==="x"?"y":"x"}function ii(t){return t==="y"?"height":"width"}function fe(t){return["top","bottom"].includes(re(t))?"y":"x"}function si(t){return ti(fe(t))}function us(t,e,i){i===void 0&&(i=!1);let s=Re(t),o=si(t),n=ii(o),r=o==="x"?s===(i?"end":"start")?"right":"left":s==="start"?"bottom":"top";return e.reference[n]>e.floating[n]&&(r=Ye(r)),[r,Ye(r)]}function hs(t){let e=Ye(t);return[kt(t),e,kt(e)]}function kt(t){return t.replace(/start|end/g,e=>Do[e])}function Mo(t,e,i){let s=["left","right"],o=["right","left"],n=["top","bottom"],r=["bottom","top"];switch(t){case"top":case"bottom":return i?e?o:s:e?s:o;case"left":case"right":return e?n:r;default:return[]}}function ds(t,e,i,s){let o=Re(t),n=Mo(re(t),i==="start",s);return o&&(n=n.map(r=>r+"-"+o),e&&(n=n.concat(n.map(kt)))),n}function Ye(t){return t.replace(/left|right|bottom|top/g,e=>Lo[e])}function Io(t){return{top:0,right:0,bottom:0,left:0,...t}}function fs(t){return typeof t!="number"?Io(t):{top:t,right:t,bottom:t,left:t}}function ye(t){let{x:e,y:i,width:s,height:o}=t;return{width:s,height:o,top:i,left:e,right:e+s,bottom:i+o,x:e,y:i}}function ps(t,e,i){let{reference:s,floating:o}=t,n=fe(e),r=si(e),c=ii(r),l=re(e),a=n==="y",f=s.x+s.width/2-o.width/2,d=s.y+s.height/2-o.height/2,m=s[c]/2-o[c]/2,g;switch(l){case"top":g={x:f,y:s.y-o.height};break;case"bottom":g={x:f,y:s.y+s.height};break;case"right":g={x:s.x+s.width,y:d};break;case"left":g={x:s.x-o.width,y:d};break;default:g={x:s.x,y:s.y}}switch(Re(e)){case"start":g[r]-=m*(i&&a?-1:1);break;case"end":g[r]+=m*(i&&a?-1:1);break}return g}var bs=async(t,e,i)=>{let{placement:s="bottom",strategy:o="absolute",middleware:n=[],platform:r}=i,c=n.filter(Boolean),l=await(r.isRTL==null?void 0:r.isRTL(e)),a=await r.getElementRects({reference:t,floating:e,strategy:o}),{x:f,y:d}=ps(a,s,l),m=s,g={},h=0;for(let b=0;bpe<=0)){var We,Ve;let pe=(((We=n.flip)==null?void 0:We.index)||0)+1,Wi=z[pe];if(Wi)return{data:{index:pe,overflows:ae},reset:{placement:Wi}};let qe=(Ve=ae.filter(ke=>ke.overflows[0]<=0).sort((ke,ce)=>ke.overflows[1]-ce.overflows[1])[0])==null?void 0:Ve.placement;if(!qe)switch(g){case"bestFit":{var Be;let ke=(Be=ae.filter(ce=>{if(R){let ue=fe(ce.placement);return ue===E||ue==="y"}return!0}).map(ce=>[ce.placement,ce.overflows.filter(ue=>ue>0).reduce((ue,$s)=>ue+$s,0)]).sort((ce,ue)=>ce[1]-ue[1])[0])==null?void 0:Be[0];ke&&(qe=ke);break}case"initialPlacement":qe=c;break}if(o!==qe)return{reset:{placement:qe}}}return{}}}};async function Ro(t,e){let{placement:i,platform:s,elements:o}=t,n=await(s.isRTL==null?void 0:s.isRTL(o.floating)),r=re(i),c=Re(i),l=fe(i)==="y",a=["left","top"].includes(r)?-1:1,f=n&&l?-1:1,d=Ie(e,t),{mainAxis:m,crossAxis:g,alignmentAxis:h}=typeof d=="number"?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return c&&typeof h=="number"&&(g=c==="end"?h*-1:h),l?{x:g*f,y:m*a}:{x:m*a,y:g*f}}var gs=function(t){return t===void 0&&(t=0),{name:"offset",options:t,async fn(e){var i,s;let{x:o,y:n,placement:r,middlewareData:c}=e,l=await Ro(e,t);return r===((i=c.offset)==null?void 0:i.placement)&&(s=c.arrow)!=null&&s.alignmentOffset?{}:{x:o+l.x,y:n+l.y,data:{...l,placement:r}}}}},vs=function(t){return t===void 0&&(t={}),{name:"shift",options:t,async fn(e){let{x:i,y:s,placement:o}=e,{mainAxis:n=!0,crossAxis:r=!1,limiter:c={fn:v=>{let{x:y,y:E}=v;return{x:y,y:E}}},...l}=Ie(t,e),a={x:i,y:s},f=await Ct(e,l),d=fe(re(o)),m=ti(d),g=a[m],h=a[d];if(n){let v=m==="y"?"top":"left",y=m==="y"?"bottom":"right",E=g+f[v],_=g-f[y];g=ei(E,g,_)}if(r){let v=d==="y"?"top":"left",y=d==="y"?"bottom":"right",E=h+f[v],_=h-f[y];h=ei(E,h,_)}let b=c.fn({...e,[m]:g,[d]:h});return{...b,data:{x:b.x-i,y:b.y-s,enabled:{[m]:n,[d]:r}}}}}};var ws=function(t){return t===void 0&&(t={}),{name:"size",options:t,async fn(e){var i,s;let{placement:o,rects:n,platform:r,elements:c}=e,{apply:l=()=>{},...a}=Ie(t,e),f=await Ct(e,a),d=re(o),m=Re(o),g=fe(o)==="y",{width:h,height:b}=n.floating,v,y;d==="top"||d==="bottom"?(v=d,y=m===(await(r.isRTL==null?void 0:r.isRTL(c.floating))?"start":"end")?"left":"right"):(y=d,v=m==="end"?"top":"bottom");let E=b-f.top-f.bottom,_=h-f.left-f.right,L=de(b-f[v],E),O=de(h-f[y],_),R=!e.middlewareData.shift,z=L,ee=O;if((i=e.middlewareData.shift)!=null&&i.enabled.x&&(ee=_),(s=e.middlewareData.shift)!=null&&s.enabled.y&&(z=E),R&&!m){let ae=V(f.left,0),We=V(f.right,0),Ve=V(f.top,0),Be=V(f.bottom,0);g?ee=h-2*(ae!==0||We!==0?ae+We:V(f.left,f.right)):z=b-2*(Ve!==0||Be!==0?Ve+Be:V(f.top,f.bottom))}await l({...e,availableWidth:ee,availableHeight:z});let q=await r.getDimensions(c.floating);return h!==q.width||b!==q.height?{reset:{rects:!0}}:{}}}};function Tt(){return typeof window<"u"}function Ae(t){return As(t)?(t.nodeName||"").toLowerCase():"#document"}function B(t){var e;return(t==null||(e=t.ownerDocument)==null?void 0:e.defaultView)||window}function J(t){var e;return(e=(As(t)?t.ownerDocument:t.document)||window.document)==null?void 0:e.documentElement}function As(t){return Tt()?t instanceof Node||t instanceof B(t).Node:!1}function U(t){return Tt()?t instanceof Element||t instanceof B(t).Element:!1}function Q(t){return Tt()?t instanceof HTMLElement||t instanceof B(t).HTMLElement:!1}function ys(t){return!Tt()||typeof ShadowRoot>"u"?!1:t instanceof ShadowRoot||t instanceof B(t).ShadowRoot}function Fe(t){let{overflow:e,overflowX:i,overflowY:s,display:o}=G(t);return/auto|scroll|overlay|hidden|clip/.test(e+s+i)&&!["inline","contents"].includes(o)}function xs(t){return["table","td","th"].includes(Ae(t))}function Qe(t){return[":popover-open",":modal"].some(e=>{try{return t.matches(e)}catch{return!1}})}function Ot(t){let e=Pt(),i=U(t)?G(t):t;return["transform","translate","scale","rotate","perspective"].some(s=>i[s]?i[s]!=="none":!1)||(i.containerType?i.containerType!=="normal":!1)||!e&&(i.backdropFilter?i.backdropFilter!=="none":!1)||!e&&(i.filter?i.filter!=="none":!1)||["transform","translate","scale","rotate","perspective","filter"].some(s=>(i.willChange||"").includes(s))||["paint","layout","strict","content"].some(s=>(i.contain||"").includes(s))}function Es(t){let e=le(t);for(;Q(e)&&!xe(e);){if(Ot(e))return e;if(Qe(e))return null;e=le(e)}return null}function Pt(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function xe(t){return["html","body","#document"].includes(Ae(t))}function G(t){return B(t).getComputedStyle(t)}function Ze(t){return U(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.scrollX,scrollTop:t.scrollY}}function le(t){if(Ae(t)==="html")return t;let e=t.assignedSlot||t.parentNode||ys(t)&&t.host||J(t);return ys(e)?e.host:e}function _s(t){let e=le(t);return xe(e)?t.ownerDocument?t.ownerDocument.body:t.body:Q(e)&&Fe(e)?e:_s(e)}function Ne(t,e,i){var s;e===void 0&&(e=[]),i===void 0&&(i=!0);let o=_s(t),n=o===((s=t.ownerDocument)==null?void 0:s.body),r=B(o);if(n){let c=Lt(r);return e.concat(r,r.visualViewport||[],Fe(o)?o:[],c&&i?Ne(c):[])}return e.concat(o,Ne(o,[],i))}function Lt(t){return t.parent&&Object.getPrototypeOf(t.parent)?t.frameElement:null}function Cs(t){let e=G(t),i=parseFloat(e.width)||0,s=parseFloat(e.height)||0,o=Q(t),n=o?t.offsetWidth:i,r=o?t.offsetHeight:s,c=Xe(i)!==n||Xe(s)!==r;return c&&(i=n,s=r),{width:i,height:s,$:c}}function ni(t){return U(t)?t:t.contextElement}function He(t){let e=ni(t);if(!Q(e))return X(1);let i=e.getBoundingClientRect(),{width:s,height:o,$:n}=Cs(e),r=(n?Xe(i.width):i.width)/s,c=(n?Xe(i.height):i.height)/o;return(!r||!Number.isFinite(r))&&(r=1),(!c||!Number.isFinite(c))&&(c=1),{x:r,y:c}}var No=X(0);function Ts(t){let e=B(t);return!Pt()||!e.visualViewport?No:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function Fo(t,e,i){return e===void 0&&(e=!1),!i||e&&i!==B(t)?!1:e}function Ee(t,e,i,s){e===void 0&&(e=!1),i===void 0&&(i=!1);let o=t.getBoundingClientRect(),n=ni(t),r=X(1);e&&(s?U(s)&&(r=He(s)):r=He(t));let c=Fo(n,i,s)?Ts(n):X(0),l=(o.left+c.x)/r.x,a=(o.top+c.y)/r.y,f=o.width/r.x,d=o.height/r.y;if(n){let m=B(n),g=s&&U(s)?B(s):s,h=m,b=Lt(h);for(;b&&s&&g!==h;){let v=He(b),y=b.getBoundingClientRect(),E=G(b),_=y.left+(b.clientLeft+parseFloat(E.paddingLeft))*v.x,L=y.top+(b.clientTop+parseFloat(E.paddingTop))*v.y;l*=v.x,a*=v.y,f*=v.x,d*=v.y,l+=_,a+=L,h=B(b),b=Lt(h)}}return ye({width:f,height:d,x:l,y:a})}function ri(t,e){let i=Ze(t).scrollLeft;return e?e.left+i:Ee(J(t)).left+i}function Os(t,e,i){i===void 0&&(i=!1);let s=t.getBoundingClientRect(),o=s.left+e.scrollLeft-(i?0:ri(t,s)),n=s.top+e.scrollTop;return{x:o,y:n}}function Ho(t){let{elements:e,rect:i,offsetParent:s,strategy:o}=t,n=o==="fixed",r=J(s),c=e?Qe(e.floating):!1;if(s===r||c&&n)return i;let l={scrollLeft:0,scrollTop:0},a=X(1),f=X(0),d=Q(s);if((d||!d&&!n)&&((Ae(s)!=="body"||Fe(r))&&(l=Ze(s)),Q(s))){let g=Ee(s);a=He(s),f.x=g.x+s.clientLeft,f.y=g.y+s.clientTop}let m=r&&!d&&!n?Os(r,l,!0):X(0);return{width:i.width*a.x,height:i.height*a.y,x:i.x*a.x-l.scrollLeft*a.x+f.x+m.x,y:i.y*a.y-l.scrollTop*a.y+f.y+m.y}}function Wo(t){return Array.from(t.getClientRects())}function Vo(t){let e=J(t),i=Ze(t),s=t.ownerDocument.body,o=V(e.scrollWidth,e.clientWidth,s.scrollWidth,s.clientWidth),n=V(e.scrollHeight,e.clientHeight,s.scrollHeight,s.clientHeight),r=-i.scrollLeft+ri(t),c=-i.scrollTop;return G(s).direction==="rtl"&&(r+=V(e.clientWidth,s.clientWidth)-o),{width:o,height:n,x:r,y:c}}function Bo(t,e){let i=B(t),s=J(t),o=i.visualViewport,n=s.clientWidth,r=s.clientHeight,c=0,l=0;if(o){n=o.width,r=o.height;let a=Pt();(!a||a&&e==="fixed")&&(c=o.offsetLeft,l=o.offsetTop)}return{width:n,height:r,x:c,y:l}}function qo(t,e){let i=Ee(t,!0,e==="fixed"),s=i.top+t.clientTop,o=i.left+t.clientLeft,n=Q(t)?He(t):X(1),r=t.clientWidth*n.x,c=t.clientHeight*n.y,l=o*n.x,a=s*n.y;return{width:r,height:c,x:l,y:a}}function Ss(t,e,i){let s;if(e==="viewport")s=Bo(t,i);else if(e==="document")s=Vo(J(t));else if(U(e))s=qo(e,i);else{let o=Ts(t);s={x:e.x-o.x,y:e.y-o.y,width:e.width,height:e.height}}return ye(s)}function Ps(t,e){let i=le(t);return i===e||!U(i)||xe(i)?!1:G(i).position==="fixed"||Ps(i,e)}function $o(t,e){let i=e.get(t);if(i)return i;let s=Ne(t,[],!1).filter(c=>U(c)&&Ae(c)!=="body"),o=null,n=G(t).position==="fixed",r=n?le(t):t;for(;U(r)&&!xe(r);){let c=G(r),l=Ot(r);!l&&c.position==="fixed"&&(o=null),(n?!l&&!o:!l&&c.position==="static"&&!!o&&["absolute","fixed"].includes(o.position)||Fe(r)&&!l&&Ps(t,r))?s=s.filter(f=>f!==r):o=c,r=le(r)}return e.set(t,s),s}function zo(t){let{element:e,boundary:i,rootBoundary:s,strategy:o}=t,r=[...i==="clippingAncestors"?Qe(e)?[]:$o(e,this._c):[].concat(i),s],c=r[0],l=r.reduce((a,f)=>{let d=Ss(e,f,o);return a.top=V(d.top,a.top),a.right=de(d.right,a.right),a.bottom=de(d.bottom,a.bottom),a.left=V(d.left,a.left),a},Ss(e,c,o));return{width:l.right-l.left,height:l.bottom-l.top,x:l.left,y:l.top}}function jo(t){let{width:e,height:i}=Cs(t);return{width:e,height:i}}function Ko(t,e,i){let s=Q(e),o=J(e),n=i==="fixed",r=Ee(t,!0,n,e),c={scrollLeft:0,scrollTop:0},l=X(0);if(s||!s&&!n)if((Ae(e)!=="body"||Fe(o))&&(c=Ze(e)),s){let m=Ee(e,!0,n,e);l.x=m.x+e.clientLeft,l.y=m.y+e.clientTop}else o&&(l.x=ri(o));let a=o&&!s&&!n?Os(o,c):X(0),f=r.left+c.scrollLeft-l.x-a.x,d=r.top+c.scrollTop-l.y-a.y;return{x:f,y:d,width:r.width,height:r.height}}function oi(t){return G(t).position==="static"}function ks(t,e){if(!Q(t)||G(t).position==="fixed")return null;if(e)return e(t);let i=t.offsetParent;return J(t)===i&&(i=i.ownerDocument.body),i}function Ls(t,e){let i=B(t);if(Qe(t))return i;if(!Q(t)){let o=le(t);for(;o&&!xe(o);){if(U(o)&&!oi(o))return o;o=le(o)}return i}let s=ks(t,e);for(;s&&xs(s)&&oi(s);)s=ks(s,e);return s&&xe(s)&&oi(s)&&!Ot(s)?i:s||Es(t)||i}var Uo=async function(t){let e=this.getOffsetParent||Ls,i=this.getDimensions,s=await i(t.floating);return{reference:Ko(t.reference,await e(t.floating),t.strategy),floating:{x:0,y:0,width:s.width,height:s.height}}};function Go(t){return G(t).direction==="rtl"}var Yo={convertOffsetParentRelativeRectToViewportRelativeRect:Ho,getDocumentElement:J,getClippingRect:zo,getOffsetParent:Ls,getElementRects:Uo,getClientRects:Wo,getDimensions:jo,getScale:He,isElement:U,isRTL:Go};function Ds(t,e){return t.x===e.x&&t.y===e.y&&t.width===e.width&&t.height===e.height}function Xo(t,e){let i=null,s,o=J(t);function n(){var c;clearTimeout(s),(c=i)==null||c.disconnect(),i=null}function r(c,l){c===void 0&&(c=!1),l===void 0&&(l=1),n();let a=t.getBoundingClientRect(),{left:f,top:d,width:m,height:g}=a;if(c||e(),!m||!g)return;let h=Je(d),b=Je(o.clientWidth-(f+m)),v=Je(o.clientHeight-(d+g)),y=Je(f),_={rootMargin:-h+"px "+-b+"px "+-v+"px "+-y+"px",threshold:V(0,de(1,l))||1},L=!0;function O(R){let z=R[0].intersectionRatio;if(z!==l){if(!L)return r();z?r(!1,z):s=setTimeout(()=>{r(!1,1e-7)},1e3)}z===1&&!Ds(a,t.getBoundingClientRect())&&r(),L=!1}try{i=new IntersectionObserver(O,{..._,root:o.ownerDocument})}catch{i=new IntersectionObserver(O,_)}i.observe(t)}return r(!0),n}function Ms(t,e,i,s){s===void 0&&(s={});let{ancestorScroll:o=!0,ancestorResize:n=!0,elementResize:r=typeof ResizeObserver=="function",layoutShift:c=typeof IntersectionObserver=="function",animationFrame:l=!1}=s,a=ni(t),f=o||n?[...a?Ne(a):[],...Ne(e)]:[];f.forEach(y=>{o&&y.addEventListener("scroll",i,{passive:!0}),n&&y.addEventListener("resize",i)});let d=a&&c?Xo(a,i):null,m=-1,g=null;r&&(g=new ResizeObserver(y=>{let[E]=y;E&&E.target===a&&g&&(g.unobserve(e),cancelAnimationFrame(m),m=requestAnimationFrame(()=>{var _;(_=g)==null||_.observe(e)})),i()}),a&&!l&&g.observe(a),g.observe(e));let h,b=l?Ee(t):null;l&&v();function v(){let y=Ee(t);b&&!Ds(b,y)&&i(),b=y,h=requestAnimationFrame(v)}return i(),()=>{var y;f.forEach(E=>{o&&E.removeEventListener("scroll",i),n&&E.removeEventListener("resize",i)}),d?.(),(y=g)==null||y.disconnect(),g=null,l&&cancelAnimationFrame(h)}}var Is=gs;var Rs=vs,Ns=ms,Fs=ws;var Hs=(t,e,i)=>{let s=new Map,o={platform:Yo,...i},n={...o.platform,_c:s};return bs(t,e,{...o,platform:n})};var Y=class extends k{boot({options:e}){if(e({reference:null,auto:!0,position:"bottom start",gap:"5",offset:"0",matchWidth:!1,crossAxis:!1,scrollY:!0}),this.options().reference===null||this.options().position===null)return;let[i,s]=Zo(this.el,{scrollY:this.options().scrollY}),o=Jo(this.el,this.options().reference,i,{position:this.options().position,gap:this.options().gap,offset:this.options().offset,matchWidth:this.options().matchWidth,crossAxis:this.options().crossAxis,scrollY:this.options().scrollY}),n=()=>{};this.reposition=(...r)=>{this.options().auto?n=Ms(this.options().reference,this.el,o):o(null,...r)},this.cleanup=()=>{n(),s()}}};function Jo(t,e,i,{position:s,offset:o,gap:n,matchWidth:r,crossAxis:c,scrollY:l}){let a=window.getComputedStyle(t).maxHeight;return a=a==="none"?null:parseFloat(a),(f,d,m)=>{Hs(e,t,{placement:Qo(s),middleware:[Is({mainAxis:Number(n),alignmentAxis:Number(o)}),Ns(),Rs({padding:5,crossAxis:c}),Fs({padding:5,apply({rects:g,elements:h,availableHeight:b}){r&&Object.assign(h.floating.style,{width:`${g.reference.width}px`});let v=a;v===null&&(v=l?h.floating.scrollHeight:h.floating.offsetHeight),h.floating.style.maxHeight=b>v?"":`${b}px`}})]}).then(({x:g,y:h})=>{i(d||g,m||h)})}}function Qo(t){let e=t.split(" ");switch(e[0]){case"start":e[0]=he()?"right":"left";break;case"end":e[0]=he()?"left":"right";break}return e.join("-")}function Zo(t,{scrollY:e=!0}){let i=(r,c)=>{Object.assign(t.style,{position:"absolute",overflowY:e?"auto":"hidden",left:`${r}px`,top:`${c}px`,right:"auto",bottom:"auto"})},s,o,n=new MutationObserver(()=>i(s,o));return[(r,c)=>{s=r,o=c,n.disconnect(),i(s,o),n.observe(t,{attributeFilter:["style"]})},()=>{n.disconnect()}]}var li=class extends x{boot(){let e=this.trigger(),i=this.overlay();if(e){if(!i)return console.warn("ui-dropdown: no [popover] overlay found",this)}else return console.warn("ui-dropdown: no trigger element found",this);if(this._disabled=this.hasAttribute("disabled"),this._controllable=new M(this),i._popoverable=new K(i),i._anchorable=new Y(i,{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}),i._popoverable.onChange(()=>{i._popoverable.getState()?i._anchorable.reposition():i._anchorable.cleanup()}),!this.hasAttribute("hover")){let{lock:n,unlock:r}=oe(i._popoverable.el);i._popoverable.onChange(()=>{i._popoverable.getState()?n():r()})}this._controllable.initial(n=>i._popoverable.setState(n)),this._controllable.getter(()=>i._popoverable.getState());let s=D();if(this._controllable.setter(n=>i._popoverable.setState(n)),i._popoverable.onChange(s(()=>this._controllable.dispatch())),this.hasAttribute("hover")){let n=()=>{};Me(e,i,{gain(){i._popoverable.setState(!0),n=p(document,"scroll",()=>{i._popoverable.getState()&&(i._popoverable.setState(!1),n())}).off},lose(){i._popoverable.setState(!1),n()},focusable:!1})}p(e,"click",()=>i._popoverable.toggle()),i._popoverable.getState()?(u(this,"data-open",""),u(e,"data-open",""),u(i,"data-open","")):(w(this,"data-open"),w(e,"data-open"),w(i,"data-open")),i._popoverable.onChange(()=>{i._popoverable.getState()?(u(this,"data-open",""),u(e,"data-open",""),u(i,"data-open","")):(w(this,"data-open"),w(e,"data-open"),w(i,"data-open"))});let o=N(i,"dropdown");u(e,"aria-haspopup","true"),u(e,"aria-controls",o),u(e,"aria-expanded",i._popoverable.getState()?"true":"false"),i._popoverable.onChange(()=>{u(e,"aria-expanded",i._popoverable.getState()?"true":"false")}),i._popoverable.onChange(()=>{setTimeout(()=>i._popoverable.getState()?i.onPopoverShow?.():i.onPopoverHide?.())})}unmount(){if(this.overlay()?._popoverable?.getState()&&!this.hasAttribute("hover")){let{unlock:e}=oe();e()}}trigger(){return this.querySelector("button,ui-button,a")}overlay(){return this.lastElementChild?.matches("[popover]")&&this.lastElementChild}};A("dropdown",li);var ai=class extends x{boot(){let e=this.hasAttribute("label")?"label":"description",i=this.button(),s=this.overlay();if(i){if(!s)return}else return console.warn("ui-tooltip: no trigger element found",this);s._popoverable=new K(s,{scope:"tooltip"}),s._anchorable=new Y(s,{reference:i,position:this.hasAttribute("position")?this.getAttribute("position"):void 0,gap:this.hasAttribute("gap")?this.getAttribute("gap"):void 0,offset:this.hasAttribute("offset")?this.getAttribute("offset"):void 0}),s._popoverable.onChange(()=>{s._popoverable.getState()?s._anchorable.reposition():s._anchorable.cleanup()}),this._disableable=new P(this);let o;this._disableable.onInitAndChange(a=>{o&&(o(),o=null),a||(o=Me(i,s,{gain(){s._popoverable.setState(!0)},lose(){s._popoverable.setState(!1)},focusable:!0,useSafeArea:!1}).remove)}),new MutationObserver(()=>{this.getAttribute("draggable")==="true"&&s._popoverable.setState(!1)}).observe(this,{attributeFilter:["draggable"]});let r=N(s,"tooltip"),c=this.hasAttribute("interactive"),l=this.hasAttribute("label")||i.textContent.trim()==="";c?(u(i,"aria-controls",r),u(i,"aria-expanded","false"),s._popoverable.onChange(()=>{s._popoverable.getState()?u(i,"aria-expanded","true"):u(i,"aria-expanded","false")})):(l?u(i,"aria-labelledby",r):u(i,"aria-describedby",r),u(s,"aria-hidden","true")),u(s,"role","tooltip")}button(){return this.firstElementChild}overlay(){return this.lastElementChild!==this.button()&&this.lastElementChild.tagName!=="TEMPLATE"&&this.lastElementChild}};A("tooltip",ai);var C={STATE_CHANGED:"stateChanged",DESKTOP_COLLAPSED:"desktopCollapsed",DESKTOP_EXPANDED:"desktopExpanded",MOBILE_COLLAPSED:"mobileCollapsed",MOBILE_EXPANDED:"mobileExpanded",VIEWPORT_ENTER_MOBILE:"viewportEnterMobile",VIEWPORT_ENTER_DESKTOP:"viewportEnterDesktop"},ci=class extends x{boot(){if(this.config={breakpoint:this.hasAttribute("breakpoint")?this.getAttribute("breakpoint"):1024,collapsible:!1,persist:this.hasAttribute("persist")?!["false","none"].includes(this.getAttribute("persist")):!0,sticky:!!this.hasAttribute("sticky")},this.observable=new yt,this.state={active:!1,viewportDesktop:!0,viewportMobile:!1,collapsedMobile:!0,collapsedDesktop:!1},this.config.sticky&&this.setStickyPositionStyles(),this.hasAttribute("collapsible")){let e=this.getAttribute("collapsible");e==="true"?this.config.collapsible=!0:e==="false"?this.config.collapsible=!1:e==="mobile"&&(this.config.collapsible="mobile")}this.config.persist&&this.config.collapsible&&(this.state.collapsedDesktop=JSON.parse(localStorage.getItem("flux-sidebar-collapsed-desktop"))),this.removeAttribute("data-flux-sidebar-cloak"),this.observable.subscribe(C.VIEWPORT_ENTER_DESKTOP,()=>{let e=Gt(this,"transition","none");setTimeout(e),this.state.viewportDesktop=!0,this.state.viewportMobile=!1,this.observable.notify(C.STATE_CHANGED)}),this.observable.subscribe(C.VIEWPORT_ENTER_MOBILE,()=>{let e=Gt(this,"transition","none");setTimeout(e),this.state.viewportDesktop=!1,this.state.viewportMobile=!0,this.observable.notify(C.STATE_CHANGED)}),this.observable.subscribe(C.DESKTOP_COLLAPSED,()=>{this.state.collapsedDesktop=!0,this.observable.notify(C.STATE_CHANGED)}),this.observable.subscribe(C.DESKTOP_EXPANDED,()=>{this.state.collapsedDesktop=!1,this.observable.notify(C.STATE_CHANGED)}),this.observable.subscribe(C.MOBILE_COLLAPSED,()=>{this.state.collapsedMobile=!0,this.observable.notify(C.STATE_CHANGED)}),this.observable.subscribe(C.MOBILE_EXPANDED,()=>{this.state.collapsedMobile=!1,this.observable.notify(C.STATE_CHANGED)}),this.observable.subscribe(C.STATE_CHANGED,()=>{this.config.persist&&localStorage.setItem("flux-sidebar-collapsed-desktop",JSON.stringify(this.state.collapsedDesktop)),this.updateDataAttributes(this)}),new ui(this.observable,this.config),document.addEventListener("flux-sidebar-toggle",()=>{this.state.viewportDesktop?this.state.collapsedDesktop?this.observable.notify(C.DESKTOP_EXPANDED):this.observable.notify(C.DESKTOP_COLLAPSED):this.state.collapsedMobile?this.observable.notify(C.MOBILE_EXPANDED):this.observable.notify(C.MOBILE_COLLAPSED)}),this.addEventListener("click",e=>{e.target===this&&this.state.collapsedDesktop&&this.observable.notify(C.DESKTOP_EXPANDED)}),this.addEventListener("mouseenter",e=>{this.state.active=!0,this.observable.notify(C.STATE_CHANGED)}),this.addEventListener("mouseleave",e=>{this.state.active=!1,this.observable.notify(C.STATE_CHANGED)}),this.addEventListener("focusin",e=>{this.state.active=!0,this.observable.notify(C.STATE_CHANGED)}),this.addEventListener("focusout",e=>{this.state.active=!1,this.observable.notify(C.STATE_CHANGED)})}setStickyPositionStyles(){let e=this.offsetTop,i=window.pageYOffset;i>0&&(window.scrollTo(window.scrollX,0),e=this.offsetTop,window.scrollTo(window.scrollX,i)),this.style.position="sticky",this.style.top=e+"px",this.style.maxHeight=`calc(100dvh - ${e}px)`}updateDataAttributes(e){let i=this.config.collapsible===!0;i&&(this.state.active?u(e,"data-flux-sidebar-active",""):se(e,"data-flux-sidebar-active")),this.state.viewportDesktop?(se(e,"data-flux-sidebar-on-mobile"),u(e,"data-flux-sidebar-on-desktop",""),se(e,"data-flux-sidebar-collapsed-mobile"),this.state.collapsedDesktop?i&&u(e,"data-flux-sidebar-collapsed-desktop",""):se(e,"data-flux-sidebar-collapsed-desktop")):(se(e,"data-flux-sidebar-on-desktop"),u(e,"data-flux-sidebar-on-mobile",""),se(e,"data-flux-sidebar-collapsed-desktop"),this.state.collapsedMobile?u(e,"data-flux-sidebar-collapsed-mobile",""):se(e,"data-flux-sidebar-collapsed-mobile"))}},ui=class{constructor(e,{breakpoint:i}){this.observable=e,this.breakpoint=i,this.watchForViewportChanges()}watchForViewportChanges(){let e=typeof this.breakpoint=="number"?`${this.breakpoint}px`:this.breakpoint,i=matchMedia(`(min-width: ${e})`);i.matches?this.observable.notify(C.VIEWPORT_ENTER_DESKTOP):this.observable.notify(C.VIEWPORT_ENTER_MOBILE),i.addEventListener("change",()=>{i.matches?this.observable.notify(C.VIEWPORT_ENTER_DESKTOP):this.observable.notify(C.VIEWPORT_ENTER_MOBILE)})}},hi=class extends x{mount(){let e=this.querySelector("button,ui-button");p(e||this,"click",()=>{this.dispatchEvent(new CustomEvent("flux-sidebar-toggle",{bubbles:!0}))}),queueMicrotask(()=>{let i=document.querySelector("ui-sidebar");i.updateDataAttributes(this),i.observable.subscribe(C.STATE_CHANGED,()=>{i.updateDataAttributes(this)})})}};A("sidebar",ci);A("sidebar-toggle",hi);var di=class extends x{boot(){u(this,"role","button"),this._disableable=new P(this),this._disableable.onInitAndChange(e=>{e?w(this,"tabindex","0"):u(this,"tabindex","0")}),this._buttonType=this.getAttribute("type")||"button"}mount(){p(this,"keydown",e=>{e.key==="Enter"&&(e.preventDefault(),this.disabled||this.click()),e.key===" "&&e.preventDefault()}),p(this,"keyup",e=>{e.key===" "&&(e.preventDefault(),e.stopPropagation(),this.disabled||this.click())}),p(this,"click",()=>{this.disabled||(this._buttonType==="submit"?this._handleSubmit():this._buttonType==="reset"&&this._handleReset())})}_handleSubmit(){let e=this.closest("form");e&&e.requestSubmit()}_handleReset(){let e=this.closest("form");e&&e.reset()}};T(({css:t})=>t`ui-button { display: block; }`);A("button",di);var _e=class extends Z{groupOfType=H;boot({options:e}){e({wrap:!1,ensureTabbable:!0})}mount(){this.options().ensureTabbable&&this.ensureTabbable()}focusFirst(){let e;e=e||this.walker().find(i=>i.hasAttribute("autofocus")),e=e||this.walker().find(i=>i.getAttribute("tabindex")==="0"),e=e||this.walker().find(i=>i.getAttribute("tabindex")==="-1"),e=e||this.walker().find(i=>rs(i)),e?.focus()}focusPrev(){this.moveFocus(e=>this.options().wrap?this.walker().prevOrLast(e):this.walker().prev(e))}focusNext(){this.moveFocus(e=>this.options().wrap?this.walker().nextOrFirst(e):this.walker().next(e))}focusBySearch(e){let i=this.walker().find(s=>s.textContent.toLowerCase().trim().startsWith(e.toLowerCase()));i?.use(H).tabbable(),i?.use(H).focus()}moveFocus(e){let i=this.walker().find(o=>o.use(H).isTabbable());e(i)?.use(H).focus()}ensureTabbable(){this.walker().findOrFirst(e=>{e.use(H).isTabbable()})?.use(H).tabbable()}wipeTabbables(){this.walker().each(e=>{e.use(H).untabbable()})}untabbleOthers(e){this.walker().each(i=>{i!==e&&i.use(H).untabbable()})}walker(){return I(this.el,(e,{skip:i,reject:s})=>{if(e[this.constructor.name]&&e!==this.el)return s();if(!e[this.groupOfType.name])return i();if(e.hasAttribute("disabled"))return s()})}},H=class extends k{groupedByType=_e;boot({options:e}){e({hover:!1,disableable:null,tabbable:!1,tabbableAttr:null})}mount(){let e=this.options().disableable;if(!e)throw"Focusable requires a Disableable instance...";this.el.hasAttribute("tabindex")||(this.options().tabbable?this.tabbable():this.untabbable()),this.pauseFocusListener=this.on("focus",e.enabled(()=>{this.focus(!1)})).pause,this.on("focus",e.enabled(()=>{we()&&u(this.el,"data-focus","")})),this.on("blur",e.enabled(()=>{w(this.el,"data-focus")})),this.options().hover&&this.on("pointerenter",e.enabled(()=>{this.group()?.untabbleOthers(this.el),this.tabbable()})),this.options().hover&&this.on("pointerleave",e.enabled(i=>{this.untabbable()}))}focus(e=!0){this.group()?.untabbleOthers(this.el),this.tabbable(),e&&this.pauseFocusListener(()=>{this.el.focus({focusVisible:!1})})}tabbable(){u(this.el,"tabindex","0"),this.options().tabbableAttr&&u(this.el,this.options().tabbableAttr,"")}untabbable(){u(this.el,"tabindex","-1"),this.options().tabbableAttr&&w(this.el,this.options().tabbableAttr)}isTabbable(){return this.el.getAttribute("tabindex")==="0"}};var fi=class extends F{boot(){let e=this;this._disableable=new P(this),this._selectable=new S(e,{toggleable:!0,dataAttr:"data-checked",ariaAttr:"aria-checked",value:this.hasAttribute("value")?this.getAttribute("value"):null,label:this.hasAttribute("label")?this.getAttribute("label"):null,selectedInitially:this.hasAttribute("checked")}),this._submittable=new $(this,{name:this.getAttribute("name"),value:this.getAttribute("value")??"on",includeWhenEmpty:!1,shouldUpdateValue:!1}),this.value=this._selectable.getValue(),this._detangled=D(),this._selectable.onChange(this._detangled(()=>{this.dispatchEvent(new Event("input",{bubbles:!1,cancelable:!0})),this.dispatchEvent(new Event("change",{bubbles:!1,cancelable:!0}))})),u(e,"role","switch"),this._selectable.onInitAndChange(()=>{this._submittable.update(this._selectable.getState())}),this._disableable.onInitAndChange(i=>{i?w(e,"tabindex","0"):u(e,"tabindex","0")}),p(e,"click",this._disableable.disabled(i=>{i.preventDefault(),i.stopPropagation()}),{capture:!0}),p(e,"click",this._disableable.enabled(i=>{this._selectable.press()})),p(e,"keydown",this._disableable.enabled(i=>{i.key==="Enter"&&(this._selectable.press(),i.preventDefault(),i.stopPropagation())})),p(e,"keydown",this._disableable.enabled(i=>{i.key===" "&&(i.preventDefault(),i.stopPropagation())})),p(e,"keyup",this._disableable.enabled(i=>{i.key===" "&&(this._selectable.press(),i.preventDefault(),i.stopPropagation())})),en(e)}get checked(){return this._selectable.isSelected()}set checked(e){this._detangled(()=>{e?this._selectable.select():this._selectable.deselect()})()}};function en(t){t.closest("label")?.addEventListener("click",e=>{t.contains(e.target)||t.click()})}T(({css:t})=>t`ui-switch { display: inline-block; user-select: none; }`);A("switch",fi);var pi=class extends x{mount(){let e=this.querySelector("button,ui-button");p(e,"click",()=>{At(this,s=>!!s._closeable)?._closeable?.close()})}};A("close",pi);var bi=class t extends x{mount(){this.control=this.fieldWalker().find(e=>this.isControl(e)),this.control}associateLabelWithControl(e){e&&this.label&&(this.control=e,!this.control.hasAttribute("aria-labelledby")&&(u(this.elOrButton(this.control),"aria-labelledby",this.label.id),this.control&&!(this.control instanceof F)&&this.hasAttribute("disabled")&&this.control.setAttribute("disabled","")))}associateDescriptionWithControl(e){e&&this.description&&(this.control=e,!this.control.hasAttribute("aria-describedby")&&u(this.elOrButton(this.control),"aria-describedby",this.description.id))}associateLabel(e){this.label=e,p(e,"click",i=>{["a","button","ui-button"].includes(i.target.localName)||this.focusOrTogggle(this.control)}),this.control&&this.associateLabelWithControl(this.control)}associateDescription(e){this.description=e,this.control&&this.associateDescriptionWithControl(this.control)}fieldWalker(){return I(this,(e,{skip:i,reject:s})=>{if(e instanceof t&&e!==this||e.parentElement.localName==="ui-editor"&&e!==this)return s()})}isControl(e){return!!(e instanceof F||e.matches("input, textarea, select"))}focusOrTogggle(e){if(!e||e.disabled||e.hasAttribute("disabled"))return;e.localName==="input"&&["checkbox","radio"].includes(e.type)||["ui-switch","ui-radio","ui-checkbox"].includes(e.localName)?(e.click(),e.focus()):e.localName==="input"&&["file"].includes(e.type)?e.click():["ui-select","ui-date-picker","ui-time-picker","ui-otp"].includes(e.localName)?e.trigger()?.focus():["ui-editor"].includes(e.localName)?e.focus():["ui-composer"].includes(e.localName)?e.focusInput():e.focus()}elOrButton(e){return e instanceof x&&e.firstElementChild instanceof HTMLButtonElement?e.firstElementChild:e}},mi=class extends x{mount(){N(this,"label"),u(this,"aria-hidden","true"),this.closest("ui-field")?.associateLabel(this)}},gi=class extends x{mount(){N(this,"description"),u(this,"aria-hidden","true"),this.closest("ui-field")?.associateDescription(this)}};T(({css:t})=>t` ui-label { display: inline-block; cursor: default; } ui-description { display: block; } `);A("field",bi);A("label",mi);A("description",gi);var vi=class extends x{mount(){let e=N(this,"legend"),i=this.closest("fieldset");i&&u(i,"aria-labelledby",e)}};T(({css:t})=>t`ui-legend { display: block; }`);A("legend",vi);var wi=class t extends F{boot(){this._disableable=new P(this),this._disableable.onInitAndChange(e=>{this.walker().each(i=>{i.disabled=e})}),this._selectable=new j(this),this._controllable=new M(this,{disabled:this._disabled,bubbles:!0}),this._focusable=new _e(this,{wrap:!0}),this._submittable=new $(this,{name:this.getAttribute("name"),value:this._selectable.getState(),includeWhenEmpty:!1}),this._controllable.initial(e=>e&&this._selectable.setState(e)),this._controllable.getter(()=>this._selectable.getState()),this._detangled=D(),this._controllable.setter(this._detangled(e=>{this._selectable.setState(e)})),this._selectable.onChange(this._detangled(()=>{this._controllable.dispatch()})),this._selectable.onInitAndChange(()=>{this._submittable.update(this._selectable.getState())}),p(this,"keydown",e=>{["ArrowDown","ArrowRight"].includes(e.key)?(this._focusable.focusNext(),e.preventDefault(),e.stopPropagation()):["ArrowUp","ArrowLeft"].includes(e.key)&&(this._focusable.focusPrev(),e.preventDefault(),e.stopPropagation())}),u(this,"role","radiogroup"),queueMicrotask(()=>{this._submittable.update(this._selectable.getState())})}walker(){return I(this,(e,{skip:i,reject:s})=>{if(e instanceof t)return s();if(e.localName!=="ui-radio")return i()})}},yi=class extends F{boot(){let e=this;this._disableable=new P(this),this._selectable=new S(e,{value:this.hasAttribute("value")?this.getAttribute("value"):Math.random().toString(36).substring(2,10),label:this.hasAttribute("label")?this.getAttribute("label"):null,selectedInitially:this.hasAttribute("checked"),dataAttr:"data-checked",ariaAttr:"aria-checked"}),this.value=this._selectable.getValue(),this._selectable.onChange(()=>{this._selectable.isSelected()&&this._focusable.focus(!1)}),this._disableable.onChange(i=>{i?this._focusable.untabbable():this._selectable.isSelected()&&this._focusable.tabbable()}),u(e,"role","radio"),this._focusable=new H(e,{disableable:this._disableable,tabbableAttr:"data-active"}),p(e,"click",this._disableable.disabled(i=>{i.preventDefault(),i.stopPropagation()}),{capture:!0}),p(e,"click",this._disableable.enabled(i=>{this._selectable.press()})),p(e,"keydown",this._disableable.enabled(i=>{i.key==="Enter"&&this.closest("form")?.requestSubmit()})),p(e,"keydown",this._disableable.enabled(i=>{i.key===" "&&(i.preventDefault(),i.stopPropagation())})),p(e,"keyup",this._disableable.enabled(i=>{i.key===" "&&(this._selectable.press(),i.preventDefault(),i.stopPropagation())})),tn(e),p(e,"focus",i=>{we()&&this._selectable.select()})}get checked(){return this._selectable.isSelected()}set checked(e){(this.closest("ui-radio-group")?._detangled||(()=>{}))(()=>{e&&this._selectable.select()})()}};function tn(t){t.closest("label")?.addEventListener("click",e=>{t.contains(e.target)||t.click()})}T(({css:t})=>t`ui-radio-group { display: block; }`);T(({css:t})=>t`ui-radio { display: inline-block; user-select: none; }`);A("radio-group",wi);A("radio",yi);var Dt=class extends x{boot(){if(this.querySelectorAll("[data-appended]").forEach(e=>e.remove()),!this.querySelector("template")){let e=document.createElement("template");e.setAttribute("name","placeholder"),e.innerHTML=""+this.innerHTML+"",this.innerHTML="",this.appendChild(e)}if(!this.querySelector('template[name="options"]')){let e=document.createElement("template");e.setAttribute("name","options"),e.innerHTML="
",this.appendChild(e)}if(!this.querySelector('template[name="option"]')){let e=document.createElement("template");e.setAttribute("name","option"),e.innerHTML="
",this.appendChild(e)}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,ui-pillbox"),this.multiple=this.picker.hasAttribute("multiple")}mount(){queueMicrotask(()=>{this.picker._selectable.onInitAndChange(()=>{this.render(!0)});let e=this.picker.list();e&&new MutationObserver(i=>{queueMicrotask(()=>this.render())}).observe(e,{childList:!0})})}render(e){if(this.multiple){let i=this.picker.value,s=Array.from(this.selecteds.keys()).filter(r=>!i.includes(r)),o=i.filter(r=>!this.selecteds.has(r));s.forEach(r=>this.selecteds.delete(r));let n=new Map;for(let r of o){let c=this.picker._selectable.findByValue(r);if(!c){if(e)return setTimeout(()=>this.render());throw`Could not find option for value "${r}"`}n.set(r,c)}n.forEach((r,c)=>this.selecteds.set(c,r)),this.templates.placeholder?.clearPlaceholder?.(),this.templates.overflow?.clearOverflow?.(),this.templates.options?.clearOptions?.(),this.selecteds.size>0?this.renderOptions({hasOverflowed:r=>{if(this.max==="auto"){let c=!1;if(this.renderOverflow(this.selecteds.size,this.selecteds.size-r),this.clientWidthparseInt(this.max)},renderOverflow:r=>{this.templates?.overflow?.getAttribute("mode")!=="append"&&this.templates.options?.clearOptions?.(),this.renderOverflow(this.selecteds.size,r)}}):this.renderPlaceholder()}else{let i=this.picker.value;if(Array.from(this.selecteds.keys()).includes(i))return;this.selecteds.clear();let s=this.picker._selectable.findByValue(i);if(s)this.selecteds.set(i,s);else if(!["",null,void 0].includes(i)){if(e)return setTimeout(()=>{this.render()});throw`Could not find option for value "${i}"`}this.templates.placeholder?.clearPlaceholder?.(),this.templates.option?.clearOption?.(),this.selecteds.size>0?this.renderOption():this.renderPlaceholder()}}renderOptions({hasOverflowed:e,renderOverflow:i}){let s=document.createElement("div");s.style.display="contents";let o=et(this.templates.options,{default:s});this.templates.options.after(o),this.templates.options.clearOptions=()=>{o.remove(),this.templates.options.clearOptions=()=>{}};let n=0,r=!1;for(let[l,a]of this.selecteds){let f=new DocumentFragment;f.append(...a.el.cloneNode(!0).childNodes);let d=et(this.templates.option,{text:a.getSelectedLabel()??a.getLabel(),default:a.getSelectedLabel()??f,value:l});if(d.setAttribute("data-value",l),d.setAttribute("data-appended",""),d.deselect=()=>a.deselect(),s.appendChild(d),n++,e(n)){r=!0,s.removeChild(d),n--;break}}let c=new DocumentFragment;c.append(...s.childNodes),s.replaceWith(c),r&&i(this.selecteds.size-n)}renderOption(){for(let[e,i]of this.selecteds){let s=new DocumentFragment;s.append(...i.el.cloneNode(!0).childNodes);let o=et(this.templates.option,{text:i.getSelectedLabel()??i.getLabel(),default:i.getSelectedLabel()??s,value:e});o.setAttribute("data-value",e),o.setAttribute("data-appended",e),o.deselect=()=>i.deselect(),this.templates.option.after(o),this.templates.option.clearOption=()=>{o.remove(),this.templates.option.clearOption=()=>{}}}}renderPlaceholder(){if(!this.templates.placeholder)return;let e=et(this.templates.placeholder);e.setAttribute("data-appended",""),this.templates.placeholder.after(e),this.templates.placeholder.clearPlaceholder=()=>{e.remove(),this.templates.placeholder.clearPlaceholder=()=>{}}}renderOverflow(e,i){if(!this.templates.overflow)return;let s=et(this.templates.overflow,{remainder:i,count:this.selecteds.size});s.setAttribute("data-appended",""),this.templates.overflow.after(s),this.templates.overflow.clearOverflow=()=>{s.remove(),this.templates.placeholder.clearOverflow=()=>{}}}},Mt=class extends x{boot(){this.addEventListener("click",e=>{e.stopPropagation();let i=this.closest("[data-value]")?.getAttribute("data-value");if(i===void 0)return;let s=this.closest("ui-pillbox")._selectable,o=s.selectableByValue(i);o?o.deselect():s.deselectByValue(i)})}};function et(t,e={}){let i=t.content.cloneNode(!0);return Object.entries(e).forEach(([s,o])=>{(s==="default"?i.querySelectorAll("slot:not([name])"):i.querySelectorAll(`slot[name="${s}"]`)).forEach(r=>r.replaceWith(typeof o=="string"?document.createTextNode(o):o))}),i.firstElementChild}var tt=class extends Z{groupOfType=W;boot({options:e}){e({wrap:!1,filter:!1}),this.onChanges=[]}onChange(e){this.onChanges.push(e)}activated(e){this.onChanges.forEach(i=>i())}activateFirst(){this.filterAwareWalker().first()?.use(W).activate()}activateBySearch(e){this.filterAwareWalker().find(s=>s.textContent.toLowerCase().trim().startsWith(e.toLowerCase()))?.use(W).activate()}activateSelectedOrFirst(e){if(!e||(s=>s.matches("ui-option, ui-option-create")?getComputedStyle(s).display==="none":!1)(e)){this.filterAwareWalker().first()?.use(W).activate();return}e?.use(W).activate()}activateActiveOrFirst(){let e=this.getActive();if(!e){this.filterAwareWalker().first()?.use(W).activate();return}e?.use(W).activate()}activateActiveOrLast(){let e=this.getActive();if(!e){this.filterAwareWalker().last()?.use(W).activate();return}e?.use(W).activate()}activatePrev(){let e=this.getActive();if(!e){this.filterAwareWalker().last()?.use(W).activate();return}let i;this.options.wrap?i=this.filterAwareWalker().prevOrLast(e):i=this.filterAwareWalker().prev(e),i?.use(W).activate()}activateNext(){let e=this.getActive();if(!e){this.filterAwareWalker().first()?.use(W).activate();return}let i;this.options.wrap?i=this.filterAwareWalker().nextOrFirst(e):i=this.filterAwareWalker().next(e),i?.use(W).activate()}getActive(){return this.walker().find(e=>e.use(W).isActive())}clearActive(){this.getActive()?.use(W).deactivate()}filterAwareWalker(){let e=i=>i.matches("ui-option, ui-option-create")?getComputedStyle(i).display==="none":!1;return I(this.el,(i,{skip:s,reject:o})=>{if(i[this.constructor.name]&&i!==this.el)return o();if(!i[this.groupOfType.name])return s();if(i.hasAttribute("disabled")||e(i))return o()})}},W=class t extends k{groupedByType=tt;mount(){this.el.addEventListener("mouseenter",()=>{this.activate()}),this.el.addEventListener("mouseleave",()=>{this.deactivate()})}activate(e=!1){this.group()&&this.group().walker().each(i=>i.use(t).deactivate(!1)),!(this.el.hasAttribute("disabled")&&!e)&&(u(this.el,"data-active",""),we()&&this.el.scrollIntoView({block:"nearest"}),this.group()&&this.group().activated(this.el))}deactivate(e=!0){w(this.el,"data-active"),e&&this.group()&&this.group().activated(this.el)}isActive(){return this.el.hasAttribute("data-active")}};var it=class extends Z{groupOfType=Se;boot({options:e}){e({}),this.onChanges=[],this.lastSearch=""}onChange(e){this.onChanges.push(e)}filter(e){e===""?this.walker().each(i=>{i.use(Se).unfilter()}):this.walker().each(i=>{this.matches(i,e)?i.use(Se).unfilter():i.use(Se).filter()}),this.lastSearch!==e&&this.onChanges.forEach(i=>i()),this.lastSearch=e}matches(e,i){return this.normalize(e.textContent).includes(this.normalize(i))}normalize(e){return e.normalize("NFD").replace(/\p{Diacritic}/gu,"").toLowerCase().trim()}hasResults(){return this.walker().some(e=>!e.use(Se).isFiltered())}},Se=class extends k{groupedByType=it;boot({options:e}){e({mirror:null,keep:!1}),this.onChanges=[]}filter(){this.options().keep||(u(this.el,"data-hidden",""),this.options().mirror&&u(this.options().mirror,"data-hidden",""))}unfilter(){this.options().keep||(w(this.el,"data-hidden"),this.options().mirror&&w(this.options().mirror,"data-hidden",""))}isFiltered(){return this.el.hasAttribute("data-hidden")}};var nt=class extends F{boot(){let e=this.list();this._controllable=new M(this,{bubbles:!0}),this._selectable=new j(e,{multiple:this.hasAttribute("multiple")}),this._submittable=new $(this,{name:this.getAttribute("name"),value:this._selectable.getState()}),this._controllable.initial(s=>s&&this._selectable.setState(s)),this._controllable.getter(()=>this._selectable.getState());let i=D();this._controllable.setter(i(s=>{this._selectable.setState(s)})),this._selectable.onChange(i(()=>{this._controllable.dispatch(),this.dispatchEvent(new CustomEvent("select",{bubbles:!1}))})),this._selectable.onInitAndChange(()=>{this._submittable.update(this._selectable.getState())})}mount(){this._disableable=new P(this),queueMicrotask(()=>{this._submittable.update(this._selectable.getState())});let e=this.input(),i=this.button(),s=this.list(),o=this.hasAttribute("multiple"),n=this.hasAttribute("autocomplete"),r=this.hasAttribute("autocomplete")&&this.getAttribute("autocomplete").trim().split(" ").includes("strict"),c=this.querySelector("ui-options")||this,l=sn(c,"options",o);this._activatable=new tt(c,{filter:"data-hidden"}),!e&&!i&&this._disableable.onInitAndChange(h=>{h?this.removeAttribute("tabindex"):this.setAttribute("tabindex","0")}),this.hasAttribute("filter")&&this.getAttribute("filter")!=="manual"&&(this._filterable=new it(s),this._filterable.onChange(()=>{this._activatable.clearActive(),this._filterable.hasResults()&&this._activatable.activateFirst()}),this.addEventListener("close",()=>{this._filterable&&requestAnimationFrame(()=>{this._filterable.filter("")})}));let a=this.querySelector("[popover]:not(ui-tooltip > [popover])"),f=a?.querySelector('input:not([type="hidden"])'),d=this.querySelector('input:not([type="hidden"])');d=a?.contains(d)?null:d;let m=this.querySelector("button,ui-button");if(m=a?.contains(m)?null:m,!(a||d))st(this,this._activatable),ot(this,this,this._activatable),Vs(this,this._activatable,this._selectable);else if(!a&&d){let h=d;this._disableable.onInitAndChange(b=>{b?h&&u(h,"disabled",""):h&&w(h,"disabled")}),Ti(this,h,this._selectable,this._popoverable),Vs(h,this._activatable,this._selectable),qs(n,r,this,h,this._selectable,this._popoverable,this._filterable),Ci(h),ki(h),this._filterable&&Si(s,h,this._filterable),Nt(h,this._activatable,this._selectable),st(h,this._activatable),ot(this,h,this._activatable),It(this,this._activatable)}else if(a&&d){let h=d;u(h,"role","combobox"),u(h,"aria-controls",l);let b=a;this._popoverable=new K(b),this._anchorable=new Y(b,{reference:h,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}),qs(n,r,this,h,this._selectable,this._popoverable,this._filterable),this._disableable.onInitAndChange(v=>{v?h&&u(h,"disabled",""):h&&w(h,"disabled")}),this.querySelectorAll("button,ui-button").forEach(v=>{b.contains(v)||(u(v,"tabindex","-1"),u(v,"aria-controls",l),u(v,"aria-haspopup","listbox"),Rt(v,this._popoverable),p(v,"click",()=>{this._popoverable.toggle(),h.focus()}))}),Ti(this,h,this._selectable,this._popoverable),Ai(this,h,b,this._popoverable,this._anchorable),Pi(this,this._popoverable,[h]),Rt(h,this._popoverable),Ci(h),ki(h),this._filterable&&Si(s,h,this._filterable),Nt(h,this._activatable,this._selectable),rn(h,this._popoverable),_i(h,this._popoverable,this._activatable,this._selectable),on(h,this._popoverable),Ei(this,this._popoverable),st(h,this._activatable),ot(this,h,this._activatable),It(this,this._activatable),xi(this._popoverable,this._activatable,this._selectable),Oi(this,this._selectable,this._popoverable,o)}else if(a&&f){let h=m,b=f,v=a;u(h,"role","combobox"),u(b,"role","combobox"),u(h,"aria-controls",l),this._disableable.onInitAndChange(y=>{y?(h&&u(h,"disabled",""),b&&u(b,"disabled","")):(h&&w(h,"disabled"),b&&w(b,"disabled"))}),this._popoverable=new K(v),this._anchorable=new Y(v,{reference:h,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,scrollY:!1}),Ci(b),ki(b),this._filterable&&Si(s,b,this._filterable),Nt(b,this._activatable,this._selectable),nn(b,this._popoverable),Ai(this,h,v,this._popoverable,this._anchorable),Pi(this,this._popoverable,[b]),Rt(h,this._popoverable),Ti(this,b,this._selectable,this._popoverable),_i(h,this._popoverable,this._activatable,this._selectable),Bs(h,this._popoverable,b),Ei(this,this._popoverable),st(b,this._activatable),Ws(h,this._activatable,this._popoverable),ot(this,b,this._activatable),It(this,this._activatable),xi(this._popoverable,this._activatable,this._selectable),Oi(this,this._selectable,this._popoverable,o)}else if(a){let h=m,b=a;u(h,"role","combobox"),u(h,"aria-controls",l),this._disableable.onInitAndChange(v=>{v?(h&&u(h,"disabled",""),e&&u(e,"disabled","")):(h&&w(h,"disabled"),e&&w(e,"disabled"))}),this._popoverable=new K(b),this._anchorable=new Y(b,{reference:h,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}),Ai(this,h,b,this._popoverable,this._anchorable),Pi(this,this._popoverable),Rt(h,this._popoverable),_i(h,this._popoverable,this._activatable,this._selectable),Bs(h,this._popoverable),Nt(h,this._activatable,this._selectable),Ei(this,this._popoverable),st(h,this._activatable),Ws(h,this._activatable,this._popoverable),ot(this,h,this._activatable),It(this,this._activatable),xi(this._popoverable,this._activatable,this._selectable),Oi(this,this._selectable,this._popoverable,o)}new MutationObserver(()=>{requestAnimationFrame(()=>{if(!this._popoverable||this._popoverable.getState()){let h=this._selectable.selecteds().find(b=>!b.el._disableable.isDisabled())?.el;this._activatable.activateSelectedOrFirst(h)}else this._activatable.clearActive()})}).observe(s,{childList:!0})}unmount(){if(this._popoverable?.getState()){let{unlock:e}=oe();e()}}trigger(){return this.button()||this.input()}button(){return Array.from(this.querySelectorAll("button,ui-button")).find(e=>e.nextElementSibling?.matches("[popover]"))||null}input(){return this.querySelector('input:not([type="hidden"])')}list(){return this.querySelector("ui-options")||this}clear(){this._selectable.deselectAll(),this.dispatchEvent(new CustomEvent("clear",{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})))}};A("selected-remove",Mt);A("selected",Dt);A("select",nt);T(({css:t})=>t`ui-select { display: block; }`);T(({css:t})=>t`ui-selected-option { display: contents; }`);function st(t,e){p(t,"keydown",i=>{["ArrowDown","ArrowUp"].includes(i.key)&&(i.key==="ArrowDown"?(e.activateNext(),i.preventDefault(),i.stopPropagation()):i.key==="ArrowUp"&&(e.activatePrev(),i.preventDefault(),i.stopPropagation()))})}function Ws(t,e,i){xt(t,s=>{e.activateBySearch(s),i.getState()||e.getActive()?.click()})}function ot(t,e,i){p(e,"keydown",s=>{if(s.key==="Enter"){let o=i.getActive();if(s.preventDefault(),s.stopPropagation(),!o||o._disableable?.isDisabled())return;o.click(),t.dispatchEvent(new CustomEvent("interaction",{bubbles:!1,cancelable:!1,detail:{optionEl:o}})),o.hasAttribute("action")&&t.dispatchEvent(new CustomEvent("action",{bubbles:!1,cancelable:!1,detail:{optionEl:o}}))}})}function It(t,e,i=!1){p(t,i?"pointerdown":"click",s=>{if(s.target.closest("ui-option, ui-option-create")){let o=s.target.closest("ui-option, ui-option-create");if(o._disableable.isDisabled())return;o._selectable?.trigger(),t.dispatchEvent(new CustomEvent("interaction",{bubbles:!1,cancelable:!1,detail:{optionEl:o}})),o.hasAttribute("action")&&t.dispatchEvent(new CustomEvent("action",{bubbles:!1,cancelable:!1,detail:{optionEl:o}})),s.preventDefault(),s.stopPropagation()}})}function Vs(t,e,i){p(t,"focus",()=>{let s=i.selecteds().find(o=>!o.el._disableable.isDisabled())?.el;e.activateSelectedOrFirst(s)}),p(t,"blur",()=>{e.clearActive()})}function sn(t,e){let i=N(t,"options");return u(t,"role","listbox"),u(t,"aria-multiselectable",e?"true":"false"),i}function Rt(t,e){u(t,"aria-haspopup","listbox");let i=()=>{u(t,"aria-expanded",e.getState()?"true":"false"),e.getState()?u(t,"data-open",""):w(t,"data-open","")};e.onChange(()=>{i()}),i()}function Ai(t,e,i,s,o){let n=()=>{Array.from([t,i]).forEach(r=>{s.getState()?u(r,"data-open",""):w(r,"data-open","")}),s.getState()?o.reposition():o.cleanup()};s.onChange(()=>n()),n(),s.onChange(()=>{s.getState()?t.dispatchEvent(new Event("open",{bubbles:!1,cancelable:!1})):t.dispatchEvent(new Event("close",{bubbles:!1,cancelable:!1}))})}function xi(t,e,i){t.onChange(()=>{if(t.getState()){let s=i.selecteds().find(o=>!o.el._disableable.isDisabled())?.el;setTimeout(()=>{e.activateSelectedOrFirst(s)})}else e.clearActive()})}function Ei(t,e){p(t,"keydown",i=>{i.key==="Escape"&&e.getState()&&(e.setState(!1),i.preventDefault(),i.stopImmediatePropagation())})}function _i(t,e){p(t,"keydown",i=>{["ArrowDown","ArrowUp"].includes(i.key)&&(i.key==="ArrowDown"||i.key==="ArrowUp")&&(e.getState()||(e.setState(!0),i.preventDefault(),i.stopImmediatePropagation()))})}function on(t,e){p(t,"click",()=>{e.getState()||(e.setState(!0),t.focus())})}function Bs(t,e,i=null){p(t,"click",()=>{e.setState(!e.getState()),t.focus(),e.getState()&&i&&i.focus()})}function nn(t,e){e.onChange(()=>{e.getState()&&setTimeout(()=>t.focus())})}function Si(t,e,i){p(e,"input",o=>{i.filter(o.target.value)}),new MutationObserver(()=>{i.filter(e.value)}).observe(t,{childList:!0})}function ki(t){p(t,"focus",()=>t.select())}function Ci(t){p(t,"change",e=>e.stopPropagation()),p(t,"input",e=>e.stopPropagation())}function rn(t,e){p(t,"keydown",i=>{(/^[a-zA-Z0-9]$/.test(i.key)||i.key==="Backspace")&&(e.getState()||e.setState(!0))})}function Ti(t,e,i,s){if(!t.hasAttribute("clear"))return;let n=d=>{e.value!==d&&(e.value=d,e.dispatchEvent(new Event("input",{bubbles:!1})))},r=t.getAttribute("clear"),c=r===""||r.split(" ").includes("action"),l=r===""||r.split(" ").includes("select"),a=r===""||r.split(" ").includes("close"),f=r===""||r.split(" ").includes("esc");r==="none"&&(c=l=a=f=!1),c?t.addEventListener("action",d=>{n("")}):l&&i.onChange(()=>{queueMicrotask(()=>n(""))}),a&&s.onChange(()=>{s.getState()||n("")}),f&&p(e,"keydown",d=>{d.key==="Escape"&&n("")})}function Oi(t,e,i,s){let o=!s,n=!s,r=!s;if(t.hasAttribute("close")){let c=t.getAttribute("close");if(o=c==="",n=c.split(" ").includes("action"),r=c.split(" ").includes("select"),c==="none")return}o||n?t.addEventListener("interaction",c=>{let l=c.detail.optionEl;if(!l.hasAttribute("action")){i.setState(!1);return}setTimeout(()=>{if(!l.hasAttribute("data-flux-loading")&&!l.hasAttribute("data-loading")){i.setState(!1);return}let a=new MutationObserver(()=>{requestAnimationFrame(()=>{t.querySelector("input[data-invalid]")||i.setState(!1)}),a.disconnect()});a.observe(l,{attributes:!0,attributeFilter:["data-loading","data-flux-loading"]})},10)}):r&&e.onChange(()=>{i.setState(!1)})}function Nt(t,e,i){e.onChange(()=>{let s=e.getActive();s?u(t,"aria-activedescendant",s.id):w(t,"aria-activedescendant")}),i.onChange(s=>{if(!s)return;let o=s.el;o&&u(t,"aria-activedescendant",o.id)})}function qs(t,e,i,s,o,n,r){if(!t){u(s,"autocomplete","off"),u(s,"aria-autocomplete","none");return}let c=a=>{s.value!==a&&(s.value=a,s.dispatchEvent(new Event("input",{bubbles:!1})))};u(s,"autocomplete","off"),u(s,"aria-autocomplete","list"),s.value!==""&&o.setState(s.value);let l=()=>{o.isNotEmpty()?requestAnimationFrame(()=>{c(o.selectedTextValue()),e&&u(s,"data-selected",o.selectedTextValue())}):(c(""),w(s,"data-selected"))};queueMicrotask(()=>{o.onInitAndChange(()=>l())}),i.addEventListener("interaction",a=>{a.detail.optionEl._selectable?.isSelected()&&l()}),e&&n.onChange(()=>{n.getState()||requestAnimationFrame(()=>{c(s.getAttribute("data-selected"))})})}function Pi(t,e,i=[]){let{lock:s,unlock:o}=oe(e.el,!1,i);e.onChange(()=>{e.getState()?s():o()})}var Li=class t extends x{boot(){if(this._focusable=new _e(this,{wrap:!1,ensureTabbable:!1}),p(this,"keydown",e=>{["ArrowDown"].includes(e.key)?(e.target===this?this._focusable.focusFirst():this._focusable.focusNext(),e.preventDefault(),e.stopPropagation()):["ArrowUp"].includes(e.key)&&(e.target===this?this._focusable.focusFirst():this._focusable.focusPrev(),e.preventDefault(),e.stopPropagation())}),xt(this,e=>this._focusable.focusBySearch(e)),this.hasAttribute("popover")&&this.addEventListener("lofi-close-popovers",()=>{this.hasAttribute("keep-open")||setTimeout(()=>this.hidePopover(),50)}),this.parentElement.localName==="ui-dropdown"){let e=this.parentElement;p(e.trigger(),"keydown",i=>{i.key==="ArrowDown"&&(this.fromArrowDown=!0,this.showPopover(),i.preventDefault(),i.stopPropagation())})}u(this,"role","menu"),u(this,"tabindex","-1")}mount(){this.initializeMenuItems(),new MutationObserver(i=>{this.initializeMenuItems()}).observe(this,{childList:!0,subtree:!0})}onPopoverShow(){requestAnimationFrame(()=>{this.fromArrowDown?(this._focusable.focusFirst(),this.fromArrowDown=!1):this.focus()})}onPopoverHide(){this._focusable.wipeTabbables()}initializeMenuItems(){this.walker().each(e=>{e._disableable||ln(e)})}walker(){return I(this,(e,{skip:i,reject:s})=>{if(e instanceof t||e instanceof nt)return s();if(!["a","button"].includes(e.localName))return i()})}},Di=class extends x{boot(){}},Mi=class extends x{boot(){this._disabled=this.hasAttribute("disabled"),this._disableable=new P(this);let e=this;if(this._disabled&&(u(e,"disabled",""),u(e,"aria-disabled","true")),N(e,"menu-checkbox"),u(e,"role","menuitemcheckbox"),this._disabled)return;e._focusable=new H(e,{disableable:this._disableable,hover:!0,tabbableAttr:"data-active"}),e._selectable=new S(e,{toggleable:!0,value:this.hasAttribute("value")?this.getAttribute("value"):e.textContent.trim(),label:this.hasAttribute("label")?this.getAttribute("label"):e.textContent.trim(),dataAttr:"data-checked",ariaAttr:"aria-checked",selectedInitially:this.hasAttribute("checked")}),this._controllable=new M(this),this._controllable.initial(s=>s&&e._selectable.setState(s)),this._controllable.getter(()=>e._selectable.getState());let i=D();this._controllable.setter(i(s=>{this._selectable.setState(s)})),this._selectable.onChange(i(()=>{this._controllable.dispatch()})),p(e,"click",()=>{this.hasAttribute("keep-open")||this.dispatchEvent(new CustomEvent("lofi-close-popovers",{bubbles:!0})),e._selectable.press()}),Fi(e)}},Ii=class extends x{boot(){this._disabled=this.hasAttribute("disabled"),this._disableable=new P(this);let e=this;this._disabled&&(u(e,"disabled",""),u(e,"aria-disabled","true")),N(e,"menu-radio"),u(e,"role","menuitemradio"),!this._disabled&&(e._focusable=new H(e,{disableable:this._disableable,hover:!0,tabbableAttr:"data-active"}),e._selectable=new S(e,{toggleable:!1,value:this.hasAttribute("value")?this.getAttribute("value"):e.textContent.trim(),label:this.hasAttribute("label")?this.getAttribute("label"):e.textContent.trim(),dataAttr:"data-checked",ariaAttr:"aria-checked",selectedInitially:this.hasAttribute("checked")}),p(e,"click",()=>{this.hasAttribute("keep-open")||this.dispatchEvent(new CustomEvent("lofi-close-popovers",{bubbles:!0})),e._selectable.press()}),Fi(e))}},Ri=class extends x{boot(){this._selectable=new j(this),this._controllable=new M(this),u(this,"role","group"),this._controllable.initial(i=>i&&this._selectable.setState(i)),this._controllable.getter(()=>this._selectable.getState());let e=D();this._controllable.setter(e(i=>{this._selectable.setState(i)})),this._selectable.onChange(e(()=>{this._controllable.dispatch()})),p(this,"lofi-close-popovers",i=>{this.hasAttribute("keep-open")&&(i.preventDefault(),i.stopPropagation())})}},Ni=class extends x{boot(){this._selectable=new j(this,{multiple:!0}),this._controllable=new M(this),u(this,"role","group"),this._controllable.initial(i=>i&&this._selectable.setState(i)),this._controllable.getter(()=>this._selectable.getState());let e=D();this._controllable.setter(e(i=>{this._selectable.setState(i)})),this._selectable.onChange(e(()=>{this._controllable.dispatch()}))}};T(({css:t})=>t`ui-menu[popover]:popover-open { display: block; }`);T(({css:t})=>t`ui-menu[popover].\:popover-open { display: block; }`);T(({css:t})=>t`ui-menu-checkbox, ui-menu-radio { cursor: default; display: contents; }`);A("menu",Li);A("submenu",Di);A("menu-checkbox",Mi);A("menu-radio",Ii);A("menu-radio-group",Ri);A("menu-checkbox-group",Ni);function Fi(t){p(t,"keydown",e=>{e.key==="Enter"&&(t.click(),e.preventDefault(),e.stopPropagation())}),p(t,"keydown",e=>{e.key===" "&&(e.preventDefault(),e.stopPropagation())}),p(t,"keyup",e=>{e.key===" "&&(t.click(),e.preventDefault(),e.stopPropagation())})}function ln(t){t._disableable=new P(t),t._disabled=t.hasAttribute("disabled");let e=t.querySelector("a"),i=t,s=t.parentElement.matches("ui-submenu")&&t.parentElement.querySelector("ui-menu[popover]"),o=e||i;if(t._disabled&&(u(o,"disabled",""),u(o,"aria-disabled","true")),N(o,"menu-item"),u(o,"role","menuitem"),!t._disabled)if(o._focusable=new H(o,{disableable:t._disableable,hover:!0,tabbableAttr:"data-active"}),!s)t.hasAttribute("disabled")||p(t,"click",()=>{t.hasAttribute("keep-open")||t.dispatchEvent(new CustomEvent("lofi-close-popovers",{bubbles:!0}))}),Fi(i);else{s._popoverable=new K(s,{triggers:[i]}),s._anchorable=new Y(s,{reference:i,position:s.hasAttribute("position")?s.getAttribute("position"):he()?"left start":"right start",gap:s.hasAttribute("gap")?s.getAttribute("gap"):"-5",crossAxis:!0}),i.addEventListener("click",r=>{s._popoverable.setState(!0)});let{clear:n}=Me(i,s,{gain(){s._popoverable.setState(!0)},lose(){s._popoverable.setState(!1)},focusable:!1,useSafeArea:!0});s._popoverable.onChange(()=>{s._popoverable.getState()||(n(),s._focusable.wipeTabbables()),s._popoverable.getState()?s._anchorable.reposition():s._anchorable.cleanup()}),p(i,"keydown",r=>{r.key==="Enter"&&(s._popoverable.setState(!0),setTimeout(()=>s._focusable.focusFirst()))}),p(i,"keydown",r=>{r.key==="ArrowRight"&&(s._popoverable.setState(!0),setTimeout(()=>s._focusable.focusFirst()))}),p(s,"keydown",r=>{r.key==="ArrowLeft"&&(s._popoverable.setState(!1),i.focus(),r.stopPropagation())})}}var Hi=class extends F{mount(){this.inputEls=this.querySelectorAll("[data-flux-otp-input]"),this.length=this.inputEls.length,this.config={mode:this.getAttribute("mode")||"numeric",autocomplete:this.getAttribute("autocomplete")||"one-time-code",autoSubmit:this.getAttribute("submit")==="auto",inputAriaLabelTemplate:this.getAttribute("data-flux-input-aria-label")||"Character {current} of {total}"},this.state={length:0,onChanges:[],getValue:()=>Array.from(this.inputEls).map(i=>i.value).join(""),setValue:i=>{let s=(i??"").replace(/\s/g,"").replace(this.invalidCharacters(),"").toUpperCase();for(let o=0;oo(s))},notify:()=>{let i=this.state.getValue();this.state.length=i.length,this.state.onChanges.forEach(s=>s(i))},reapply:()=>{let i=this.state.getValue();this.state.setValue(i)},onChange:i=>{this.state.onChanges.push(i)}},this.hasAttribute("value")&&this.state.setValue(this.getAttribute("value")),this._controllable=new M(this),this._controllable.initial(i=>i&&this.state.setValue(i)),this._controllable.getter(()=>this.state.getValue());let e=D();this._controllable.setter(e(i=>this.state.setValue(i))),this.state.onChange(e(()=>this._controllable.dispatch())),this._submittable=new $(this,{name:this.getAttribute("name"),value:this.state.getValue()}),this.state.onChange(i=>{this._submittable.update(i),i.length===this.length&&this.config.autoSubmit&&this.closest("form")?.requestSubmit(),Array.from(this.inputEls).findIndex(o=>o===document.activeElement)>this.nextIndex()&&this.focusIndex(this.nextIndex())}),this._disableable=new P(this),this._disableable.onInitAndChange(i=>{for(let s of this.inputEls)i?u(s,"disabled",i):w(s,"disabled")}),this.updateTabIndexes(this.nextIndex());for(let i=0;i{s=o.target.value}),p(this.inputEls[i],"input",o=>{o.stopPropagation();let n=o.target.value;if(n.length>1){this.state.setValue(n),this.focusIndex(this.nextIndex()),o.preventDefault();return}if(n==""){this.state.reapply(),i{["Backspace","Delete","Clear"].includes(o.key)?o.target.value===""&&requestAnimationFrame(()=>this.focusPrev(i)):o.key==="ArrowRight"?(he()?this.focusPrev(i):this.focusNext(i),o.preventDefault()):o.key==="ArrowLeft"&&(he()?this.focusNext(i):this.focusPrev(i),o.preventDefault())}),p(this.inputEls[i],"pointerdown",o=>{this.focusIndex(Math.min(i,this.nextIndex())),o.preventDefault()}),p(this.inputEls[i],"focus",o=>{o.target.setSelectionRange(0,1),this.updateTabIndexes(i)})}}trigger(){return this.inputEls[this.nextIndex()]}focusIndex(e){let i=this.inputEls[e];document.activeElement===i&&i.blur(),i.focus()}focusPrev(e){this.focusIndex(Math.max(0,e-1))}focusNext(e){this.focusIndex(Math.min(e+1,this.nextIndex()))}nextIndex(){return Math.min(this.state.length,this.length-1)}updateTabIndexes(e){for(let i=0;i{let t=window.Alpine,e=window.Flux?.applyAppearance;e||(e=()=>{window.Flux.appearance=null,window.localStorage.removeItem("flux.appearance")});let i=t.reactive({toast(...o){let n={slots:{},dataset:{}};typeof o[0]=="string"&&(n.slots.text=o.shift()),typeof o[0]=="string"&&(n.slots.heading=n.slots.text,n.slots.text=o.shift());let r=o.shift()||{};r.text&&(n.slots.text=r.text),r.heading&&(n.slots.heading=r.heading),r.variant&&(n.dataset.variant=r.variant),r.position&&(n.dataset.position=r.position),r.duration!==void 0&&(n.duration=r.duration),document.dispatchEvent(new CustomEvent("toast-show",{detail:n}))},modal(o){return{show(){document.dispatchEvent(new CustomEvent("modal-show",{detail:{name:o}}))},close(){document.dispatchEvent(new CustomEvent("modal-close",{detail:{name:o}}))}}},modals(){return{close(){document.dispatchEvent(new CustomEvent("modal-close",{detail:{}}))}}},appearance:window.localStorage.getItem("flux.appearance")||"system",systemAppearanceChanged:1,get dark(){return JSON.stringify(i.systemAppearanceChanged),i.appearance==="system"?window.matchMedia("(prefers-color-scheme: dark)").matches:i.appearance==="dark"},set dark(o){let n=this.dark;o!==n&&(o?i.appearance="dark":i.appearance="light")}});window.Flux=i,t.magic("flux",()=>i),t.effect(()=>{e(i.appearance)}),document.addEventListener("livewire:navigating",o=>{o.detail.onSwap(()=>{e(i.appearance)})}),window.matchMedia("(prefers-color-scheme: dark)").addEventListener("change",()=>{i.systemAppearanceChanged++,e(i.appearance)}),t.data("fluxInputClearable",()=>({clear(){let o=this.$el.closest("[data-flux-input]").querySelector("input");o.value="",o.dispatchEvent(new Event("input",{bubbles:!1})),o.dispatchEvent(new Event("change",{bubbles:!1})),o.dispatchEvent(new CustomEvent("clear",{bubbles:!1})),o.focus()}})),t.data("fluxInputViewable",()=>({open:!1,toggle(){this.open=!this.open,this.$el.closest("[data-flux-input]").querySelector("input").setAttribute("type",this.open?"text":"password")},init(){let o=this.$el.closest("[data-flux-input]")?.querySelector("input");if(!o)return;new MutationObserver(()=>{let r=this.open?"text":"password";o.getAttribute("type")!==r&&o.setAttribute("type",r)}).observe(o,{attributes:!0,attributeFilter:["type"]})}})),t.data("fluxInputCopyable",()=>({copied:!1,copy(){this.copied=!this.copied;let o=this.$el.closest("[data-flux-input]").querySelector("input");navigator.clipboard&&navigator.clipboard.writeText(o.value),o.dispatchEvent(new CustomEvent("copy",{bubbles:!1})),setTimeout(()=>this.copied=!1,2e3)}})),t.data("fluxInputFile",o=>({updateLabel(n){this.$refs.name.textContent=n.target.files[1]?n.target.files.length+" "+o.files:n.target.files[0]?.name||o.noFile},init(){Object.defineProperty(this.$refs.input,"value",{...Object.getOwnPropertyDescriptor(HTMLInputElement.prototype,"value"),set(n){Object.getOwnPropertyDescriptor(HTMLInputElement.prototype,"value").set.call(this,n),n||this.dispatchEvent(new Event("change",{bubbles:!0}))}})}})),t.data("fluxModal",(o,n)=>({handleShow(r){r.detail.name===o&&(n&&r.detail.scope===n?this.$el.showModal():r.detail.scope||this.$el.showModal())},handleClose(r){r.detail.name?r.detail.name===o&&(n&&r.detail.scope===n?this.$el.close():r.detail.scope||this.$el.close()):this.$el.close()}})),t.data("fluxCommandInputClearable",()=>({clear(){let o=this.$el.closest("[data-flux-command-input]").querySelector("input");o.value="",o.dispatchEvent(new Event("input",{bubbles:!1})),o.dispatchEvent(new CustomEvent("clear",{bubbles:!1})),o.focus()}})),t.data("fluxSelectSearchClearable",()=>({clear(){let o=this.$el.closest("[data-flux-select-search]").querySelector("input");o.value="",o.dispatchEvent(new Event("input",{bubbles:!1})),o.dispatchEvent(new CustomEvent("clear",{bubbles:!1})),o.focus()}})),t.data("fluxPillboxSearchClearable",()=>({clear(){let o=this.$el.closest("[data-flux-pillbox-search]").querySelector("input");o.value="",o.dispatchEvent(new Event("input",{bubbles:!1})),o.dispatchEvent(new CustomEvent("clear",{bubbles:!1})),o.focus()}}))});!is()&&!ss()&&os();})();