let m,S,M,P;const d={light:"",dark:""},j=[];async function U(t){return await new Promise(e=>setTimeout(e,t))}function X(){return"fxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,t=>{const e=Math.random()*16|0;return(t==="x"?e:e&3|8).toString(16)})}function x(t,e){try{return typeof t=="string"?(e!=null?e:document).querySelector(t):t}catch{return null}}function y(t,e){try{return typeof t=="string"?(e!=null?e:document).querySelectorAll(t):t!=null?t:j}catch{return j}}function g(t,e){var n,r;return(r=(n=t==null?void 0:t.classList)==null?void 0:n.contains(e))!=null?r:!1}function L(t,e){var n;return((n=t==null?void 0:t.tagName)==null?void 0:n.toLowerCase())===e}function C(t,e){var n;return((n=t==null?void 0:t.type)==null?void 0:n.toLowerCase())===e}function h(t,e){var n;(n=t==null?void 0:t.classList)==null||n.add(e)}function f(t,e){var n;(n=t==null?void 0:t.classList)==null||n.remove(e)}function p(t,e,n,r=!0){t==null||t.addEventListener(e,n,r)}function H(t,e,n,r=!0){t==null||t.removeEventListener(e,n,r)}function Y(t,e){var n;(n=e==null?void 0:e.parentNode)==null||n.insertBefore(t,e)}function N(t){return t==null?void 0:t.previousElementSibling}function K(t){return t==null?void 0:t.nextElementSibling}function k(t){return t==null?void 0:t.parentElement}function J(t){const e=document.createElement("div");for(let n=0,r=Object.keys(t),a=r.length;n{A()},180)}function $(t,e){if(e&&e.key==="Enter"){const a=N(t);return C(a,"file")?a.click():void 0}const n=t,r=K(t);!C(r,"text")||(r.value=n.files?Array.from(n.files).map(a=>a.name).join(", "):"",r.readOnly=!0,p(r,"keydown",ct,!1),w(r))}function _(t,e){if(e&&e.key==="Enter"){const a=N(t);return C(a,"color")?a.click():void 0}const n=t,r=K(t);!C(r,"text")||(r.readOnly=!0,r.value=n.value,p(r,"keydown",ut,!1),w(r))}function Z(t){const e=k(t),n=k(t);e.removeAttribute("style"),g(e,"min")&&e.style.setProperty("---size",`${Math.max(t.scrollHeight,n.offsetHeight)}px`)}function V(t){const e=k(t),n=x("span",e),r=y("input",e);if(!r.length||!n)return;const a=parseInt(getComputedStyle(document.documentElement).getPropertyValue("--size"))||16,c=g(e,"max")?0:.25*a*100/r[0].offsetWidth,o=[],l=[];for(let T=0,W=r.length;T1&&(i=Math.abs(o[1]-o[0]),u=o[1]>o[0]?o[0]:o[1],s=100-u-i,b>v&&(v=l[1]||0,b=l[0])),e.style.setProperty("---start",`${u}%`),e.style.setProperty("---end",`${s}%`),e.style.setProperty("---value1",`'${v}'`),e.style.setProperty("---value2",`'${b}'`)}function F(t){if(t){const n=t.target;if(n.type==="range")return V(n)}const e=y(".slider > input[type=range]");e.length?p(globalThis,"input",F,!1):H(globalThis,"input",F,!1);for(let n=0,r=e.length;n{var a,c;if(p(document.body,"click",R),E(t),g(e,"active")){if(!n)return f(e,"active");const o=n.target,l=x((a=o.getAttribute("data-ui"))!=null?a:""),i=o.closest("menu"),u=!x("menu",(c=o.closest("[data-ui]"))!=null?c:void 0);return l&&l!==i?I(o,l):!l&&!u&&i?!1:f(e,"active")}const r=y("menu.active");for(let o=0,l=r.length;o{c||(f(t,"active"),f(e,"active"),f(n,"active"),r.close())},l){const u=y("dialog, a, .overlay",o);for(let s=0,v=u.length;s{f(e,"active")},n!=null?n:6e3))}function gt(){if(d.light&&d.dark)return d;const t=document.createElement("body");t.className="light",document.body.appendChild(t);const e=document.createElement("body");e.className="dark",document.body.appendChild(e);const n=getComputedStyle(t),r=getComputedStyle(e),a=["--primary","--on-primary","--primary-container","--on-primary-container","--secondary","--on-secondary","--secondary-container","--on-secondary-container","--tertiary","--on-tertiary","--tertiary-container","--on-tertiary-container","--error","--on-error","--error-container","--on-error-container","--background","--on-background","--surface","--on-surface","--surface-variant","--on-surface-variant","--outline","--outline-variant","--shadow","--scrim","--inverse-surface","--inverse-on-surface","--inverse-primary","--surface-dim","--surface-bright","--surface-container-lowest","--surface-container-low","--surface-container","--surface-container-high","--surface-container-highest"];for(let c=0,o=a.length;c{const r=a=>{let c="";for(let o=0,l=Object.keys(a),i=l.length;o label");for(let i=0,u=r.length;i input:not([type=file], [type=color], [type=range]), .field > select, .field > textarea");for(let i=0,u=a.length;i input[type=file]");for(let i=0,u=c.length;i input[type=color]");for(let i=0,u=o.length;i textarea");for(let i=0,u=l.length;iawait A("setup"));globalThis.beercss=A;globalThis.ui=A; export default globalThis.ui;