From 93ee875b0aafd933d944008d97c5775e94a45207 Mon Sep 17 00:00:00 2001 From: Azgaar Date: Sun, 30 Jun 2024 17:39:24 +0000 Subject: [PATCH] =?UTF-8?q?Deploying=20to=20gh-pages=20from=20@=20Azgaar/s?= =?UTF-8?q?pell-caster@7d834eabd3f07dc93a0ee67b3b6db3a8c2743457=20?= =?UTF-8?q?=F0=9F=9A=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- assets/index-BfT9z44A.js | 15 --------------- assets/index-BfT9z44A.js.map | 1 - assets/index-hplJRtDP.js | 15 +++++++++++++++ assets/index-hplJRtDP.js.map | 1 + index.html | 2 +- 5 files changed, 17 insertions(+), 17 deletions(-) delete mode 100644 assets/index-BfT9z44A.js delete mode 100644 assets/index-BfT9z44A.js.map create mode 100644 assets/index-hplJRtDP.js create mode 100644 assets/index-hplJRtDP.js.map diff --git a/assets/index-BfT9z44A.js b/assets/index-BfT9z44A.js deleted file mode 100644 index c84b8a0..0000000 --- a/assets/index-BfT9z44A.js +++ /dev/null @@ -1,15 +0,0 @@ -var pn=Object.defineProperty;var $n=(e,t,n)=>t in e?pn(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var V=(e,t,n)=>$n(e,typeof t!="symbol"?t+"":t,n);(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))r(s);new MutationObserver(s=>{for(const o of s)if(o.type==="childList")for(const i of o.addedNodes)i.tagName==="LINK"&&i.rel==="modulepreload"&&r(i)}).observe(document,{childList:!0,subtree:!0});function n(s){const o={};return s.integrity&&(o.integrity=s.integrity),s.referrerPolicy&&(o.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?o.credentials="include":s.crossOrigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function r(s){if(s.ep)return;s.ep=!0;const o=n(s);fetch(s.href,o)}})();function U(){}const dt=e=>e;function _n(e,t){for(const n in t)e[n]=t[n];return e}function Lt(e){return e()}function Mt(){return Object.create(null)}function ge(e){e.forEach(Lt)}function Be(e){return typeof e=="function"}function re(e,t){return e!=e?t==t:e!==t||e&&typeof e=="object"||typeof e=="function"}let Ve;function yn(e,t){return e===t?!0:(Ve||(Ve=document.createElement("a")),Ve.href=t,e===Ve.href)}function bn(e){return Object.keys(e).length===0}function vn(e,...t){if(e==null){for(const r of t)r(void 0);return U}const n=e.subscribe(...t);return n.unsubscribe?()=>n.unsubscribe():n}function wn(e,t,n){e.$$.on_destroy.push(vn(t,n))}function Tt(e,t,n,r){if(e){const s=Ht(e,t,n,r);return e[0](s)}}function Ht(e,t,n,r){return e[1]&&r?_n(n.ctx.slice(),e[1](r(t))):n.ctx}function Vt(e,t,n,r){if(e[2]&&r){const s=e[2](r(n));if(t.dirty===void 0)return s;if(typeof s=="object"){const o=[],i=Math.max(t.dirty.length,s.length);for(let a=0;a32){const t=[],n=e.ctx.length/32;for(let r=0;rwindow.performance.now():()=>Date.now(),ht=Jt?e=>requestAnimationFrame(e):U;const Ye=new Set;function Qt(e){Ye.forEach(t=>{t.c(e)||(Ye.delete(t),t.f())}),Ye.size!==0&&ht(Qt)}function Zt(e){let t;return Ye.size===0&&ht(Qt),{promise:new Promise(n=>{Ye.add(t={c:e,f:n})}),abort(){Ye.delete(t)}}}function h(e,t){e.appendChild(t)}function en(e){if(!e)return document;const t=e.getRootNode?e.getRootNode():e.ownerDocument;return t&&t.host?t:e.ownerDocument}function kn(e){const t=y("style");return t.textContent="/* empty */",Mn(en(e),t),t.sheet}function Mn(e,t){return h(e.head||e,t),t.sheet}function C(e,t,n){e.insertBefore(t,n||null)}function P(e){e.parentNode&&e.parentNode.removeChild(e)}function xn(e,t){for(let n=0;ne.removeEventListener(t,n,r)}function f(e,t,n){n==null?e.removeAttribute(t):e.getAttribute(t)!==n&&e.setAttribute(t,n)}function Sn(e){return Array.from(e.childNodes)}function fe(e,t){t=""+t,e.data!==t&&(e.data=t)}function En(e,t,{bubbles:n=!1,cancelable:r=!1}={}){return new CustomEvent(e,{detail:t,bubbles:n,cancelable:r})}const Ke=new Map;let Qe=0;function Pn(e){let t=5381,n=e.length;for(;n--;)t=(t<<5)-t^e.charCodeAt(n);return t>>>0}function zn(e,t){const n={stylesheet:kn(t),rules:{}};return Ke.set(e,n),n}function nn(e,t,n,r,s,o,i,a=0){const l=16.666/r;let c=`{ -`;for(let p=0;p<=1;p+=l){const w=t+(n-t)*o(p);c+=p*100+`%{${i(w,1-w)}} -`}const u=c+`100% {${i(n,1-n)}} -}`,m=`__svelte_${Pn(u)}_${a}`,$=en(e),{stylesheet:_,rules:g}=Ke.get($)||zn($,e);g[m]||(g[m]=!0,_.insertRule(`@keyframes ${m} ${u}`,_.cssRules.length));const d=e.style.animation||"";return e.style.animation=`${d?`${d}, `:""}${m} ${r}ms linear ${s}ms 1 both`,Qe+=1,m}function ct(e,t){const n=(e.style.animation||"").split(", "),r=n.filter(t?o=>o.indexOf(t)<0:o=>o.indexOf("__svelte")===-1),s=n.length-r.length;s&&(e.style.animation=r.join(", "),Qe-=s,Qe||Cn())}function Cn(){ht(()=>{Qe||(Ke.forEach(e=>{const{ownerNode:t}=e.stylesheet;t&&P(t)}),Ke.clear())})}let je;function Ie(e){je=e}function An(){if(!je)throw new Error("Function called outside component initialization");return je}function rn(e){An().$$.on_mount.push(e)}const Ae=[],oe=[];let Xe=[];const St=[],Yn=Promise.resolve();let ft=!1;function Xn(){ft||(ft=!0,Yn.then(sn))}function ie(e){Xe.push(e)}const at=new Set;let ze=0;function sn(){if(ze!==0)return;const e=je;do{try{for(;zee.indexOf(r)===-1?t.push(r):n.push(r)),n.forEach(r=>r()),Xe=t}let Re;function on(){return Re||(Re=Promise.resolve(),Re.then(()=>{Re=null})),Re}function Ze(e,t,n){e.dispatchEvent(En(`${t?"intro":"outro"}${n}`))}const Je=new Set;let ue;function de(){ue={r:0,c:[],p:ue}}function he(){ue.r||ge(ue.c),ue=ue.p}function k(e,t){e&&e.i&&(Je.delete(e),e.i(t))}function E(e,t,n,r){if(e&&e.o){if(Je.has(e))return;Je.add(e),ue.c.push(()=>{Je.delete(e),r&&(n&&e.d(1),r())}),e.o(t)}else r&&r()}const an={duration:0};function tt(e,t,n){const r={direction:"in"};let s=t(e,n,r),o=!1,i,a,l=0;function c(){i&&ct(e,i)}function u(){const{delay:$=0,duration:_=300,easing:g=dt,tick:d=U,css:p}=s||an;p&&(i=nn(e,0,1,_,$,g,p,l++)),d(0,1);const w=Kt()+$,A=w+_;a&&a.abort(),o=!0,ie(()=>Ze(e,!0,"start")),a=Zt(X=>{if(o){if(X>=A)return d(1,0),Ze(e,!0,"end"),c(),o=!1;if(X>=w){const O=g((X-w)/_);d(O,1-O)}}return o})}let m=!1;return{start(){m||(m=!0,ct(e),Be(s)?(s=s(r),on().then(u)):u())},invalidate(){m=!1},end(){o&&(c(),o=!1)}}}function ln(e,t,n){const r={direction:"out"};let s=t(e,n,r),o=!0,i;const a=ue;a.r+=1;let l;function c(){const{delay:u=0,duration:m=300,easing:$=dt,tick:_=U,css:g}=s||an;g&&(i=nn(e,1,0,m,u,$,g));const d=Kt()+u,p=d+m;ie(()=>Ze(e,!1,"start")),"inert"in e&&(l=e.inert,e.inert=!0),Zt(w=>{if(o){if(w>=p)return _(0,1),Ze(e,!1,"end"),--a.r||ge(a.c),!1;if(w>=d){const A=$((w-d)/m);_(1-A,A)}}return o})}return Be(s)?on().then(()=>{s=s(r),c()}):c(),{end(u){u&&"inert"in e&&(e.inert=l),u&&s.tick&&s.tick(1,0),o&&(i&&ct(e,i),o=!1)}}}function De(e){return(e==null?void 0:e.length)!==void 0?e:Array.from(e)}function Rn(e,t){e.d(1),t.delete(e.key)}function qn(e,t){E(e,1,1,()=>{t.delete(e.key)})}function cn(e,t,n,r,s,o,i,a,l,c,u,m){let $=e.length,_=o.length,g=$;const d={};for(;g--;)d[e[g].key]=g;const p=[],w=new Map,A=new Map,X=[];for(g=_;g--;){const M=m(s,o,g),q=n(M);let W=i.get(q);W?X.push(()=>W.p(M,t)):(W=c(q,M),W.c()),w.set(q,p[g]=W),q in d&&A.set(q,Math.abs(g-d[q]))}const O=new Set,S=new Set;function b(M){k(M,1),M.m(a,u),i.set(M.key,M),u=M.first,_--}for(;$&&_;){const M=p[_-1],q=e[$-1],W=M.key,H=q.key;M===q?(u=M.first,$--,_--):w.has(H)?!i.has(W)||O.has(W)?b(M):S.has(H)?$--:A.get(W)>A.get(H)?(S.add(W),b(M)):(O.add(H),$--):(l(q,i),$--)}for(;$--;){const M=e[$];w.has(M.key)||l(M,i)}for(;_;)b(p[_-1]);return ge(X),p}function T(e){e&&e.c()}function B(e,t,n){const{fragment:r,after_update:s}=e.$$;r&&r.m(t,n),ie(()=>{const o=e.$$.on_mount.map(Lt).filter(Be);e.$$.on_destroy?e.$$.on_destroy.push(...o):ge(o),e.$$.on_mount=[]}),s.forEach(ie)}function F(e,t){const n=e.$$;n.fragment!==null&&(Nn(n.after_update),ge(n.on_destroy),n.fragment&&n.fragment.d(t),n.on_destroy=n.fragment=null,n.ctx=[])}function In(e,t){e.$$.dirty[0]===-1&&(Ae.push(e),Xn(),e.$$.dirty.fill(0)),e.$$.dirty[t/31|0]|=1<{const g=_.length?_[0]:$;return c.ctx&&s(c.ctx[m],c.ctx[m]=g)&&(!c.skip_bound&&c.bound[m]&&c.bound[m](g),u&&In(e,m)),$}):[],c.update(),u=!0,ge(c.before_update),c.fragment=r?r(c.ctx):!1,t.target){if(t.hydrate){const m=Sn(t.target);c.fragment&&c.fragment.l(m),m.forEach(P)}else c.fragment&&c.fragment.c();t.intro&&k(e.$$.fragment),B(e,t.target,t.anchor),sn()}Ie(l)}class xe{constructor(){V(this,"$$");V(this,"$$set")}$destroy(){F(this,1),this.$destroy=U}$on(t,n){if(!Be(n))return U;const r=this.$$.callbacks[t]||(this.$$.callbacks[t]=[]);return r.push(n),()=>{const s=r.indexOf(n);s!==-1&&r.splice(s,1)}}$set(t){this.$$set&&!bn(t)&&(this.$$.skip_bound=!0,this.$$set(t),this.$$.skip_bound=!1)}}const jn="4";typeof window<"u"&&(window.__svelte||(window.__svelte={v:new Set})).v.add(jn);const Ce=[];function On(e,t=U){let n;const r=new Set;function s(a){if(re(e,a)&&(e=a,n)){const l=!Ce.length;for(const c of r)c[1](),Ce.push(c,e);if(l){for(let c=0;c{r.delete(c),r.size===0&&n&&(n(),n=null)}}return{set:s,update:o,subscribe:i}}const we=On("canvas");function Wn(e){return e<.5?4*e*e*e:.5*Math.pow(2*e-2,3)+1}function Bn(e){const t=e-1;return t*t*t+1}function Et(e,{delay:t=0,duration:n=400,easing:r=dt}={}){const s=+getComputedStyle(e).opacity;return{delay:t,duration:n,easing:r,css:o=>`opacity: ${o*s}`}}function Pt(e,{delay:t=0,duration:n=400,easing:r=Bn,x:s=0,y:o=0,opacity:i=0}={}){const a=getComputedStyle(e),l=+a.opacity,c=a.transform==="none"?"":a.transform,u=l*(1-i),[m,$]=xt(s),[_,g]=xt(o);return{delay:t,duration:n,easing:r,css:(d,p)=>` - transform: ${c} translate(${(1-d)*m}${$}, ${(1-d)*_}${g}); - opacity: ${l-u*p}`}}function fn(e,{delay:t=0,speed:n,duration:r,easing:s=Wn}={}){let o=e.getTotalLength();const i=getComputedStyle(e);return i.strokeLinecap!=="butt"&&(o+=parseInt(i.strokeWidth)),r===void 0?n===void 0?r=800:r=o/n:typeof r=="function"&&(r=r(o)),{delay:t,duration:r,easing:s,css:(a,l)=>` - stroke-dasharray: ${o}; - stroke-dashoffset: ${l*o}; - `}}function Fn(e){let t,n,r,s;const o=e[1].default,i=Tt(o,e,e[0],null);return{c(){t=y("div"),i&&i.c(),f(t,"aria-label","page container"),f(t,"class","flex w-full h-full")},m(a,l){C(a,t,l),i&&i.m(t,null),s=!0},p(a,[l]){e=a,i&&i.p&&(!s||l&1)&&Ut(i,o,e,e[0],s?Vt(o,e[0],l,null):Gt(e[0]),null)},i(a){s||(k(i,a),a&&ie(()=>{s&&(r&&r.end(1),n=tt(t,Et,{duration:Ue,delay:Ue}),n.start())}),s=!0)},o(a){E(i,a),n&&n.invalidate(),a&&(r=ln(t,Et,{duration:Ue,delay:Ue})),s=!1},d(a){a&&P(t),i&&i.d(a),a&&r&&r.end()}}}const Ue=300;function Ln(e,t,n){let{$$slots:r={},$$scope:s}=t;return e.$$set=o=>{"$$scope"in o&&n(0,s=o.$$scope)},[s,r]}class nt extends xe{constructor(t){super(),Me(this,t,Ln,Fn,re,{})}}function Tn(e){let t,n,r,s;const o=e[3].default,i=Tt(o,e,e[2],null);return{c(){t=y("button"),i&&i.c(),f(t,"aria-current",e[1]),f(t,"class","p-2 bg-primary text-base font-fantasy text-light rounded transition duration-300 hover:bg-accent hover:shadow-glow aria-current:bg-accent/70")},m(a,l){C(a,t,l),i&&i.m(t,null),n=!0,r||(s=te(t,"click",function(){Be(e[0])&&e[0].apply(this,arguments)}),r=!0)},p(a,[l]){e=a,i&&i.p&&(!n||l&4)&&Ut(i,o,e,e[2],n?Vt(o,e[2],l,null):Gt(e[2]),null),(!n||l&2)&&f(t,"aria-current",e[1])},i(a){n||(k(i,a),n=!0)},o(a){E(i,a),n=!1},d(a){a&&P(t),i&&i.d(a),r=!1,s()}}}function Hn(e,t,n){let{$$slots:r={},$$scope:s}=t,{onClick:o}=t,{current:i=null}=t;return e.$$set=a=>{"onClick"in a&&n(0,o=a.onClick),"current"in a&&n(1,i=a.current),"$$scope"in a&&n(2,s=a.$$scope)},[o,i,s,r]}class ne extends xe{constructor(t){super(),Me(this,t,Hn,Tn,re,{onClick:0,current:1})}}const ke=Math.PI*2,Vn=273,Un=6,Gn=6,un=1e3;class me{constructor(t,n){V(this,"x");V(this,"y");this.x=t,this.y=n}}class Jn{constructor(t,n,r,s){V(this,"x");V(this,"y");V(this,"Width");V(this,"Height");this.x=t,this.y=n,this.Width=r,this.Height=s}}class lt{constructor(t,n){V(this,"Name");V(this,"Points");V(this,"Vector");this.Name=t,this.Points=rr(n,Kn);var r=sr(this.Points);this.Points=dn(this.Points,-r),this.Points=or(this.Points,qe),this.Points=ir(this.Points,Qn),this.Vector=ar(this.Points)}}class zt{constructor(t,n,r){V(this,"Name");V(this,"Score");V(this,"Time");this.Name=t,this.Score=n,this.Time=r}}const Kn=64,qe=250,Qn=new me(0,0),Zn=Math.sqrt(qe*qe+qe*qe),er=.5*Zn,Ct=hn(45),tr=hn(2),ce=.5*(-1+Math.sqrt(5));class nr{constructor(t){V(this,"Recognize");V(this,"AddGesture");const n=Object.entries(t).map(([r,s])=>new lt(r,s.map(([o,i])=>new me(o,i))));this.Recognize=function(r,s){for(var o=Date.now(),i=new lt("",r),a=-1,l=1/0,c=0;c=n){var a=e[o-1].x+(n-r)/i*(e[o].x-e[o-1].x),l=e[o-1].y+(n-r)/i*(e[o].y-e[o-1].y),c=new me(a,l);s[s.length]=c,e.splice(o,0,c),r=0}else r+=i}return s.length==t-1&&(s[s.length]=new me(e[e.length-1].x,e[e.length-1].y)),s}function sr(e){var t=mt(e);return Math.atan2(t.y-e[0].y,t.x-e[0].x)}function dn(e,t){for(var n=mt(e),r=Math.cos(t),s=Math.sin(t),o=[],i=0;is;)in.clearRect(0,0,e,t),150)}function gr({width:e,height:t,particles:n}){const r=e/2,s=t/2,o=50;for(let i=0;i<200;i++){const a=Math.random()*ke,l=r+Math.cos(a)*o,c=s+Math.sin(a)*o;n.push({x:l,y:c,size:Math.random()*5+2,speedX:Math.cos(a)*(Math.random()*5+2),speedY:Math.sin(a)*(Math.random()*5+2),color:`hsl(${Math.random()*60+240}, 100%, 50%)`,life:200})}}function pr({width:e,height:t,particles:n}){const r=t/2,s=e*1.5;for(let o=0;o=.95?`You cast ${e.name}! Excellent quality!`:t>=.85?`You cast ${e.name}! Great job!`:t>=.75?`Good job! ${e.name} casted!`:t>=.65?`${e.name} casted, but could be better.`:t>=.55?`${e.name} casted, but needs improvement.`:t>=.45?`Meh, ${e.name} must be cleaner.`:t>=.35?`Poor casting of ${e.name}. Try again!`:t>=.25?`Awful casting of ${e.name}. Try harder!`:t>=.15?`Just terrible, even my grandma can cast ${e.name} better`:`You're a disgrace to all wizards. ${e.name} is beyond your abilities.`}function Xr(e,t,n){let r,s,o,i,a,l,c,u="Draw a magical symbol to cast a spell!",m=!1,$=0,_=0,g=[],d=[];const{Recognize:p}=new nr(We);rn(()=>{w(),A()});function w(){[a,l,c].forEach(v=>{v.width=i.offsetWidth,v.height=i.offsetHeight})}function A(){b(),ae(),requestAnimationFrame(A)}function X(v){m=!0;const[N,I]=At(v);[$,_]=[N,I],g.push({x:$,y:_}),H({x:$,y:_,size:3,speedX:4,speedY:4,life:30})}function O(v){if(!r||!m)return;const[N,I]=At(v);r.beginPath(),r.moveTo($,_),r.lineTo(N,I),r.strokeStyle=`hsla(${Vn}, 100%, 50%, 1)`,r.lineWidth=4,r.lineCap="round",r.stroke();const J=$+(N-$),$e=_+(I-_);H({x:J,y:$e,size:3,speedX:4,speedY:4,life:30}),[$,_]=[N,I],g.push({x:N,y:I})}function S(){m=!1,M(g),W(g),g=[]}function b(){if(!a||!r||m)return;const v=r.getImageData(0,0,a.width,a.height),N=v.data;for(let I=3;I0&&(N[I]-=Un);r.putImageData(v,0,0)}function M(v){v.forEach(({x:N,y:I})=>{H({x:N,y:I,size:2,speedX:2,speedY:2,life:50})})}function q(){r==null||r.clearRect(0,0,a.width,a.height),s==null||s.clearRect(0,0,l.width,l.height),o==null||o.clearRect(0,0,c.width,c.height),g=[],d=[],n(4,u="Draw a magical symbol to cast a spell!")}function W(v){if(v.lengthJ.stroke===N.Name&&N.Score>=J.minScore);if(!I){n(4,u="You failed to cast a spell!");return}n(4,u=Yr(I,N.Score)),mn(I.effect,c,d)}function H({x:v,y:N,size:I,speedX:J,speedY:$e,life:Se}){d.push({x:v,y:N,size:Math.random()*I+2,speedX:Math.random()*J-J/2,speedY:Math.random()*$e-$e/2,color:`hsl(${Math.random()*60+240}, 100%, 50%)`,life:Se})}function ae(){!l||!s||(s.clearRect(0,0,l.width,l.height),d.forEach((v,N)=>{v.x+=v.speedX,v.y+=v.speedY,v.life--,v.size*=.99,s.fillStyle=v.color,s.beginPath(),s.arc(v.x,v.y,v.size,0,ke),s.fill(),(v.life<=0||v.size<.1)&&d.splice(N,1)}))}function D(v){oe[v?"unshift":"push"](()=>{a=v,n(0,a)})}function L(v){oe[v?"unshift":"push"](()=>{l=v,n(1,l)})}function Z(v){oe[v?"unshift":"push"](()=>{c=v,n(2,c)})}function pe(v){oe[v?"unshift":"push"](()=>{i=v,n(3,i)})}const se=()=>we.set("spellbook"),le=()=>we.set("strokes"),Fe=()=>we.set("effects");return e.$$.update=()=>{e.$$.dirty[0]&1&&(r=a==null?void 0:a.getContext("2d")),e.$$.dirty[0]&2&&(s=l==null?void 0:l.getContext("2d")),e.$$.dirty[0]&4&&(o=c==null?void 0:c.getContext("2d"))},[a,l,c,i,u,w,X,O,S,q,D,L,Z,pe,se,le,Fe]}class Dr extends xe{constructor(t){super(),Me(this,t,Xr,Cr,re,{},null,[-1,-1])}}function Yt(e,t,n){const r=e.slice();return r[12]=t[n][0],r}function Nr(e){let t,n;return{c(){t=y("h2"),t.textContent=`${e[12]}`,n=z(),f(t,"class","mb-2")},m(r,s){C(r,t,s),C(r,n,s)},p:U,d(r){r&&(P(t),P(n))}}}function Xt(e,t){let n,r,s;return r=new ne({props:{onClick:t[4](t[12]),$$slots:{default:[Nr]},$$scope:{ctx:t}}}),{key:e,first:null,c(){n=tn(),T(r.$$.fragment),this.first=n},m(o,i){C(o,n,i),B(r,o,i),s=!0},p(o,i){t=o;const a={};i&32768&&(a.$$scope={dirty:i,ctx:t}),r.$set(a)},i(o){s||(k(r.$$.fragment,o),s=!0)},o(o){E(r.$$.fragment,o),s=!1},d(o){o&&P(n),F(r,o)}}}function Rr(e){let t;return{c(){t=Y("Clear canvas")},m(n,r){C(n,t,r)},d(n){n&&P(t)}}}function qr(e){let t;return{c(){t=Y("Back to practice")},m(n,r){C(n,t,r)},d(n){n&&P(t)}}}function Ir(e){let t,n,r,s,o,i,a,l,c,u,m=[],$=new Map,_,g,d,p,w,A,X=De(Object.entries(ut));const O=S=>S[12];for(let S=0;S{n(1,s.width=r.offsetWidth,s),n(1,s.height=r.offsetHeight,s),n(2,o.width=r.offsetWidth,o),n(2,o.height=r.offsetHeight,o),a()});function a(){l(),requestAnimationFrame(a)}function l(){const d=s==null?void 0:s.getContext("2d");d&&(d.clearRect(0,0,s.width,s.height),i.forEach((p,w)=>{p.x+=p.speedX,p.y+=p.speedY,p.life--,p.size*=.99,d.fillStyle=p.color,d.beginPath(),d.arc(p.x,p.y,p.size,0,ke),d.fill(),(p.life<=0||p.size<.1)&&i.splice(w,1)}))}function c(){const d=s==null?void 0:s.getContext("2d");d==null||d.clearRect(0,0,s.width,s.height);const p=o==null?void 0:o.getContext("2d");p==null||p.clearRect(0,0,o.width,o.height),i=[]}function u(d){return()=>mn(d,o,i)}function m(d){oe[d?"unshift":"push"](()=>{s=d,n(1,s)})}function $(d){oe[d?"unshift":"push"](()=>{o=d,n(2,o)})}function _(d){oe[d?"unshift":"push"](()=>{r=d,n(0,r)})}return[r,s,o,c,u,m,$,_,()=>we.set("canvas")]}class Wr extends xe{constructor(t){super(),Me(this,t,Or,jr,re,{})}}function Dt(e,t,n){const r=e.slice();return r[5]=t[n],r[7]=n,r}function Nt(e){let t,n,r;return{c(){t=et("polyline"),f(t,"points",n=We[e[1].stroke].join(" ")),f(t,"fill","none"),f(t,"stroke","var(--primary-color)"),f(t,"stroke-width","3"),f(t,"stroke-linecap","round"),f(t,"stroke-linejoin","round")},m(s,o){C(s,t,o)},p(s,o){o&2&&n!==(n=We[s[1].stroke].join(" "))&&f(t,"points",n)},i(s){s&&(r||ie(()=>{r=tt(t,fn,{duration:un}),r.start()}))},o:U,d(s){s&&P(t)}}}function Br(e){let t=e[5].name+"",n;return{c(){n=Y(t)},m(r,s){C(r,n,s)},p:U,d(r){r&&P(n)}}}function Rt(e){let t,n;function r(){return e[3](e[7])}return t=new ne({props:{onClick:r,current:e[7]===e[0],$$slots:{default:[Br]},$$scope:{ctx:e}}}),{c(){T(t.$$.fragment)},m(s,o){B(t,s,o),n=!0},p(s,o){e=s;const i={};o&3&&(i.onClick=r),o&1&&(i.current=e[7]===e[0]),o&256&&(i.$$scope={dirty:o,ctx:e}),t.$set(i)},i(s){n||(k(t.$$.fragment,s),n=!0)},o(s){E(t.$$.fragment,s),n=!1},d(s){F(t,s)}}}function Fr(e){let t;return{c(){t=Y("Back to practice")},m(n,r){C(n,t,r)},d(n){n&&P(t)}}}function Lr(e){let t,n,r,s=e[1].name+"",o,i,a,l,c,u=e[1].name+"",m,$,_,g,d,p,w,A,X,O=e[1],S,b,M=e[1].name+"",q,W,H=e[1].name+"",ae,D,L,Z,pe,se=e[1].name+"",le,Fe,v,N,I,J,$e,Se=e[1].name+"",rt,pt,$t,_e,_t,Le=e[0]+1+"",st,yt,ot,ee,Te,bt,Ee,Pe,vt,ye,He,Ne,K,it,wt,Q=Nt(e),be=De(Oe),j=[];for(let x=0;xE(j[x],1,1,()=>{j[x]=null});return ye=new ne({props:{onClick:e[4],$$slots:{default:[Fr]},$$scope:{ctx:e}}}),{c(){t=y("main"),n=y("div"),r=y("h2"),o=Y(s),i=z(),a=y("div"),l=y("div"),c=y("p"),m=Y(u),$=Y(` is a fundamental chronomancy spell that freezes a target in time. When cast successfully, - the target becomes immobilized and unaware of the passage of time.`),_=z(),g=y("div"),g.innerHTML='

Difficulty: Novice

Energy Cost: 25

Duration: Up to 1 minute

Range: 30 feet

',d=z(),p=y("div"),w=y("div"),A=y("button"),X=et("svg"),Q.c(),S=z(),b=y("p"),q=Y(M),W=Y(` is often considered the cornerstone of chronomancy. Its ability to halt the flow of time - for a single target makes it invaluable in both combat and non-combat situations. When casting `),ae=Y(H),D=Y(`, - visualize time as a river flowing around your target. Your goal is to create a perfectly still eddy in - that river, isolating your target from the timestream.`),L=z(),Z=y("p"),pe=Y("Common applications of "),le=Y(se),Fe=Y(" include:"),v=z(),N=y("ul"),N.innerHTML="
  • Freezing an opponent in combat
  • Preserving a dying creature until healing can be administered
  • Protecting fragile objects during transport
  • Creating "living statues" for artistic or strategic purposes
  • ",I=z(),J=y("p"),$e=Y("Warning: overuse of "),rt=Y(Se),pt=Y(` on living beings can have unforeseen consequences. Always release the - spell carefully, allowing the target to gradually reintegrate with the normal flow of time.`),$t=z(),_e=y("div"),_t=Y("- "),st=Y(Le),yt=Y(" -"),ot=z(),ee=y("aside"),Te=y("h1"),Te.textContent="Spellbook",bt=z(),Ee=y("nav"),Pe=y("div");for(let x=0;x*:not(:last-child)]:mb-8"),f(_e,"id","page-number"),f(_e,"class","text-right text-lg pb-4"),f(p,"id","right-page"),f(p,"class","flex flex-col justify-between flex-1 gap-8 px-6 text-dark text-lg"),f(a,"class","flex h-full"),f(n,"id","book"),f(n,"class","flex flex-col gap-2 p-5 w-[90%] h-[90%] rounded-lg bg-[#eae5de] shadow-glow overflow-y-auto bg-[url('/book.webp')] bg-[size:100%_100%]"),f(t,"class","relative flex flex-1 items-center justify-center"),f(Te,"class","text-3xl text-center"),f(Pe,"id","spells-list"),f(Pe,"class","flex flex-col gap-2"),f(Ee,"class","flex flex-col gap-4"),f(ee,"id","ui-container"),f(ee,"class","p-5 flex flex-col gap-4 flex-[0_0_var(--aside-width)] overflow-y-auto select-none bg-surface border-l-2 border-primary")},m(x,R){C(x,t,R),h(t,n),h(n,r),h(r,o),h(n,i),h(n,a),h(a,l),h(l,c),h(c,m),h(c,$),h(l,_),h(l,g),h(a,d),h(a,p),h(p,w),h(w,A),h(A,X),Q.m(X,null),h(w,S),h(w,b),h(b,q),h(b,W),h(b,ae),h(b,D),h(w,L),h(w,Z),h(Z,pe),h(Z,le),h(Z,Fe),h(w,v),h(w,N),h(w,I),h(w,J),h(J,$e),h(J,rt),h(J,pt),h(p,$t),h(p,_e),h(_e,_t),h(_e,st),h(_e,yt),C(x,ot,R),C(x,ee,R),h(ee,Te),h(ee,bt),h(ee,Ee),h(Ee,Pe);for(let ve=0;ve{K&&(Ne&&Ne.end(1),He=tt(ee,Pt,{x:400,delay:300}),He.start())}),K=!0}},o(x){E(Q),j=j.filter(Boolean);for(let R=0;Rn(1,s),l=>{n(0,r=l),n(1,s=Oe[l])},()=>we.set("canvas")]}class Vr extends xe{constructor(t){super(),Me(this,t,Hr,Tr,re,{})}}function qt(e,t,n){const r=e.slice();return r[3]=t[n][0],r[4]=t[n][1],r}function It(e){let t,n;return{c(){t=et("polyline"),f(t,"points",e[4].join(" ")),f(t,"fill","none"),f(t,"stroke","var(--primary-color)"),f(t,"stroke-width","3"),f(t,"stroke-linecap","round"),f(t,"stroke-linejoin","round")},m(r,s){C(r,t,s)},p:U,i(r){r&&(n||ie(()=>{n=tt(t,fn,{duration:un}),n.start()}))},o:U,d(r){r&&P(t)}}}function jt(e,t){let n,r,s=t[0][t[3]],o,i,a,l,c,u=It(t);function m(){return t[1](t[3])}return{key:e,first:null,c(){n=y("button"),r=et("svg"),u.c(),o=z(),i=y("h2"),i.textContent=`${t[3]}`,a=z(),f(r,"width","200"),f(r,"height","200"),f(r,"viewBox","0 0 200 200"),f(r,"fill","none"),f(r,"xmlns","http://www.w3.org/2000/svg"),f(i,"class","mb-2"),f(n,"class","rounded-lg bg-surface"),this.first=n},m($,_){C($,n,_),h(n,r),u.m(r,null),h(n,o),h(n,i),h(n,a),l||(c=te(n,"click",m),l=!0)},p($,_){t=$,_&1&&re(s,s=t[0][t[3]])?(de(),E(u,1,1,U),he(),u=It(t),u.c(),k(u,1),u.m(r,null)):u.p(t,_)},d($){$&&P(n),u.d($),l=!1,c()}}}function Ur(e){let t;return{c(){t=Y("Back to practice")},m(n,r){C(n,t,r)},d(n){n&&P(t)}}}function Gr(e){let t,n,r=[],s=new Map,o,i,a,l,c,u,m,$=De(Object.entries(We));const _=g=>g[3];for(let g=0;g<$.length;g+=1){let d=qt(e,$,g),p=_(d);s.set(p,r[g]=jt(p,d))}return u=new ne({props:{onClick:e[2],$$slots:{default:[Ur]},$$scope:{ctx:e}}}),{c(){t=y("main"),n=y("div");for(let g=0;gn(0,r[i]=!r[i],r),()=>we.set("canvas")]}class Qr extends xe{constructor(t){super(),Me(this,t,Kr,Jr,re,{})}}function Ot(e){let t,n;return t=new Dr({}),{c(){T(t.$$.fragment)},m(r,s){B(t,r,s),n=!0},i(r){n||(k(t.$$.fragment,r),n=!0)},o(r){E(t.$$.fragment,r),n=!1},d(r){F(t,r)}}}function Wt(e){let t,n;return t=new Vr({}),{c(){T(t.$$.fragment)},m(r,s){B(t,r,s),n=!0},i(r){n||(k(t.$$.fragment,r),n=!0)},o(r){E(t.$$.fragment,r),n=!1},d(r){F(t,r)}}}function Bt(e){let t,n;return t=new Qr({}),{c(){T(t.$$.fragment)},m(r,s){B(t,r,s),n=!0},i(r){n||(k(t.$$.fragment,r),n=!0)},o(r){E(t.$$.fragment,r),n=!1},d(r){F(t,r)}}}function Ft(e){let t,n;return t=new Wr({}),{c(){T(t.$$.fragment)},m(r,s){B(t,r,s),n=!0},i(r){n||(k(t.$$.fragment,r),n=!0)},o(r){E(t.$$.fragment,r),n=!1},d(r){F(t,r)}}}function Zr(e){let t,n,r,s,o,i=e[0]==="canvas"&&Ot(),a=e[0]==="spellbook"&&Wt(),l=e[0]==="strokes"&&Bt(),c=e[0]==="effects"&&Ft();return{c(){i&&i.c(),t=z(),a&&a.c(),n=z(),l&&l.c(),r=z(),c&&c.c(),s=tn()},m(u,m){i&&i.m(u,m),C(u,t,m),a&&a.m(u,m),C(u,n,m),l&&l.m(u,m),C(u,r,m),c&&c.m(u,m),C(u,s,m),o=!0},p(u,[m]){u[0]==="canvas"?i?m&1&&k(i,1):(i=Ot(),i.c(),k(i,1),i.m(t.parentNode,t)):i&&(de(),E(i,1,1,()=>{i=null}),he()),u[0]==="spellbook"?a?m&1&&k(a,1):(a=Wt(),a.c(),k(a,1),a.m(n.parentNode,n)):a&&(de(),E(a,1,1,()=>{a=null}),he()),u[0]==="strokes"?l?m&1&&k(l,1):(l=Bt(),l.c(),k(l,1),l.m(r.parentNode,r)):l&&(de(),E(l,1,1,()=>{l=null}),he()),u[0]==="effects"?c?m&1&&k(c,1):(c=Ft(),c.c(),k(c,1),c.m(s.parentNode,s)):c&&(de(),E(c,1,1,()=>{c=null}),he())},i(u){o||(k(i),k(a),k(l),k(c),o=!0)},o(u){E(i),E(a),E(l),E(c),o=!1},d(u){u&&(P(t),P(n),P(r),P(s)),i&&i.d(u),a&&a.d(u),l&&l.d(u),c&&c.d(u)}}}function es(e,t,n){let r;return wn(e,we,s=>n(0,r=s)),[r]}class ts extends xe{constructor(t){super(),Me(this,t,es,Zr,re,{})}}new ts({target:document.getElementById("app")}); -//# sourceMappingURL=index-BfT9z44A.js.map diff --git a/assets/index-BfT9z44A.js.map b/assets/index-BfT9z44A.js.map deleted file mode 100644 index 917a93b..0000000 --- a/assets/index-BfT9z44A.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index-BfT9z44A.js","sources":["../../node_modules/svelte/src/runtime/internal/utils.js","../../node_modules/svelte/src/runtime/internal/environment.js","../../node_modules/svelte/src/runtime/internal/loop.js","../../node_modules/svelte/src/runtime/internal/dom.js","../../node_modules/svelte/src/runtime/internal/style_manager.js","../../node_modules/svelte/src/runtime/internal/lifecycle.js","../../node_modules/svelte/src/runtime/internal/scheduler.js","../../node_modules/svelte/src/runtime/internal/transitions.js","../../node_modules/svelte/src/runtime/internal/each.js","../../node_modules/svelte/src/runtime/internal/Component.js","../../node_modules/svelte/src/shared/version.js","../../node_modules/svelte/src/runtime/internal/disclose-version/index.js","../../node_modules/svelte/src/runtime/store/index.js","../../src/lib/store.ts","../../node_modules/svelte/src/runtime/easing/index.js","../../node_modules/svelte/src/runtime/transition/index.js","../../src/components/PageContainer.svelte","../../src/components/PrimaryButton.svelte","../../src/lib/config.ts","../../src/lib/dollar.ts","../../src/lib/effects.ts","../../src/lib/spells.ts","../../src/lib/strokes.ts","../../src/pages/Canvas.svelte","../../src/pages/Effects.svelte","../../src/pages/Spellbook.svelte","../../src/pages/Strokes.svelte","../../src/App.svelte","../../src/main.ts"],"sourcesContent":["/** @returns {void} */\nexport function noop() {}\n\nexport const identity = (x) => x;\n\n/**\n * @template T\n * @template S\n * @param {T} tar\n * @param {S} src\n * @returns {T & S}\n */\nexport function assign(tar, src) {\n\t// @ts-ignore\n\tfor (const k in src) tar[k] = src[k];\n\treturn /** @type {T & S} */ (tar);\n}\n\n// Adapted from https://github.com/then/is-promise/blob/master/index.js\n// Distributed under MIT License https://github.com/then/is-promise/blob/master/LICENSE\n/**\n * @param {any} value\n * @returns {value is PromiseLike}\n */\nexport function is_promise(value) {\n\treturn (\n\t\t!!value &&\n\t\t(typeof value === 'object' || typeof value === 'function') &&\n\t\ttypeof (/** @type {any} */ (value).then) === 'function'\n\t);\n}\n\n/** @returns {void} */\nexport function add_location(element, file, line, column, char) {\n\telement.__svelte_meta = {\n\t\tloc: { file, line, column, char }\n\t};\n}\n\nexport function run(fn) {\n\treturn fn();\n}\n\nexport function blank_object() {\n\treturn Object.create(null);\n}\n\n/**\n * @param {Function[]} fns\n * @returns {void}\n */\nexport function run_all(fns) {\n\tfns.forEach(run);\n}\n\n/**\n * @param {any} thing\n * @returns {thing is Function}\n */\nexport function is_function(thing) {\n\treturn typeof thing === 'function';\n}\n\n/** @returns {boolean} */\nexport function safe_not_equal(a, b) {\n\treturn a != a ? b == b : a !== b || (a && typeof a === 'object') || typeof a === 'function';\n}\n\nlet src_url_equal_anchor;\n\n/**\n * @param {string} element_src\n * @param {string} url\n * @returns {boolean}\n */\nexport function src_url_equal(element_src, url) {\n\tif (element_src === url) return true;\n\tif (!src_url_equal_anchor) {\n\t\tsrc_url_equal_anchor = document.createElement('a');\n\t}\n\t// This is actually faster than doing URL(..).href\n\tsrc_url_equal_anchor.href = url;\n\treturn element_src === src_url_equal_anchor.href;\n}\n\n/** @param {string} srcset */\nfunction split_srcset(srcset) {\n\treturn srcset.split(',').map((src) => src.trim().split(' ').filter(Boolean));\n}\n\n/**\n * @param {HTMLSourceElement | HTMLImageElement} element_srcset\n * @param {string | undefined | null} srcset\n * @returns {boolean}\n */\nexport function srcset_url_equal(element_srcset, srcset) {\n\tconst element_urls = split_srcset(element_srcset.srcset);\n\tconst urls = split_srcset(srcset || '');\n\n\treturn (\n\t\turls.length === element_urls.length &&\n\t\turls.every(\n\t\t\t([url, width], i) =>\n\t\t\t\twidth === element_urls[i][1] &&\n\t\t\t\t// We need to test both ways because Vite will create an a full URL with\n\t\t\t\t// `new URL(asset, import.meta.url).href` for the client when `base: './'`, and the\n\t\t\t\t// relative URLs inside srcset are not automatically resolved to absolute URLs by\n\t\t\t\t// browsers (in contrast to img.src). This means both SSR and DOM code could\n\t\t\t\t// contain relative or absolute URLs.\n\t\t\t\t(src_url_equal(element_urls[i][0], url) || src_url_equal(url, element_urls[i][0]))\n\t\t)\n\t);\n}\n\n/** @returns {boolean} */\nexport function not_equal(a, b) {\n\treturn a != a ? b == b : a !== b;\n}\n\n/** @returns {boolean} */\nexport function is_empty(obj) {\n\treturn Object.keys(obj).length === 0;\n}\n\n/** @returns {void} */\nexport function validate_store(store, name) {\n\tif (store != null && typeof store.subscribe !== 'function') {\n\t\tthrow new Error(`'${name}' is not a store with a 'subscribe' method`);\n\t}\n}\n\nexport function subscribe(store, ...callbacks) {\n\tif (store == null) {\n\t\tfor (const callback of callbacks) {\n\t\t\tcallback(undefined);\n\t\t}\n\t\treturn noop;\n\t}\n\tconst unsub = store.subscribe(...callbacks);\n\treturn unsub.unsubscribe ? () => unsub.unsubscribe() : unsub;\n}\n\n/**\n * Get the current value from a store by subscribing and immediately unsubscribing.\n *\n * https://svelte.dev/docs/svelte-store#get\n * @template T\n * @param {import('../store/public.js').Readable} store\n * @returns {T}\n */\nexport function get_store_value(store) {\n\tlet value;\n\tsubscribe(store, (_) => (value = _))();\n\treturn value;\n}\n\n/** @returns {void} */\nexport function component_subscribe(component, store, callback) {\n\tcomponent.$$.on_destroy.push(subscribe(store, callback));\n}\n\nexport function create_slot(definition, ctx, $$scope, fn) {\n\tif (definition) {\n\t\tconst slot_ctx = get_slot_context(definition, ctx, $$scope, fn);\n\t\treturn definition[0](slot_ctx);\n\t}\n}\n\nfunction get_slot_context(definition, ctx, $$scope, fn) {\n\treturn definition[1] && fn ? assign($$scope.ctx.slice(), definition[1](fn(ctx))) : $$scope.ctx;\n}\n\nexport function get_slot_changes(definition, $$scope, dirty, fn) {\n\tif (definition[2] && fn) {\n\t\tconst lets = definition[2](fn(dirty));\n\t\tif ($$scope.dirty === undefined) {\n\t\t\treturn lets;\n\t\t}\n\t\tif (typeof lets === 'object') {\n\t\t\tconst merged = [];\n\t\t\tconst len = Math.max($$scope.dirty.length, lets.length);\n\t\t\tfor (let i = 0; i < len; i += 1) {\n\t\t\t\tmerged[i] = $$scope.dirty[i] | lets[i];\n\t\t\t}\n\t\t\treturn merged;\n\t\t}\n\t\treturn $$scope.dirty | lets;\n\t}\n\treturn $$scope.dirty;\n}\n\n/** @returns {void} */\nexport function update_slot_base(\n\tslot,\n\tslot_definition,\n\tctx,\n\t$$scope,\n\tslot_changes,\n\tget_slot_context_fn\n) {\n\tif (slot_changes) {\n\t\tconst slot_context = get_slot_context(slot_definition, ctx, $$scope, get_slot_context_fn);\n\t\tslot.p(slot_context, slot_changes);\n\t}\n}\n\n/** @returns {void} */\nexport function update_slot(\n\tslot,\n\tslot_definition,\n\tctx,\n\t$$scope,\n\tdirty,\n\tget_slot_changes_fn,\n\tget_slot_context_fn\n) {\n\tconst slot_changes = get_slot_changes(slot_definition, $$scope, dirty, get_slot_changes_fn);\n\tupdate_slot_base(slot, slot_definition, ctx, $$scope, slot_changes, get_slot_context_fn);\n}\n\n/** @returns {any[] | -1} */\nexport function get_all_dirty_from_scope($$scope) {\n\tif ($$scope.ctx.length > 32) {\n\t\tconst dirty = [];\n\t\tconst length = $$scope.ctx.length / 32;\n\t\tfor (let i = 0; i < length; i++) {\n\t\t\tdirty[i] = -1;\n\t\t}\n\t\treturn dirty;\n\t}\n\treturn -1;\n}\n\n/** @returns {{}} */\nexport function exclude_internal_props(props) {\n\tconst result = {};\n\tfor (const k in props) if (k[0] !== '$') result[k] = props[k];\n\treturn result;\n}\n\n/** @returns {{}} */\nexport function compute_rest_props(props, keys) {\n\tconst rest = {};\n\tkeys = new Set(keys);\n\tfor (const k in props) if (!keys.has(k) && k[0] !== '$') rest[k] = props[k];\n\treturn rest;\n}\n\n/** @returns {{}} */\nexport function compute_slots(slots) {\n\tconst result = {};\n\tfor (const key in slots) {\n\t\tresult[key] = true;\n\t}\n\treturn result;\n}\n\n/** @returns {(this: any, ...args: any[]) => void} */\nexport function once(fn) {\n\tlet ran = false;\n\treturn function (...args) {\n\t\tif (ran) return;\n\t\tran = true;\n\t\tfn.call(this, ...args);\n\t};\n}\n\nexport function null_to_empty(value) {\n\treturn value == null ? '' : value;\n}\n\nexport function set_store_value(store, ret, value) {\n\tstore.set(value);\n\treturn ret;\n}\n\nexport const has_prop = (obj, prop) => Object.prototype.hasOwnProperty.call(obj, prop);\n\nexport function action_destroyer(action_result) {\n\treturn action_result && is_function(action_result.destroy) ? action_result.destroy : noop;\n}\n\n/** @param {number | string} value\n * @returns {[number, string]}\n */\nexport function split_css_unit(value) {\n\tconst split = typeof value === 'string' && value.match(/^\\s*(-?[\\d.]+)([^\\s]*)\\s*$/);\n\treturn split ? [parseFloat(split[1]), split[2] || 'px'] : [/** @type {number} */ (value), 'px'];\n}\n\nexport const contenteditable_truthy_values = ['', true, 1, 'true', 'contenteditable'];\n","import { noop } from './utils.js';\n\nexport const is_client = typeof window !== 'undefined';\n\n/** @type {() => number} */\nexport let now = is_client ? () => window.performance.now() : () => Date.now();\n\nexport let raf = is_client ? (cb) => requestAnimationFrame(cb) : noop;\n\n// used internally for testing\n/** @returns {void} */\nexport function set_now(fn) {\n\tnow = fn;\n}\n\n/** @returns {void} */\nexport function set_raf(fn) {\n\traf = fn;\n}\n","import { raf } from './environment.js';\n\nconst tasks = new Set();\n\n/**\n * @param {number} now\n * @returns {void}\n */\nfunction run_tasks(now) {\n\ttasks.forEach((task) => {\n\t\tif (!task.c(now)) {\n\t\t\ttasks.delete(task);\n\t\t\ttask.f();\n\t\t}\n\t});\n\tif (tasks.size !== 0) raf(run_tasks);\n}\n\n/**\n * For testing purposes only!\n * @returns {void}\n */\nexport function clear_loops() {\n\ttasks.clear();\n}\n\n/**\n * Creates a new task that runs on each raf frame\n * until it returns a falsy value or is aborted\n * @param {import('./private.js').TaskCallback} callback\n * @returns {import('./private.js').Task}\n */\nexport function loop(callback) {\n\t/** @type {import('./private.js').TaskEntry} */\n\tlet task;\n\tif (tasks.size === 0) raf(run_tasks);\n\treturn {\n\t\tpromise: new Promise((fulfill) => {\n\t\t\ttasks.add((task = { c: callback, f: fulfill }));\n\t\t}),\n\t\tabort() {\n\t\t\ttasks.delete(task);\n\t\t}\n\t};\n}\n","import { contenteditable_truthy_values, has_prop } from './utils.js';\n\nimport { ResizeObserverSingleton } from './ResizeObserverSingleton.js';\n\n// Track which nodes are claimed during hydration. Unclaimed nodes can then be removed from the DOM\n// at the end of hydration without touching the remaining nodes.\nlet is_hydrating = false;\n\n/**\n * @returns {void}\n */\nexport function start_hydrating() {\n\tis_hydrating = true;\n}\n\n/**\n * @returns {void}\n */\nexport function end_hydrating() {\n\tis_hydrating = false;\n}\n\n/**\n * @param {number} low\n * @param {number} high\n * @param {(index: number) => number} key\n * @param {number} value\n * @returns {number}\n */\nfunction upper_bound(low, high, key, value) {\n\t// Return first index of value larger than input value in the range [low, high)\n\twhile (low < high) {\n\t\tconst mid = low + ((high - low) >> 1);\n\t\tif (key(mid) <= value) {\n\t\t\tlow = mid + 1;\n\t\t} else {\n\t\t\thigh = mid;\n\t\t}\n\t}\n\treturn low;\n}\n\n/**\n * @param {NodeEx} target\n * @returns {void}\n */\nfunction init_hydrate(target) {\n\tif (target.hydrate_init) return;\n\ttarget.hydrate_init = true;\n\t// We know that all children have claim_order values since the unclaimed have been detached if target is not \n\n\tlet children = /** @type {ArrayLike} */ (target.childNodes);\n\t// If target is , there may be children without claim_order\n\tif (target.nodeName === 'HEAD') {\n\t\tconst my_children = [];\n\t\tfor (let i = 0; i < children.length; i++) {\n\t\t\tconst node = children[i];\n\t\t\tif (node.claim_order !== undefined) {\n\t\t\t\tmy_children.push(node);\n\t\t\t}\n\t\t}\n\t\tchildren = my_children;\n\t}\n\t/*\n\t * Reorder claimed children optimally.\n\t * We can reorder claimed children optimally by finding the longest subsequence of\n\t * nodes that are already claimed in order and only moving the rest. The longest\n\t * subsequence of nodes that are claimed in order can be found by\n\t * computing the longest increasing subsequence of .claim_order values.\n\t *\n\t * This algorithm is optimal in generating the least amount of reorder operations\n\t * possible.\n\t *\n\t * Proof:\n\t * We know that, given a set of reordering operations, the nodes that do not move\n\t * always form an increasing subsequence, since they do not move among each other\n\t * meaning that they must be already ordered among each other. Thus, the maximal\n\t * set of nodes that do not move form a longest increasing subsequence.\n\t */\n\t// Compute longest increasing subsequence\n\t// m: subsequence length j => index k of smallest value that ends an increasing subsequence of length j\n\tconst m = new Int32Array(children.length + 1);\n\t// Predecessor indices + 1\n\tconst p = new Int32Array(children.length);\n\tm[0] = -1;\n\tlet longest = 0;\n\tfor (let i = 0; i < children.length; i++) {\n\t\tconst current = children[i].claim_order;\n\t\t// Find the largest subsequence length such that it ends in a value less than our current value\n\t\t// upper_bound returns first greater value, so we subtract one\n\t\t// with fast path for when we are on the current longest subsequence\n\t\tconst seq_len =\n\t\t\t(longest > 0 && children[m[longest]].claim_order <= current\n\t\t\t\t? longest + 1\n\t\t\t\t: upper_bound(1, longest, (idx) => children[m[idx]].claim_order, current)) - 1;\n\t\tp[i] = m[seq_len] + 1;\n\t\tconst new_len = seq_len + 1;\n\t\t// We can guarantee that current is the smallest value. Otherwise, we would have generated a longer sequence.\n\t\tm[new_len] = i;\n\t\tlongest = Math.max(new_len, longest);\n\t}\n\t// The longest increasing subsequence of nodes (initially reversed)\n\n\t/**\n\t * @type {NodeEx2[]}\n\t */\n\tconst lis = [];\n\t// The rest of the nodes, nodes that will be moved\n\n\t/**\n\t * @type {NodeEx2[]}\n\t */\n\tconst to_move = [];\n\tlet last = children.length - 1;\n\tfor (let cur = m[longest] + 1; cur != 0; cur = p[cur - 1]) {\n\t\tlis.push(children[cur - 1]);\n\t\tfor (; last >= cur; last--) {\n\t\t\tto_move.push(children[last]);\n\t\t}\n\t\tlast--;\n\t}\n\tfor (; last >= 0; last--) {\n\t\tto_move.push(children[last]);\n\t}\n\tlis.reverse();\n\t// We sort the nodes being moved to guarantee that their insertion order matches the claim order\n\tto_move.sort((a, b) => a.claim_order - b.claim_order);\n\t// Finally, we move the nodes\n\tfor (let i = 0, j = 0; i < to_move.length; i++) {\n\t\twhile (j < lis.length && to_move[i].claim_order >= lis[j].claim_order) {\n\t\t\tj++;\n\t\t}\n\t\tconst anchor = j < lis.length ? lis[j] : null;\n\t\ttarget.insertBefore(to_move[i], anchor);\n\t}\n}\n\n/**\n * @param {Node} target\n * @param {Node} node\n * @returns {void}\n */\nexport function append(target, node) {\n\ttarget.appendChild(node);\n}\n\n/**\n * @param {Node} target\n * @param {string} style_sheet_id\n * @param {string} styles\n * @returns {void}\n */\nexport function append_styles(target, style_sheet_id, styles) {\n\tconst append_styles_to = get_root_for_style(target);\n\tif (!append_styles_to.getElementById(style_sheet_id)) {\n\t\tconst style = element('style');\n\t\tstyle.id = style_sheet_id;\n\t\tstyle.textContent = styles;\n\t\tappend_stylesheet(append_styles_to, style);\n\t}\n}\n\n/**\n * @param {Node} node\n * @returns {ShadowRoot | Document}\n */\nexport function get_root_for_style(node) {\n\tif (!node) return document;\n\tconst root = node.getRootNode ? node.getRootNode() : node.ownerDocument;\n\tif (root && /** @type {ShadowRoot} */ (root).host) {\n\t\treturn /** @type {ShadowRoot} */ (root);\n\t}\n\treturn node.ownerDocument;\n}\n\n/**\n * @param {Node} node\n * @returns {CSSStyleSheet}\n */\nexport function append_empty_stylesheet(node) {\n\tconst style_element = element('style');\n\t// For transitions to work without 'style-src: unsafe-inline' Content Security Policy,\n\t// these empty tags need to be allowed with a hash as a workaround until we move to the Web Animations API.\n\t// Using the hash for the empty string (for an empty tag) works in all browsers except Safari.\n\t// So as a workaround for the workaround, when we append empty style tags we set their content to /* empty */.\n\t// The hash 'sha256-9OlNO0DNEeaVzHL4RZwCLsBHA8WBQ8toBp/4F5XV2nc=' will then work even in Safari.\n\tstyle_element.textContent = '/* empty */';\n\tappend_stylesheet(get_root_for_style(node), style_element);\n\treturn style_element.sheet;\n}\n\n/**\n * @param {ShadowRoot | Document} node\n * @param {HTMLStyleElement} style\n * @returns {CSSStyleSheet}\n */\nfunction append_stylesheet(node, style) {\n\tappend(/** @type {Document} */ (node).head || node, style);\n\treturn style.sheet;\n}\n\n/**\n * @param {NodeEx} target\n * @param {NodeEx} node\n * @returns {void}\n */\nexport function append_hydration(target, node) {\n\tif (is_hydrating) {\n\t\tinit_hydrate(target);\n\t\tif (\n\t\t\ttarget.actual_end_child === undefined ||\n\t\t\t(target.actual_end_child !== null && target.actual_end_child.parentNode !== target)\n\t\t) {\n\t\t\ttarget.actual_end_child = target.firstChild;\n\t\t}\n\t\t// Skip nodes of undefined ordering\n\t\twhile (target.actual_end_child !== null && target.actual_end_child.claim_order === undefined) {\n\t\t\ttarget.actual_end_child = target.actual_end_child.nextSibling;\n\t\t}\n\t\tif (node !== target.actual_end_child) {\n\t\t\t// We only insert if the ordering of this node should be modified or the parent node is not target\n\t\t\tif (node.claim_order !== undefined || node.parentNode !== target) {\n\t\t\t\ttarget.insertBefore(node, target.actual_end_child);\n\t\t\t}\n\t\t} else {\n\t\t\ttarget.actual_end_child = node.nextSibling;\n\t\t}\n\t} else if (node.parentNode !== target || node.nextSibling !== null) {\n\t\ttarget.appendChild(node);\n\t}\n}\n\n/**\n * @param {Node} target\n * @param {Node} node\n * @param {Node} [anchor]\n * @returns {void}\n */\nexport function insert(target, node, anchor) {\n\ttarget.insertBefore(node, anchor || null);\n}\n\n/**\n * @param {NodeEx} target\n * @param {NodeEx} node\n * @param {NodeEx} [anchor]\n * @returns {void}\n */\nexport function insert_hydration(target, node, anchor) {\n\tif (is_hydrating && !anchor) {\n\t\tappend_hydration(target, node);\n\t} else if (node.parentNode !== target || node.nextSibling != anchor) {\n\t\ttarget.insertBefore(node, anchor || null);\n\t}\n}\n\n/**\n * @param {Node} node\n * @returns {void}\n */\nexport function detach(node) {\n\tif (node.parentNode) {\n\t\tnode.parentNode.removeChild(node);\n\t}\n}\n\n/**\n * @returns {void} */\nexport function destroy_each(iterations, detaching) {\n\tfor (let i = 0; i < iterations.length; i += 1) {\n\t\tif (iterations[i]) iterations[i].d(detaching);\n\t}\n}\n\n/**\n * @template {keyof HTMLElementTagNameMap} K\n * @param {K} name\n * @returns {HTMLElementTagNameMap[K]}\n */\nexport function element(name) {\n\treturn document.createElement(name);\n}\n\n/**\n * @template {keyof HTMLElementTagNameMap} K\n * @param {K} name\n * @param {string} is\n * @returns {HTMLElementTagNameMap[K]}\n */\nexport function element_is(name, is) {\n\treturn document.createElement(name, { is });\n}\n\n/**\n * @template T\n * @template {keyof T} K\n * @param {T} obj\n * @param {K[]} exclude\n * @returns {Pick>}\n */\nexport function object_without_properties(obj, exclude) {\n\tconst target = /** @type {Pick>} */ ({});\n\tfor (const k in obj) {\n\t\tif (\n\t\t\thas_prop(obj, k) &&\n\t\t\t// @ts-ignore\n\t\t\texclude.indexOf(k) === -1\n\t\t) {\n\t\t\t// @ts-ignore\n\t\t\ttarget[k] = obj[k];\n\t\t}\n\t}\n\treturn target;\n}\n\n/**\n * @template {keyof SVGElementTagNameMap} K\n * @param {K} name\n * @returns {SVGElement}\n */\nexport function svg_element(name) {\n\treturn document.createElementNS('http://www.w3.org/2000/svg', name);\n}\n\n/**\n * @param {string} data\n * @returns {Text}\n */\nexport function text(data) {\n\treturn document.createTextNode(data);\n}\n\n/**\n * @returns {Text} */\nexport function space() {\n\treturn text(' ');\n}\n\n/**\n * @returns {Text} */\nexport function empty() {\n\treturn text('');\n}\n\n/**\n * @param {string} content\n * @returns {Comment}\n */\nexport function comment(content) {\n\treturn document.createComment(content);\n}\n\n/**\n * @param {EventTarget} node\n * @param {string} event\n * @param {EventListenerOrEventListenerObject} handler\n * @param {boolean | AddEventListenerOptions | EventListenerOptions} [options]\n * @returns {() => void}\n */\nexport function listen(node, event, handler, options) {\n\tnode.addEventListener(event, handler, options);\n\treturn () => node.removeEventListener(event, handler, options);\n}\n\n/**\n * @returns {(event: any) => any} */\nexport function prevent_default(fn) {\n\treturn function (event) {\n\t\tevent.preventDefault();\n\t\t// @ts-ignore\n\t\treturn fn.call(this, event);\n\t};\n}\n\n/**\n * @returns {(event: any) => any} */\nexport function stop_propagation(fn) {\n\treturn function (event) {\n\t\tevent.stopPropagation();\n\t\t// @ts-ignore\n\t\treturn fn.call(this, event);\n\t};\n}\n\n/**\n * @returns {(event: any) => any} */\nexport function stop_immediate_propagation(fn) {\n\treturn function (event) {\n\t\tevent.stopImmediatePropagation();\n\t\t// @ts-ignore\n\t\treturn fn.call(this, event);\n\t};\n}\n\n/**\n * @returns {(event: any) => void} */\nexport function self(fn) {\n\treturn function (event) {\n\t\t// @ts-ignore\n\t\tif (event.target === this) fn.call(this, event);\n\t};\n}\n\n/**\n * @returns {(event: any) => void} */\nexport function trusted(fn) {\n\treturn function (event) {\n\t\t// @ts-ignore\n\t\tif (event.isTrusted) fn.call(this, event);\n\t};\n}\n\n/**\n * @param {Element} node\n * @param {string} attribute\n * @param {string} [value]\n * @returns {void}\n */\nexport function attr(node, attribute, value) {\n\tif (value == null) node.removeAttribute(attribute);\n\telse if (node.getAttribute(attribute) !== value) node.setAttribute(attribute, value);\n}\n/**\n * List of attributes that should always be set through the attr method,\n * because updating them through the property setter doesn't work reliably.\n * In the example of `width`/`height`, the problem is that the setter only\n * accepts numeric values, but the attribute can also be set to a string like `50%`.\n * If this list becomes too big, rethink this approach.\n */\nconst always_set_through_set_attribute = ['width', 'height'];\n\n/**\n * @param {Element & ElementCSSInlineStyle} node\n * @param {{ [x: string]: string }} attributes\n * @returns {void}\n */\nexport function set_attributes(node, attributes) {\n\t// @ts-ignore\n\tconst descriptors = Object.getOwnPropertyDescriptors(node.__proto__);\n\tfor (const key in attributes) {\n\t\tif (attributes[key] == null) {\n\t\t\tnode.removeAttribute(key);\n\t\t} else if (key === 'style') {\n\t\t\tnode.style.cssText = attributes[key];\n\t\t} else if (key === '__value') {\n\t\t\t/** @type {any} */ (node).value = node[key] = attributes[key];\n\t\t} else if (\n\t\t\tdescriptors[key] &&\n\t\t\tdescriptors[key].set &&\n\t\t\talways_set_through_set_attribute.indexOf(key) === -1\n\t\t) {\n\t\t\tnode[key] = attributes[key];\n\t\t} else {\n\t\t\tattr(node, key, attributes[key]);\n\t\t}\n\t}\n}\n\n/**\n * @param {Element & ElementCSSInlineStyle} node\n * @param {{ [x: string]: string }} attributes\n * @returns {void}\n */\nexport function set_svg_attributes(node, attributes) {\n\tfor (const key in attributes) {\n\t\tattr(node, key, attributes[key]);\n\t}\n}\n\n/**\n * @param {Record} data_map\n * @returns {void}\n */\nexport function set_custom_element_data_map(node, data_map) {\n\tObject.keys(data_map).forEach((key) => {\n\t\tset_custom_element_data(node, key, data_map[key]);\n\t});\n}\n\n/**\n * @returns {void} */\nexport function set_custom_element_data(node, prop, value) {\n\tconst lower = prop.toLowerCase(); // for backwards compatibility with existing behavior we do lowercase first\n\tif (lower in node) {\n\t\tnode[lower] = typeof node[lower] === 'boolean' && value === '' ? true : value;\n\t} else if (prop in node) {\n\t\tnode[prop] = typeof node[prop] === 'boolean' && value === '' ? true : value;\n\t} else {\n\t\tattr(node, prop, value);\n\t}\n}\n\n/**\n * @param {string} tag\n */\nexport function set_dynamic_element_data(tag) {\n\treturn /-/.test(tag) ? set_custom_element_data_map : set_attributes;\n}\n\n/**\n * @returns {void}\n */\nexport function xlink_attr(node, attribute, value) {\n\tnode.setAttributeNS('http://www.w3.org/1999/xlink', attribute, value);\n}\n\n/**\n * @param {HTMLElement} node\n * @returns {string}\n */\nexport function get_svelte_dataset(node) {\n\treturn node.dataset.svelteH;\n}\n\n/**\n * @returns {unknown[]} */\nexport function get_binding_group_value(group, __value, checked) {\n\tconst value = new Set();\n\tfor (let i = 0; i < group.length; i += 1) {\n\t\tif (group[i].checked) value.add(group[i].__value);\n\t}\n\tif (!checked) {\n\t\tvalue.delete(__value);\n\t}\n\treturn Array.from(value);\n}\n\n/**\n * @param {HTMLInputElement[]} group\n * @returns {{ p(...inputs: HTMLInputElement[]): void; r(): void; }}\n */\nexport function init_binding_group(group) {\n\t/**\n\t * @type {HTMLInputElement[]} */\n\tlet _inputs;\n\treturn {\n\t\t/* push */ p(...inputs) {\n\t\t\t_inputs = inputs;\n\t\t\t_inputs.forEach((input) => group.push(input));\n\t\t},\n\t\t/* remove */ r() {\n\t\t\t_inputs.forEach((input) => group.splice(group.indexOf(input), 1));\n\t\t}\n\t};\n}\n\n/**\n * @param {number[]} indexes\n * @returns {{ u(new_indexes: number[]): void; p(...inputs: HTMLInputElement[]): void; r: () => void; }}\n */\nexport function init_binding_group_dynamic(group, indexes) {\n\t/**\n\t * @type {HTMLInputElement[]} */\n\tlet _group = get_binding_group(group);\n\n\t/**\n\t * @type {HTMLInputElement[]} */\n\tlet _inputs;\n\n\tfunction get_binding_group(group) {\n\t\tfor (let i = 0; i < indexes.length; i++) {\n\t\t\tgroup = group[indexes[i]] = group[indexes[i]] || [];\n\t\t}\n\t\treturn group;\n\t}\n\n\t/**\n\t * @returns {void} */\n\tfunction push() {\n\t\t_inputs.forEach((input) => _group.push(input));\n\t}\n\n\t/**\n\t * @returns {void} */\n\tfunction remove() {\n\t\t_inputs.forEach((input) => _group.splice(_group.indexOf(input), 1));\n\t}\n\treturn {\n\t\t/* update */ u(new_indexes) {\n\t\t\tindexes = new_indexes;\n\t\t\tconst new_group = get_binding_group(group);\n\t\t\tif (new_group !== _group) {\n\t\t\t\tremove();\n\t\t\t\t_group = new_group;\n\t\t\t\tpush();\n\t\t\t}\n\t\t},\n\t\t/* push */ p(...inputs) {\n\t\t\t_inputs = inputs;\n\t\t\tpush();\n\t\t},\n\t\t/* remove */ r: remove\n\t};\n}\n\n/** @returns {number} */\nexport function to_number(value) {\n\treturn value === '' ? null : +value;\n}\n\n/** @returns {any[]} */\nexport function time_ranges_to_array(ranges) {\n\tconst array = [];\n\tfor (let i = 0; i < ranges.length; i += 1) {\n\t\tarray.push({ start: ranges.start(i), end: ranges.end(i) });\n\t}\n\treturn array;\n}\n\n/**\n * @param {Element} element\n * @returns {ChildNode[]}\n */\nexport function children(element) {\n\treturn Array.from(element.childNodes);\n}\n\n/**\n * @param {ChildNodeArray} nodes\n * @returns {void}\n */\nfunction init_claim_info(nodes) {\n\tif (nodes.claim_info === undefined) {\n\t\tnodes.claim_info = { last_index: 0, total_claimed: 0 };\n\t}\n}\n\n/**\n * @template {ChildNodeEx} R\n * @param {ChildNodeArray} nodes\n * @param {(node: ChildNodeEx) => node is R} predicate\n * @param {(node: ChildNodeEx) => ChildNodeEx | undefined} process_node\n * @param {() => R} create_node\n * @param {boolean} dont_update_last_index\n * @returns {R}\n */\nfunction claim_node(nodes, predicate, process_node, create_node, dont_update_last_index = false) {\n\t// Try to find nodes in an order such that we lengthen the longest increasing subsequence\n\tinit_claim_info(nodes);\n\tconst result_node = (() => {\n\t\t// We first try to find an element after the previous one\n\t\tfor (let i = nodes.claim_info.last_index; i < nodes.length; i++) {\n\t\t\tconst node = nodes[i];\n\t\t\tif (predicate(node)) {\n\t\t\t\tconst replacement = process_node(node);\n\t\t\t\tif (replacement === undefined) {\n\t\t\t\t\tnodes.splice(i, 1);\n\t\t\t\t} else {\n\t\t\t\t\tnodes[i] = replacement;\n\t\t\t\t}\n\t\t\t\tif (!dont_update_last_index) {\n\t\t\t\t\tnodes.claim_info.last_index = i;\n\t\t\t\t}\n\t\t\t\treturn node;\n\t\t\t}\n\t\t}\n\t\t// Otherwise, we try to find one before\n\t\t// We iterate in reverse so that we don't go too far back\n\t\tfor (let i = nodes.claim_info.last_index - 1; i >= 0; i--) {\n\t\t\tconst node = nodes[i];\n\t\t\tif (predicate(node)) {\n\t\t\t\tconst replacement = process_node(node);\n\t\t\t\tif (replacement === undefined) {\n\t\t\t\t\tnodes.splice(i, 1);\n\t\t\t\t} else {\n\t\t\t\t\tnodes[i] = replacement;\n\t\t\t\t}\n\t\t\t\tif (!dont_update_last_index) {\n\t\t\t\t\tnodes.claim_info.last_index = i;\n\t\t\t\t} else if (replacement === undefined) {\n\t\t\t\t\t// Since we spliced before the last_index, we decrease it\n\t\t\t\t\tnodes.claim_info.last_index--;\n\t\t\t\t}\n\t\t\t\treturn node;\n\t\t\t}\n\t\t}\n\t\t// If we can't find any matching node, we create a new one\n\t\treturn create_node();\n\t})();\n\tresult_node.claim_order = nodes.claim_info.total_claimed;\n\tnodes.claim_info.total_claimed += 1;\n\treturn result_node;\n}\n\n/**\n * @param {ChildNodeArray} nodes\n * @param {string} name\n * @param {{ [key: string]: boolean }} attributes\n * @param {(name: string) => Element | SVGElement} create_element\n * @returns {Element | SVGElement}\n */\nfunction claim_element_base(nodes, name, attributes, create_element) {\n\treturn claim_node(\n\t\tnodes,\n\t\t/** @returns {node is Element | SVGElement} */\n\t\t(node) => node.nodeName === name,\n\t\t/** @param {Element} node */\n\t\t(node) => {\n\t\t\tconst remove = [];\n\t\t\tfor (let j = 0; j < node.attributes.length; j++) {\n\t\t\t\tconst attribute = node.attributes[j];\n\t\t\t\tif (!attributes[attribute.name]) {\n\t\t\t\t\tremove.push(attribute.name);\n\t\t\t\t}\n\t\t\t}\n\t\t\tremove.forEach((v) => node.removeAttribute(v));\n\t\t\treturn undefined;\n\t\t},\n\t\t() => create_element(name)\n\t);\n}\n\n/**\n * @param {ChildNodeArray} nodes\n * @param {string} name\n * @param {{ [key: string]: boolean }} attributes\n * @returns {Element | SVGElement}\n */\nexport function claim_element(nodes, name, attributes) {\n\treturn claim_element_base(nodes, name, attributes, element);\n}\n\n/**\n * @param {ChildNodeArray} nodes\n * @param {string} name\n * @param {{ [key: string]: boolean }} attributes\n * @returns {Element | SVGElement}\n */\nexport function claim_svg_element(nodes, name, attributes) {\n\treturn claim_element_base(nodes, name, attributes, svg_element);\n}\n\n/**\n * @param {ChildNodeArray} nodes\n * @returns {Text}\n */\nexport function claim_text(nodes, data) {\n\treturn claim_node(\n\t\tnodes,\n\t\t/** @returns {node is Text} */\n\t\t(node) => node.nodeType === 3,\n\t\t/** @param {Text} node */\n\t\t(node) => {\n\t\t\tconst data_str = '' + data;\n\t\t\tif (node.data.startsWith(data_str)) {\n\t\t\t\tif (node.data.length !== data_str.length) {\n\t\t\t\t\treturn node.splitText(data_str.length);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tnode.data = data_str;\n\t\t\t}\n\t\t},\n\t\t() => text(data),\n\t\ttrue // Text nodes should not update last index since it is likely not worth it to eliminate an increasing subsequence of actual elements\n\t);\n}\n\n/**\n * @returns {Text} */\nexport function claim_space(nodes) {\n\treturn claim_text(nodes, ' ');\n}\n\n/**\n * @param {ChildNodeArray} nodes\n * @returns {Comment}\n */\nexport function claim_comment(nodes, data) {\n\treturn claim_node(\n\t\tnodes,\n\t\t/** @returns {node is Comment} */\n\t\t(node) => node.nodeType === 8,\n\t\t/** @param {Comment} node */\n\t\t(node) => {\n\t\t\tnode.data = '' + data;\n\t\t\treturn undefined;\n\t\t},\n\t\t() => comment(data),\n\t\ttrue\n\t);\n}\n\nfunction get_comment_idx(nodes, text, start) {\n\tfor (let i = start; i < nodes.length; i += 1) {\n\t\tconst node = nodes[i];\n\t\tif (node.nodeType === 8 /* comment node */ && node.textContent.trim() === text) {\n\t\t\treturn i;\n\t\t}\n\t}\n\treturn -1;\n}\n\n/**\n * @param {boolean} is_svg\n * @returns {HtmlTagHydration}\n */\nexport function claim_html_tag(nodes, is_svg) {\n\t// find html opening tag\n\tconst start_index = get_comment_idx(nodes, 'HTML_TAG_START', 0);\n\tconst end_index = get_comment_idx(nodes, 'HTML_TAG_END', start_index + 1);\n\tif (start_index === -1 || end_index === -1) {\n\t\treturn new HtmlTagHydration(is_svg);\n\t}\n\n\tinit_claim_info(nodes);\n\tconst html_tag_nodes = nodes.splice(start_index, end_index - start_index + 1);\n\tdetach(html_tag_nodes[0]);\n\tdetach(html_tag_nodes[html_tag_nodes.length - 1]);\n\tconst claimed_nodes = html_tag_nodes.slice(1, html_tag_nodes.length - 1);\n\tif (claimed_nodes.length === 0) {\n\t\treturn new HtmlTagHydration(is_svg);\n\t}\n\tfor (const n of claimed_nodes) {\n\t\tn.claim_order = nodes.claim_info.total_claimed;\n\t\tnodes.claim_info.total_claimed += 1;\n\t}\n\treturn new HtmlTagHydration(is_svg, claimed_nodes);\n}\n\n/**\n * @param {Text} text\n * @param {unknown} data\n * @returns {void}\n */\nexport function set_data(text, data) {\n\tdata = '' + data;\n\tif (text.data === data) return;\n\ttext.data = /** @type {string} */ (data);\n}\n\n/**\n * @param {Text} text\n * @param {unknown} data\n * @returns {void}\n */\nexport function set_data_contenteditable(text, data) {\n\tdata = '' + data;\n\tif (text.wholeText === data) return;\n\ttext.data = /** @type {string} */ (data);\n}\n\n/**\n * @param {Text} text\n * @param {unknown} data\n * @param {string} attr_value\n * @returns {void}\n */\nexport function set_data_maybe_contenteditable(text, data, attr_value) {\n\tif (~contenteditable_truthy_values.indexOf(attr_value)) {\n\t\tset_data_contenteditable(text, data);\n\t} else {\n\t\tset_data(text, data);\n\t}\n}\n\n/**\n * @returns {void} */\nexport function set_input_value(input, value) {\n\tinput.value = value == null ? '' : value;\n}\n\n/**\n * @returns {void} */\nexport function set_input_type(input, type) {\n\ttry {\n\t\tinput.type = type;\n\t} catch (e) {\n\t\t// do nothing\n\t}\n}\n\n/**\n * @returns {void} */\nexport function set_style(node, key, value, important) {\n\tif (value == null) {\n\t\tnode.style.removeProperty(key);\n\t} else {\n\t\tnode.style.setProperty(key, value, important ? 'important' : '');\n\t}\n}\n\n/**\n * @returns {void} */\nexport function select_option(select, value, mounting) {\n\tfor (let i = 0; i < select.options.length; i += 1) {\n\t\tconst option = select.options[i];\n\t\tif (option.__value === value) {\n\t\t\toption.selected = true;\n\t\t\treturn;\n\t\t}\n\t}\n\tif (!mounting || value !== undefined) {\n\t\tselect.selectedIndex = -1; // no option should be selected\n\t}\n}\n\n/**\n * @returns {void} */\nexport function select_options(select, value) {\n\tfor (let i = 0; i < select.options.length; i += 1) {\n\t\tconst option = select.options[i];\n\t\toption.selected = ~value.indexOf(option.__value);\n\t}\n}\n\nexport function select_value(select) {\n\tconst selected_option = select.querySelector(':checked');\n\treturn selected_option && selected_option.__value;\n}\n\nexport function select_multiple_value(select) {\n\treturn [].map.call(select.querySelectorAll(':checked'), (option) => option.__value);\n}\n// unfortunately this can't be a constant as that wouldn't be tree-shakeable\n// so we cache the result instead\n\n/**\n * @type {boolean} */\nlet crossorigin;\n\n/**\n * @returns {boolean} */\nexport function is_crossorigin() {\n\tif (crossorigin === undefined) {\n\t\tcrossorigin = false;\n\t\ttry {\n\t\t\tif (typeof window !== 'undefined' && window.parent) {\n\t\t\t\tvoid window.parent.document;\n\t\t\t}\n\t\t} catch (error) {\n\t\t\tcrossorigin = true;\n\t\t}\n\t}\n\treturn crossorigin;\n}\n\n/**\n * @param {HTMLElement} node\n * @param {() => void} fn\n * @returns {() => void}\n */\nexport function add_iframe_resize_listener(node, fn) {\n\tconst computed_style = getComputedStyle(node);\n\tif (computed_style.position === 'static') {\n\t\tnode.style.position = 'relative';\n\t}\n\tconst iframe = element('iframe');\n\tiframe.setAttribute(\n\t\t'style',\n\t\t'display: block; position: absolute; top: 0; left: 0; width: 100%; height: 100%; ' +\n\t\t\t'overflow: hidden; border: 0; opacity: 0; pointer-events: none; z-index: -1;'\n\t);\n\tiframe.setAttribute('aria-hidden', 'true');\n\tiframe.tabIndex = -1;\n\tconst crossorigin = is_crossorigin();\n\n\t/**\n\t * @type {() => void}\n\t */\n\tlet unsubscribe;\n\tif (crossorigin) {\n\t\tiframe.src = \"data:text/html,\";\n\t\tunsubscribe = listen(\n\t\t\twindow,\n\t\t\t'message',\n\t\t\t/** @param {MessageEvent} event */ (event) => {\n\t\t\t\tif (event.source === iframe.contentWindow) fn();\n\t\t\t}\n\t\t);\n\t} else {\n\t\tiframe.src = 'about:blank';\n\t\tiframe.onload = () => {\n\t\t\tunsubscribe = listen(iframe.contentWindow, 'resize', fn);\n\t\t\t// make sure an initial resize event is fired _after_ the iframe is loaded (which is asynchronous)\n\t\t\t// see https://github.com/sveltejs/svelte/issues/4233\n\t\t\tfn();\n\t\t};\n\t}\n\tappend(node, iframe);\n\treturn () => {\n\t\tif (crossorigin) {\n\t\t\tunsubscribe();\n\t\t} else if (unsubscribe && iframe.contentWindow) {\n\t\t\tunsubscribe();\n\t\t}\n\t\tdetach(iframe);\n\t};\n}\nexport const resize_observer_content_box = /* @__PURE__ */ new ResizeObserverSingleton({\n\tbox: 'content-box'\n});\nexport const resize_observer_border_box = /* @__PURE__ */ new ResizeObserverSingleton({\n\tbox: 'border-box'\n});\nexport const resize_observer_device_pixel_content_box = /* @__PURE__ */ new ResizeObserverSingleton(\n\t{ box: 'device-pixel-content-box' }\n);\nexport { ResizeObserverSingleton };\n\n/**\n * @returns {void} */\nexport function toggle_class(element, name, toggle) {\n\t// The `!!` is required because an `undefined` flag means flipping the current state.\n\telement.classList.toggle(name, !!toggle);\n}\n\n/**\n * @template T\n * @param {string} type\n * @param {T} [detail]\n * @param {{ bubbles?: boolean, cancelable?: boolean }} [options]\n * @returns {CustomEvent}\n */\nexport function custom_event(type, detail, { bubbles = false, cancelable = false } = {}) {\n\treturn new CustomEvent(type, { detail, bubbles, cancelable });\n}\n\n/**\n * @param {string} selector\n * @param {HTMLElement} parent\n * @returns {ChildNodeArray}\n */\nexport function query_selector_all(selector, parent = document.body) {\n\treturn Array.from(parent.querySelectorAll(selector));\n}\n\n/**\n * @param {string} nodeId\n * @param {HTMLElement} head\n * @returns {any[]}\n */\nexport function head_selector(nodeId, head) {\n\tconst result = [];\n\tlet started = 0;\n\tfor (const node of head.childNodes) {\n\t\tif (node.nodeType === 8 /* comment node */) {\n\t\t\tconst comment = node.textContent.trim();\n\t\t\tif (comment === `HEAD_${nodeId}_END`) {\n\t\t\t\tstarted -= 1;\n\t\t\t\tresult.push(node);\n\t\t\t} else if (comment === `HEAD_${nodeId}_START`) {\n\t\t\t\tstarted += 1;\n\t\t\t\tresult.push(node);\n\t\t\t}\n\t\t} else if (started > 0) {\n\t\t\tresult.push(node);\n\t\t}\n\t}\n\treturn result;\n}\n/** */\nexport class HtmlTag {\n\t/**\n\t * @private\n\t * @default false\n\t */\n\tis_svg = false;\n\t/** parent for creating node */\n\te = undefined;\n\t/** html tag nodes */\n\tn = undefined;\n\t/** target */\n\tt = undefined;\n\t/** anchor */\n\ta = undefined;\n\tconstructor(is_svg = false) {\n\t\tthis.is_svg = is_svg;\n\t\tthis.e = this.n = null;\n\t}\n\n\t/**\n\t * @param {string} html\n\t * @returns {void}\n\t */\n\tc(html) {\n\t\tthis.h(html);\n\t}\n\n\t/**\n\t * @param {string} html\n\t * @param {HTMLElement | SVGElement} target\n\t * @param {HTMLElement | SVGElement} anchor\n\t * @returns {void}\n\t */\n\tm(html, target, anchor = null) {\n\t\tif (!this.e) {\n\t\t\tif (this.is_svg)\n\t\t\t\tthis.e = svg_element(/** @type {keyof SVGElementTagNameMap} */ (target.nodeName));\n\t\t\t/** #7364 target for