requestmovies/data/wwwroot/beer.min.js

3 lines
9.6 KiB
JavaScript

const V=[];function E(){return window.matchMedia("(pointer: coarse)").matches}function ut(){return window.matchMedia("(prefers-color-scheme: dark)").matches}async function W(t){await new Promise(n=>setTimeout(n,t))}function lt(){return"fxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,t=>{const n=Math.random()*16|0;return(t==="x"?n:n&3|8).toString(16)})}function x(t,n){try{return typeof t=="string"?(n??document).querySelector(t):t}catch{return null}}function s(t,n){try{return typeof t=="string"?(n??document).querySelectorAll(t):t??V}catch{return V}}function a(t,n){return(t==null?void 0:t.classList.contains(n))??!1}function p(t,n){var e;return((e=t==null?void 0:t.tagName)==null?void 0:e.toLowerCase())===n}function C(t,n){var e;return((e=t==null?void 0:t.type)==null?void 0:e.toLowerCase())===n}function y(t,n){if(t instanceof NodeList)for(let e=0;e<t.length;e++)t[e].classList.add(n);else t==null||t.classList.add(n)}function f(t,n){if(t instanceof NodeList)for(let e=0;e<t.length;e++)t[e].classList.remove(n);else t==null||t.classList.remove(n)}function o(t,n,e,i=!0){t!=null&&t.addEventListener&&t.addEventListener(n,e,i)}function F(t,n,e,i=!0){t!=null&&t.removeEventListener&&t.removeEventListener(n,e,i)}function ft(t,n){var e;(e=n==null?void 0:n.parentNode)==null||e.insertBefore(t,n)}function O(t){return t==null?void 0:t.previousElementSibling}function N(t){return t==null?void 0:t.nextElementSibling}function b(t){return t==null?void 0:t.parentElement}function dt(t){const n=document.createElement("div");for(let e=0,i=Object.keys(t),u=i.length;e<u;e++){const c=i[e],r=t[c];n.setAttribute(c,r)}return n}function _(){var t;(t=document.activeElement)==null||t.blur()}function pt(t){return s('[data-ui="#'+t+'"]')}function yt(t){return x('[data-ui="#'+t+'"]')}function gt(t){t.id&&a(t,"page")&&(t=yt(t.id)??t);const n=b(t);if(!a(n,"tabs")&&!a(n,"tabbed")&&!p(n,"nav"))return;const e=s("a",n);for(let i=0;i<e.length;i++)f(e[i],"active");y(t,"active")}function G(t){t.placeholder||(t.placeholder=" ")}function ht(t){const n=t.currentTarget,e=b(n),i=x("input:not([type=file], [type=checkbox], [type=radio]), select, textarea",e);i&&i.focus()}function $(t){const n=t.currentTarget;w(n)}function q(t){const n=t.currentTarget;w(n)}function vt(t){const n=t.currentTarget;z(n)}function bt(t){const n=t.currentTarget;B(n)}function kt(t){const n=t.currentTarget;z(n,t)}function xt(t){const n=t.currentTarget;B(n,t)}function mt(t){const n=t.currentTarget;Q(n)}function Tt(){const t=s(".field > label");for(let n=0;n<t.length;n++)o(t[n],"click",ht)}function Ct(){const t=s(".field > input:not([type=file], [type=color], [type=range])");for(let n=0;n<t.length;n++)o(t[n],"focus",$),o(t[n],"blur",q),w(t[n])}function wt(){const t=s(".field > select");for(let n=0;n<t.length;n++)o(t[n],"focus",$),o(t[n],"blur",q)}function Lt(){const t=s(".field > input[type=file]");for(let n=0;n<t.length;n++)o(t[n],"change",vt),z(t[n])}function At(){const t=s(".field > input[type=color]");for(let n=0;n<t.length;n++)o(t[n],"change",bt),B(t[n])}function Et(){const t=s(".field.textarea > textarea");for(let n=0;n<t.length;n++)o(t[n],"focus",$),o(t[n],"blur",q),o(t[n],"input",mt),Q(t[n])}function w(t){C(t,"number")&&!t.value&&(t.value=""),G(t)}function z(t,n){if((n==null?void 0:n.key)==="Enter"){const i=O(t);if(!C(i,"file"))return;i.click();return}const e=N(t);C(e,"text")&&(e.value=t.files?Array.from(t.files).map(i=>i.name).join(", "):"",e.readOnly=!0,o(e,"keydown",kt,!1),w(e))}function B(t,n){if((n==null?void 0:n.key)==="Enter"){const i=O(t);if(!C(i,"color"))return;i.click();return}const e=N(t);C(e,"text")&&(e.readOnly=!0,e.value=t.value,o(e,"keydown",xt,!1),w(e))}function Q(t){G(t);const n=b(t);n.removeAttribute("style"),a(n,"min")&&n.style.setProperty("---size",`${Math.max(t.scrollHeight,n.offsetHeight)}px`)}function St(){Tt(),Ct(),wt(),Lt(),At(),Et()}function H(t){const n=t.target;!p(n,"input")&&!p(n,"select")||(n.type==="range"?(n.focus(),Y(n)):X())}function Dt(t){if(!E())return;const n=t.target,e=b(n);a(e,"vertical")&&document.body.classList.add("no-scroll")}function Mt(t){if(!E())return;const n=t.target,e=b(n);a(e,"vertical")&&document.body.classList.remove("no-scroll")}function X(){const t=document.body,n=s(".slider > input[type=range]");n.length?o(t,"input",H,!1):F(t,"input",H,!1);for(let e=0;e<n.length;e++)Y(n[e])}function Y(t){o(t,"focus",Dt),o(t,"blur",Mt);const n=b(t),e=x("span",n),i=s("input",n);if(!i.length||!e)return;const u=parseInt(getComputedStyle(document.documentElement).getPropertyValue("--size"))||16,c=a(n,"max")?0:.25*u*100/i[0].offsetWidth,r=[],d=[];for(let v=0,ct=i.length;v<ct;v++){const R=parseFloat(i[v].min)||0,at=parseFloat(i[v].max)||100,j=parseFloat(i[v].value)||0,U=(j-R)*100/(at-R),st=c/2-c*U/100;r.push(U+st),d.push(j)}let g=r[0],h=0,L=100-h-g,k=d[0],m=d[1]||0;i.length>1&&(g=Math.abs(r[1]-r[0]),h=r[1]>r[0]?r[0]:r[1],L=100-h-g,m>k&&(k=d[1]||0,m=d[0])),n.style.setProperty("---start",`${h}%`),n.style.setProperty("---end",`${L}%`),n.style.setProperty("---value1",`'${k}'`),n.style.setProperty("---value2",`'${m}'`)}function It(){X()}const l={light:"",dark:""};function I(){var t;return(t=document==null?void 0:document.body)!=null&&t.classList.contains("dark")?"dark":"light"}function Pt(){if(l.light&&l.dark)return l;const t=document.body,n=document.createElement("body");n.className="light",t.appendChild(n);const e=document.createElement("body");e.className="dark",t.appendChild(e);const i=getComputedStyle(n),u=getComputedStyle(e),c=["--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 r=0,d=c.length;r<d;r++)l.light+=c[r]+":"+i.getPropertyValue(c[r])+";",l.dark+=c[r]+":"+u.getPropertyValue(c[r])+";";return t.removeChild(n),t.removeChild(e),l}function Ft(t){const n=globalThis,e=document.body;if(!t||!n.materialDynamicColors)return Pt();const i=I();return t.light&&t.dark?(l.light=t.light,l.dark=t.dark,e.setAttribute("style",t[i]),t):n.materialDynamicColors(t).then(u=>{const c=r=>{let d="";for(let g=0,h=Object.keys(r),L=h.length;g<L;g++){const k=h[g],m=r[k],v=k.replace(/([a-z0-9]|(?=[A-Z]))([A-Z])/g,"$1-$2").toLowerCase();d+="--"+v+":"+m+";"}return d};return l.light=c(u.light),l.dark=c(u.dark),e.setAttribute("style",l[i]),l})}function J(t){const n=globalThis,e=document.body;if(!e)return t;if(!t)return I();t==="auto"&&(t=ut()?"dark":"light"),e.classList.remove("light","dark"),e.classList.add(t);const i=t==="light"?l.light:l.dark;return n.materialDynamicColors&&e.setAttribute("style",i),I()}const A=[];function tt(t){if(t.key==="Escape"){const n=t.currentTarget;et(n,n)}}function nt(t,n){f(pt(t.id),"active"),f(t,"active"),f(n,"active"),t.close(),A.pop();const e=A[A.length-1];e?e.focus():E()&&document.body.classList.remove("no-scroll")}async function Ot(t,n,e,i){!p(i,"button")&&!a(i,"button")&&!a(i,"chip")&&y(i,"active"),y(n,"active"),y(t,"active"),e?t.showModal():t.show(),await W(90),e||o(t,"keydown",tt,!1),A.push(t),t.focus(),E()&&document.body.classList.add("no-scroll")}function Nt(t){const n=t.currentTarget,e=N(n);p(e,"dialog")&&nt(e,n)}async function et(t,n){_();let e=O(n);const i=a(n,"active")||n.open,u=a(n,"modal");u||F(n,"keydown",tt,!1),a(e,"overlay")||(e=dt({class:"overlay"}),ft(e,n),await W(90)),u||o(e,"click",Nt,!1),i?nt(n,e):Ot(n,e,u,t)}let S;function it(t){F(document.body,"click",it);const n=t.target,e=s("menu.active");for(let i=0;i<e.length;i++)ot(n,e[i],t)}function _t(t){setTimeout(()=>{const n=x(".field > input",t);n?n.focus():t.focus()},90)}function ot(t,n,e){S&&clearTimeout(S),S=setTimeout(()=>{o(document.body,"click",it),p(document.activeElement,"input")||_();const i=a(n,"active"),u=(e==null?void 0:e.target)===t,c=!!t.closest("menu");if(!i&&c||i&&u){f(n,"active");return}f(s("menu.active"),"active"),y(n,"active"),_t(n)},90)}let T;function $t(t){const n=t.currentTarget;f(n,"active"),T&&clearTimeout(T)}function qt(t,n){_();const e=s(".snackbar.active");for(let i=0;i<e.length;i++)f(e[i],"active");y(t,"active"),o(t,"click",$t),T&&clearTimeout(T),n!==-1&&(T=setTimeout(()=>{f(t,"active")},n??6e3))}function zt(t){const n=b(t);n&&f(s(".page",n),"active"),y(t,"active")}let D,M;function Z(){D&&clearTimeout(D),D=setTimeout(async()=>await P(),180)}async function K(t,n,e,i){if(!(!n&&(n=x(t.getAttribute("data-ui")),!n))){if(gt(t),p(n,"dialog")){await et(t,n);return}if(p(n,"menu")){ot(t,n,i);return}if(a(n,"snackbar")){qt(n,e);return}if(a(n,"page")){zt(n);return}if(a(n,"active")){f(t,"active"),f(n,"active");return}y(n,"active")}}function Bt(t){K(t.currentTarget,null,null,t)}function Kt(t){t.key==="Enter"&&K(t.currentTarget,null,null,t)}function rt(){M||(M=new MutationObserver(Z),M.observe(document.body,{childList:!0,subtree:!0}),Z())}function Rt(){const t=s("[data-ui]");for(let n=0,e=t.length;n<e;n++)o(t[n],"click",Bt),p(t[n],"a")&&!t[n].getAttribute("href")&&o(t[n],"keydown",Kt)}function P(t,n){if(t){if(t==="setup"){rt();return}if(t==="guid")return lt();if(t==="mode")return J(n);if(t==="theme")return Ft(n);const e=x(t);if(!e)return;K(e,e,n)}Rt(),St(),It()}function jt(){var e;const t=globalThis,n=(e=t==null?void 0:t.document)==null?void 0:e.body;n&&!n.classList.contains("dark")&&!n.classList.contains("light")&&J("auto"),o(t,"load",rt,!1),t.beercss=P,t.ui=P}jt();
export default globalThis.ui;