var g=class extends HTMLElement{connectedCallback(){this.created||(document.addEventListener("menutrigger:expand",t=>{this.classList.toggle("visible",t.detail==="true")}),this.created=!0)}};customElements&&customElements.define&&customElements.define("amedia-menubar",g);var p=class extends HTMLElement{toggle(t){this.content.setAttribute("aria-hidden",t.detail==="true"?"false":"true")}connectedCallback(){this.created||(this.content=this.getElementsByClassName("amedia-menu").amediamenu,document.addEventListener("menutrigger:expand",t=>this.toggle(t)),this.created=!0)}};customElements&&customElements.define&&customElements.define("amedia-menu-container",p);var x=class extends HTMLElement{constructor(){super(),this.addEventListener("click",()=>this.toggle()),this.expanded=this.getAttribute("expanded")||"false"}toggle(){this.expanded=this.expanded==="true"?"false":"true",this.classList.toggle("pushed",this.expanded==="true");let t=this.querySelector("button");if(t){t.setAttribute("aria-expanded",this.expanded);let n=this.expanded==="true"?"Lukk hovedmeny":"\xC5pne hovedmeny";t.setAttribute("aria-label",n)}let s=new CustomEvent("menutrigger:expand",{detail:this.expanded});document.dispatchEvent(s)}};customElements&&customElements.define&&customElements.define("amedia-menutrigger",x);var H=document.createElement.bind(document);function w(e,t){return e*=100,t*=100,(Math.random()*(t-e+1)+e)/100}var i=Math.PI/2*3,L=.3,D=1,y=.06,k=8,h=Math.PI/k,S,a=18;function P(e,t){let s=document.createElement("canvas");s.width=a*t,s.height=a*t;let n=s.getContext("2d");n.scale(t,t);let d=a/2,m=a/(a/2),v=a/3-1,r=a/2,u=a/2,c=r,o=u;n.fillStyle=e,n.beginPath(),n.moveTo(r,u-d);let M=k;for(;M>0;)c=r+Math.cos(i)*d,o=u+Math.sin(i)*d,n.lineTo(c,o),i+=h,c=r+Math.cos(i)*m,o=u+Math.sin(i)*m,n.lineTo(c,o),i+=h,c=r+Math.cos(i)*v,o=u+Math.sin(i)*v,n.lineTo(c,o),i+=h,c=r+Math.cos(i)*m,o=u+Math.sin(i)*m,n.lineTo(c,o),i+=h,M-=1;return n.lineTo(r,u-d),n.fill(),n.closePath(),s}function I(e,t,s,n){return S===void 0&&(S=P(t,s)),{x:n.x,y:n.y,ctx:e,color:t,pulseDir:1,starScale:w(L,D),ratio:s}}function q(e,t){let{ctx:s}=e;s.globalAlpha=t,s.setTransform(e.ratio,0,0,e.ratio,0,0),s.translate(e.x,e.y);let n=a*t;s.drawImage(S,-(n/2),-(n/2),n,n),s.globalAlpha=1}function z(e){return e.pulseDir===1?(e.starScale-=y,e.starScale<L&&(e.pulseDir=-1)):(e.starScale+=y,e.starScale>D&&(e.pulseDir=1)),e.starScale}function $(e){q(e,z(e))}var C=25,l=H("canvas"),f=l.getContext("2d"),A=[],T="#fff",E=0,B=Date.now(),F=window.matchMedia("(prefers-reduced-motion: reduce)");function R(){if(F.matches||Date.now()-B>5e3||(requestAnimationFrame(R),E=(E+1)%4,E!==0))return;f.setTransform(1,0,0,1,0,0),f.clearRect(0,0,l.width,l.height);let e=C;for(;e>0;)e-=1,$(A[e])}var b=class extends HTMLElement{init(){if(new Date().getMonth()!==11)return;let t=this.offsetWidth,s=this.offsetHeight,n=window.devicePixelRatio||1;T=this.getAttribute("star-color"),l.width=t*n,l.height=s*n,l.style.width=`${t}px`,l.style.height=`${s}px`,f.scale(n,n),this.appendChild(l);let d=C;for(;d>0;)d-=1,A.push(I(f,T,n,{x:w(10,t-10),y:w(10,s-10)}));window.addEventListener("load",()=>R())}connectedCallback(){this.created||this.init(),this.created=!0}};customElements&&customElements.define&&customElements.define("foxfield-xmas",b);
//# sourceMappingURL=index.js.map
