(()=>{var ct=class extends Event{oldState;newState;constructor(t,{oldState:e="",newState:i="",...s}={}){super(t,s),this.oldState=String(e||""),this.newState=String(i||"")}},$i=new WeakMap;function Gi(t,e,i){$i.set(t,setTimeout(()=>{$i.has(t)&&t.dispatchEvent(new ct("toggle",{cancelable:!1,oldState:e,newState:i}))},0))}var qt=globalThis.ShadowRoot||function(){},Gs=globalThis.HTMLDialogElement||function(){},nt=new WeakMap,ee=new WeakMap,$e=new WeakMap;function rt(t){return $e.get(t)||"hidden"}var lt=new WeakMap;function Ys(t){let e=t.popoverTargetElement;if(!(e instanceof HTMLElement))return;let i=rt(e);t.popoverTargetAction==="show"&&i==="showing"||t.popoverTargetAction==="hide"&&i==="hidden"||(i==="showing"?qe(e,!0,!0):be(e,!1)&&(lt.set(e,t),Bt(e)))}function be(t,e){return!(t.popover!=="auto"&&t.popover!=="manual"||!t.isConnected||e&&rt(t)!=="showing"||!e&&rt(t)!=="hidden"||t instanceof Gs&&t.hasAttribute("open")||document.fullscreenElement===t)}function zi(t){return t?Array.from(ee.get(t.ownerDocument)||[]).indexOf(t)+1:0}function Xs(t){let e=Yi(t),i=Js(t);return zi(e)>zi(i)?e:i}function at(t){let e=ee.get(t);for(let i of e||[])if(!i.isConnected)e.delete(i);else return i;return null}function Ce(t){return typeof t.getRootNode=="function"?t.getRootNode():t.parentNode?Ce(t.parentNode):t}function Yi(t){for(;t;){if(t instanceof HTMLElement&&t.popover==="auto"&&$e.get(t)==="showing")return t;if(t=t instanceof Element&&t.assignedSlot||t.parentElement||Ce(t),t instanceof qt&&(t=t.host),t instanceof Document)return}}function Js(t){for(;t;){let e=t.popoverTargetElement;if(e instanceof HTMLElement)return e;if(t=t.parentElement||Ce(t),t instanceof qt&&(t=t.host),t instanceof Document)return}}function Qs(t){let e=new Map,i=0;for(let n of ee.get(t.ownerDocument)||[])e.set(n,i),i+=1;e.set(t,i),i+=1;let s=null;function o(n){let r=Yi(n);if(r===null)return null;let u=e.get(r);(s===null||e.get(s)"u")return;window.ToggleEvent=window.ToggleEvent||ct;function t(l){return l?.includes(":popover-open")&&(l=l.replace(so,"$1.\\:popover-open")),l}pe(Document.prototype,"querySelector",t),pe(Document.prototype,"querySelectorAll",t),pe(Element.prototype,"querySelector",t),pe(Element.prototype,"querySelectorAll",t),pe(Element.prototype,"matches",t),pe(Element.prototype,"closest",t),pe(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(){Bt(this)}},hidePopover:{enumerable:!0,configurable:!0,value(){qe(this,!0,!0)}},togglePopover:{enumerable:!0,configurable:!0,value(l){$e.get(this)==="showing"&&l===void 0||l===!1?qe(this,!0,!0):(l===void 0||l===!0)&&Bt(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 Vt(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&&Vt(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=Ce(this),d=this.getAttribute("popovertarget");return(f instanceof Document||f instanceof Ui)&&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=Ce(f);if(!(d instanceof Ui||d instanceof Document))return;let m=a.find(g=>g.matches?.("[popovertargetaction],[popovertarget]"));if(m){Ys(m),l.preventDefault();return}},r=l=>{let a=l.key,f=l.target;!l.defaultPrevented&&f&&(a==="Escape"||a==="Esc")&&ht(f.ownerDocument,!0,!0)};(l=>{l.addEventListener("click",n),l.addEventListener("keydown",r),l.addEventListener("pointerdown",Ki),l.addEventListener("pointerup",Ki)})(document),Vt(document)}io()||ro();var gt=class extends Event{oldState;newState;constructor(t,{oldState:e="",newState:i="",...s}={}){super(t,s),this.oldState=String(e||""),this.newState=String(i||"")}},Ji=new WeakMap;function is(t,e,i){Ji.set(t,setTimeout(()=>{Ji.has(t)&&t.dispatchEvent(new gt("toggle",{cancelable:!1,oldState:e,newState:i}))},0))}var Ut=globalThis.ShadowRoot||function(){},lo=globalThis.HTMLDialogElement||function(){},dt=new WeakMap,te=new WeakMap,je=new WeakMap;function ft(t){return je.get(t)||"hidden"}var pt=new WeakMap;function ao(t){let e=t.popoverTargetElement;if(!(e instanceof HTMLElement))return;let i=ft(e);t.popoverTargetAction==="show"&&i==="showing"||t.popoverTargetAction==="hide"&&i==="hidden"||(i==="showing"?ze(e,!0,!0):ge(e,!1)&&(pt.set(e,t),Kt(e)))}function ge(t,e){return!(t.popover!=="auto"&&t.popover!=="manual"||!t.isConnected||e&&ft(t)!=="showing"||!e&&ft(t)!=="hidden"||t instanceof lo&&t.hasAttribute("open")||document.fullscreenElement===t)}function Qi(t){return t?Array.from(te.get(t.ownerDocument)||[]).indexOf(t)+1:0}function uo(t){let e=ss(t),i=co(t);return Qi(e)>Qi(i)?e:i}function bt(t){let e=te.get(t);for(let i of e||[])if(!i.isConnected)e.delete(i);else return i;return null}function Oe(t){return typeof t.getRootNode=="function"?t.getRootNode():t.parentNode?Oe(t.parentNode):t}function ss(t){for(;t;){if(t instanceof HTMLElement&&t.popover==="auto"&&je.get(t)==="showing")return t;if(t=t instanceof Element&&t.assignedSlot||t.parentElement||Oe(t),t instanceof Ut&&(t=t.host),t instanceof Document)return}}function co(t){for(;t;){let e=t.popoverTargetElement;if(e instanceof HTMLElement)return e;if(t=t.parentElement||Oe(t),t instanceof Ut&&(t=t.host),t instanceof Document)return}}function ho(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=ss(n);if(r===null)return null;let u=e.get(r);(s===null||e.get(s)"u")return;window.ToggleEvent=window.ToggleEvent||gt;function t(l){return l?.includes(":popover-open")&&(l=l.replace(mo,"$1.\\:popover-open")),l}me(Document.prototype,"querySelector",t),me(Document.prototype,"querySelectorAll",t),me(Element.prototype,"querySelector",t),me(Element.prototype,"querySelectorAll",t),me(Element.prototype,"matches",t),me(Element.prototype,"closest",t),me(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(){Kt(this)}},hidePopover:{enumerable:!0,configurable:!0,value(){ze(this,!0,!0)}},togglePopover:{enumerable:!0,configurable:!0,value(l){je.get(this)==="showing"&&l===void 0||l===!1?ze(this,!0,!0):(l===void 0||l===!0)&&Kt(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 jt(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&&jt(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=Oe(this),d=this.getAttribute("popovertarget");return(f instanceof Document||f instanceof ts)&&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=Oe(f);if(!(d instanceof ts||d instanceof Document))return;let m=a.find(g=>g.matches?.("[popovertargetaction],[popovertarget]"));if(m){ao(m),l.preventDefault();return}},r=l=>{let a=l.key,f=l.target;!l.defaultPrevented&&f&&(a==="Escape"||a==="Esc")&&vt(f.ownerDocument,!0,!0)};(l=>{l.addEventListener("click",n),l.addEventListener("keydown",r),l.addEventListener("pointerdown",es),l.addEventListener("pointerup",es)})(document),jt(document)}var wt;function Yt(t){let e=t({css:(i,...s)=>`@layer base { ${i.raw[0]+s.join("")} }`});if(document.adoptedStyleSheets===void 0){let i=document.createElement("style");i.textContent=e,document.head.appendChild(i);return}wt===void 0&&(wt=new CSSStyleSheet,document.adoptedStyleSheets=[...document.adoptedStyleSheets,wt]),wt.insertRule(e)}function yt(t,e){let i=t;for(;i;){if(e(i))return i;i=i.parentElement}}function M(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 Gt(i)}var Gt=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 y(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 us(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 wo(t,e){let i;return function(){let s=this,o=arguments;i||(t.apply(s,o),i=!0,setTimeout(()=>i=!1,e))}}var Ke="pointer";document.addEventListener("keydown",()=>Ke="keyboard",{capture:!0});document.addEventListener("pointerdown",t=>{Ke=t.pointerType==="mouse"?"mouse":"touch"},{capture:!0});document.addEventListener("pointermove",t=>{Ke=t.pointerType==="mouse"?"mouse":"touch"},{capture:!0});function ve(){return Ke==="keyboard"}function xt(){return Ke==="touch"}function Et(t,e){let i="",s=Co(()=>{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 Ao(t,e){return"lofi-"+(e?e+"-":"")+Math.random().toString(16).slice(2)}function R(t,e){let i=t.hasAttribute("id")?t.getAttribute("id"):Ao(t,e);return c(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)=>{if(!t){t=!0;try{e(...i)}finally{t=!1}}}}function De(t,e,{gain:i,lose:s,focusable:o,useSafeArea:n}){let r=!1,u=v=>{ve()&&(t.contains(v.target)||e.contains(v.target)?(r=!0,i()):(r=!1,s()))};o&&document.addEventListener("focusin",u);let l=()=>{document.removeEventListener("focusin",u)},a=()=>{},f=()=>{},d=()=>{r=!1,s(),a(),f()},m=()=>{r=!1,a(),f()},g=v=>{xt()||r||(r=!0,i(),setTimeout(()=>{let{safeArea:A,redraw:E,remove:_}=n?yo(t,e,v.clientX,v.clientY):ko();a=_;let L,O=wo(I=>{let $=e.getBoundingClientRect(),Z=t.getBoundingClientRect(),B;switch(A.contains(I.target)&&xo(Z,$,I.clientX,I.clientY)?B="safeArea":e.contains(I.target)?B="panel":t.contains(I.target)?B="trigger":B="outside",L&&clearTimeout(L),B){case"outside":d();break;case"trigger":E(I.clientX,I.clientY);break;case"panel":a();break;case"safeArea":E(I.clientX,I.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 yo(t,e,i,s){let o=document.createElement("div"),n=e.getBoundingClientRect(),r=t.getBoundingClientRect();o.style.position="fixed",c(o,"data-safe-area","");let u=(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,A,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,A=a-h,E=`polygon(0% 0%, 100% ${A}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,A=a-h,E=`polygon(0% ${A}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,A=l-d,E=`polygon(0% 0%, 100% 0%, ${A}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,A=l-d,E=`polygon(${A}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),u(l,a)},remove:()=>{o.remove()}}}function xo(t,e,i,s){return!Eo(t,i,s)&&!_o(e,i,s)}function Eo(t,e,i){return t.left<=e&&e<=t.right&&t.top<=i&&i<=t.bottom}function _o(t,e,i){return t.left<=e&&e<=t.right&&t.top<=i&&i<=t.bottom}function c(t,e,i){t._durableAttributeObserver===void 0&&(t._durableAttributeObserver=cs(t,[e])),t._durableAttributeObserver.hasAttribute(e)||t._durableAttributeObserver.addAttribute(e),t._durableAttributeObserver.pause(()=>{t.setAttribute(e,i)})}function ie(t,e){w(t,e),So(t,e)}function w(t,e){t._durableAttributeObserver===void 0&&(t._durableAttributeObserver=cs(t,[e])),t._durableAttributeObserver.hasAttribute(e)||t._durableAttributeObserver.addAttribute(e),t._durableAttributeObserver.pause(()=>{t.removeAttribute(e)})}function So(t,e){t?._durableAttributeObserver?.hasAttribute(e)&&t._durableAttributeObserver.releaseAttribute(e)}function cs(t,e){let i=o=>{o.forEach(n=>{n.oldValue===null?t._durableAttributeObserver.pause(()=>w(t,n.attributeName)):t._durableAttributeObserver.pause(()=>c(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 ko(){return{safeArea:{contains:()=>!1},redraw:()=>{},remove:()=>{}}}function Co(t,e){let i;return(...s)=>{clearTimeout(i),i=setTimeout(()=>{t(...s)},e)}}var Pe=0,Le=!1;Yt(({css:t})=>t`[data-flux-allow-scroll] { pointer-events: auto; }`);function se(t=null,e=!1,i=[]){if(e)return{lock:()=>{},unlock:()=>{}};let s=(n=!1)=>{as(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})`,To(document.documentElement,r),n&&(c(t,"data-flux-allow-scroll",""),i.forEach(u=>{c(u,"data-flux-allow-scroll","")}),Le=!0)},o=(n=!1)=>{as(document.documentElement),n&&(ie(t,"data-flux-allow-scroll"),i.forEach(r=>{w(r,"data-flux-allow-scroll")}),Le=!1)};return{lock(){Pe++,!(Pe>1&&t!==null&&Le)&&s(t!==null&&!Le)},unlock(){Pe=Math.max(0,Pe-1),!(Pe>0&&t!==null&&!Le)&&(o(t!==null&&Le),Pe>0&&s(!1))}}}function To(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 as(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 Xt(t,e,i){let s=t.style[e];return t.style[e]=i,()=>{t.style[e]=s}}function ce(t){return getComputedStyle(t).direction==="rtl"}function hs(){return/^((?!chrome|android).)*safari/i.test(navigator.userAgent)&&!navigator.userAgent.includes("CriOS")&&!navigator.userAgent.includes("FxiOS")}var At=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}},N=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 yt(this.el,e=>e[this.groupedByType.name])?.use(this.groupedByType)}on(e,i){return p(this.el,e,i)}},Q=class extends k{constructor(e,i={}){super(e,i)}walker(){return M(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 P=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 Ue=null;document.addEventListener("mousedown",t=>Ue=t);var _t=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){Ue=null;return}Ue&&ds(this.el,Ue)&&ds(this.el,o)&&(this.cancel(),o.preventDefault(),o.stopPropagation()),Ue=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(()=>{c(e,"style",this.state?"display: none":"display: block"),this.state&&hs()&&!this.el.hasAttribute("autofocus")&&this.el.querySelectorAll("[autofocus]").length===0&&setTimeout(()=>{this.el.setAttribute("tabindex","-1"),this.el.focus(),this.el.blur()})})}};function ds(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 St=class extends k{boot(){this.onCloses=[]}onClose(e){this.onCloses.push(e)}close(){this.onCloses.forEach(e=>e())}};var Jt=class extends x{boot(){this.querySelectorAll("[data-appended]").forEach(u=>u.remove()),this._controllable=new P(this,{disabled:this.hasAttribute("disabled")});let e=this.button(),i=this.dialog();if(!i)return;i._dialogable=new _t(i,{clickOutside:!this.hasAttribute("disable-click-outside")}),i._closeable=new St(i),i._closeable.onClose(()=>i._dialogable.hide()),this._controllable.initial(u=>u&&i._dialogable.show()),this._controllable.getter(()=>i._dialogable.getState());let s=D();this._controllable.setter(s(u=>{i._dialogable.setState(u)})),i._dialogable.onChange(s(()=>{this._controllable.dispatch()}));let o=()=>{i._dialogable.getState()?(c(this,"data-open",""),e?.setAttribute("data-open",""),c(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}=se();i._dialogable.onChange(()=>{i._dialogable.getState()?n():r()}),e&&p(e,"click",u=>{i._dialogable.show()})}unmount(){if(this.dialog()?._dialogable?.getState()){let{unlock:e}=se();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()}};Yt(({css:t})=>t`dialog, ::backdrop { margin: auto; }`);y("modal",Jt);var kt=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 T=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 Qt=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._disableable=new T(this),this._disableable.onInitAndChange(n=>{n?e.hasAttribute("disabled")||c(e,"disabled",""):e.hasAttribute("disabled")&&w(e,"disabled")}),this._controllable=new P(this,{disabled:this.disabled}),i._disclosable=new kt(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()?(c(this,"data-open",""),c(e,"data-open",""),c(i,"data-open","")):(w(this,"data-open"),w(e,"data-open"),w(i,"data-open"))};i._disclosable.onChange(()=>s()),s(),p(e,"click",n=>{this.disabled||i._disclosable.setState(!i._disclosable.getState())});let o=R(i,"disclosure");c(e,"aria-controls",o),c(e,"aria-expanded","false"),i._disclosable.onChange(()=>{i._disclosable.getState()?c(e,"aria-expanded","true"):c(e,"aria-expanded","false")}),this.hasAttribute("open")&&i._disclosable.setState(!0)}button(){return this.querySelector("button,ui-button")}details(){return this.lastElementChild}},Zt=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 M(this,(e,{skip:i,reject:s})=>{if(e instanceof t&&e!==this||e.localName!=="ui-disclosure")return s()})}};y("disclosure",Qt);y("disclosure-group",Zt);var z=class extends Q{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 M(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=z,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)||c(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,c(this.el,this.options().ariaAttr,"true"),c(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,c(this.el,this.options().ariaAttr,"true"),c(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,c(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,c(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 q=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 ei=class t extends N{boot(){this._disableable=new T(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 z(this,{multiple:!0}),this._controllable=new P(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 q(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())}),c(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 M(this,(e,{skip:i,reject:s})=>{if(e instanceof t)return s();if(e.localName!=="ui-checkbox")return i()})}},ti=class extends N{boot(){let e=this;this.isIndeterminate=!1,this._disableable=new T(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 q(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())}),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}))})),c(e,"role","checkbox"),this._disableable.onInitAndChange(i=>{i?w(e,"tabindex","0"):c(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())})),Oo(e)}get value(){return this._selectable?.getValue()}set value(e){this._selectable&&(this._selectable.value=e+"",this._submittable&&(this._submittable.value=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?c(this,"data-indeterminate",""):w(this,"data-indeterminate")}};y("checkbox-group",ei);y("checkbox",ti);function Oo(t){t.closest("label")?.addEventListener("click",e=>{t.contains(e.target)||t._selectable.press()})}var oe=new Map,j=class extends k{boot({options:e}){e({triggers:[],scope:null});let i=this.options().scope||"global";c(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){Po(this.el,i);let n=new AbortController,r=document.activeElement,u=[...this.triggers,r];setTimeout(()=>{Lo(this.el,u,n),Do(this.el,u,n),Mo(this.el,u,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")oe.has(i)||oe.set(i,new Set),oe.get(i).add(this.el);else if(s.newState==="closed"){if(!oe.has(i))return;oe.get(i).delete(this.el),oe.get(i).size===0&&oe.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 Po(t,e){oe.has(e)&&oe.get(e).forEach(i=>{t.contains(i)||i.contains(t)||i.hidePopover()})}function Lo(t,e,i){document.addEventListener("click",s=>{t.contains(s.target)||e.includes(s.target)||t.hidePopover()},{signal:i.signal})}function Do(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 Mo(t,e,i){document.addEventListener("keydown",s=>{s.key==="Escape"&&t.hidePopover()},{signal:i.signal})}var he=Math.min,W=Math.max,Ye=Math.round,Xe=Math.floor,Y=t=>({x:t,y:t}),Io={left:"right",right:"left",bottom:"top",top:"bottom"},Ro={start:"end",end:"start"};function ii(t,e,i){return W(t,he(e,i))}function Me(t,e){return typeof t=="function"?t(e):t}function ne(t){return t.split("-")[0]}function Ie(t){return t.split("-")[1]}function si(t){return t==="x"?"y":"x"}function oi(t){return t==="y"?"height":"width"}function de(t){return["top","bottom"].includes(ne(t))?"y":"x"}function ni(t){return si(de(t))}function fs(t,e,i){i===void 0&&(i=!1);let s=Ie(t),o=ni(t),n=oi(o),r=o==="x"?s===(i?"end":"start")?"right":"left":s==="start"?"bottom":"top";return e.reference[n]>e.floating[n]&&(r=Ge(r)),[r,Ge(r)]}function ps(t){let e=Ge(t);return[Ct(t),e,Ct(e)]}function Ct(t){return t.replace(/start|end/g,e=>Ro[e])}function No(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 bs(t,e,i,s){let o=Ie(t),n=No(ne(t),i==="start",s);return o&&(n=n.map(r=>r+"-"+o),e&&(n=n.concat(n.map(Ct)))),n}function Ge(t){return t.replace(/left|right|bottom|top/g,e=>Io[e])}function Fo(t){return{top:0,right:0,bottom:0,left:0,...t}}function ms(t){return typeof t!="number"?Fo(t):{top:t,right:t,bottom:t,left:t}}function we(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 gs(t,e,i){let{reference:s,floating:o}=t,n=de(e),r=ni(e),u=oi(r),l=ne(e),a=n==="y",f=s.x+s.width/2-o.width/2,d=s.y+s.height/2-o.height/2,m=s[u]/2-o[u]/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(Ie(e)){case"start":g[r]-=m*(i&&a?-1:1);break;case"end":g[r]+=m*(i&&a?-1:1);break}return g}var vs=async(t,e,i)=>{let{placement:s="bottom",strategy:o="absolute",middleware:n=[],platform:r}=i,u=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}=gs(a,s,l),m=s,g={},h=0;for(let b=0;bfe<=0)){var He,We;let fe=(((He=n.flip)==null?void 0:He.index)||0)+1,qi=$[fe];if(qi)return{data:{index:fe,overflows:le},reset:{placement:qi}};let Be=(We=le.filter(Se=>Se.overflows[0]<=0).sort((Se,ae)=>Se.overflows[1]-ae.overflows[1])[0])==null?void 0:We.placement;if(!Be)switch(g){case"bestFit":{var Ve;let Se=(Ve=le.filter(ae=>{if(I){let ue=de(ae.placement);return ue===E||ue==="y"}return!0}).map(ae=>[ae.placement,ae.overflows.filter(ue=>ue>0).reduce((ue,Us)=>ue+Us,0)]).sort((ae,ue)=>ae[1]-ue[1])[0])==null?void 0:Ve[0];Se&&(Be=Se);break}case"initialPlacement":Be=u;break}if(o!==Be)return{reset:{placement:Be}}}return{}}}};async function Ho(t,e){let{placement:i,platform:s,elements:o}=t,n=await(s.isRTL==null?void 0:s.isRTL(o.floating)),r=ne(i),u=Ie(i),l=de(i)==="y",a=["left","top"].includes(r)?-1:1,f=n&&l?-1:1,d=Me(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 u&&typeof h=="number"&&(g=u==="end"?h*-1:h),l?{x:g*f,y:m*a}:{x:m*a,y:g*f}}var As=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:u}=e,l=await Ho(e,t);return r===((i=u.offset)==null?void 0:i.placement)&&(s=u.arrow)!=null&&s.alignmentOffset?{}:{x:o+l.x,y:n+l.y,data:{...l,placement:r}}}}},ys=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:u={fn:v=>{let{x:A,y:E}=v;return{x:A,y:E}}},...l}=Me(t,e),a={x:i,y:s},f=await Tt(e,l),d=de(ne(o)),m=si(d),g=a[m],h=a[d];if(n){let v=m==="y"?"top":"left",A=m==="y"?"bottom":"right",E=g+f[v],_=g-f[A];g=ii(E,g,_)}if(r){let v=d==="y"?"top":"left",A=d==="y"?"bottom":"right",E=h+f[v],_=h-f[A];h=ii(E,h,_)}let b=u.fn({...e,[m]:g,[d]:h});return{...b,data:{x:b.x-i,y:b.y-s,enabled:{[m]:n,[d]:r}}}}}};var xs=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:u}=e,{apply:l=()=>{},...a}=Me(t,e),f=await Tt(e,a),d=ne(o),m=Ie(o),g=de(o)==="y",{width:h,height:b}=n.floating,v,A;d==="top"||d==="bottom"?(v=d,A=m===(await(r.isRTL==null?void 0:r.isRTL(u.floating))?"start":"end")?"left":"right"):(A=d,v=m==="end"?"top":"bottom");let E=b-f.top-f.bottom,_=h-f.left-f.right,L=he(b-f[v],E),O=he(h-f[A],_),I=!e.middlewareData.shift,$=L,Z=O;if((i=e.middlewareData.shift)!=null&&i.enabled.x&&(Z=_),(s=e.middlewareData.shift)!=null&&s.enabled.y&&($=E),I&&!m){let le=W(f.left,0),He=W(f.right,0),We=W(f.top,0),Ve=W(f.bottom,0);g?Z=h-2*(le!==0||He!==0?le+He:W(f.left,f.right)):$=b-2*(We!==0||Ve!==0?We+Ve:W(f.top,f.bottom))}await l({...e,availableWidth:Z,availableHeight:$});let B=await r.getDimensions(u.floating);return h!==B.width||b!==B.height?{reset:{rects:!0}}:{}}}};function Ot(){return typeof window<"u"}function Ae(t){return _s(t)?(t.nodeName||"").toLowerCase():"#document"}function V(t){var e;return(t==null||(e=t.ownerDocument)==null?void 0:e.defaultView)||window}function X(t){var e;return(e=(_s(t)?t.ownerDocument:t.document)||window.document)==null?void 0:e.documentElement}function _s(t){return Ot()?t instanceof Node||t instanceof V(t).Node:!1}function K(t){return Ot()?t instanceof Element||t instanceof V(t).Element:!1}function J(t){return Ot()?t instanceof HTMLElement||t instanceof V(t).HTMLElement:!1}function Es(t){return!Ot()||typeof ShadowRoot>"u"?!1:t instanceof ShadowRoot||t instanceof V(t).ShadowRoot}function Ne(t){let{overflow:e,overflowX:i,overflowY:s,display:o}=U(t);return/auto|scroll|overlay|hidden|clip/.test(e+s+i)&&!["inline","contents"].includes(o)}function Ss(t){return["table","td","th"].includes(Ae(t))}function Je(t){return[":popover-open",":modal"].some(e=>{try{return t.matches(e)}catch{return!1}})}function Pt(t){let e=Lt(),i=K(t)?U(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 ks(t){let e=re(t);for(;J(e)&&!ye(e);){if(Pt(e))return e;if(Je(e))return null;e=re(e)}return null}function Lt(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function ye(t){return["html","body","#document"].includes(Ae(t))}function U(t){return V(t).getComputedStyle(t)}function Qe(t){return K(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.scrollX,scrollTop:t.scrollY}}function re(t){if(Ae(t)==="html")return t;let e=t.assignedSlot||t.parentNode||Es(t)&&t.host||X(t);return Es(e)?e.host:e}function Cs(t){let e=re(t);return ye(e)?t.ownerDocument?t.ownerDocument.body:t.body:J(e)&&Ne(e)?e:Cs(e)}function Re(t,e,i){var s;e===void 0&&(e=[]),i===void 0&&(i=!0);let o=Cs(t),n=o===((s=t.ownerDocument)==null?void 0:s.body),r=V(o);if(n){let u=Dt(r);return e.concat(r,r.visualViewport||[],Ne(o)?o:[],u&&i?Re(u):[])}return e.concat(o,Re(o,[],i))}function Dt(t){return t.parent&&Object.getPrototypeOf(t.parent)?t.frameElement:null}function Ps(t){let e=U(t),i=parseFloat(e.width)||0,s=parseFloat(e.height)||0,o=J(t),n=o?t.offsetWidth:i,r=o?t.offsetHeight:s,u=Ye(i)!==n||Ye(s)!==r;return u&&(i=n,s=r),{width:i,height:s,$:u}}function li(t){return K(t)?t:t.contextElement}function Fe(t){let e=li(t);if(!J(e))return Y(1);let i=e.getBoundingClientRect(),{width:s,height:o,$:n}=Ps(e),r=(n?Ye(i.width):i.width)/s,u=(n?Ye(i.height):i.height)/o;return(!r||!Number.isFinite(r))&&(r=1),(!u||!Number.isFinite(u))&&(u=1),{x:r,y:u}}var Wo=Y(0);function Ls(t){let e=V(t);return!Lt()||!e.visualViewport?Wo:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function Vo(t,e,i){return e===void 0&&(e=!1),!i||e&&i!==V(t)?!1:e}function xe(t,e,i,s){e===void 0&&(e=!1),i===void 0&&(i=!1);let o=t.getBoundingClientRect(),n=li(t),r=Y(1);e&&(s?K(s)&&(r=Fe(s)):r=Fe(t));let u=Vo(n,i,s)?Ls(n):Y(0),l=(o.left+u.x)/r.x,a=(o.top+u.y)/r.y,f=o.width/r.x,d=o.height/r.y;if(n){let m=V(n),g=s&&K(s)?V(s):s,h=m,b=Dt(h);for(;b&&s&&g!==h;){let v=Fe(b),A=b.getBoundingClientRect(),E=U(b),_=A.left+(b.clientLeft+parseFloat(E.paddingLeft))*v.x,L=A.top+(b.clientTop+parseFloat(E.paddingTop))*v.y;l*=v.x,a*=v.y,f*=v.x,d*=v.y,l+=_,a+=L,h=V(b),b=Dt(h)}}return we({width:f,height:d,x:l,y:a})}function ai(t,e){let i=Qe(t).scrollLeft;return e?e.left+i:xe(X(t)).left+i}function Ds(t,e,i){i===void 0&&(i=!1);let s=t.getBoundingClientRect(),o=s.left+e.scrollLeft-(i?0:ai(t,s)),n=s.top+e.scrollTop;return{x:o,y:n}}function Bo(t){let{elements:e,rect:i,offsetParent:s,strategy:o}=t,n=o==="fixed",r=X(s),u=e?Je(e.floating):!1;if(s===r||u&&n)return i;let l={scrollLeft:0,scrollTop:0},a=Y(1),f=Y(0),d=J(s);if((d||!d&&!n)&&((Ae(s)!=="body"||Ne(r))&&(l=Qe(s)),J(s))){let g=xe(s);a=Fe(s),f.x=g.x+s.clientLeft,f.y=g.y+s.clientTop}let m=r&&!d&&!n?Ds(r,l,!0):Y(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 qo(t){return Array.from(t.getClientRects())}function $o(t){let e=X(t),i=Qe(t),s=t.ownerDocument.body,o=W(e.scrollWidth,e.clientWidth,s.scrollWidth,s.clientWidth),n=W(e.scrollHeight,e.clientHeight,s.scrollHeight,s.clientHeight),r=-i.scrollLeft+ai(t),u=-i.scrollTop;return U(s).direction==="rtl"&&(r+=W(e.clientWidth,s.clientWidth)-o),{width:o,height:n,x:r,y:u}}function zo(t,e){let i=V(t),s=X(t),o=i.visualViewport,n=s.clientWidth,r=s.clientHeight,u=0,l=0;if(o){n=o.width,r=o.height;let a=Lt();(!a||a&&e==="fixed")&&(u=o.offsetLeft,l=o.offsetTop)}return{width:n,height:r,x:u,y:l}}function jo(t,e){let i=xe(t,!0,e==="fixed"),s=i.top+t.clientTop,o=i.left+t.clientLeft,n=J(t)?Fe(t):Y(1),r=t.clientWidth*n.x,u=t.clientHeight*n.y,l=o*n.x,a=s*n.y;return{width:r,height:u,x:l,y:a}}function Ts(t,e,i){let s;if(e==="viewport")s=zo(t,i);else if(e==="document")s=$o(X(t));else if(K(e))s=jo(e,i);else{let o=Ls(t);s={x:e.x-o.x,y:e.y-o.y,width:e.width,height:e.height}}return we(s)}function Ms(t,e){let i=re(t);return i===e||!K(i)||ye(i)?!1:U(i).position==="fixed"||Ms(i,e)}function Ko(t,e){let i=e.get(t);if(i)return i;let s=Re(t,[],!1).filter(u=>K(u)&&Ae(u)!=="body"),o=null,n=U(t).position==="fixed",r=n?re(t):t;for(;K(r)&&!ye(r);){let u=U(r),l=Pt(r);!l&&u.position==="fixed"&&(o=null),(n?!l&&!o:!l&&u.position==="static"&&!!o&&["absolute","fixed"].includes(o.position)||Ne(r)&&!l&&Ms(t,r))?s=s.filter(f=>f!==r):o=u,r=re(r)}return e.set(t,s),s}function Uo(t){let{element:e,boundary:i,rootBoundary:s,strategy:o}=t,r=[...i==="clippingAncestors"?Je(e)?[]:Ko(e,this._c):[].concat(i),s],u=r[0],l=r.reduce((a,f)=>{let d=Ts(e,f,o);return a.top=W(d.top,a.top),a.right=he(d.right,a.right),a.bottom=he(d.bottom,a.bottom),a.left=W(d.left,a.left),a},Ts(e,u,o));return{width:l.right-l.left,height:l.bottom-l.top,x:l.left,y:l.top}}function Go(t){let{width:e,height:i}=Ps(t);return{width:e,height:i}}function Yo(t,e,i){let s=J(e),o=X(e),n=i==="fixed",r=xe(t,!0,n,e),u={scrollLeft:0,scrollTop:0},l=Y(0);if(s||!s&&!n)if((Ae(e)!=="body"||Ne(o))&&(u=Qe(e)),s){let m=xe(e,!0,n,e);l.x=m.x+e.clientLeft,l.y=m.y+e.clientTop}else o&&(l.x=ai(o));let a=o&&!s&&!n?Ds(o,u):Y(0),f=r.left+u.scrollLeft-l.x-a.x,d=r.top+u.scrollTop-l.y-a.y;return{x:f,y:d,width:r.width,height:r.height}}function ri(t){return U(t).position==="static"}function Os(t,e){if(!J(t)||U(t).position==="fixed")return null;if(e)return e(t);let i=t.offsetParent;return X(t)===i&&(i=i.ownerDocument.body),i}function Is(t,e){let i=V(t);if(Je(t))return i;if(!J(t)){let o=re(t);for(;o&&!ye(o);){if(K(o)&&!ri(o))return o;o=re(o)}return i}let s=Os(t,e);for(;s&&Ss(s)&&ri(s);)s=Os(s,e);return s&&ye(s)&&ri(s)&&!Pt(s)?i:s||ks(t)||i}var Xo=async function(t){let e=this.getOffsetParent||Is,i=this.getDimensions,s=await i(t.floating);return{reference:Yo(t.reference,await e(t.floating),t.strategy),floating:{x:0,y:0,width:s.width,height:s.height}}};function Jo(t){return U(t).direction==="rtl"}var Qo={convertOffsetParentRelativeRectToViewportRelativeRect:Bo,getDocumentElement:X,getClippingRect:Uo,getOffsetParent:Is,getElementRects:Xo,getClientRects:qo,getDimensions:Go,getScale:Fe,isElement:K,isRTL:Jo};function Rs(t,e){return t.x===e.x&&t.y===e.y&&t.width===e.width&&t.height===e.height}function Zo(t,e){let i=null,s,o=X(t);function n(){var u;clearTimeout(s),(u=i)==null||u.disconnect(),i=null}function r(u,l){u===void 0&&(u=!1),l===void 0&&(l=1),n();let a=t.getBoundingClientRect(),{left:f,top:d,width:m,height:g}=a;if(u||e(),!m||!g)return;let h=Xe(d),b=Xe(o.clientWidth-(f+m)),v=Xe(o.clientHeight-(d+g)),A=Xe(f),_={rootMargin:-h+"px "+-b+"px "+-v+"px "+-A+"px",threshold:W(0,he(1,l))||1},L=!0;function O(I){let $=I[0].intersectionRatio;if($!==l){if(!L)return r();$?r(!1,$):s=setTimeout(()=>{r(!1,1e-7)},1e3)}$===1&&!Rs(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 Ns(t,e,i,s){s===void 0&&(s={});let{ancestorScroll:o=!0,ancestorResize:n=!0,elementResize:r=typeof ResizeObserver=="function",layoutShift:u=typeof IntersectionObserver=="function",animationFrame:l=!1}=s,a=li(t),f=o||n?[...a?Re(a):[],...Re(e)]:[];f.forEach(A=>{o&&A.addEventListener("scroll",i,{passive:!0}),n&&A.addEventListener("resize",i)});let d=a&&u?Zo(a,i):null,m=-1,g=null;r&&(g=new ResizeObserver(A=>{let[E]=A;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?xe(t):null;l&&v();function v(){let A=xe(t);b&&!Rs(b,A)&&i(),b=A,h=requestAnimationFrame(v)}return i(),()=>{var A;f.forEach(E=>{o&&E.removeEventListener("scroll",i),n&&E.removeEventListener("resize",i)}),d?.(),(A=g)==null||A.disconnect(),g=null,l&&cancelAnimationFrame(h)}}var Fs=As;var Hs=ys,Ws=ws,Vs=xs;var Bs=(t,e,i)=>{let s=new Map,o={platform:Qo,...i},n={...o.platform,_c:s};return vs(t,e,{...o,platform:n})};var qs=!(CSS.supports?.("selector(:popover-open)")??!1),G=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]=sn(this.el,{scrollY:this.options().scrollY}),o=en(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=Ns(this.options().reference,this.el,o):o(null,...r)},this.cleanup=()=>{n(),s()}}};function en(t,e,i,{position:s,offset:o,gap:n,matchWidth:r,crossAxis:u,scrollY:l}){let a=window.getComputedStyle(t).maxHeight;return a=a==="none"?null:parseFloat(a),(f,d,m)=>{Bs(e,t,{strategy:qs?"fixed":"absolute",placement:tn(s,t),middleware:[Fs({mainAxis:Number(n),alignmentAxis:Number(o)}),Ws(),Hs({padding:5,crossAxis:u}),Vs({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 tn(t,e){let i=t.split(" ");switch(i[0]){case"start":i[0]=ce(e)?"right":"left";break;case"end":i[0]=ce(e)?"left":"right";break}return i.join("-")}function sn(t,{scrollY:e=!0}){let i=(r,u)=>{Object.assign(t.style,{position:qs?"fixed":"absolute",overflowY:e?"auto":"hidden",left:`${r}px`,top:`${u}px`,right:"auto",bottom:"auto"})},s,o,n=new MutationObserver(()=>i(s,o));return[(r,u)=>{s=r,o=u,n.disconnect(),i(s,o),n.observe(t,{attributeFilter:["style"]})},()=>{n.disconnect()}]}var ui=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 P(this),i._popoverable=new j(i),i._anchorable=new G(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}=se(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=()=>{};De(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()?(c(this,"data-open",""),c(e,"data-open",""),c(i,"data-open","")):(w(this,"data-open"),w(e,"data-open"),w(i,"data-open")),i._popoverable.onChange(()=>{i._popoverable.getState()?(c(this,"data-open",""),c(e,"data-open",""),c(i,"data-open","")):(w(this,"data-open"),w(e,"data-open"),w(i,"data-open"))});let o=R(i,"dropdown");c(e,"aria-haspopup","true"),c(e,"aria-controls",o),c(e,"aria-expanded",i._popoverable.getState()?"true":"false"),i._popoverable.onChange(()=>{c(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}=se();e()}}trigger(){return this.querySelector("button,ui-button,a")}overlay(){return this.lastElementChild?.matches("[popover]")&&this.lastElementChild}};y("dropdown",ui);var ci=class extends x{boot(){this._controllable=new P(this),this._controllable.initial(e=>e!=null&&this.setValue(parseFloat(e))),this._controllable.getter(()=>this.currentValue),this._controllable.setter(e=>this.setValue(parseFloat(e))),c(this,"role","progressbar"),c(this,"aria-valuemin",0),this.currentValue===void 0&&this.setValue(this.hasAttribute("value")?parseFloat(this.getAttribute("value")):0),new MutationObserver(()=>this.updateVisual()).observe(this,{attributes:!0,attributeFilter:["max"]})}setValue(e){this.currentValue=e,this.updateVisual()}updateVisual(){let e=this.hasAttribute("max")?parseFloat(this.getAttribute("max")):100,i=Math.max(0,Math.min(100,this.currentValue/e*100));this.style.setProperty("--flux-progress",i),this.style.setProperty("--flux-progress-percentage",i+"%"),c(this,"aria-valuenow",this.currentValue),c(this,"aria-valuemax",e)}};y("progress",ci);var hi=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 j(s,{scope:"tooltip"}),s._anchorable=new G(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 T(this);let o;this._disableable.onInitAndChange(a=>{o&&(o(),o=null),a||(o=De(this,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=R(s,"tooltip"),u=this.hasAttribute("interactive"),l=this.hasAttribute("label")||i.textContent.trim()==="";u?(c(i,"aria-controls",r),c(i,"aria-expanded","false"),s._popoverable.onChange(()=>{s._popoverable.getState()?c(i,"aria-expanded","true"):c(i,"aria-expanded","false")})):(l?c(i,"aria-labelledby",r):c(i,"aria-describedby",r),c(s,"aria-hidden","true")),c(s,"role","tooltip")}button(){return this.firstElementChild}overlay(){return this.lastElementChild!==this.button()&&this.lastElementChild.tagName!=="TEMPLATE"&&this.lastElementChild}};y("tooltip",hi);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"},di=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 At,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=Xt(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=Xt(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 fi(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?c(e,"data-flux-sidebar-active",""):ie(e,"data-flux-sidebar-active")),this.state.viewportDesktop?(ie(e,"data-flux-sidebar-on-mobile"),c(e,"data-flux-sidebar-on-desktop",""),ie(e,"data-flux-sidebar-collapsed-mobile"),this.state.collapsedDesktop?i&&c(e,"data-flux-sidebar-collapsed-desktop",""):ie(e,"data-flux-sidebar-collapsed-desktop")):(ie(e,"data-flux-sidebar-on-desktop"),c(e,"data-flux-sidebar-on-mobile",""),ie(e,"data-flux-sidebar-collapsed-desktop"),this.state.collapsedMobile?c(e,"data-flux-sidebar-collapsed-mobile",""):ie(e,"data-flux-sidebar-collapsed-mobile"))}},fi=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)})}},pi=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)})})}};y("sidebar",di);y("sidebar-toggle",pi);var bi=class extends x{boot(){c(this,"role","button"),this._disableable=new T(this),this._disableable.onInitAndChange(e=>{e?w(this,"tabindex","0"):c(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()}};y("button",bi);var Ee=class extends Q{groupOfType=F;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=>us(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(F).tabbable(),i?.use(F).focus()}moveFocus(e){let i=this.walker().find(o=>o.use(F).isTabbable());e(i)?.use(F).focus()}ensureTabbable(){this.walker().findOrFirst(e=>{e.use(F).isTabbable()})?.use(F).tabbable()}wipeTabbables(){this.walker().each(e=>{e.use(F).untabbable()})}untabbleOthers(e){this.walker().each(i=>{i!==e&&i.use(F).untabbable()})}walker(){return M(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()})}},F=class extends k{groupedByType=Ee;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(()=>{ve()&&c(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(){c(this.el,"tabindex","0"),this.options().tabbableAttr&&c(this.el,this.options().tabbableAttr,"")}untabbable(){c(this.el,"tabindex","-1"),this.options().tabbableAttr&&w(this.el,this.options().tabbableAttr)}isTabbable(){return this.el.getAttribute("tabindex")==="0"}};var mi=class extends N{boot(){let e=this;this._disableable=new T(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 q(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}))})),c(e,"role","switch"),this._selectable.onInitAndChange(()=>{this._submittable.update(this._selectable.getState())}),this._disableable.onInitAndChange(i=>{i?w(e,"tabindex","0"):c(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())})),on(e)}get checked(){return this._selectable.isSelected()}set checked(e){this._detangled(()=>{e?this._selectable.select():this._selectable.deselect()})()}};function on(t){t.closest("label")?.addEventListener("click",e=>{t.contains(e.target)||t.click()})}y("switch",mi);var gi=class extends x{mount(){let e=this.querySelector("button,ui-button");p(e,"click",()=>{yt(this,s=>!!s._closeable)?._closeable?.close()})}};y("close",gi);var vi=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")&&(c(this.elOrButton(this.control),"aria-labelledby",this.label.id),this.control&&!(this.control instanceof N)&&this.hasAttribute("disabled")&&this.control.setAttribute("disabled","")))}associateDescriptionWithControl(e){e&&this.description&&(this.control=e,!this.control.hasAttribute("aria-describedby")&&c(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 M(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 N||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}},wi=class extends x{mount(){R(this,"label"),c(this,"aria-hidden","true"),this.closest("ui-field")?.associateLabel(this)}},Ai=class extends x{mount(){R(this,"description"),c(this,"aria-hidden","true"),this.closest("ui-field")?.associateDescription(this)}};y("field",vi);y("label",wi);y("description",Ai);var yi=class extends x{mount(){let e=R(this,"legend"),i=this.closest("fieldset");i&&c(i,"aria-labelledby",e)}};y("legend",yi);var xi=class t extends N{boot(){this._disableable=new T(this),this._disableable.onInitAndChange(e=>{this.walker().each(i=>{i.disabled=e})}),this._selectable=new z(this),this._controllable=new P(this,{disabled:this._disabled,bubbles:!0}),this._focusable=new Ee(this,{wrap:!0}),this._submittable=new q(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())}),c(this,"role","radiogroup"),queueMicrotask(()=>{this._submittable.update(this._selectable.getState())})}walker(){return M(this,(e,{skip:i,reject:s})=>{if(e instanceof t)return s();if(e.localName!=="ui-radio")return i()})}},Ei=class extends N{boot(){let e=this;this._disableable=new T(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._selectable.onChange(()=>{this._selectable.isSelected()&&this._focusable.focus(!1)}),this._disableable.onChange(i=>{i?this._focusable.untabbable():this._selectable.isSelected()&&this._focusable.tabbable()}),c(e,"role","radio"),this._focusable=new F(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())})),nn(e),p(e,"focus",i=>{ve()&&this._selectable.select()})}get value(){return this._selectable?.getValue()}set value(e){this._selectable&&(this._selectable.value=e+"")}get checked(){return this._selectable.isSelected()}set checked(e){(this.closest("ui-radio-group")?._detangled||(()=>{}))(()=>{e&&this._selectable.select()})()}};function nn(t){t.closest("label")?.addEventListener("click",e=>{t.contains(e.target)||t.click()})}y("radio-group",xi);y("radio",Ei);var Mt=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 u=this.picker._selectable.findByValue(r);if(!u){if(e)return setTimeout(()=>this.render());throw`Could not find option for value "${r}"`}n.set(r,u)}n.forEach((r,u)=>this.selecteds.set(u,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 u=!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=Ze(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=Ze(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 u=new DocumentFragment;u.append(...s.childNodes),s.replaceWith(u),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=Ze(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=Ze(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=Ze(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=()=>{}}}},It=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 Ze(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 et=class extends Q{groupOfType=H;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(H).activate()}activateBySearch(e){this.filterAwareWalker().find(s=>s.textContent.toLowerCase().trim().startsWith(e.toLowerCase()))?.use(H).activate()}activateSelectedOrFirst(e){if(!e||(s=>s.matches("ui-option, ui-option-create")?getComputedStyle(s).display==="none":!1)(e)){this.filterAwareWalker().first()?.use(H).activate();return}e?.use(H).activate()}activateActiveOrFirst(){let e=this.getActive();if(!e){this.filterAwareWalker().first()?.use(H).activate();return}e?.use(H).activate()}activateActiveOrLast(){let e=this.getActive();if(!e){this.filterAwareWalker().last()?.use(H).activate();return}e?.use(H).activate()}activatePrev(){let e=this.getActive();if(!e){this.filterAwareWalker().last()?.use(H).activate();return}let i;this.options.wrap?i=this.filterAwareWalker().prevOrLast(e):i=this.filterAwareWalker().prev(e),i?.use(H).activate()}activateNext(){let e=this.getActive();if(!e){this.filterAwareWalker().first()?.use(H).activate();return}let i;this.options.wrap?i=this.filterAwareWalker().nextOrFirst(e):i=this.filterAwareWalker().next(e),i?.use(H).activate()}getActive(){return this.walker().find(e=>e.use(H).isActive())}clearActive(){this.getActive()?.use(H).deactivate()}filterAwareWalker(){let e=i=>i.matches("ui-option, ui-option-create")?getComputedStyle(i).display==="none":!1;return M(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()})}},H=class t extends k{groupedByType=et;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)&&(c(this.el,"data-active",""),ve()&&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 tt=class extends Q{groupOfType=_e;boot({options:e}){e({}),this.onChanges=[],this.lastSearch=""}onChange(e){this.onChanges.push(e)}filter(e){e===""?this.walker().each(i=>{i.use(_e).unfilter()}):this.walker().each(i=>{this.matches(i,e)?i.use(_e).unfilter():i.use(_e).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(_e).isFiltered())}},_e=class extends k{groupedByType=tt;boot({options:e}){e({mirror:null,keep:!1}),this.onChanges=[]}filter(){this.options().keep||(c(this.el,"data-hidden",""),this.options().mirror&&c(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 ot=class extends N{boot(){let e=this.list();this._controllable=new P(this,{bubbles:!0}),this._selectable=new z(e,{multiple:this.hasAttribute("multiple")}),this._submittable=new q(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 T(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"),u=this.querySelector("ui-options")||this,l=rn(u,"options",o);this._activatable=new et(u,{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 tt(s),this._filterable.onChange(()=>{this._activatable.clearActive(),this._filterable.hasResults()&&this._activatable.activateFirst()}),this.addEventListener("open",()=>{this._filterable&&this._filterable.filter("")}),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))it(this,this._activatable),st(this,this,this._activatable),zs(this,this._activatable,this._selectable);else if(!a&&d){let h=d;this._disableable.onInitAndChange(b=>{b?h&&c(h,"disabled",""):h&&w(h,"disabled")}),Li(this,h,this._selectable,this._popoverable),zs(h,this._activatable,this._selectable),Ks(n,r,this,h,this._selectable,this._popoverable,this._filterable),Pi(h),Oi(h),this._filterable&&Ti(s,h,this._filterable),Ft(h,this._activatable,this._selectable),it(h,this._activatable),st(this,h,this._activatable),Rt(this,this._activatable)}else if(a&&d){let h=d;c(h,"role","combobox"),c(h,"aria-controls",l);let b=a;this._popoverable=new j(b),this._anchorable=new G(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}),Ks(n,r,this,h,this._selectable,this._popoverable,this._filterable),this._disableable.onInitAndChange(v=>{v?h&&c(h,"disabled",""):h&&w(h,"disabled")}),this.querySelectorAll("button,ui-button").forEach(v=>{b.contains(v)||(c(v,"tabindex","-1"),c(v,"aria-controls",l),c(v,"aria-haspopup","listbox"),Nt(v,this._popoverable),p(v,"click",()=>{this._popoverable.toggle(),xt()||h.focus()}))}),Li(this,h,this._selectable,this._popoverable),_i(this,h,b,this._popoverable,this._anchorable),Mi(this,this._popoverable,[h]),Nt(h,this._popoverable),Pi(h),Oi(h),this._filterable&&Ti(s,h,this._filterable),Ft(h,this._activatable,this._selectable),un(h,this._popoverable),Ci(h,this._popoverable,this._activatable,this._selectable),ln(h,this._popoverable),ki(this,this._popoverable),it(h,this._activatable),st(this,h,this._activatable),Rt(this,this._activatable),Si(this._popoverable,this._activatable,this._selectable),Di(this,this._selectable,this._popoverable,o)}else if(a&&f){let h=m,b=f,v=a;c(h,"role","combobox"),c(b,"role","combobox"),c(h,"aria-controls",l),this._disableable.onInitAndChange(A=>{A?(h&&c(h,"disabled",""),b&&c(b,"disabled","")):(h&&w(h,"disabled"),b&&w(b,"disabled"))}),this._popoverable=new j(v),this._anchorable=new G(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}),Pi(b),Oi(b),this._filterable&&Ti(s,b,this._filterable),Ft(b,this._activatable,this._selectable),an(b,this._popoverable),_i(this,h,v,this._popoverable,this._anchorable),Mi(this,this._popoverable,[b]),Nt(h,this._popoverable),Li(this,b,this._selectable,this._popoverable),Ci(h,this._popoverable,this._activatable,this._selectable),js(h,this._popoverable),ki(this,this._popoverable),it(b,this._activatable),$s(h,this._activatable,this._popoverable),st(this,b,this._activatable),Rt(this,this._activatable),Si(this._popoverable,this._activatable,this._selectable),Di(this,this._selectable,this._popoverable,o)}else if(a){let h=m,b=a;c(h,"role","combobox"),c(h,"aria-controls",l),this._disableable.onInitAndChange(v=>{v?(h&&c(h,"disabled",""),e&&c(e,"disabled","")):(h&&w(h,"disabled"),e&&w(e,"disabled"))}),this._popoverable=new j(b),this._anchorable=new G(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}),_i(this,h,b,this._popoverable,this._anchorable),Mi(this,this._popoverable),Nt(h,this._popoverable),Ci(h,this._popoverable,this._activatable,this._selectable),js(h,this._popoverable),Ft(h,this._activatable,this._selectable),ki(this,this._popoverable),it(h,this._activatable),$s(h,this._activatable,this._popoverable),st(this,h,this._activatable),Rt(this,this._activatable),Si(this._popoverable,this._activatable,this._selectable),Di(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}=se();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.setState(null),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})))}};y("selected-remove",It);y("selected",Mt);y("select",ot);function it(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 $s(t,e,i){Et(t,s=>{e.activateBySearch(s),i.getState()||e.getActive()?.click()})}function st(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 Rt(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 zs(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 rn(t,e){let i=R(t,"options");return c(t,"role","listbox"),c(t,"aria-multiselectable",e?"true":"false"),i}function Nt(t,e){c(t,"aria-haspopup","listbox");let i=()=>{c(t,"aria-expanded",e.getState()?"true":"false"),e.getState()?c(t,"data-open",""):w(t,"data-open","")};e.onChange(()=>{i()}),i()}function _i(t,e,i,s,o){let n=()=>{Array.from([t,i]).forEach(r=>{s.getState()?c(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 Si(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 ki(t,e){p(t,"keydown",i=>{i.key==="Escape"&&e.getState()&&(e.setState(!1),i.preventDefault(),i.stopImmediatePropagation())})}function Ci(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 ln(t,e){p(t,"click",()=>{e.getState()||(e.setState(!0),t.focus())})}function js(t,e){p(t,"click",()=>{e.setState(!e.getState()),t.focus()})}function an(t,e){e.onChange(()=>{e.getState()&&!xt()&&setTimeout(()=>t.focus())})}function Ti(t,e,i){p(e,"input",o=>{i.filter(o.target.value)}),new MutationObserver(()=>{requestAnimationFrame(()=>{i.filter(e.value)})}).observe(t,{childList:!0})}function Oi(t){p(t,"focus",()=>t.select())}function Pi(t){p(t,"change",e=>e.stopPropagation()),p(t,"input",e=>e.stopPropagation())}function un(t,e){p(t,"keydown",i=>{(/^[a-zA-Z0-9]$/.test(i.key)||i.key==="Backspace")&&(e.getState()||e.setState(!0))})}function Li(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"),u=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"&&(u=l=a=f=!1),u?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 Di(t,e,i,s){let o=!s,n=!s,r=!s;if(t.hasAttribute("close")){let u=t.getAttribute("close");if(o=u==="",n=u.split(" ").includes("action"),r=u.split(" ").includes("select"),u==="none")return}o||n?t.addEventListener("interaction",u=>{let l=u.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 Ft(t,e,i){e.onChange(()=>{let s=e.getActive();s?c(t,"aria-activedescendant",s.id):w(t,"aria-activedescendant")}),i.onChange(s=>{if(!s)return;let o=s.el;o&&c(t,"aria-activedescendant",o.id)})}function Ks(t,e,i,s,o,n,r){if(!t){c(s,"autocomplete","off"),c(s,"aria-autocomplete","none");return}let u=a=>{s.value!==a&&(s.value=a,s.dispatchEvent(new Event("input",{bubbles:!1})))};c(s,"autocomplete","off"),c(s,"aria-autocomplete","list"),s.value!==""&&o.isEmpty()&&o.setState(s.value);let l=()=>{o.isNotEmpty()?requestAnimationFrame(()=>{u(o.selectedTextValue()),e&&c(s,"data-selected",o.selectedTextValue())}):(u(""),w(s,"data-selected"))};queueMicrotask(()=>{o.isEmpty()&&s.value!==""&&o.setState(s.value),o.onInitAndChange(()=>l())}),i.addEventListener("interaction",a=>{a.detail.optionEl._selectable?.isSelected()&&l()}),e&&n.onChange(()=>{n.getState()||requestAnimationFrame(()=>{u(s.getAttribute("data-selected"))})})}function Mi(t,e,i=[]){let{lock:s,unlock:o}=se(e.el,!1,i);e.onChange(()=>{e.getState()?s():o()})}var Ii=class t extends x{boot(){if(this._focusable=new Ee(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())}),Et(this,e=>this._focusable.focusBySearch(e)),this.hasAttribute("popover")&&this.addEventListener("lofi-close-popovers",e=>{this.hasAttribute("keep-open")||(e.detail?.immediate?this.hidePopover():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())})}c(this,"role","menu"),c(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||cn(e)})}walker(){return M(this,(e,{skip:i,reject:s})=>{if(e instanceof t||e instanceof ot)return s();if(!["a","button"].includes(e.localName))return i()})}},Ri=class extends x{boot(){}},Ni=class extends x{boot(){let e=this;this._disableable=new T(this),this._disableable.onInitAndChange(s=>{s?c(e,"aria-disabled","true"):w(e,"aria-disabled")}),R(e,"menu-checkbox"),c(e,"role","menuitemcheckbox"),e._focusable=new F(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 P(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._disableable.enabled(()=>{this.hasAttribute("keep-open")||this.dispatchEvent(new CustomEvent("lofi-close-popovers",{bubbles:!0})),e._selectable.press()})),Vi(e)}},Fi=class extends x{boot(){let e=this;this._disableable=new T(this),this._disableable.onInitAndChange(i=>{i?c(e,"aria-disabled","true"):w(e,"aria-disabled")}),R(e,"menu-radio"),c(e,"role","menuitemradio"),e._focusable=new F(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._disableable.enabled(()=>{this.hasAttribute("keep-open")||this.dispatchEvent(new CustomEvent("lofi-close-popovers",{bubbles:!0})),e._selectable.press()})),Vi(e)}},Hi=class extends x{boot(){this._selectable=new z(this),this._controllable=new P(this),c(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())})}},Wi=class extends x{boot(){this._selectable=new z(this,{multiple:!0}),this._controllable=new P(this),c(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()}))}};y("menu",Ii);y("submenu",Ri);y("menu-checkbox",Ni);y("menu-radio",Fi);y("menu-radio-group",Hi);y("menu-checkbox-group",Wi);function Vi(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 cn(t){let e=t.querySelector("a"),i=t,s=t.parentElement.matches("ui-submenu")&&t.parentElement.querySelector("ui-menu[popover]"),o=e||i;if(t._disableable=new T(t),t._disableable.onInitAndChange(n=>{n?c(o,"aria-disabled","true"):w(o,"aria-disabled")}),R(o,"menu-item"),c(o,"role","menuitem"),o._focusable=new F(o,{disableable:t._disableable,hover:!0,tabbableAttr:"data-active"}),s){s._popoverable=new j(s,{triggers:[i]}),s._anchorable=new G(s,{reference:i,position:s.hasAttribute("position")?s.getAttribute("position"):ce(s)?"left start":"right start",gap:s.hasAttribute("gap")?s.getAttribute("gap"):"-5",crossAxis:!0}),i.addEventListener("click",t._disableable.enabled(r=>{s._popoverable.setState(!0)}));let{clear:n}=De(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())})}else{let n=t._disableable.enabled(()=>{t.hasAttribute("keep-open")||t.dispatchEvent(new CustomEvent("lofi-close-popovers",{bubbles:!0,detail:{immediate:!0}}))});p(t,"mouseup",n),p(t,"click",r=>!r.isTrusted&&n()),Vi(i)}}var Bi=class extends N{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 P(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 q(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 T(this),this._disableable.onInitAndChange(i=>{for(let s of this.inputEls)i?c(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"?(ce(this)?this.focusPrev(i):this.focusNext(i),o.preventDefault()):o.key==="ArrowLeft"&&(ce(this)?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()}}))});!ns()&&!rs()&&ls();})();