diff --git a/_app/immutable/chunks/3.813f8056.js b/_app/immutable/chunks/3.813f8056.js new file mode 100644 index 00000000..5f27281e --- /dev/null +++ b/_app/immutable/chunks/3.813f8056.js @@ -0,0 +1 @@ +import{_ as an}from"./preload-helper.a4192956.js";import{R as _e,Q as It,T as Be,U as rn,S as He,i as qe,s as ze,O as ot,V as le,e as p,m as P,H as pe,a as v,b as T,n as ee,d as m,o as B,I as ve,f as h,L as z,W as Ae,g as U,h as u,J as ge,p as $,t as H,C as lt,w as nt,l as J,K as be,X as je,Y as it,M as oe,N as ke,P as Ce,z as Q,A as Y,B as ae,v as De,q as ue,Z as ms,r as Fl,_ as Ye,$ as on,a0 as zt,c as xl,u as $l,j as Rl,k as Hl,a1 as Ss,a2 as Rt,F as cn,a3 as As,a4 as Ts,a5 as un,a6 as fn,G as dn}from"./vendor_svelte.517cf6ee.js";import{w as Ht,b as hn,c as mn,e as Ns,f as Is,g as ql,h as Wt,i as Jt,a as js,j as is}from"./vendor.1acf520b.js";const Ds={1:0,2:2,3:4,4:5,5:7,6:9,7:11};function $e(l,e=0,t=0){return{interval:`${l}${"♭".repeat(e)}${"♯".repeat(t)}`,interval_seq:l,semitones:zl(l,e,t),flats:e,sharps:t}}function zl(l,e,t){return(l<8?Ds[l]:Ds[l%7])-e+t+Math.floor(l/8)*12}function Wl(l){let e,t=0,s=0;l<0?(t=1+Math.floor(-l/100),e=-l%100):l>100?(s=Math.floor(l/100),e=l%100):e=l;const n=zl(e,t,s);return{interval:`${e}${"♭".repeat(t)}${"♯".repeat(s)}`,interval_seq:e,semitones:n,flats:t,sharps:s}}const _n=[[["maj"],["Major Chord"],"major",[1,3,5]],[["6"],["Major 6th Chord"],"major",[1,3,5,6]],[["6/9"],["Major 6th/9th Chord"],"major",[1,3,5,6,9]],[["maj7"],["Major 7th Chord"],"major",[1,3,5,7]],[["maj9"],["Major 9th Chord"],"major",[1,3,5,7,9]],[["maj11"],["Major 11th Chord"],"major",[1,3,5,7,9,11]],[["maj13"],["Major 13th Chord"],"major",[1,3,5,7,9,11,13]],[["m"],["Minor Chord"],"minor",[1,-3,5]],[["m6"],["Minor 6th Chord"],"minor",[1,-3,5,6]],[["m7"],["Minor 7th Chord"],"minor",[1,-3,5,-7]],[["m9"],["Minor 9th Chord"],"minor",[1,-3,5,-7,9]],[["m11"],["Minor 11th Chord"],"minor",[1,-3,5,-7,9,11]],[["m13"],["Minor 13th Chord"],"minor",[1,-3,5,-7,9,11,13]],[["sus2"],["Suspended 2nd Chord"],"suspended",[1,2,5]],[["sus4"],["Suspended 4th Chord"],"suspended",[1,4,5]],[["7sus4"],["Suspended 4th Seventh Chord"],"suspended",[1,4,5,-7]],[["7"],["Dominant 7th Chord"],"major",[1,3,5,-7]],[["7#9"],["Dominant 7th Sharp 9th Chord"],"major",[1,3,5,-7,109]],[["9"],["Dominant 9th Chord"],"major",[1,3,5,-7,9]],[["11"],["Dominant 11th Chord"],"major",[1,3,5,-7,9,11]],[["13"],["Dominant 13th Chord"],"major",[1,3,5,-7,9,11,13]],[["5"],["Power Chord"],"indeterminate",[1,5]],[["dim","°"],["Diminished Chord"],"diminished",[1,-3,-5]],[["dim7","°7"],["Diminished 7th Chord"],"diminished",[1,-3,-5,-107]],[["m7b5"],["Half-Diminished 7th Chord"],"diminished",[1,-3,-5,-7]],[["aug","+"],["Augmented Chord"],"augmented",[1,3,105]],[["aug7","+7"],["Augmented 7th Chord"],"augmented",[1,3,105,-7]]];let as=[];function Jl(){return _n.map(l=>{const e=l[3].map(Wl);return{suffixes:l[0],name:l[1][0],type:l[2],intervals:e}})}function Dt(l){as.length===0&&(as=Jl());const e=l.replaceAll(/-|\s/g,"").toLowerCase().trim();return as.find(t=>t.suffixes.find(s=>s===e)||t.name.replaceAll(/-|\s/g,"").trim().toLowerCase()===e)}function pn(l,e,t){let s=e<0?l.flats-e:l.flats,n=e>0?l.sharps+e:l.sharps;if(s>0&&n>0){const a=Math.min(s,n);s-=a,n-=a}const r=(l.semitones+e)%12;return{...l,semitones:r<0?r+12:r,note:`${l.note.charAt(0)}${"♭".repeat(s)}${"♯".repeat(n)}`,flats:s,sharps:n,midi:t}}function cs(l,e,t){const s=[];for(let n=0;n_.semitones===a%12),i=r.flats>0,c=r.sharps>0,f=(i?a+1:c?a-1:a)%12,d=i?-1:c?1:0;s.push(pn(o??e.notesMap.get(f),o?0:d,a))}return s}const Ls=["B♭","E♭","A♭","D♭","G♭","C♭","F♭"],vn=["F♯","C♯","G♯","D♯","A♯","E♯","B♯"],Ps=new Map([[0,"C"],[-1,"F"],[-2,"B♭"],[-3,"E♭"],[-4,"A♭"],[-5,"D♭"],[-6,"G♭"],[-7,"C♭"],[1,"G"],[2,"D"],[3,"A"],[4,"E"],[5,"B"],[6,"F♯"],[7,"C♯"]]);function gn(l){let e=0,t=0;for(let s=0;sa.note.slice(0,2)===Ls[s]),r=l.find(a=>a.note.slice(0,2)===vn[s]);if(n)e+=1;else if(r)t+=1;else break}return e>t?{flats:e,sharps:0,majorSignature:Ps.get(e*-1)}:{flats:0,sharps:t,majorSignature:Ps.get(t)}}function bn(l){return l>=9?`${l>=10?"X":""}${l===9?"IX":"I".repeat(l%10)}`:`${l>=5?"V":""}${l===4?"IV":"I".repeat(l%5)}`}function Ql(l){return l.map(e=>{const t=[$e(1)];let s;return e.major?(t.push($e(3)),e.suffix.startsWith("+")?t.push($e(5,0,1)):e.suffix.startsWith("6")?t.push($e(6)):e.suffix.startsWith("7")?t.push($e(7,1)):e.suffix.startsWith("maj7")?t.push($e(7)):s=Dt("maj")):e.minor?(t.push($e(3,1)),e.suffix.startsWith("°")?t.push($e(5,1)):e.suffix.startsWith("6")?(t.push($e(6)),s=Dt("m"+e.suffix)):e.suffix.startsWith("7")?(t.push($e(7,1)),s=Dt("m"+e.suffix)):s=Dt("m")):e.suffix.startsWith("sus2")?t.push($e(2)):e.suffix.startsWith("sus4")&&t.push($e(4)),t.length<=2&&t.push($e(5)),t.length<=2&&t.push($e(8)),s||(s=Dt(e.suffix)),{...s,intervals:t}})}function yn(l,e){let t=e.has(4)&&e.has(7),s=e.has(3)&&e.has(7);const n=bn(l);let r="";return t||s||(e.has(3)&&e.has(6)?(r="°",s=!0):e.has(4)&&e.has(8)?(r="+",t=!0):e.has(3)&&e.has(10)?(s=!0,r="7"):e.has(4)&&e.has(10)?(r="7",t=!0):e.has(4)&&e.has(11)?(r="maj7",t=!0):e.has(3)&&e.has(8)?(r="6",s=!0):e.has(4)&&e.has(9)?(r="6",t=!0):e.has(2)?r="sus2":e.has(5)?r="sus4":e.has(7)?r="5":r="?"),{degree:l,roman:s?n.toLowerCase():n,suffix:r,major:t,minor:s,semitones:e}}function kn(l){const e=l.length;return l.map((t,s)=>{const n=t.semitones,r=new Set;for(let a=1;a{const e=l[0],t=l[1].map(Wl),s=kn(t);return{names:e,intervals:t,triads:s}})}function wn(l){rs.length===0&&(rs=_s());const e=l.replaceAll(/-|\s/g,"").toLowerCase().trim();return rs.find(t=>t.names.find(s=>s.replaceAll(/-|\s/g,"").trim().toLowerCase()===e))}const En=/^[a-gA-G][♭Bb#♯sS]*[0-9]?$/,Sn=/^[0-9]$/,tt=[{note:"C",semitones:0,sharps:0,flats:0},{note:"C♯",semitones:1,sharps:1,flats:0},{note:"D",semitones:2,sharps:0,flats:0},{note:"E♭",semitones:3,sharps:0,flats:1},{note:"E",semitones:4,sharps:0,flats:0},{note:"F",semitones:5,sharps:0,flats:0},{note:"F♯",semitones:6,sharps:1,flats:0},{note:"G",semitones:7,sharps:0,flats:0},{note:"G♯",semitones:8,sharps:1,flats:0},{note:"A",semitones:9,sharps:0,flats:0},{note:"B♭",semitones:10,sharps:0,flats:1},{note:"B",semitones:11,sharps:0,flats:0}];function Yl(l){return l===12?1:Math.floor((l-12)/12)}function Xe(l){return`${l.note}${Yl(l.midi)}`}function At(l){const t=(l-12)%12;return{...tt[t],semitones:t,midi:l}}function An(l,e=!0,t=!1){if(e&&!En.test(l))return{err:`Unrecognized note "${l}"`,code:400};const s=l.trim(),n=s.charAt(0).toUpperCase(),r=tt.find(d=>d.note.charAt(0)===n&&d.note.length===1);if(!r)return{err:`Unable to find note ${s}`,code:500};const a=s.slice(1).split("").reduce((d,_)=>d+(_.toLowerCase()==="b"||_==="♭"?-1:_==="#"||_==="♯"?1:0),0);let o;if(Sn.test(s.charAt(s.length-1)))try{o=parseInt(s.charAt(s.length-1),10)}catch{}if(t&&o===void 0)return{err:`No octave provided: ${l}`,code:400};o===void 0&&(o=0);let i=(r.semitones+a)%12;i=i<0?i+12:i;const c=a<0?-a:0,f=a>0?a:0;return{data:{note:`${n}${"♭".repeat(c)}${"♯".repeat(f)}`,semitones:i,midi:12+o*12+i,flats:c,sharps:f}}}function Xl(l){const e=tt.find(t=>t.note.charAt(0)===l.charAt(0)&&t.note.length===1);if(e){const t=l.slice(1).split("").reduce((n,r)=>n+(r.toLowerCase()==="b"||r==="♭"?-1:r==="#"||r==="♯"?1:0),0),s=(e.semitones+t)%12;return{note:l,semitones:s<0?s+12:s,flats:t<0?-t:0,sharps:t>0?t:0}}}const Tn=/^[a-gA-G][♭b#♯]?$/,os="ABCDEFG";function Nn(l,e){return e.map(t=>os.charAt((os.indexOf(l)+t.interval_seq-1)%os.length))}function In(l,e,t){return t.map((s,n)=>{const r=e[n],a=(l+s.semitones)%12,o=tt[a],i=o.note.charAt(0);if(ir||i==="A"&&r==="G"){let c=1,f=a===0?tt.length-1:a-c,d=tt[f];for(;d.note.charAt(0)!==r;)c+=1,f=f===0?tt.length-1:f-1,d=tt[f];return{semitones:a,note:d.note+"♯".repeat(c),flats:0,sharps:c+(d.note.includes("♯")?1:0)}}else return{semitones:a,note:o.note,flats:o.flats,sharps:o.sharps}})}function Qt(l,e){if(!Tn.test(l))return{err:`Unknown key: ${l}`,code:400};const t=wn(e);if(!t)return{err:`Unknown scale: ${e}`,code:404};const s=`${l.charAt(0).toUpperCase()}${l.charAt(1).replace("b","♭").replace("#","♯")}`,n=Xl(s);if(!n)return{err:`Unable to find root for note: ${s}`,code:404};const r=Nn(s.charAt(0),t.intervals),a=In(n.semitones,r,t.intervals),o=new Map(tt.map(i=>{const c=a.find(f=>f.semitones===i.semitones);return c?[i.semitones,c]:[i.semitones,{...i}]}));return{data:{key:s,scale:t.names[0],names:t.names,...gn(a),intervals:t.intervals.map(i=>({...i})),triads:t.triads.map(i=>({...i})),scaleNotes:a,notesMap:o}}}const us=new Map;function jn(l,e){try{const t=e==="local"?window.localStorage:window.sessionStorage;return{data:JSON.parse(t.getItem(l)||"")}}catch(t){return{err:`Failed to retrieve value from storage: ${t}`,code:400}}}function Dn(l,e,t){try{return(t==="local"?window.localStorage:window.sessionStorage).setItem(e,JSON.stringify(l)),{data:void 0}}catch(s){return{err:`Failed to store the value: ${s}`,code:400}}}function ht(l,e){const{key:t,storage:s="local",namespace:n="default"}=e,r=jn(t,s),a=_e(l);"data"in r?l.set(e.deserialize?e.deserialize(r.data):r.data):"err"in r&&(e!=null&&e.debug)&&console.info(r.err);const o=l.subscribe(c=>{const f=Dn(e.serialize?e.serialize(c):c,t,s);"err"in f&&(e!=null&&e.debug)&&console.error(f.err)}),i=us.get(n);return i?i.push({key:t,storage:s,value:l,defaultValue:a,unsubscribe:o}):us.set(n,[{key:t,storage:s,value:l,defaultValue:a,unsubscribe:o}]),l}function Ln(l=["default"],e){l.forEach(t=>{var s;(s=us.get(t))==null||s.forEach(n=>{if(e!=null&&e.cb)e==null||e.cb(n);else try{e!=null&&e.unsubscribe&&n.unsubscribe(),n.value.set(n.defaultValue),(n.storage==="local"?window.localStorage:window.sessionStorage).removeItem(n.key)}catch{}})})}async function Pn(l,e){const t=await fetch(l);if(!t.ok)return{err:t.statusText,code:t.status};const s=await t.arrayBuffer();return{data:await e.decodeAudioData(s)}}async function Bn(l,e){const t=["/a0.mp3","/a1.mp3","/a2.mp3","/a3.mp3","/a4.mp3","/a5.mp3","/a6.mp3","/a7.mp3","/damper.mp3","/Piano Impulse6.mp3"],s=await Promise.all(t.map(r=>Pn(`${l}${r}`,e))),n=[];return s.forEach(r=>{"err"in r?console.error(`Failed to load audio: ${r.err}`):n.push(r.data)}),n}class Gn{constructor(e,t,s,n){this.noteA=t.createBufferSource(),this.noteB=t.createBufferSource(),this.gainA=t.createGain(),this.gainB=t.createGain(),this.gain=t.createGain(),this.biquadFilter=t.createBiquadFilter(),this.biquadFilter.type="lowpass",this.biquadFilter.connect(s),this.gain.connect(this.biquadFilter),this.gainA.connect(this.gain),this.noteA.connect(this.gainA),this.gainB.connect(this.gain),this.noteB.connect(this.gainB),e<90&&(this.damp=t.createBufferSource(),this.damp.buffer=n,this.damp.connect(s))}on(e,t,s,n,r,a,o,i){this.noteA.buffer=e,this.noteA.playbackRate.value=s,this.biquadFilter.frequency.value=r,this.gainA.gain.value=a,this.gain.gain.value=i,t&&(this.noteB.buffer=t,this.noteB.playbackRate.value=n,this.gainB.gain.value=o,this.noteB.start(0)),this.noteA.start(0)}off(e,t,s){var n;this.gain.gain.setTargetAtTime(0,e,t),this.noteA.stop(s),this.noteB.stop(s),(n=this.damp)==null||n.start(0)}}class Mn{constructor(e){return this.bufferlists=[],this.sus=!1,this.sustained=[],this.notes=new Map,this.context=e,this.convolver=e.createConvolver(),this.directGain=e.createGain(),this.convGain=e.createGain(),this.convGainAfter=e.createGain(),this.convGain.connect(this.convolver),this.convolver.connect(this.convGainAfter),this.convGainAfter.connect(e.destination),this.directGain.connect(e.destination),this.directGain.connect(this.convGain),this.directGain.gain.value=.75,this.convGain.gain.value=0,this.convGainAfter.gain.value=0,this}load(e){e.forEach((t,s)=>{this.bufferlists.push(t),s===8?this.damper=t:s===9&&(this.convolver.buffer=t)})}playChord(e,t=80){e.forEach(s=>{this.noteOn(s,t)})}noteOn(e,t=80){if(e<109&&e>20){const s=this.notes.get(e);s&&(s.off(this.context.currentTime,1.1,this.context.currentTime+2),this.sustained.splice(this.sustained.indexOf(e),1));const n=Math.floor((e-21)/12),r=n+1,a=n*12+21,o=2**((e-69)/12)*440,i=t/127;let c=o*(2-(e-21)/50)+3*o*i;e<60&&(c=440*(3-(60-21)/50)+3*o*i);const f=1-(e%12/12+1)/12,d=Math.pow(2,(e-a)/12),_=0,b=0,g=i**1.4,E=new Gn(e,this.context,this.directGain,this.damper);E.on(this.bufferlists[n],this.bufferlists[r],d,_,c,f,b,g),this.notes.set(e,E)}}noteOff(e){if(this.sus)this.sustained.push(e);else{const t=this.notes.get(e);e<90&&t&&t.off(this.context.currentTime+.03,.08,this.context.currentTime+2),this.notes.delete(e)}}sustain(e){if(e==127)this.sus=!0,this.convGain.gain.value=1,this.convGainAfter.gain.value=1;else if(e==0){this.sus=!1,this.convGain.gain.value=0,this.convGainAfter.gain.value=0;for(let t=0;t[At(l[0]),At(l[1])]),Bs=Be(void 0),st=Be(void 0),at=ht(Be({fixedVelocity:void 0,keyFadeTimeout:1500,useSound:!0,useKeyboard:!0,useHotkeys:!0,useAutoOctave:!0}),{key:"inputs"}),Re={async openMidi(){return Ht.enable().then(()=>(fs.set(!0),Ht.inputs.length>0?(Yt.set(Ht.inputs[0]),{data:Ht.inputs[0]}):{err:"No MIDI device found.",code:400})).catch(l=>({err:l.toString(),code:403}))},disableMidi(){fs.set(!1),Yt.set(void 0)},setMidiRange(l){ps.set(l)},setInputValue(l,e){at.update(t=>({...t,[l]:e})),l==="useSound"&&!e?st.set(void 0):l==="useSound"&&!_e(st)&&this.initAudio()},async initAudio(){let l=_e(Bs);if(l||(l=new AudioContext,Bs.set(l)),!_e(st)){const e=new Mn(l),t=await Bn(`${Vn}audio`,l);e.load(t),st.set(e)}}};let et;rn({A:{note:"C",semitones:0,flats:0,sharps:0},W:{note:"C♯",semitones:1,flats:0,sharps:1},S:{note:"D",semitones:2,flats:0,sharps:0},E:{note:"E♭",semitones:3,flats:1,sharps:0},D:{note:"E",semitones:4,flats:0,sharps:0},F:{note:"F",semitones:5,flats:0,sharps:0},T:{note:"F♯",semitones:6,flats:0,sharps:1},G:{note:"G",semitones:7,flats:0,sharps:0},Y:{note:"G♯",semitones:8,flats:0,sharps:1},H:{note:"A",semitones:9,flats:0,sharps:0},U:{note:"B♭",semitones:10,flats:1,sharps:0},J:{note:"B",semitones:11,flats:0,sharps:0},K:{note:"C",semitones:12,flats:0,sharps:0},O:{note:"C♯",semitones:13,flats:0,sharps:1},L:{note:"D",semitones:14,flats:0,sharps:0},P:{note:"E♭",semitones:15,flats:1,sharps:0},Ö:{note:"E",semitones:16,flats:0,sharps:0},Ä:{note:"F",semitones:17,flats:0,sharps:0},Å:{note:"F♯",semitones:18,flats:0,sharps:1}});const kt=Be(["C","Major"]),Nt=It(kt,l=>{const e=Qt(l[0],l[1]);return"data"in e?e.data:{key:l[0],scale:l[1],names:["major"],flats:0,sharps:0,majorSignature:"C",intervals:[],scaleNotes:[],triads:[],notesMap:new Map}}),Gs=Be([]),gt=Be([]);function ds(l,e){if(l.length>0){const t=Date.now();let s=t;const n=l.filter(r=>(r.started+e>t&&(s=Math.min(s,r.started)),r.started+e>t));return!et&&n.length>0&&(et=setTimeout(()=>{et=void 0,gt.update(r=>ds(r,e))},e-(t-s)+100)),n}return l}const he={setKey(l){kt.update(e=>[l,e[1]])},setScale(l){kt.update(e=>[e[0],l])},setKeyAndScale(l,e){kt.set([l,e])},setTarget(l=[]){Gs.set(l)},getNote(l){return{..._e(Nt).notesMap.get(l%12),midi:l}},pushPlayed(l,e,t){const n={..._e(Nt).notesMap.get(l%12),midi:l},r=Date.now(),a=e===void 0?"default":e?"correct":"wrong";if(gt.update(o=>{const i=o.findIndex(c=>c.midi===l);return i>=0&&o.splice(i,1),[...o,{...n,color:a,started:r}]}),!et&&t!==-1){const o=t??_e(at).keyFadeTimeout;et=setTimeout(()=>{et=void 0,gt.update(i=>ds(i,o))},o)}},setPlayed(l,e,t){const s=Date.now(),n=e===void 0?"default":e?"correct":"wrong";if(gt.update(r=>[...l.map(a=>({...a,color:n,started:s}))]),!et&&t!==-1){const r=t??_e(at).keyFadeTimeout;et=setTimeout(()=>{et=void 0,gt.update(a=>ds(a,r))},r)}},clearPlayed(){gt.set([]),clearTimeout(et),et=void 0},clearScore(l=!1){l&&kt.set(["C","Major"]),Gs.set([]),gt.set([])}};class vs{constructor(e,t,s){this.guesses=[],this.times=[],this.correct=0,this.guessed=0,this.idx=0,this.type=e,this.data=t,this.baseOptions=s;const n=[],{count:r}=s,a=t.map(i=>typeof i=="object"&&i!==null?{...i}:i);let o=s.duplicates;!s.duplicates&&r>a.length&&(console.warn(`Trying to create game with count ${r} larger than available unique values ${t.length}`),o=!0);for(let i=0;i0&&n.push(f[0])}}this.sampled=n,this.timing=performance.now()}get current(){return this.sampled[this.idx]}get latestGuess(){const e=this.sampled[this.idx-1],t=this.guesses[this.idx-1];return{target:e,guessed:t}}get ended(){return this.sampled.length0?l.sharps+e:l.sharps;if(s>0&&n>0){const a=Math.min(s,n);s-=a,n-=a}const r=(l.semitones+e)%12;return{...l,semitones:r<0?r+12:r,note:`${l.note.charAt(0)}${"♭".repeat(s)}${"♯".repeat(n)}`,flats:s,sharps:n,midi:t}}function On(l,e,t){const s=[];for(let n=0;n_.semitones===a%12),i=r.flats>0,c=r.sharps>0,f=(i?a+1:c?a-1:a)%12,d=i?-1:c?1:0;s.push(Kn(o??e.notesMap.get(f),o?0:d,a))}return s}const Un=[{note:"C",semitones:0,sharps:0,flats:0},{note:"C♯",semitones:1,sharps:1,flats:0},{note:"D",semitones:2,sharps:0,flats:0},{note:"E♭",semitones:3,sharps:0,flats:1},{note:"E",semitones:4,sharps:0,flats:0},{note:"F",semitones:5,sharps:0,flats:0},{note:"F♯",semitones:6,sharps:1,flats:0},{note:"G",semitones:7,sharps:0,flats:0},{note:"G♯",semitones:8,sharps:1,flats:0},{note:"A",semitones:9,sharps:0,flats:0},{note:"B♭",semitones:10,sharps:0,flats:1},{note:"B",semitones:11,sharps:0,flats:0}];function Fn(l){const t=(l-12)%12;return{...Un[t],semitones:t,midi:l}}function xn(l){return`${l.note.trim().charAt(0).toUpperCase()}${"♭".repeat(l.flats)}${"♯".repeat(l.sharps)}`}class ft extends vs{constructor(e,t,s){const n=t.range[0],r=t.range[1],a=new Set(t.scale.scaleNotes.map(i=>i.semitones)),o=s.chords.flatMap(i=>{const c=[],f=i.intervals.reduce((d,_)=>_.semitones>d?_.semitones:d,0);for(let d=n;d<=r-f;d+=1)if((!s.onlyScale||a.has(d%12))&&(!i.allowed||i.allowed.has(d%12))){const _=On(d,t.scale,i.intervals);c.push({...i,rootNote:_[0].note,chord:`${_[0].note}${i.suffixes[0]}`,notes:_})}return c});super(e,o,t),this.played=new Set,this.opts=s}addPlayedNote(e){this.played.add(e)}guessWrittenChord(e){const t={chord:`${xn(e)}${e.chord.toLowerCase()}`,notes:[]},s=this.current.chord===t.chord;return this.addGuessed(t,s)}guess(){const e=Array.from(this.played.values()).map(n=>Fn(n)).sort((n,r)=>n.midi-r.midi);this.played.clear();const t={chord:"",notes:e},s=this.current.notes.every(n=>e.find(r=>r.midi%12===n.midi%12));return this.addGuessed(t,s)}}const $n={major:{C:{num:0},F:{acc:"b",num:1},Bb:{acc:"b",num:2},Eb:{acc:"b",num:3},Ab:{acc:"b",num:4},Db:{acc:"b",num:5},Gb:{acc:"b",num:6},Cb:{acc:"b",num:7},G:{acc:"#",num:1},D:{acc:"#",num:2},A:{acc:"#",num:3},E:{acc:"#",num:4},B:{acc:"#",num:5},"F#":{acc:"#",num:6},"C#":{acc:"#",num:7}},minor:{A:{num:0},D:{acc:"b",num:1},G:{acc:"b",num:2},C:{acc:"b",num:3},F:{acc:"b",num:4},Bb:{acc:"b",num:5},Eb:{acc:"b",num:6},Ab:{acc:"b",num:7},E:{acc:"#",num:1},B:{acc:"#",num:2},"F#":{acc:"#",num:3},"C#":{acc:"#",num:4},"G#":{acc:"#",num:5},"D#":{acc:"#",num:6},"A#":{acc:"#",num:7}}};class Lt extends vs{constructor(e,t){const s=e==="keys-major"?"major":"minor";super(e,Object.keys($n[s]),t)}guess(e){const t=this.current===e;return this.addGuessed(e,t)}}class Tt extends vs{constructor(e,t){const s=t.range[0],n=t.range[1];super(e,Array.from(new Array(n-s+1)).map((r,a)=>s+a),t)}guess(e){const t=this.current===e;return this.addGuessed(e,t)}}const Zl={count:10,duplicates:!0,autoplay:!0,waitSeconds:3},bt=Be("waiting"),dt=ht(Be(Zl),{key:"game-options"}),yt=Be(void 0),gs=Be(Jl().map(l=>({...l,selected:!0}))),ye={play(...[l,e]){var i,c,f;let t;const s=_e(Nt),n=_e(ps),r=_e(dt),a={scale:s,range:n,duplicates:r.duplicates,count:r.count};let o=[s.key,s.scale];if(l==="notes")t=new Tt(l,a),he.setTarget([he.getNote(t.current)]),(i=_e(st))==null||i.noteOn(t.current);else if(l==="pitches")t=new Tt(l,a),he.setTarget(),Re.setInputValue("useSound",!0),(c=_e(st))==null||c.noteOn(t.current);else if(l==="keys-major"||l=="keys-minor")t=new Lt(l,a),o=[t.current,l==="keys-major"?"major":"minor"];else if(l==="chords-play"||l==="chords-write")t=new ft(l,a,e);else if(l==="chords-diatonic"){const d=Ql(s.triads).map((_,b)=>({..._,allowed:new Set([s.scaleNotes[b].semitones])}));t=new ft(l,a,{chords:d})}else throw Error("Unknown game type: "+l);return typeof t.current!="number"&&typeof t.current!="string"&&((f=_e(st))==null||f.playChord(t.current.notes.map(d=>d.midi)),he.setTarget(t.current.notes)),he.setKeyAndScale(o[0],o[1]),he.clearPlayed(),bt.set("waiting"),yt.set(t),t},updateState(l){bt.set(l)},setOptionValue(l,e){dt.update(t=>({...t,[l]:e}))},toggleChords(l){gs.update(e=>e.map(t=>({...t,selected:l(t)})))},nextGuess(){var e,t;const l=_e(yt);l!=null&&l.ended?bt.set("ended"):l instanceof Tt?(l.type==="notes"?he.setTarget([he.getNote(l.current)]):he.setTarget(),he.clearPlayed(),(e=_e(st))==null||e.noteOn(l.current),ye.updateState("waiting"),l.startTime()):l instanceof ft?(he.setTarget(l.current.notes),he.clearPlayed(),(t=_e(st))==null||t.playChord(l==null?void 0:l.current.notes.map(s=>s.midi)),bt.set("waiting"),l.startTime()):l instanceof Lt&&(he.setKey(l.current),bt.set("waiting"),l.startTime())},clearGame(l=!1){const e=_e(yt);e&&he.setKeyAndScale(e.baseOptions.scale.key,e.baseOptions.scale.scale),l&&dt.set(Zl),yt.set(void 0),bt.set("waiting"),he.clearScore()}},Rn={layout:{default:["§ 1 2 3 4 5 6 7 8 9 0 + ´ {bksp}","{tab} q w e r t y u i o p å ¨ {enter}","{lock} a s d f g h j k l ö ä '","{shift} < z x c v b n m , . - {shift}",".com @ {space}"],shift:['° ! " # $ % & / ( ) = ? ` {bksp}',"{tab} Q W E R T Y U I O P Å ^","{lock} A S D F G H J K L Ö Ä * {enter}","{shift} > Z X C V B N M ; : _ {shift}",".com @ {space}"]}},Hn=[["IntlBackslash","Digit1","Digit2","Digit3","Digit4","Digit5","Digit6","Digit7","Digit8","Digit9","Digit0","Minus","Equal","Backspace"],["Tab","KeyQ","KeyW","KeyE","KeyR","KeyT","KeyY","KeyU","KeyI","KeyO","KeyP","BracketLeft","BracketRight","Enter"],["Capslock","KeyA","KeyS","KeyD","KeyF","KeyG","KeyH","KeyJ","KeyK","KeyL","Semicolon","Quote","Backslash"],["ShiftLeft","Backquote","KeyZ","KeyX","KeyC","KeyV","KeyB","KeyN","KeyM","Comma","Period","Slash","ShiftRight"]];function qn(l,e){return l[1].forEach((t,s)=>{let n;s===2?n={...e[1]}:s===3?n={...e[3]}:s===5?n={...e[6]}:s===6?n={...e[8]}:s===7?n={...e[10]}:s===9?(n={...e[1]},n.semitones+=12):s===10&&(n={...e[3]},n.semitones+=12),l[1][s].note=n}),l[2].forEach((t,s)=>{let n;s===1?n={...e[0]}:s===2?n={...e[2]}:s===3?n={...e[4]}:s===4?n={...e[5]}:s===5?n={...e[7]}:s===6?n={...e[9]}:s===7?n={...e[11]}:s===8?(n={...e[0]},n.semitones+=12):s===9?(n={...e[2]},n.semitones+=12):s===10?(n={...e[4]},n.semitones+=12):s===11?(n={...e[5]},n.semitones+=12):s===12&&(n={...e[7]},n.semitones+=12),l[2][s].note=n}),l}class zn{constructor(e={layout:"middle-row"}){this.language="en",this.rows=[[],[],[],[]],this.opts=e,this.setLayout(Rn)}setOptions(e){this.opts={...this.opts,...e}}setLayout(e){const t=[[],[],[],[]];e.layout.default.forEach((s,n)=>{s.split(" ").forEach((r,a)=>{n<4&&t[n].push({key:r,code:Hn[n][a]})})}),this.rows=t}setNotes(e){this.opts.layout==="middle-row"&&(this.rows=qn(this.rows,e))}}const bs=/^[a-gA-G]$/,en=/^[♭Bb#♯sS]$/,Wn=/^[0-9]$/;let q="",ut;const tn=Be(!0),Jn=ht(Be({layout:"middle-row"}),{key:"keyboard-options"}),sn=It([Nt,Jn],([l,e])=>{const t=new zn(e);return t.setNotes(Array.from(l.notesMap.values())),t}),Qn=It(sn,l=>l.rows.map(e=>e.map((t,s)=>{let n;return t.key==="{bksp}"?n=2:t.key==="{tab}"?n=1.5:t.key==="{enter}"?n=2:t.key==="{lock}"?n=1.75:t.key==="{shift}"&&s===0?n=1.5:t.key==="{shift}"&&(n=2.5),n?{...t,size:n}:t}))),Zt=It(sn,l=>new Map([...l.rows[0].map(e=>[e.code,e]),...l.rows[1].map(e=>[e.code,e]),...l.rows[2].map(e=>[e.code,e]),...l.rows[3].map(e=>[e.code,e])])),Yn=It(Zt,l=>Array.from(l.values()).map(e=>e.note).filter(e=>e!==void 0));function Xn(l,e){const{useHotkeys:t}=_e(at),s=_e(Zt).get(l);if(t&&q.length===0&&s&&s.note)return q="",{e:"guessed-key",data:s.note.note};if(!t&&q.length===0&&bs.test(e))return q+=e.toUpperCase(),{e:"string",data:q};if(!t&&q.length>0&&en.test(e))return e==="b"||e==="B"?q+="♭":q+="♯",{e:"string",data:q};if(l==="Backspace"&&q.length>0)return q=q.slice(0,-1),{e:"string",data:q};if(l==="Enter"&&q.length>0){const n=q;return q="",{e:"guessed-key",data:n}}return!1}function Zn(l,e,t){if(l==="Enter"&&q.length>0){const s={note:"",flats:0,sharps:0,chord:""};for(let n=0;n0?s.chord+=q[n].toLowerCase():q[n]==="♭"?(s.note+=q[n],s.flats+=1):q[n]==="♯"?(s.note+=q[n],s.sharps+=1):s.chord+=q[n].toLowerCase();return q="",{e:"guessed-chord",data:s}}else{if(l==="Backspace"&&q.length>0)return q=q.slice(0,-1),{e:"string",data:q};if(q.length===0&&bs.test(e))return q+=e.toUpperCase(),{e:"string",data:q};if(q.length>0&&e.length===1)return q.length===1&&(e==="b"||e==="B")?q+="♭":q.length===1&&e==="#"?q+="♯":q+=e,{e:"string",data:q}}return!1}function ea(l,e,t){const{useAutoOctave:s,useHotkeys:n}=_e(at);let r;const o=_e(Zt).get(l),i=(o==null?void 0:o.key)||"";let c=!1;if(!ut&&n&&(o!=null&&o.note)?(ut=o.note,s&&(r=Yl(_e(Xt)[0].midi)),c="note"):!n&&q.length===0&&bs.test(e)?(q+=e.toUpperCase(),c="input"):!n&&q.length>0&&en.test(e)&&(e==="b"||e==="B"?q+="♭":q+="♯",c="input"),Wn.test(i))try{r=parseInt(i)}catch{}if(ut&&r!==void 0){const f=ut.semitones+(r+1+(t?1:0))*12;return ut=void 0,{e:"guessed-note",data:f}}else if(q&&r!==void 0){const f=Ge.findNote(q),d=f?f.semitones+(r+1)*12:void 0;return ut=void 0,q="",d!==void 0?{e:"guessed-note",data:d}:{e:"string",data:q}}else if(l==="Backspace"&&(ut||q.length>0))return ut=void 0,q=q.slice(0,-1),{e:"string",data:q};return c==="note"?{e:"note",data:ut}:c==="input"?{e:"string",data:q}:!1}const Ge={setKeyboardFocus(l){tn.set(l)},findNote(l){return _e(Yn).find(e=>{if(e.note.charAt(0)===l.charAt(0)){const t=l.slice(1).split("").reduce((s,n)=>s+(n.toLowerCase()==="b"||n==="♭"?-1:n.toLowerCase()==="s"||n==="#"||n==="♯"?1:0),0);return t>0?e.sharps===t:t<0?e.flats===t*-1:e.flats===0&&e.sharps===0}})},handleInput(l,e,t=!1){const s=_e(yt);return s instanceof Lt?Xn(l,e.toUpperCase()):s instanceof ft&&s.type==="chords-write"?Zn(l,e):_e(at).useKeyboard?ea(l,e.toUpperCase(),t):!1}};function Ms(l,e,t){const s=l.slice();return s[29]=e[t],s[31]=t,s}function Vs(l,e,t){const s=l.slice();return s[34]=e[t],s}function Ks(l,e,t){const s=l.slice();return s[8]=e[t],s}function Os(l,e,t){const s=l.slice();return s[29]=e[t],s[31]=t,s}function Us(l,e,t){const s=l.slice();return s[34]=e[t],s}function Fs(l,e,t){const s=l.slice();return s[8]=e[t],s}function ta(l){let e,t=le(l[29].intervals),s=[];for(let n=0;n0?sa:ta}let N=C(l),k=N(l);return{c(){e=p("li"),t=p("button"),s=p("span"),pe(n.$$.fragment),r=P(),a=p("div"),i=Q(o),c=P(),f=p("li"),k.c(),_=P(),b=p("li"),E=Q(g),this.h()},l(S){e=v(S,"LI",{});var j=T(e);t=v(j,"BUTTON",{class:!0});var A=T(t);s=v(A,"SPAN",{class:!0});var O=T(s);ve(n.$$.fragment,O),O.forEach(m),r=B(A),a=v(A,"DIV",{class:!0});var w=T(a);i=Y(w,o),w.forEach(m),A.forEach(m),j.forEach(m),c=B(S),f=v(S,"LI",{class:!0,title:!0});var L=T(f);k.l(L),L.forEach(m),_=B(S),b=v(S,"LI",{class:!0});var I=T(b);E=Y(I,g),I.forEach(m),this.h()},h(){h(s,"class","px-1 py-1 rounded"),z(s,"text-green-500",l[29].selected),z(s,"text-gray-400",!l[29].selected),h(a,"class","ml-1 px-1 w-full bg-gray-200 svelte-1j99daw"),h(t,"class","flex items-center justify-center w-full select-btn svelte-1j99daw"),z(t,"hidden",l[7]),h(f,"class","intervals svelte-1j99daw"),h(f,"title",d=l[29].intervals.map(Js).join("-")),h(b,"class","text-xs")},m(S,j){U(S,e,j),u(e,t),u(t,s),ge(n,s,null),u(t,r),u(t,a),u(a,i),U(S,c,j),U(S,f,j),k.m(f,null),U(S,_,j),U(S,b,j),u(b,E),y=!0,D||(G=$(t,"click",K),D=!0)},p(S,j){l=S;const A={};j[0]&64&&(A.icon=l[29].selected?Wt:Jt),n.$set(A),(!y||j[0]&64)&&z(s,"text-green-500",l[29].selected),(!y||j[0]&64)&&z(s,"text-gray-400",!l[29].selected),(!y||j[0]&64)&&o!==(o=l[29].suffixes[0]+"")&&ae(i,o),(!y||j[0]&128)&&z(t,"hidden",l[7]),N===(N=C(l))&&k?k.p(l,j):(k.d(1),k=N(l),k&&(k.c(),k.m(f,null))),(!y||j[0]&64&&d!==(d=l[29].intervals.map(Js).join("-")))&&h(f,"title",d),(!y||j[0]&64)&&g!==(g=l[29].name+"")&&ae(E,g)},i(S){y||(H(n.$$.fragment,S),y=!0)},o(S){J(n.$$.fragment,S),y=!1},d(S){S&&(m(e),m(c),m(f),m(_),m(b)),be(n),k.d(),D=!1,G()}}}function la(l){let e,t=le(l[29].intervals),s=[];for(let n=0;n0?na:la}let N=C(l),k=N(l);return{c(){e=p("li"),t=p("button"),s=p("span"),pe(n.$$.fragment),r=P(),a=p("div"),i=Q(o),c=P(),f=p("li"),k.c(),_=P(),b=p("li"),E=Q(g),this.h()},l(S){e=v(S,"LI",{});var j=T(e);t=v(j,"BUTTON",{class:!0});var A=T(t);s=v(A,"SPAN",{class:!0});var O=T(s);ve(n.$$.fragment,O),O.forEach(m),r=B(A),a=v(A,"DIV",{class:!0});var w=T(a);i=Y(w,o),w.forEach(m),A.forEach(m),j.forEach(m),c=B(S),f=v(S,"LI",{class:!0,title:!0});var L=T(f);k.l(L),L.forEach(m),_=B(S),b=v(S,"LI",{class:!0});var I=T(b);E=Y(I,g),I.forEach(m),this.h()},h(){h(s,"class","px-1 py-1 rounded"),z(s,"text-green-500",l[29].selected),z(s,"text-gray-400",!l[29].selected),h(a,"class","ml-1 px-1 w-full bg-gray-200 svelte-1j99daw"),h(t,"class","flex items-center justify-center w-full select-btn svelte-1j99daw"),z(t,"hidden",l[7]),h(f,"class","intervals svelte-1j99daw"),h(f,"title",d=l[29].intervals.map(Qs).join("-")),h(b,"class","text-xs")},m(S,j){U(S,e,j),u(e,t),u(t,s),ge(n,s,null),u(t,r),u(t,a),u(a,i),U(S,c,j),U(S,f,j),k.m(f,null),U(S,_,j),U(S,b,j),u(b,E),y=!0,D||(G=$(t,"click",K),D=!0)},p(S,j){l=S;const A={};j[0]&32&&(A.icon=l[29].selected?Wt:Jt),n.$set(A),(!y||j[0]&32)&&z(s,"text-green-500",l[29].selected),(!y||j[0]&32)&&z(s,"text-gray-400",!l[29].selected),(!y||j[0]&32)&&o!==(o=l[29].suffixes[0]+"")&&ae(i,o),(!y||j[0]&128)&&z(t,"hidden",l[7]),N===(N=C(l))&&k?k.p(l,j):(k.d(1),k=N(l),k&&(k.c(),k.m(f,null))),(!y||j[0]&32&&d!==(d=l[29].intervals.map(Qs).join("-")))&&h(f,"title",d),(!y||j[0]&32)&&g!==(g=l[29].name+"")&&ae(E,g)},i(S){y||(H(n.$$.fragment,S),y=!0)},o(S){J(n.$$.fragment,S),y=!1},d(S){S&&(m(e),m(c),m(f),m(_),m(b)),be(n),k.d(),D=!1,G()}}}function aa(l){let e,t,s,n,r="Chords",a,o,i,c,f,d,_,b,g,E,y,D,G,K,C,N,k,S="Key",j,A,O,w,L="Scale",I,F,M,V,R="Note",te,se,fe,ie,Me,xe,Ve,me,We,Fe;c=new ot({props:{icon:hn,width:20}}),_=new ot({props:{icon:mn,width:16}}),E=new ot({props:{icon:l[4]?Ns:Is,width:16}}),G=new ot({props:{icon:ql,width:16}});let Ne=le(l[6]),re=[];for(let x=0;xJ(re[x],1,1,()=>{re[x]=null});let de=le(l[5]),W=[];for(let x=0;xJ(W[x],1,1,()=>{W[x]=null});return{c(){e=p("div"),t=p("fieldset"),s=p("legend"),n=p("button"),n.textContent=r,a=P(),o=p("div"),i=p("button"),pe(c.$$.fragment),f=P(),d=p("button"),pe(_.$$.fragment),b=P(),g=p("button"),pe(E.$$.fragment),y=P(),D=p("button"),pe(G.$$.fragment),K=P(),C=p("div"),N=p("div"),k=p("label"),k.textContent=S,j=P(),A=p("input"),O=P(),w=p("label"),w.textContent=L,I=P(),F=p("input"),M=P(),V=p("label"),V.textContent=R,te=P(),se=p("input"),fe=P(),ie=p("ul");for(let x=0;xl.interval,Qs=l=>l.interval;function ra(l,e,t){let s,n,r,a,o,i;oe(l,gs,M=>t(20,o=M));let c="C",f=Qt(c,Ws),d="",_,b=[],g=[];const E=ht(Be(!0),{key:"chords-hidden"});oe(l,E,M=>t(7,i=M));function y(){E.update(M=>!M)}function D(){const M=_&&60+_.semitones;if("err"in f||!M)t(2,b=[]),t(3,g=[]);else{const V=f.data;t(2,b=n.map(R=>cs(M,V,R.intervals))),t(3,g=r.map(R=>cs(M,V,R.intervals)))}}function G({currentTarget:{value:M}}){t(0,c=`${M.charAt(0).toUpperCase()}${M.charAt(1).toLowerCase()}`),f=Qt(c,Ws),D()}function K({currentTarget:{value:M}}){t(1,d=`${M.charAt(0).toUpperCase()}${M.charAt(1).toLowerCase()}`),t(8,_=Xl(d)),D()}function C(M){ye.toggleChords(V=>V.name===M.name?!V.selected:V.selected)}function N(){const M=R=>R.suffixes[0]==="maj"||R.suffixes[0]==="m",V=o.filter(M).every(R=>R.selected);ye.toggleChords(R=>M(R)?!V:R.selected)}function k(){const M=R=>R.suffixes[0]==="maj7"||R.suffixes[0]==="m7"||R.suffixes[0]==="7"||R.suffixes[0]==="dim7"||R.suffixes[0]==="aug7",V=o.filter(M).every(R=>R.selected);ye.toggleChords(R=>M(R)?!V:R.selected)}function S(){ye.toggleChords(M=>!a)}function j(){ye.toggleChords(M=>!0)}const A=()=>Ge.setKeyboardFocus(!1),O=()=>Ge.setKeyboardFocus(!0),w=()=>Ge.setKeyboardFocus(!1),L=()=>Ge.setKeyboardFocus(!0),I=M=>C(M),F=M=>C(M);return l.$$set=M=>{t(18,e=ke(ke({},e),Ce(M)))},l.$$.update=()=>{l.$$.dirty[0]&1048576&&t(19,s=o),l.$$.dirty[0]&524288&&t(6,n=s.filter((M,V)=>VV>=s.length/2)),l.$$.dirty[0]&524288&&t(4,a=s.every(M=>M.selected))},e=Ce(e),[c,d,b,g,a,r,n,i,_,E,y,G,K,C,N,k,S,j,e,s,o,A,O,w,L,I,F]}class oa extends He{constructor(e){super(),qe(this,e,ra,aa,ze,{},null,[-1,-1])}}function Ys(l,e,t){const s=l.slice();return s[10]=e[t],s}function ia(l){let e;return{c(){e=Q(" ")},l(t){e=Y(t," ")},m(t,s){U(t,e,s)},p:ue,d(t){t&&m(e)}}}function ca(l){let e,t,s="Played:",n,r=le(l[2]),a=[];for(let o=0;o0?ca:ia}let a=r(l),o=a(l);function i(d,_){return d[0]&&d[1]==="ended"?va:d[0]&&d[3].autoplay?pa:d[0]?_a:ma}let c=i(l),f=c(l);return{c(){e=p("div"),o.c(),s=P(),n=p("div"),f.c(),this.h()},l(d){e=v(d,"DIV",{class:!0});var _=T(e);o.l(_),_.forEach(m),s=B(d),n=v(d,"DIV",{class:!0});var b=T(n);f.l(b),b.forEach(m),this.h()},h(){h(e,"class",t=Ae(`${l[8].class||""} min-h-[3.25rem]`)+" svelte-1lxfpqs"),h(n,"class","mt-2 h-8")},m(d,_){U(d,e,_),o.m(e,null),U(d,s,_),U(d,n,_),f.m(n,null)},p(d,[_]){a===(a=r(d))&&o?o.p(d,_):(o.d(1),o=a(d),o&&(o.c(),o.m(e,null))),_&256&&t!==(t=Ae(`${d[8].class||""} min-h-[3.25rem]`)+" svelte-1lxfpqs")&&h(e,"class",t),c===(c=i(d))&&f?f.p(d,_):(f.d(1),f=c(d),f&&(f.c(),f.m(n,null)))},i:ue,o:ue,d(d){d&&(m(e),m(s),m(n)),o.d(),f.d()}}}const Zs=l=>l.note,el=l=>l.note;function ba(l,e,t){let s,n,r;oe(l,bt,_=>t(1,s=_)),oe(l,gt,_=>t(2,n=_)),oe(l,dt,_=>t(3,r=_));let{game:a}=e;function o(){ye.nextGuess()}function i(){ye.setOptionValue("autoplay",!0),ye.nextGuess()}function c(){a instanceof ft?ye.play(a.type,a.opts):a&&ye.play(a.type,void 0)}function f(){ye.clearGame()}const d=()=>ye.setOptionValue("autoplay",!1);return l.$$set=_=>{t(8,e=ke(ke({},e),Ce(_))),"game"in _&&t(0,a=_.game)},e=Ce(e),[a,s,n,r,o,i,c,f,e,d]}class ya extends He{constructor(e){super(),qe(this,e,ba,ga,ze,{game:0})}}function tl(l){let e;return{c(){e=p("li"),this.h()},l(t){e=v(t,"LI",{class:!0}),T(e).forEach(m),this.h()},h(){h(e,"class","m-[0.175rem] mr-0")},m(t,s){U(t,e,s)},d(t){t&&m(e)}}}function sl(l){let e;return{c(){e=p("div"),this.h()},l(t){e=v(t,"DIV",{class:!0}),T(e).forEach(m),this.h()},h(){h(e,"class","enter-part bg-[#ececf1] rounded-l absolute top-[-2px] left-[-12px] w-[13px] h-[2.8rem] svelte-jvhfju")},m(t,s){U(t,e,s)},d(t){t&&m(e)}}}function ll(l){let e,t=l[0].note.note+"",s;return{c(){e=p("div"),s=Q(t),this.h()},l(n){e=v(n,"DIV",{class:!0});var r=T(e);s=Y(r,t),r.forEach(m),this.h()},h(){h(e,"class","absolute top-0 left-0")},m(n,r){U(n,e,r),u(e,s)},p(n,r){r&1&&t!==(t=n[0].note.note+"")&&ae(s,t)},d(n){n&&m(e)}}}function ka(l){let e,t,s,n,r,a,o=l[0].key+"",i,c,f,d,_=l[0].key==="{enter}"&&tl(),b=l[0].key==="{enter}"&&sl(),g=l[0].note&&ll(l);return{c(){_&&_.c(),e=P(),t=p("li"),s=p("button"),b&&b.c(),n=P(),g&&g.c(),r=P(),a=p("div"),i=Q(o),this.h()},l(E){_&&_.l(E),e=B(E),t=v(E,"LI",{class:!0});var y=T(t);s=v(y,"BUTTON",{class:!0});var D=T(s);b&&b.l(D),n=B(D),g&&g.l(D),r=B(D),a=v(D,"DIV",{});var G=T(a);i=Y(G,o),G.forEach(m),D.forEach(m),y.forEach(m),this.h()},h(){h(s,"class","relative w-full h-full shadow bg-[#ececf1] rounded flex items-center justify-center svelte-jvhfju"),h(t,"class",c=Ae(`${l[1].class||""} m-[0.175rem] ${nl(l[0].size)}`)+" svelte-jvhfju"),z(t,"enter",l[0].key==="{enter}")},m(E,y){_&&_.m(E,y),U(E,e,y),U(E,t,y),u(t,s),b&&b.m(s,null),u(s,n),g&&g.m(s,null),u(s,r),u(s,a),u(a,i),f||(d=$(s,"click",l[2]),f=!0)},p(E,[y]){E[0].key==="{enter}"?_||(_=tl(),_.c(),_.m(e.parentNode,e)):_&&(_.d(1),_=null),E[0].key==="{enter}"?b||(b=sl(),b.c(),b.m(s,n)):b&&(b.d(1),b=null),E[0].note?g?g.p(E,y):(g=ll(E),g.c(),g.m(s,r)):g&&(g.d(1),g=null),y&1&&o!==(o=E[0].key+"")&&ae(i,o),y&3&&c!==(c=Ae(`${E[1].class||""} m-[0.175rem] ${nl(E[0].size)}`)+" svelte-jvhfju")&&h(t,"class",c),y&3&&z(t,"enter",E[0].key==="{enter}")},i:ue,o:ue,d(E){E&&(m(e),m(t)),_&&_.d(E),b&&b.d(),g&&g.d(),f=!1,d()}}}function nl(l){return l&&Number.isInteger(l)?`size-${l}`:l?`size-${Math.floor(l)}-${Math.floor(l*10)-Math.floor(l)*10}`:"size-1"}function Ca(l,e,t){let{value:s}=e;function n(r){ms.call(this,l,r)}return l.$$set=r=>{t(1,e=ke(ke({},e),Ce(r))),"value"in r&&t(0,s=r.value)},e=Ce(e),[s,e,n]}class wa extends He{constructor(e){super(),qe(this,e,Ca,ka,ze,{value:0})}}function al(l,e,t){const s=l.slice();return s[7]=e[t],s[9]=t,s}function rl(l,e,t){const s=l.slice();return s[10]=e[t],s}function ol(l){let e,t;return e=new wa({props:{value:l[10]}}),{c(){pe(e.$$.fragment)},l(s){ve(e.$$.fragment,s)},m(s,n){ge(e,s,n),t=!0},p(s,n){const r={};n&4&&(r.value=s[10]),e.$set(r)},i(s){t||(H(e.$$.fragment,s),t=!0)},o(s){J(e.$$.fragment,s),t=!1},d(s){be(e,s)}}}function il(l){let e,t,s,n,r=le(l[7]),a=[];for(let i=0;iJ(a[i],1,1,()=>{a[i]=null});return{c(){e=p("li"),t=P();for(let i=0;iJ(k[j],1,1,()=>{k[j]=null});return{c(){e=p("div"),t=p("div"),s=p("div"),n=p("label"),n.textContent=r,a=P(),o=p("input"),i=P(),c=p("div"),f=p("label"),f.textContent=d,_=P(),b=p("input"),g=P(),E=p("div"),y=p("ul");for(let j=0;jt(6,s=c)),oe(l,Qn,c=>t(2,n=c)),Fl(()=>{console.log(s)});let r=!0,a=!1;function o(){r=this.checked,t(0,r)}function i(){a=this.checked,t(1,a)}return l.$$set=c=>{t(3,e=ke(ke({},e),Ce(c)))},e=Ce(e),[r,a,n,e,o,i]}class Aa extends He{constructor(e){super(),qe(this,e,Sa,Ea,ze,{})}}function cl(l){let e,t;return e=new Aa({props:{class:"mt-4"}}),{c(){pe(e.$$.fragment)},l(s){ve(e.$$.fragment,s)},m(s,n){ge(e,s,n),t=!0},i(s){t||(H(e.$$.fragment,s),t=!0)},o(s){J(e.$$.fragment,s),t=!1},d(s){be(e,s)}}}function Ta(l){let e,t,s,n,r="I/O",a,o,i,c,f="Device",d,_,b,g,E,y,D="Prompt",G,K,C="Disable",N,k,S,j,A="Sound",O,w,L,I,F,M,V="Fixed velocity",R,te,se,fe,ie,Me,xe="Keyboard",Ve,me,We,Fe,Ne,re,Te="Hotkeys",de,W,ne,x,X,ce,Z="Auto-octave",we,Le,rt,Je,Ke,Ie,Ee,jt="Set keys",Ct,Oe,mt,ys="Fade timeout",es,Ze,ts,_t,Pt,ss,pt,ks="Reset all",ls,Bt,Qe,ns,Cs,Pe=l[2]&&cl();return{c(){e=p("div"),t=p("fieldset"),s=p("legend"),n=p("button"),n.textContent=r,a=P(),o=p("div"),i=p("div"),c=p("label"),c.textContent=f,d=P(),_=p("input"),g=P(),E=p("div"),y=p("button"),y.textContent=D,G=P(),K=p("button"),K.textContent=C,N=P(),k=p("div"),S=p("div"),j=p("label"),j.textContent=A,O=P(),w=p("input"),I=P(),F=p("div"),M=p("label"),M.textContent=V,R=P(),te=p("input"),se=P(),fe=p("div"),ie=p("div"),Me=p("label"),Me.textContent=xe,Ve=P(),me=p("input"),Fe=P(),Ne=p("div"),re=p("label"),re.textContent=Te,de=P(),W=p("input"),x=P(),X=p("div"),ce=p("label"),ce.textContent=Z,we=P(),Le=p("input"),Je=P(),Ke=p("div"),Ie=p("div"),Ee=p("button"),Ee.textContent=jt,Ct=P(),Oe=p("div"),mt=p("label"),mt.textContent=ys,es=P(),Ze=p("input"),ts=P(),_t=p("div"),Pt=p("div"),ss=P(),pt=p("button"),pt.textContent=ks,ls=P(),Pe&&Pe.c(),this.h()},l(Se){e=v(Se,"DIV",{class:!0});var Ue=T(e);t=v(Ue,"FIELDSET",{class:!0});var ct=T(t);s=v(ct,"LEGEND",{class:!0});var ws=T(s);n=v(ws,"BUTTON",{class:!0,"data-svelte-h":!0}),ee(n)!=="svelte-1jbbsti"&&(n.textContent=r),ws.forEach(m),a=B(ct),o=v(ct,"DIV",{class:!0});var vt=T(o);i=v(vt,"DIV",{class:!0});var wt=T(i);c=v(wt,"LABEL",{class:!0,for:!0,"data-svelte-h":!0}),ee(c)!=="svelte-crpa7y"&&(c.textContent=f),d=B(wt),_=v(wt,"INPUT",{class:!0,id:!0}),g=B(wt),E=v(wt,"DIV",{class:!0});var Gt=T(E);y=v(Gt,"BUTTON",{class:!0,"data-svelte-h":!0}),ee(y)!=="svelte-mj6mct"&&(y.textContent=D),G=B(Gt),K=v(Gt,"BUTTON",{class:!0,"data-svelte-h":!0}),ee(K)!=="svelte-1sl6oxh"&&(K.textContent=C),Gt.forEach(m),wt.forEach(m),N=B(vt),k=v(vt,"DIV",{class:!0});var Mt=T(k);S=v(Mt,"DIV",{class:!0});var Vt=T(S);j=v(Vt,"LABEL",{class:!0,for:!0,"data-svelte-h":!0}),ee(j)!=="svelte-wgxtkw"&&(j.textContent=A),O=B(Vt),w=v(Vt,"INPUT",{class:!0,id:!0,type:!0}),Vt.forEach(m),I=B(Mt),F=v(Mt,"DIV",{class:!0});var Kt=T(F);M=v(Kt,"LABEL",{class:!0,for:!0,"data-svelte-h":!0}),ee(M)!=="svelte-1tm2bth"&&(M.textContent=V),R=B(Kt),te=v(Kt,"INPUT",{class:!0,id:!0,placeholder:!0}),Kt.forEach(m),Mt.forEach(m),se=B(vt),fe=v(vt,"DIV",{class:!0});var Et=T(fe);ie=v(Et,"DIV",{class:!0});var Ot=T(ie);Me=v(Ot,"LABEL",{class:!0,for:!0,"data-svelte-h":!0}),ee(Me)!=="svelte-1js269u"&&(Me.textContent=xe),Ve=B(Ot),me=v(Ot,"INPUT",{class:!0,id:!0,type:!0}),Ot.forEach(m),Fe=B(Et),Ne=v(Et,"DIV",{class:!0});var Ut=T(Ne);re=v(Ut,"LABEL",{class:!0,for:!0,"data-svelte-h":!0}),ee(re)!=="svelte-21h39k"&&(re.textContent=Te),de=B(Ut),W=v(Ut,"INPUT",{class:!0,id:!0,type:!0}),Ut.forEach(m),x=B(Et),X=v(Et,"DIV",{class:!0});var Ft=T(X);ce=v(Ft,"LABEL",{class:!0,for:!0,"data-svelte-h":!0}),ee(ce)!=="svelte-33lczu"&&(ce.textContent=Z),we=B(Ft),Le=v(Ft,"INPUT",{class:!0,id:!0,type:!0}),Ft.forEach(m),Et.forEach(m),Je=B(vt),Ke=v(vt,"DIV",{class:!0});var St=T(Ke);Ie=v(St,"DIV",{class:!0});var Es=T(Ie);Ee=v(Es,"BUTTON",{class:!0,"data-svelte-h":!0}),ee(Ee)!=="svelte-1npcis2"&&(Ee.textContent=jt),Es.forEach(m),Ct=B(St),Oe=v(St,"DIV",{class:!0});var xt=T(Oe);mt=v(xt,"LABEL",{class:!0,for:!0,"data-svelte-h":!0}),ee(mt)!=="svelte-vd5i27"&&(mt.textContent=ys),es=B(xt),Ze=v(xt,"INPUT",{class:!0,id:!0}),xt.forEach(m),ts=B(St),_t=v(St,"DIV",{class:!0});var $t=T(_t);Pt=v($t,"DIV",{}),T(Pt).forEach(m),ss=B($t),pt=v($t,"BUTTON",{class:!0,"data-svelte-h":!0}),ee(pt)!=="svelte-jjt0c3"&&(pt.textContent=ks),$t.forEach(m),St.forEach(m),vt.forEach(m),ls=B(ct),Pe&&Pe.l(ct),ct.forEach(m),Ue.forEach(m),this.h()},h(){var Se;h(n,"class","px-1 rounded hover:bg-gray-100"),h(s,"class","text-base"),h(c,"class","font-bold"),h(c,"for","device"),h(_,"class","px-1 my-1 rounded w-50"),h(_,"id","device"),_.disabled=!0,_.value=b=((Se=l[5])==null?void 0:Se.name)??"No device",h(y,"class","btn-sm primary mr-2"),h(K,"class","btn-sm primary"),h(E,"class","flex my-[auto]"),h(i,"class","h-full flex flex-col"),h(j,"class","font-bold"),h(j,"for","sound"),h(w,"class","h-[20px]"),h(w,"id","sound"),h(w,"type","checkbox"),w.checked=L=l[3].useSound,h(S,"class","my-1 flex justify-between mr-12"),h(M,"class","font-bold"),h(M,"for","fixed-velocity"),h(te,"class","h-[20px] w-16"),h(te,"id","fixed-velocity"),h(te,"placeholder","0-127"),h(F,"class","flex justify-between"),h(k,"class","flex flex-col h-full"),h(Me,"class","font-bold"),h(Me,"for","keyboard"),h(me,"class","h-[20px]"),h(me,"id","keyboard"),h(me,"type","checkbox"),me.checked=We=l[3].useKeyboard,h(ie,"class","my-1 flex justify-between mr-12"),h(re,"class","font-bold"),h(re,"for","hotkeys"),h(W,"class","h-[20px]"),h(W,"id","hotkeys"),h(W,"type","checkbox"),W.checked=ne=l[3].useHotkeys,h(Ne,"class","my-1 flex justify-between mr-12"),h(ce,"class","font-bold"),h(ce,"for","auto-octave"),h(Le,"class","h-[20px]"),h(Le,"id","auto-octave"),h(Le,"type","checkbox"),Le.checked=rt=l[3].useAutoOctave,h(X,"class","my-1 flex justify-between mr-12"),h(fe,"class","flex flex-col h-full"),h(Ee,"class","w-full btn-sm primary"),h(Ie,"class","flex justify-between"),h(mt,"class","font-bold"),h(mt,"for","fade-timeout"),h(Ze,"class","h-[20px] w-16"),h(Ze,"id","fade-timeout"),Ze.value=l[1],h(Oe,"class","flex justify-between"),h(pt,"class","btn-sm primary"),h(_t,"class","flex justify-between"),h(Ke,"class","flex flex-col justify-between h-full"),h(o,"class","body svelte-1bpw69s"),z(o,"hidden",l[4]),h(t,"class","flex flex-col rounded border-2 px-4 py-2 my-4 text-sm svelte-1bpw69s"),z(t,"collapsed",l[4]),h(e,"class",Bt=Ae(`${l[11].class||""}`)+" svelte-1bpw69s")},m(Se,Ue){U(Se,e,Ue),u(e,t),u(t,s),u(s,n),u(t,a),u(t,o),u(o,i),u(i,c),u(i,d),u(i,_),u(i,g),u(i,E),u(E,y),u(E,G),u(E,K),u(o,N),u(o,k),u(k,S),u(S,j),u(S,O),u(S,w),u(k,I),u(k,F),u(F,M),u(F,R),u(F,te),Ye(te,l[0]),u(o,se),u(o,fe),u(fe,ie),u(ie,Me),u(ie,Ve),u(ie,me),u(fe,Fe),u(fe,Ne),u(Ne,re),u(Ne,de),u(Ne,W),u(fe,x),u(fe,X),u(X,ce),u(X,we),u(X,Le),u(o,Je),u(o,Ke),u(Ke,Ie),u(Ie,Ee),u(Ke,Ct),u(Ke,Oe),u(Oe,mt),u(Oe,es),u(Oe,Ze),u(Ke,ts),u(Ke,_t),u(_t,Pt),u(_t,ss),u(_t,pt),u(t,ls),Pe&&Pe.m(t,null),Qe=!0,ns||(Cs=[$(n,"click",l[7]),$(y,"click",Re.openMidi),$(K,"click",Re.disableMidi),$(w,"change",l[12]),$(te,"input",l[13]),$(te,"focus",l[14]),$(te,"change",l[8]),$(me,"change",l[15]),$(W,"change",l[16]),$(Le,"change",l[17]),$(Ee,"click",l[18]),$(Ze,"focus",l[19]),$(Ze,"blur",l[20]),$(Ze,"input",l[9]),$(pt,"click",l[10])],ns=!0)},p(Se,[Ue]){var ct;(!Qe||Ue&32&&b!==(b=((ct=Se[5])==null?void 0:ct.name)??"No device")&&_.value!==b)&&(_.value=b),(!Qe||Ue&8&&L!==(L=Se[3].useSound))&&(w.checked=L),Ue&1&&te.value!==Se[0]&&Ye(te,Se[0]),(!Qe||Ue&8&&We!==(We=Se[3].useKeyboard))&&(me.checked=We),(!Qe||Ue&8&&ne!==(ne=Se[3].useHotkeys))&&(W.checked=ne),(!Qe||Ue&8&&rt!==(rt=Se[3].useAutoOctave))&&(Le.checked=rt),(!Qe||Ue&2&&Ze.value!==Se[1])&&(Ze.value=Se[1]),(!Qe||Ue&16)&&z(o,"hidden",Se[4]),Se[2]?Pe?Ue&4&&H(Pe,1):(Pe=cl(),Pe.c(),H(Pe,1),Pe.m(t,null)):Pe&&(lt(),J(Pe,1,1,()=>{Pe=null}),nt()),(!Qe||Ue&16)&&z(t,"collapsed",Se[4]),(!Qe||Ue&2048&&Bt!==(Bt=Ae(`${Se[11].class||""}`)+" svelte-1bpw69s"))&&h(e,"class",Bt)},i(Se){Qe||(H(Pe),Qe=!0)},o(Se){J(Pe),Qe=!1},d(Se){Se&&m(e),Pe&&Pe.d(),ns=!1,it(Cs)}}}function Na(l,e,t){let s,n,r;oe(l,at,S=>t(3,s=S)),oe(l,Yt,S=>t(5,r=S));const a=ht(Be(!1),{key:"inputs-hidden"});oe(l,a,S=>t(4,n=S));let o=s.fixedVelocity??"",i=s.keyFadeTimeout,c=!1;at.subscribe(S=>{t(0,o=S.fixedVelocity??""),t(1,i=S.keyFadeTimeout)});function f(){a.update(S=>!S)}function d(S){const{value:j}=S.currentTarget;let A;if(j)try{A=parseInt(j)}catch{}A!==void 0&&A>=0&&A<=127?Re.setInputValue("fixedVelocity",A):j?t(0,o=s.fixedVelocity||""):Re.setInputValue("fixedVelocity",void 0),Ge.setKeyboardFocus(!0)}function _(S){try{const j=parseInt(S.currentTarget.value);Re.setInputValue("keyFadeTimeout",j)}catch{t(1,i=s.keyFadeTimeout)}}function b(){Ln()}const g=S=>Re.setInputValue("useSound",S.currentTarget.checked);function E(){o=this.value,t(0,o)}const y=()=>Ge.setKeyboardFocus(!1),D=S=>Re.setInputValue("useKeyboard",S.currentTarget.checked),G=S=>Re.setInputValue("useHotkeys",S.currentTarget.checked),K=S=>Re.setInputValue("useAutoOctave",S.currentTarget.checked),C=()=>t(2,c=!c),N=()=>Ge.setKeyboardFocus(!1),k=()=>Ge.setKeyboardFocus(!0);return l.$$set=S=>{t(11,e=ke(ke({},e),Ce(S)))},e=Ce(e),[o,i,c,s,n,r,a,f,d,_,b,e,g,E,y,D,G,K,C,N,k]}class Ia extends He{constructor(e){super(),qe(this,e,Na,Ta,ze,{})}}function ja(l){let e;return{c(){e=Q(" ")},l(t){e=Y(t," ")},m(t,s){U(t,e,s)},p:ue,d(t){t&&m(e)}}}function Da(l){let e,t=l[1].note+"",s;return{c(){e=Q("Input: "),s=Q(t)},l(n){e=Y(n,"Input: "),s=Y(n,t)},m(n,r){U(n,e,r),U(n,s,r)},p(n,r){r&2&&t!==(t=n[1].note+"")&&ae(s,t)},d(n){n&&(m(e),m(s))}}}function La(l){let e,t;return{c(){e=Q("Input: "),t=Q(l[0])},l(s){e=Y(s,"Input: "),t=Y(s,l[0])},m(s,n){U(s,e,n),U(s,t,n)},p(s,n){n&1&&ae(t,s[0])},d(s){s&&(m(e),m(t))}}}function Pa(l){let e;return{c(){e=Q(hs)},l(t){e=Y(t,hs)},m(t,s){U(t,e,s)},p:ue,d(t){t&&m(e)}}}function Ba(l){let e,t,s,n;function r(i,c){return i[2].useKeyboard&&hs?Pa:i[2].useKeyboard&&i[0]?La:i[2].useKeyboard&&i[1]?Da:ja}let a=r(l),o=a(l);return{c(){e=p("div"),o.c(),this.h()},l(i){e=v(i,"DIV",{class:!0});var c=T(e);o.l(c),c.forEach(m),this.h()},h(){h(e,"class",t=`${l[4].class||""}`)},m(i,c){U(i,e,c),o.m(e,null),s||(n=$(window,"keydown",l[3]),s=!0)},p(i,[c]){a===(a=r(i))&&o?o.p(i,c):(o.d(1),o=a(i),o&&(o.c(),o.m(e,null))),c&16&&t!==(t=`${i[4].class||""}`)&&h(e,"class",t)},i:ue,o:ue,d(i){i&&m(e),o.d(),s=!1,n()}}}let hs="";function Ga(l,e,t){let s,n;oe(l,tn,f=>t(6,s=f)),oe(l,at,f=>t(2,n=f));let{debounced:r}=e,a="",o;const i=on();function c(f){if(r||!s)return;const d=Ge.handleInput(f.code,f.key,f.shiftKey);d&&d.e==="note"?t(1,o=d.data):d&&d.e==="string"?t(0,a=d.data):d&&i(d.e,d.data)}return l.$$set=f=>{t(4,e=ke(ke({},e),Ce(f))),"debounced"in f&&t(5,r=f.debounced)},e=Ce(e),[a,o,n,c,e,r]}class Ma extends He{constructor(e){super(),qe(this,e,Ga,Ba,ze,{debounced:5})}}function Va(l){let e,t,s,n="Count",r,a,o,i,c,f="Duplicates",d,_,b,g,E,y,D="Autoplay",G,K,C,N,k,S,j="Wait seconds",A,O,w,L,I;return{c(){e=p("ul"),t=p("li"),s=p("label"),s.textContent=n,r=P(),a=p("input"),o=P(),i=p("li"),c=p("label"),c.textContent=f,d=P(),_=p("input"),g=P(),E=p("li"),y=p("label"),y.textContent=D,G=P(),K=p("input"),N=P(),k=p("li"),S=p("label"),S.textContent=j,A=P(),O=p("input"),this.h()},l(F){e=v(F,"UL",{class:!0});var M=T(e);t=v(M,"LI",{class:!0});var V=T(t);s=v(V,"LABEL",{class:!0,for:!0,"data-svelte-h":!0}),ee(s)!=="svelte-wgq9fc"&&(s.textContent=n),r=B(V),a=v(V,"INPUT",{class:!0,id:!0,type:!0}),V.forEach(m),o=B(M),i=v(M,"LI",{class:!0});var R=T(i);c=v(R,"LABEL",{class:!0,for:!0,"data-svelte-h":!0}),ee(c)!=="svelte-hcg9dq"&&(c.textContent=f),d=B(R),_=v(R,"INPUT",{class:!0,id:!0,type:!0}),R.forEach(m),g=B(M),E=v(M,"LI",{class:!0});var te=T(E);y=v(te,"LABEL",{class:!0,for:!0,"data-svelte-h":!0}),ee(y)!=="svelte-lr68n2"&&(y.textContent=D),G=B(te),K=v(te,"INPUT",{class:!0,id:!0,type:!0}),te.forEach(m),N=B(M),k=v(M,"LI",{class:!0});var se=T(k);S=v(se,"LABEL",{class:!0,for:!0,"data-svelte-h":!0}),ee(S)!=="svelte-1qj2vcy"&&(S.textContent=j),A=B(se),O=v(se,"INPUT",{class:!0,id:!0,type:!0}),se.forEach(m),M.forEach(m),this.h()},h(){h(s,"class","font-bold"),h(s,"for","guess-count"),h(a,"class","h-[20px] w-10"),h(a,"id","guess-count"),h(a,"type","number"),h(t,"class","flex items-center justify-between svelte-1elvih2"),h(c,"class","font-bold"),h(c,"for","duplicates"),h(_,"class","h-[20px]"),h(_,"id","duplicates"),h(_,"type","checkbox"),_.checked=b=l[2].duplicates,h(i,"class","flex items-center justify-between mr-6 svelte-1elvih2"),h(y,"class","font-bold"),h(y,"for","autoplay"),h(K,"class","h-[20px]"),h(K,"id","autoplay"),h(K,"type","checkbox"),K.checked=C=l[2].autoplay,h(E,"class","flex items-center justify-between mr-6 svelte-1elvih2"),h(S,"class","font-bold"),h(S,"for","wait-ms"),h(O,"class","h-[20px] w-10"),h(O,"id","wait-ms"),h(O,"type","number"),h(k,"class","flex items-center justify-between svelte-1elvih2"),h(e,"class",w=Ae(`${l[5].class||""}`)+" svelte-1elvih2")},m(F,M){U(F,e,M),u(e,t),u(t,s),u(t,r),u(t,a),Ye(a,l[0]),u(e,o),u(e,i),u(i,c),u(i,d),u(i,_),u(e,g),u(e,E),u(E,y),u(E,G),u(E,K),u(e,N),u(e,k),u(k,S),u(k,A),u(k,O),Ye(O,l[1]),L||(I=[$(a,"input",l[6]),$(a,"input",l[3]),$(_,"input",l[7]),$(K,"input",l[8]),$(O,"input",l[9]),$(O,"input",l[4])],L=!0)},p(F,[M]){M&1&&zt(a.value)!==F[0]&&Ye(a,F[0]),M&4&&b!==(b=F[2].duplicates)&&(_.checked=b),M&4&&C!==(C=F[2].autoplay)&&(K.checked=C),M&2&&zt(O.value)!==F[1]&&Ye(O,F[1]),M&32&&w!==(w=Ae(`${F[5].class||""}`)+" svelte-1elvih2")&&h(e,"class",w)},i:ue,o:ue,d(F){F&&m(e),L=!1,it(I)}}}function Ka(l,e,t){let s;oe(l,dt,_=>t(2,s=_));let n=s.count||"",r=s.waitSeconds||"";dt.subscribe(_=>{t(0,n=_.count||""),t(1,r=_.waitSeconds||"")});function a({currentTarget:{value:_}}){let b;try{b=parseInt(_),b<=0&&(b=1),ye.setOptionValue("count",b)}catch{t(0,n=s.count)}}function o({currentTarget:{value:_}}){let b;try{b=parseInt(_),b<0&&(b=0),ye.setOptionValue("waitSeconds",b)}catch{t(1,r=s.waitSeconds)}}function i(){n=zt(this.value),t(0,n)}const c=_=>ye.setOptionValue("duplicates",_.currentTarget.checked),f=_=>ye.setOptionValue("autoplay",_.currentTarget.checked);function d(){r=zt(this.value),t(1,r)}return l.$$set=_=>{t(5,e=ke(ke({},e),Ce(_)))},e=Ce(e),[n,r,s,a,o,e,i,c,f,d]}class Oa extends He{constructor(e){super(),qe(this,e,Ka,Va,ze,{})}}function ul(l,e,t){const s=l.slice();return s[20]=e[t].key,s[21]=e[t].value,s}function fl(l,e,t){const s=l.slice();return s[20]=e[t].key,s[21]=e[t].value,s}function dl(l){let e,t,s=l[21]+"",n,r,a,o,i,c,f,d;function _(){return l[13](l[20])}o=new ot({props:{icon:is,width:20}});function b(...g){return l[14](l[20],...g)}return{c(){e=p("li"),t=p("button"),n=Q(s),r=P(),a=p("button"),pe(o.$$.fragment),i=P(),this.h()},l(g){e=v(g,"LI",{class:!0});var E=T(e);t=v(E,"BUTTON",{class:!0});var y=T(t);n=Y(y,s),y.forEach(m),r=B(E),a=v(E,"BUTTON",{class:!0});var D=T(a);ve(o.$$.fragment,D),D.forEach(m),i=B(E),E.forEach(m),this.h()},h(){h(t,"class","px-2 py-1 mr-1 flex items-center w-full h-full rounded hover:bg-[#eee] svelte-1okhpct"),z(t,"selected",l[20]===l[0]),h(a,"class","px-1 py-1 flex items-center justify-center rounded text-[#222] hover:bg-blue-500 hover:text-white"),h(e,"class","flex svelte-1okhpct")},m(g,E){U(g,e,E),u(e,t),u(t,n),u(e,r),u(e,a),ge(o,a,null),u(e,i),c=!0,f||(d=[$(t,"click",_),$(a,"click",b)],f=!0)},p(g,E){l=g,(!c||E&17)&&z(t,"selected",l[20]===l[0])},i(g){c||(H(o.$$.fragment,g),c=!0)},o(g){J(o.$$.fragment,g),c=!1},d(g){g&&m(e),be(o),f=!1,it(d)}}}function hl(l){let e,t=le(l[2]),s=[];for(let n=0;nJ(O[I],1,1,()=>{O[I]=null});let L=(l[0]==="chords-write"||l[0]==="chords-play")&&hl(l);return f=new Oa({props:{class:"game-options"}}),D=new ot({props:{class:"mr-1",icon:l[3]?js:is,width:20}}),{c(){e=p("fieldset"),t=p("legend"),t.textContent=s,n=P(),r=p("div"),a=p("ul");for(let I=0;It(12,r=C)),oe(l,dt,C=>t(19,a=C)),oe(l,yt,C=>t(3,o=C));const i=[{key:"notes",value:"Play Notes"},{key:"pitches",value:"Guess Pitches"},{key:"keys-major",value:"Guess Major Keys"},{key:"keys-minor",value:"Guess Minor Keys"},{key:"chords-write",value:"Write Chords"},{key:"chords-play",value:"Play Chords"},{key:"chords-diatonic",value:"Play Diatonic Triads"}];let c=i[4].key,f="maj-m";a.count,a.waitSeconds,dt.subscribe(C=>{C.count,C.waitSeconds});function d(){ye.clearGame(!0)}function _(C,N){if(N==="chords-write"||N==="chords-play"||N==="chords-diatonic"){let k=[];f==="selected"?k=r.filter(S=>S.selected):f==="all"?k=r:f==="maj-m"?k=r.filter(S=>S.suffixes[0]==="maj"||S.suffixes[0]==="m"):f==="seventh"&&(k=r.filter(S=>S.suffixes[0]==="maj7"||S.suffixes[0]==="m7"||S.suffixes[0]==="7"||S.suffixes[0]==="dim7"||S.suffixes[0]==="aug7")),ye.play(N,{chords:k})}else ye.play(N,void 0);C.currentTarget instanceof HTMLElement&&C.currentTarget.blur(),setTimeout(()=>{window.scrollTo(0,document.body.scrollHeight)})}function b(C){t(0,c=C)}function g(C,N){t(0,c=N),_(C,N)}function E(C){t(1,f=C)}const y=C=>b(C),D=(C,N)=>g(N,C),G=C=>E(C),K=C=>_(C,c);return l.$$set=C=>{t(10,e=ke(ke({},e),Ce(C)))},l.$$.update=()=>{l.$$.dirty&4096&&t(11,s=r.reduce((C,N)=>N.selected?C+1:C,0)),l.$$.dirty&2048&&t(2,n=[{key:"maj-m",value:"Major/Minor"},{key:"seventh",value:"Seventh"},{key:"selected",value:`Selected ${s} chords`},{key:"all",value:"All"}])},e=Ce(e),[c,f,n,o,i,d,_,b,g,E,e,s,r,y,D,G,K]}class xa extends He{constructor(e){super(),qe(this,e,Fa,Ua,ze,{})}}function _l(l,e,t){const s=l.slice();return s[7]=e[t],s}function pl(l,e,t){const s=l.slice();return s[4]=e[t],s}function $a(l){let e,t=le(l[1]),s=[];for(let n=0;nl.interval;function qa(l,e,t){let{scale:s,intervals:n}=e;function r(a){ms.call(this,l,a)}return l.$$set=a=>{t(2,e=ke(ke({},e),Ce(a))),"scale"in a&&t(0,s=a.scale),"intervals"in a&&t(1,n=a.intervals)},e=Ce(e),[s,n,e,r]}class ln extends He{constructor(e){super(),qe(this,e,qa,Ha,ze,{scale:0,intervals:1})}}function yl(l,e,t){const s=l.slice();return s[7]=e[t],s}function kl(l,e,t){const s=l.slice();return s[4]=e[t],s}function za(l){let e,t=le(l[0]),s=[];for(let n=0;n2),h(e,"class","inline-flex items-baseline svelte-1roj1mi")},m(f,d){U(f,e,d),u(e,t),u(t,n),u(e,r),u(e,a),u(a,i),u(e,c)},p(f,d){d&1&&s!==(s=f[7].roman+"")&&ae(n,s),d&1&&o!==(o=f[7].suffix+"")&&ae(i,o),d&1&&z(a,"super-text",f[7].suffix.length>2)},d(f){f&&m(e)}}}function wl(l){let e,t,s=l[4]+"",n,r;return{c(){e=p("span"),t=p("span"),n=Q(s),r=P(),this.h()},l(a){e=v(a,"SPAN",{class:!0});var o=T(e);t=v(o,"SPAN",{});var i=T(t);n=Y(i,s),i.forEach(m),r=B(o),o.forEach(m),this.h()},h(){h(e,"class","inline-flex items-baseline svelte-1roj1mi")},m(a,o){U(a,e,o),u(e,t),u(t,n),u(e,r)},p(a,o){o&2&&s!==(s=a[4]+"")&&ae(n,s)},d(a){a&&m(e)}}}function Ja(l){let e,t,s,n,r,a;function o(f,d){return f[1].length>0?Wa:za}let i=o(l),c=i(l);return{c(){e=p("div"),t=p("button"),c.c(),this.h()},l(f){e=v(f,"DIV",{class:!0,title:!0});var d=T(e);t=v(d,"BUTTON",{class:!0});var _=T(t);c.l(_),_.forEach(m),d.forEach(m),this.h()},h(){h(t,"class","triads flex flex-wrap svelte-1roj1mi"),h(e,"class",s=Ae(`${l[2].class||""} `)+" svelte-1roj1mi"),h(e,"title",n=l[0].map(El).join("-"))},m(f,d){U(f,e,d),u(e,t),c.m(t,null),r||(a=$(t,"click",l[3]),r=!0)},p(f,[d]){i===(i=o(f))&&c?c.p(f,d):(c.d(1),c=i(f),c&&(c.c(),c.m(t,null))),d&4&&s!==(s=Ae(`${f[2].class||""} `)+" svelte-1roj1mi")&&h(e,"class",s),d&1&&n!==(n=f[0].map(El).join("-"))&&h(e,"title",n)},i:ue,o:ue,d(f){f&&m(e),c.d(),r=!1,a()}}}const El=l=>l.roman+l.suffix;function Qa(l,e,t){let{triads:s,chords:n}=e;function r(a){ms.call(this,l,a)}return l.$$set=a=>{t(2,e=ke(ke({},e),Ce(a))),"triads"in a&&t(0,s=a.triads),"chords"in a&&t(1,n=a.chords)},e=Ce(e),[s,n,e,r]}class nn extends He{constructor(e){super(),qe(this,e,Qa,Ja,ze,{triads:0,chords:1})}}function Sl(l,e,t){const s=l.slice();return s[25]=e[t],s}function Al(l,e,t){const s=l.slice();return s[25]=e[t],s}function Tl(l){let e,t,s=l[25].raw.names[0]+"",n,r,a,o,i,c,f;function d(){return l[13](l[25])}a=new ln({props:{scale:l[25].scale,intervals:l[25].raw.intervals}}),a.$on("click",d);function _(){return l[14](l[25])}return i=new nn({props:{triads:l[25].triads,chords:l[25].triadChords}}),i.$on("click",_),{c(){e=p("li"),t=p("div"),n=Q(s),r=P(),pe(a.$$.fragment),o=P(),pe(i.$$.fragment),c=P(),this.h()},l(b){e=v(b,"LI",{class:!0});var g=T(e);t=v(g,"DIV",{class:!0});var E=T(t);n=Y(E,s),E.forEach(m),r=B(g),ve(a.$$.fragment,g),o=B(g),ve(i.$$.fragment,g),c=B(g),g.forEach(m),this.h()},h(){h(t,"class","text-xs font-bold"),h(e,"class","svelte-4hctsl")},m(b,g){U(b,e,g),u(e,t),u(t,n),u(e,r),ge(a,e,null),u(e,o),ge(i,e,null),u(e,c),f=!0},p(b,g){l=b,(!f||g&4)&&s!==(s=l[25].raw.names[0]+"")&&ae(n,s);const E={};g&4&&(E.scale=l[25].scale),g&4&&(E.intervals=l[25].raw.intervals),a.$set(E);const y={};g&4&&(y.triads=l[25].triads),g&4&&(y.chords=l[25].triadChords),i.$set(y)},i(b){f||(H(a.$$.fragment,b),H(i.$$.fragment,b),f=!0)},o(b){J(a.$$.fragment,b),J(i.$$.fragment,b),f=!1},d(b){b&&m(e),be(a),be(i)}}}function Nl(l){let e,t,s=l[25].raw.names[0]+"",n,r,a,o,i,c,f;function d(){return l[15](l[25])}a=new ln({props:{scale:l[25].scale,intervals:l[25].raw.intervals}}),a.$on("click",d);function _(){return l[16](l[25])}return i=new nn({props:{triads:l[25].triads,chords:l[25].triadChords}}),i.$on("click",_),{c(){e=p("li"),t=p("div"),n=Q(s),r=P(),pe(a.$$.fragment),o=P(),pe(i.$$.fragment),c=P(),this.h()},l(b){e=v(b,"LI",{class:!0});var g=T(e);t=v(g,"DIV",{class:!0});var E=T(t);n=Y(E,s),E.forEach(m),r=B(g),ve(a.$$.fragment,g),o=B(g),ve(i.$$.fragment,g),c=B(g),g.forEach(m),this.h()},h(){h(t,"class","text-xs font-bold"),h(e,"class","svelte-4hctsl")},m(b,g){U(b,e,g),u(e,t),u(t,n),u(e,r),ge(a,e,null),u(e,o),ge(i,e,null),u(e,c),f=!0},p(b,g){l=b,(!f||g&2)&&s!==(s=l[25].raw.names[0]+"")&&ae(n,s);const E={};g&2&&(E.scale=l[25].scale),g&2&&(E.intervals=l[25].raw.intervals),a.$set(E);const y={};g&2&&(y.triads=l[25].triads),g&2&&(y.chords=l[25].triadChords),i.$set(y)},i(b){f||(H(a.$$.fragment,b),H(i.$$.fragment,b),f=!0)},o(b){J(a.$$.fragment,b),J(i.$$.fragment,b),f=!1},d(b){b&&m(e),be(a),be(i)}}}function Ya(l){let e,t,s,n,r="Scales",a,o,i,c,f="Key",d,_,b,g,E,y,D,G,K,C,N=le(l[2]),k=[];for(let w=0;wJ(k[w],1,1,()=>{k[w]=null});let j=le(l[1]),A=[];for(let w=0;wJ(A[w],1,1,()=>{A[w]=null});return{c(){e=p("div"),t=p("fieldset"),s=p("legend"),n=p("button"),n.textContent=r,a=P(),o=p("div"),i=p("div"),c=p("label"),c.textContent=f,d=P(),_=p("input"),b=P(),g=p("ul");for(let w=0;wt(19,r=w)),oe(l,Nt,w=>t(20,a=w)),oe(l,at,w=>t(21,o=w)),oe(l,st,w=>t(22,i=w));let d=_s().map(w=>({key:w.names[0],raw:w,scale:void 0,triads:w.triads,triadChords:[]})),_="",b=[a.key,a.scale],g;const E=ht(Be(!0),{key:"scales-hidden"});oe(l,E,w=>t(3,c=w));function y(){E.update(w=>!w)}function D({currentTarget:{value:w}}){t(0,_=`${w.charAt(0).toUpperCase()}${w.charAt(1).toLowerCase()}`),t(10,d=d.map(L=>{const I=Qt(_,L.key),F=_&&"data"in I?I.data:void 0;let M=[];return F&&(M=L.triads.map((V,R)=>`${F.scaleNotes[R].note}${!V.suffix.includes("°")&&V.minor?"m":""}${V.suffix}`)),{...L,scale:F,triadChords:M}}))}function G(w,L,I){if(wM.midi),o.fixedVelocity),g=setTimeout(()=>G(w,L,I),I)}else he.setPlayed([]),he.setKeyAndScale(b[0],b[1])}function K(w){clearTimeout(g);let L,I;w.scale?(I=w.scale,b=[a.key,a.scale],he.setKeyAndScale(w.scale.key,w.scale.scale)):I=a;const F=r[0].midi+I.scaleNotes[0].semitones;L=w.raw.intervals.map(M=>[{...I.notesMap.get(M.semitones%12),midi:F+M.semitones}]),L[0][0].semitones!==L[L.length-1][0].semitones&&L.push(L[0].map(M=>({...M,midi:M.midi+12}))),G(0,L,500)}function C(w){clearTimeout(g);const{intervals:L}=w.raw;let I,F;w.scale?(F=w.scale,b=[a.key,a.scale],he.setKeyAndScale(w.scale.key,w.scale.scale)):F=a;const M=r[0].midi+F.scaleNotes[0].semitones;I=Ql(w.triads).map((R,te)=>cs(M+F.intervals[te].semitones,F,R.intervals)),L[L.length-1].interval_seq!==1&&I.push(I[0].map(R=>({...R,midi:R.midi+12}))),G(0,I,750)}const N=()=>Ge.setKeyboardFocus(!1),k=()=>Ge.setKeyboardFocus(!0),S=w=>K(w),j=w=>C(w),A=w=>K(w),O=w=>C(w);return l.$$set=w=>{t(9,e=ke(ke({},e),Ce(w)))},l.$$.update=()=>{l.$$.dirty&1024&&t(2,s=d.filter((w,L)=>LL>=d.length/2))},e=Ce(e),[_,n,s,c,E,y,D,K,C,e,d,N,k,S,j,A,O]}class Za extends He{constructor(e){super(),qe(this,e,Xa,Ya,ze,{})}}function Il(l,e,t){const s=l.slice();return s[14]=e[t].key,s[15]=e[t].value,s[16]=e[t].icon,s[18]=t,s}const er=l=>({}),jl=l=>({}),tr=l=>({}),Dl=l=>({});function Ll(l){let e,t,s,n,r,a,o,i,c,f;const d=l[11].header,_=xl(d,l,l[10],jl);let b=le(l[0]),g=[];for(let y=0;yJ(g[y],1,1,()=>{g[y]=null});return{c(){e=p("button"),s=P(),n=p("ul"),r=p("li"),_&&_.c(),a=P();for(let y=0;y{i&&(t||(t=Rt(e,As,{duration:qt},!0)),t.run(1))}),H(_,y);for(let D=0;D{i&&(o||(o=Rt(n,Ts,{duration:qt},!0)),o.run(1))}),i=!0}},o(y){y&&(t||(t=Rt(e,As,{duration:qt},!1)),t.run(0)),J(_,y),g=g.filter(Boolean);for(let D=0;D{g[K]=null}),nt(),n=g[s],n?n.p(l,G):(n=g[s]=b[s](l),n.c()),H(n,1),n.m(t,r)),(!f||G&1)&&o!==(o=l[15]+"")&&ae(i,o),(!f||G&5)&&z(t,"selected",l[14]===l[2])},i(D){f||(H(n),f=!0)},o(D){J(n),f=!1},d(D){D&&m(e),g[s].d(),d=!1,_()}}}function nr(l){let e,t,s,n,r,a,o,i;const c=l[11].value,f=xl(c,l,l[10],Dl);let d=l[5]&&Ll(l);return{c(){e=p("div"),t=p("button"),f&&f.c(),r=P(),d&&d.c(),this.h()},l(_){e=v(_,"DIV",{class:!0,id:!0});var b=T(e);t=v(b,"BUTTON",{class:!0,title:!0});var g=T(t);f&&f.l(g),g.forEach(m),r=B(b),d&&d.l(b),b.forEach(m),this.h()},h(){h(t,"class",s=Ae(`${l[8].class||""} open-btn w-full text-justify text-sm rounded hover:bg-[#eee]`)+" svelte-h65upg"),h(t,"title",n=l[8].title||""),z(t,"disabled",l[3]),z(t,"open",l[5]),h(e,"class","relative"),h(e,"id",l[1])},m(_,b){U(_,e,b),u(e,t),f&&f.m(t,null),u(e,r),d&&d.m(e,null),l[13](e),a=!0,o||(i=$(t,"click",l[6]),o=!0)},p(_,[b]){f&&f.p&&(!a||b&1024)&&$l(f,c,_,_[10],a?Hl(c,_[10],b,tr):Rl(_[10]),Dl),(!a||b&256&&s!==(s=Ae(`${_[8].class||""} open-btn w-full text-justify text-sm rounded hover:bg-[#eee]`)+" svelte-h65upg"))&&h(t,"class",s),(!a||b&256&&n!==(n=_[8].title||""))&&h(t,"title",n),(!a||b&264)&&z(t,"disabled",_[3]),(!a||b&288)&&z(t,"open",_[5]),_[5]?d?(d.p(_,b),b&32&&H(d,1)):(d=Ll(_),d.c(),H(d,1),d.m(e,null)):d&&(lt(),J(d,1,1,()=>{d=null}),nt()),(!a||b&2)&&h(e,"id",_[1])},i(_){a||(H(f,_),H(d),a=!0)},o(_){J(f,_),J(d),a=!1},d(_){_&&m(e),f&&f.d(_),d&&d.d(),l[13](null),o=!1,i()}}}const qt=400;function ar(l,e,t){let{$$slots:s={},$$scope:n}=e,{options:r,id:a=void 0,selected:o=void 0,disabled:i=void 0,onSelect:c}=e,f,d=!1;function _(){i||t(5,d=!d)}function b(y){t(5,d=c(y))}const g=y=>b(y);function E(y){cn[y?"unshift":"push"](()=>{f=y,t(4,f)})}return l.$$set=y=>{t(8,e=ke(ke({},e),Ce(y))),"options"in y&&t(0,r=y.options),"id"in y&&t(1,a=y.id),"selected"in y&&t(2,o=y.selected),"disabled"in y&&t(3,i=y.disabled),"onSelect"in y&&t(9,c=y.onSelect),"$$scope"in y&&t(10,n=y.$$scope)},e=Ce(e),[r,a,o,i,f,d,_,b,e,c,n,s,g,E]}class rr extends He{constructor(e){super(),qe(this,e,ar,nr,ze,{options:0,id:1,selected:2,disabled:3,onSelect:9})}}function Bl(l,e,t){const s=l.slice();return s[30]=e[t],s}function Gl(l,e,t){const s=l.slice();return s[33]=e[t],s}function Ml(l){let e,t;return{c(){e=p("div"),t=Q(l[3]),this.h()},l(s){e=v(s,"DIV",{class:!0});var n=T(e);t=Y(n,l[3]),n.forEach(m),this.h()},h(){h(e,"class","error svelte-1u7ze7x")},m(s,n){U(s,e,n),u(e,t)},p(s,n){n[0]&8&&ae(t,s[3])},d(s){s&&m(e)}}}function or(l){let e,t;return{c(){e=p("div"),t=Q(l[0]),this.h()},l(s){e=v(s,"DIV",{slot:!0});var n=T(e);t=Y(n,l[0]),n.forEach(m),this.h()},h(){h(e,"slot","value")},m(s,n){U(s,e,n),u(e,t)},p(s,n){n[0]&1&&ae(t,s[0])},d(s){s&&m(e)}}}function Vl(l){let e,t=le(l[5]),s=[];for(let n=0;nt(27,n=V)),oe(l,kt,V=>t(28,r=V)),oe(l,yt,V=>t(7,o=V)),oe(l,Nt,V=>t(8,i=V));let c=Xe(n[0]),f=Xe(n[1]),d="";const _=ht(Be(!1),{key:"score-options-hidden"});oe(l,_,V=>t(6,a=V));let b=r[0],g=r[1];const E=_s(),y=E.map(V=>({key:V.names[0],value:V.names[0]}));Xt.subscribe(V=>{t(1,c=Xe(V[0])),t(2,f=Xe(V[1]))}),kt.subscribe(V=>{t(4,b=V[0]),t(0,g=V[1])});function D(V,R){const te=An(R.currentTarget.value,!0,!0);if("data"in te){const{midi:se}=te.data,fe=n,ie=[V==="min"?se:fe[0].midi,V==="max"?se:fe[1].midi];Re.setMidiRange(ie),t(3,d="")}else t(3,d=te.err),V==="min"?t(1,c=Xe(n[0])):t(2,f=Xe(n[1]))}function G(){t(3,d=""),Ge.setKeyboardFocus(!1)}function K({currentTarget:{value:V}}){t(4,b=`${V.charAt(0).toUpperCase()}${V.charAt(1).toLowerCase()}`),he.setKey(b)}function C(V){var R;return t(0,g=(R=y.find(te=>V===te.key))==null?void 0:R.value),he.setScale(g),!1}function N(){_.update(V=>!V)}function k(){he.clearScore(!0),Re.setMidiRange([60,84])}function S(){c=this.value,t(1,c)}const j=V=>D("min",V),A=()=>Ge.setKeyboardFocus(!0);function O(){f=this.value,t(2,f)}const w=V=>D("max",V),L=()=>Ge.setKeyboardFocus(!0);function I(){b=this.value,t(4,b)}const F=()=>Ge.setKeyboardFocus(!1),M=()=>Ge.setKeyboardFocus(!0);return l.$$set=V=>{t(17,e=ke(ke({},e),Ce(V)))},l.$$.update=()=>{var V;l.$$.dirty[0]&1&&t(5,s=((V=E.find(R=>R.names[0]===g))==null?void 0:V.intervals)||[])},e=Ce(e),[g,c,f,d,b,s,a,o,i,_,y,D,G,K,C,N,k,e,S,j,A,O,w,L,I,F,M]}class ur extends He{constructor(e){super(),qe(this,e,cr,ir,ze,{},null,[-1,-1])}}function fr(l){l[19]=l[20].default}function dr(l){return{c:ue,l:ue,m:ue,i:ue,o:ue,d:ue}}function hr(l){fr(l);let e,t,s;var n=l[19];function r(a,o){return{props:{class:"px-4 md:px-0"}}}return n&&(e=dn(n,r())),{c(){e&&pe(e.$$.fragment),t=De()},l(a){e&&ve(e.$$.fragment,a),t=De()},m(a,o){e&&ge(e,a,o),U(a,t,o),s=!0},i(a){s||(e&&H(e.$$.fragment,a),s=!0)},o(a){e&&J(e.$$.fragment,a),s=!1},d(a){a&&m(t),e&&be(e,a)}}}function mr(l){let e;return{c(){e=Q(" ")},l(t){e=Y(t," ")},m(t,s){U(t,e,s)},i:ue,o:ue,d(t){t&&m(e)}}}function _r(l){let e,t,s,n='MIDI Note Trainer',r,a,o,i,c,f,d,_,b,g,E,y,D,G,K,C,N,k,S;o=new Ia({}),c=new Za({}),d=new oa({}),g=new ur({props:{class:"score-options mr-4"}}),y=new xa({props:{class:"play-form"}});let j={ctx:l,current:null,token:null,hasCatch:!1,pending:mr,then:hr,catch:dr,value:20,blocks:[,,,]};return un(an(()=>import("./Score.f16aa8fe.js"),["./Score.f16aa8fe.js","./vendor_svelte.517cf6ee.js","./vendor.1acf520b.js","./vendor_vexflow.2dfca40b.js","../assets/Score.04e240b8.css"],import.meta.url),j),C=new Ma({props:{class:"min-h-32",debounced:!!l[0]}}),C.$on("guessed-chord",l[2]),C.$on("guessed-key",l[3]),C.$on("guessed-note",l[4]),k=new ya({props:{game:l[1]}}),{c(){e=p("meta"),t=P(),s=p("h1"),s.innerHTML=n,r=P(),a=p("section"),pe(o.$$.fragment),i=P(),pe(c.$$.fragment),f=P(),pe(d.$$.fragment),_=P(),b=p("div"),pe(g.$$.fragment),E=P(),pe(y.$$.fragment),D=P(),j.block.c(),G=P(),K=p("section"),pe(C.$$.fragment),N=P(),pe(k.$$.fragment),this.h()},l(A){const O=fn("svelte-1w2oado",document.head);e=v(O,"META",{name:!0,content:!0}),O.forEach(m),t=B(A),s=v(A,"H1",{class:!0,"data-svelte-h":!0}),ee(s)!=="svelte-1l8ebwf"&&(s.innerHTML=n),r=B(A),a=v(A,"SECTION",{class:!0});var w=T(a);ve(o.$$.fragment,w),i=B(w),ve(c.$$.fragment,w),f=B(w),ve(d.$$.fragment,w),_=B(w),b=v(w,"DIV",{class:!0});var L=T(b);ve(g.$$.fragment,L),E=B(L),ve(y.$$.fragment,L),L.forEach(m),w.forEach(m),D=B(A),j.block.l(A),G=B(A),K=v(A,"SECTION",{class:!0});var I=T(K);ve(C.$$.fragment,I),N=B(I),ve(k.$$.fragment,I),I.forEach(m),this.h()},h(){h(e,"name","description"),h(e,"content","App to practise music notation, scales and chords using MIDI"),h(s,"class","my-8 md:text-5xl mt-12 px-4 md:px-0 text-3xl font-cursive tracking-tight"),h(b,"class","play svelte-qjpqy3"),h(a,"class","px-4 md:px-0"),h(K,"class","mb-8 px-4 md:px-0 flex flex-col")},m(A,O){u(document.head,e),U(A,t,O),U(A,s,O),U(A,r,O),U(A,a,O),ge(o,a,null),u(a,i),ge(c,a,null),u(a,f),ge(d,a,null),u(a,_),u(a,b),ge(g,b,null),u(b,E),ge(y,b,null),U(A,D,O),j.block.m(A,j.anchor=O),j.mount=()=>G.parentNode,j.anchor=G,U(A,G,O),U(A,K,O),ge(C,K,null),u(K,N),ge(k,K,null),S=!0},p(A,[O]){l=A;const w={};O&1&&(w.debounced=!!l[0]),C.$set(w);const L={};O&2&&(L.game=l[1]),k.$set(L)},i(A){S||(H(o.$$.fragment,A),H(c.$$.fragment,A),H(d.$$.fragment,A),H(g.$$.fragment,A),H(y.$$.fragment,A),H(j.block),H(C.$$.fragment,A),H(k.$$.fragment,A),S=!0)},o(A){J(o.$$.fragment,A),J(c.$$.fragment,A),J(d.$$.fragment,A),J(g.$$.fragment,A),J(y.$$.fragment,A);for(let O=0;O<3;O+=1){const w=j.blocks[O];J(w)}J(C.$$.fragment,A),J(k.$$.fragment,A),S=!1},d(A){A&&(m(t),m(s),m(r),m(a),m(D),m(G),m(K)),m(e),be(o),be(c),be(d),be(g),be(y),j.block.d(A),j.token=null,j=null,be(C),be(k)}}}function pr(l,e,t){let s,n,r,a,o,i;oe(l,bt,N=>t(7,s=N)),oe(l,yt,N=>t(1,n=N)),oe(l,dt,N=>t(8,r=N)),oe(l,at,N=>t(9,a=N)),oe(l,st,N=>t(10,o=N)),oe(l,fs,N=>t(11,i=N));let c,f;Fl(()=>(i&&C(),window.addEventListener("keydown",d),window.addEventListener("mousedown",d),window.addEventListener("touchstart",d),()=>{window.removeEventListener("keydown",d),window.removeEventListener("mousedown",d),window.removeEventListener("touchstart",d)})),Yt.subscribe(N=>{N&&N.channels[1].addListener("noteon",_)});function d(){Re.initAudio(),window.removeEventListener("keydown",d),window.removeEventListener("mousedown",d),window.removeEventListener("touchstart",d)}function _(N){if(c)return;const k=N.rawData;b(k[1],k[2])}function b(N,k){const S=n;S instanceof Tt&&!(S!=null&&S.ended)&&s==="waiting"?y(N):S instanceof ft&&!(S!=null&&S.ended)&&s==="waiting"?(S.addPlayedNote(N),f||(f=setTimeout(E,2e3))):S||he.pushPlayed(N),o&&o.noteOn(N,a.fixedVelocity??k)}function g(){r.autoplay&&r.waitSeconds>0?t(0,c=setTimeout(()=>{r.autoplay&&ye.nextGuess(),t(0,c=void 0)},r.waitSeconds*1e3)):r.autoplay?ye.nextGuess():t(0,c=void 0)}function E(){var k;const N=n;if(N instanceof ft){const S=N.guess();he.setPlayed(((k=N.latestGuess.guessed)==null?void 0:k.notes)||[],S,-1),ye.updateState(S?"correct":"wrong"),g()}f=void 0}function y(N){const k=n;if(k instanceof Tt&&s==="waiting"){he.setTarget([he.getNote(k.current)]);const S=k.guess(N);ye.updateState(S?"correct":"wrong"),he.pushPlayed(N,S,4e3),g()}}function D(N){const k=n;if(k instanceof ft&&s==="waiting"){const S=k.guessWrittenChord(N.detail);ye.updateState(S?"correct":"wrong"),g()}}function G(N){const k=n;if(k instanceof Lt&&s==="waiting"){const S=N.detail.replaceAll("♭","b").replaceAll("♯","#"),j=k.guess(S);ye.updateState(j?"correct":"wrong"),g()}}function K(N){b(N.detail,80)}async function C(){const N=await Re.openMidi();"data"in N?N.data.name:(N.err,console.error(N.err))}return[c,n,D,G,K]}class yr extends He{constructor(e){super(),qe(this,e,pr,_r,ze,{})}}export{Ls as F,ft as G,yr as P,vn as S,Tt as a,ye as b,yt as c,gt as d,Yl as e,bt as g,st as p,Nt as s,Gs as t}; diff --git a/_app/immutable/chunks/3.d6344dfb.js b/_app/immutable/chunks/3.d6344dfb.js deleted file mode 100644 index f23829ab..00000000 --- a/_app/immutable/chunks/3.d6344dfb.js +++ /dev/null @@ -1 +0,0 @@ -import{_ as an}from"./preload-helper.a4192956.js";import{R as _e,Q as Ct,T as Pe,U as rn,S as Re,i as He,s as qe,O as rt,V as le,e as p,m as P,H as ve,a as v,b as T,n as ee,d as m,o as B,I as ge,f as h,L as z,W as Te,g as F,h as u,J as be,p as $,t as H,C as st,w as lt,l as J,K as ye,X as De,Y as ot,M as oe,N as Ce,P as we,z as Q,A as Y,B as ae,v as Le,q as ue,Z as hs,r as Fl,_ as Qe,$ as on,a0 as qt,c as Ul,u as xl,j as $l,k as Rl,a1 as Es,a2 as $t,F as cn,a3 as Ss,a4 as As,a5 as un,a6 as fn,G as dn}from"./vendor_svelte.565aa2ba.js";import{w as Rt,b as hn,c as mn,e as Ts,f as Ns,g as Hl,h as zt,i as Wt,a as Is,j as os}from"./vendor.1acf520b.js";const js={1:0,2:2,3:4,4:5,5:7,6:9,7:11};function $e(l,e=0,t=0){return{interval:`${l}${"♭".repeat(e)}${"♯".repeat(t)}`,interval_seq:l,semitones:ql(l,e,t),flats:e,sharps:t}}function ql(l,e,t){return(l<8?js[l]:js[l%7])-e+t+Math.floor(l/8)*12}function zl(l){let e,t=0,s=0;l<0?(t=1+Math.floor(-l/100),e=-l%100):l>100?(s=Math.floor(l/100),e=l%100):e=l;const n=ql(e,t,s);return{interval:`${e}${"♭".repeat(t)}${"♯".repeat(s)}`,interval_seq:e,semitones:n,flats:t,sharps:s}}const _n=[[["maj"],["Major Chord"],"major",[1,3,5]],[["6"],["Major 6th Chord"],"major",[1,3,5,6]],[["6/9"],["Major 6th/9th Chord"],"major",[1,3,5,6,9]],[["maj7"],["Major 7th Chord"],"major",[1,3,5,7]],[["maj9"],["Major 9th Chord"],"major",[1,3,5,7,9]],[["maj11"],["Major 11th Chord"],"major",[1,3,5,7,9,11]],[["maj13"],["Major 13th Chord"],"major",[1,3,5,7,9,11,13]],[["m"],["Minor Chord"],"minor",[1,-3,5]],[["m6"],["Minor 6th Chord"],"minor",[1,-3,5,6]],[["m7"],["Minor 7th Chord"],"minor",[1,-3,5,-7]],[["m9"],["Minor 9th Chord"],"minor",[1,-3,5,-7,9]],[["m11"],["Minor 11th Chord"],"minor",[1,-3,5,-7,9,11]],[["m13"],["Minor 13th Chord"],"minor",[1,-3,5,-7,9,11,13]],[["sus2"],["Suspended 2nd Chord"],"suspended",[1,2,5]],[["sus4"],["Suspended 4th Chord"],"suspended",[1,4,5]],[["7sus4"],["Suspended 4th Seventh Chord"],"suspended",[1,4,5,-7]],[["7"],["Dominant 7th Chord"],"major",[1,3,5,-7]],[["7#9"],["Dominant 7th Sharp 9th Chord"],"major",[1,3,5,-7,109]],[["9"],["Dominant 9th Chord"],"major",[1,3,5,-7,9]],[["11"],["Dominant 11th Chord"],"major",[1,3,5,-7,9,11]],[["13"],["Dominant 13th Chord"],"major",[1,3,5,-7,9,11,13]],[["5"],["Power Chord"],"indeterminate",[1,5]],[["dim","°"],["Diminished Chord"],"diminished",[1,-3,-5]],[["dim7","°7"],["Diminished 7th Chord"],"diminished",[1,-3,-5,-107]],[["m7b5"],["Half-Diminished 7th Chord"],"diminished",[1,-3,-5,-7]],[["aug","+"],["Augmented Chord"],"augmented",[1,3,105]],[["aug7","+7"],["Augmented 7th Chord"],"augmented",[1,3,105,-7]]];let ns=[];function Wl(){return _n.map(l=>{const e=l[3].map(zl);return{suffixes:l[0],name:l[1][0],type:l[2],intervals:e}})}function jt(l){ns.length===0&&(ns=Wl());const e=l.replaceAll(/-|\s/g,"").toLowerCase().trim();return ns.find(t=>t.suffixes.find(s=>s===e)||t.name.replaceAll(/-|\s/g,"").trim().toLowerCase()===e)}function pn(l,e,t){let s=e<0?l.flats-e:l.flats,n=e>0?l.sharps+e:l.sharps;if(s>0&&n>0){const a=Math.min(s,n);s-=a,n-=a}const r=(l.semitones+e)%12;return{...l,semitones:r<0?r+12:r,note:`${l.note.charAt(0)}${"♭".repeat(s)}${"♯".repeat(n)}`,flats:s,sharps:n,midi:t}}function is(l,e,t){const s=[];for(let n=0;n_.semitones===a%12),i=r.flats>0,c=r.sharps>0,f=(i?a+1:c?a-1:a)%12,d=i?-1:c?1:0;s.push(pn(o??e.notesMap.get(f),o?0:d,a))}return s}const Ds=["B♭","E♭","A♭","D♭","G♭","C♭","F♭"],vn=["F♯","C♯","G♯","D♯","A♯","E♯","B♯"],Ls=new Map([[0,"C"],[-1,"F"],[-2,"B♭"],[-3,"E♭"],[-4,"A♭"],[-5,"D♭"],[-6,"G♭"],[-7,"C♭"],[1,"G"],[2,"D"],[3,"A"],[4,"E"],[5,"B"],[6,"F♯"],[7,"C♯"]]);function gn(l){let e=0,t=0;for(let s=0;sa.note.slice(0,2)===Ds[s]),r=l.find(a=>a.note.slice(0,2)===vn[s]);if(n)e+=1;else if(r)t+=1;else break}return e>t?{flats:e,sharps:0,majorSignature:Ls.get(e*-1)}:{flats:0,sharps:t,majorSignature:Ls.get(t)}}function bn(l){return l>=9?`${l>=10?"X":""}${l===9?"IX":"I".repeat(l%10)}`:`${l>=5?"V":""}${l===4?"IV":"I".repeat(l%5)}`}function Jl(l){return l.map(e=>{const t=[$e(1)];let s;return e.major?(t.push($e(3)),e.suffix.startsWith("+")?t.push($e(5,0,1)):e.suffix.startsWith("6")?t.push($e(6)):e.suffix.startsWith("7")?t.push($e(7,1)):e.suffix.startsWith("maj7")?t.push($e(7)):s=jt("maj")):e.minor?(t.push($e(3,1)),e.suffix.startsWith("°")?t.push($e(5,1)):e.suffix.startsWith("6")?(t.push($e(6)),s=jt("m"+e.suffix)):e.suffix.startsWith("7")?(t.push($e(7,1)),s=jt("m"+e.suffix)):s=jt("m")):e.suffix.startsWith("sus2")?t.push($e(2)):e.suffix.startsWith("sus4")&&t.push($e(4)),t.length<=2&&t.push($e(5)),t.length<=2&&t.push($e(8)),s||(s=jt(e.suffix)),{...s,intervals:t}})}function yn(l,e){let t=e.has(4)&&e.has(7),s=e.has(3)&&e.has(7);const n=bn(l);let r="";return t||s||(e.has(3)&&e.has(6)?(r="°",s=!0):e.has(4)&&e.has(8)?(r="+",t=!0):e.has(3)&&e.has(10)?(s=!0,r="7"):e.has(4)&&e.has(10)?(r="7",t=!0):e.has(4)&&e.has(11)?(r="maj7",t=!0):e.has(3)&&e.has(8)?(r="6",s=!0):e.has(4)&&e.has(9)?(r="6",t=!0):e.has(2)?r="sus2":e.has(5)?r="sus4":e.has(7)?r="5":r="?"),{degree:l,roman:s?n.toLowerCase():n,suffix:r,major:t,minor:s,semitones:e}}function kn(l){const e=l.length;return l.map((t,s)=>{const n=t.semitones,r=new Set;for(let a=1;a{const e=l[0],t=l[1].map(zl),s=kn(t);return{names:e,intervals:t,triads:s}})}function wn(l){as.length===0&&(as=ms());const e=l.replaceAll(/-|\s/g,"").toLowerCase().trim();return as.find(t=>t.names.find(s=>s.replaceAll(/-|\s/g,"").trim().toLowerCase()===e))}const En=/^[a-gA-G][♭Bb#♯sS]*[0-9]?$/,Sn=/^[0-9]$/,et=[{note:"C",semitones:0,sharps:0,flats:0},{note:"C♯",semitones:1,sharps:1,flats:0},{note:"D",semitones:2,sharps:0,flats:0},{note:"E♭",semitones:3,sharps:0,flats:1},{note:"E",semitones:4,sharps:0,flats:0},{note:"F",semitones:5,sharps:0,flats:0},{note:"F♯",semitones:6,sharps:1,flats:0},{note:"G",semitones:7,sharps:0,flats:0},{note:"G♯",semitones:8,sharps:1,flats:0},{note:"A",semitones:9,sharps:0,flats:0},{note:"B♭",semitones:10,sharps:0,flats:1},{note:"B",semitones:11,sharps:0,flats:0}];function Ql(l){return l===12?1:Math.floor((l-12)/12)}function Ye(l){return`${l.note}${Ql(l.midi)}`}function Tt(l){const t=(l-12)%12;return{...et[t],semitones:t,midi:l}}function An(l,e=!0,t=!1){if(e&&!En.test(l))return{err:`Unrecognized note "${l}"`,code:400};const s=l.trim(),n=s.charAt(0).toUpperCase(),r=et.find(d=>d.note.charAt(0)===n&&d.note.length===1);if(!r)return{err:`Unable to find note ${s}`,code:500};const a=s.slice(1).split("").reduce((d,_)=>d+(_.toLowerCase()==="b"||_==="♭"?-1:_==="#"||_==="♯"?1:0),0);let o;if(Sn.test(s.charAt(s.length-1)))try{o=parseInt(s.charAt(s.length-1),10)}catch{}if(t&&o===void 0)return{err:`No octave provided: ${l}`,code:400};o===void 0&&(o=0);let i=(r.semitones+a)%12;i=i<0?i+12:i;const c=a<0?-a:0,f=a>0?a:0;return{data:{note:`${n}${"♭".repeat(c)}${"♯".repeat(f)}`,semitones:i,midi:12+o*12+i,flats:c,sharps:f}}}function Yl(l){const e=et.find(t=>t.note.charAt(0)===l.charAt(0)&&t.note.length===1);if(e){const t=l.slice(1).split("").reduce((n,r)=>n+(r.toLowerCase()==="b"||r==="♭"?-1:r==="#"||r==="♯"?1:0),0),s=(e.semitones+t)%12;return{note:l,semitones:s<0?s+12:s,flats:t<0?-t:0,sharps:t>0?t:0}}}const Tn=/^[a-gA-G][♭b#♯]?$/,rs="ABCDEFG";function Nn(l,e){return e.map(t=>rs.charAt((rs.indexOf(l)+t.interval_seq-1)%rs.length))}function In(l,e,t){return t.map((s,n)=>{const r=e[n],a=(l+s.semitones)%12,o=et[a],i=o.note.charAt(0);if(ir||i==="A"&&r==="G"){let c=1,f=a===0?et.length-1:a-c,d=et[f];for(;d.note.charAt(0)!==r;)c+=1,f=f===0?et.length-1:f-1,d=et[f];return{semitones:a,note:d.note+"♯".repeat(c),flats:0,sharps:c+(d.note.includes("♯")?1:0)}}else return{semitones:a,note:o.note,flats:o.flats,sharps:o.sharps}})}function Jt(l,e){if(!Tn.test(l))return{err:`Unknown key: ${l}`,code:400};const t=wn(e);if(!t)return{err:`Unknown scale: ${e}`,code:404};const s=`${l.charAt(0).toUpperCase()}${l.charAt(1).replace("b","♭").replace("#","♯")}`,n=Yl(s);if(!n)return{err:`Unable to find root for note: ${s}`,code:404};const r=Nn(s.charAt(0),t.intervals),a=In(n.semitones,r,t.intervals),o=new Map(et.map(i=>{const c=a.find(f=>f.semitones===i.semitones);return c?[i.semitones,c]:[i.semitones,{...i}]}));return{data:{key:s,scale:t.names[0],names:t.names,...gn(a),intervals:t.intervals.map(i=>({...i})),triads:t.triads.map(i=>({...i})),scaleNotes:a,notesMap:o}}}const cs=new Map;function jn(l,e){try{const t=e==="local"?window.localStorage:window.sessionStorage;return{data:JSON.parse(t.getItem(l)||"")}}catch(t){return{err:`Failed to retrieve value from storage: ${t}`,code:400}}}function Dn(l,e,t){try{return(t==="local"?window.localStorage:window.sessionStorage).setItem(e,JSON.stringify(l)),{data:void 0}}catch(s){return{err:`Failed to store the value: ${s}`,code:400}}}function dt(l,e){const{key:t,storage:s="local",namespace:n="default"}=e,r=jn(t,s),a=_e(l);"data"in r?l.set(e.deserialize?e.deserialize(r.data):r.data):"err"in r&&(e!=null&&e.debug)&&console.info(r.err);const o=l.subscribe(c=>{const f=Dn(e.serialize?e.serialize(c):c,t,s);"err"in f&&(e!=null&&e.debug)&&console.error(f.err)}),i=cs.get(n);return i?i.push({key:t,storage:s,value:l,defaultValue:a,unsubscribe:o}):cs.set(n,[{key:t,storage:s,value:l,defaultValue:a,unsubscribe:o}]),l}function Ln(l=["default"],e){l.forEach(t=>{var s;(s=cs.get(t))==null||s.forEach(n=>{if(e!=null&&e.cb)e==null||e.cb(n);else try{e!=null&&e.unsubscribe&&n.unsubscribe(),n.value.set(n.defaultValue),(n.storage==="local"?window.localStorage:window.sessionStorage).removeItem(n.key)}catch{}})})}async function Pn(l,e){const t=await fetch(l);if(!t.ok)return{err:t.statusText,code:t.status};const s=await t.arrayBuffer();return{data:await e.decodeAudioData(s)}}async function Bn(l,e){const t=["/a0.mp3","/a1.mp3","/a2.mp3","/a3.mp3","/a4.mp3","/a5.mp3","/a6.mp3","/a7.mp3","/damper.mp3","/Piano Impulse6.mp3"],s=await Promise.all(t.map(r=>Pn(`${l}${r}`,e))),n=[];return s.forEach(r=>{"err"in r?console.error(`Failed to load audio: ${r.err}`):n.push(r.data)}),n}class Gn{constructor(e,t,s,n){this.noteA=t.createBufferSource(),this.noteB=t.createBufferSource(),this.gainA=t.createGain(),this.gainB=t.createGain(),this.gain=t.createGain(),this.biquadFilter=t.createBiquadFilter(),this.biquadFilter.type="lowpass",this.biquadFilter.connect(s),this.gain.connect(this.biquadFilter),this.gainA.connect(this.gain),this.noteA.connect(this.gainA),this.gainB.connect(this.gain),this.noteB.connect(this.gainB),e<90&&(this.damp=t.createBufferSource(),this.damp.buffer=n,this.damp.connect(s))}on(e,t,s,n,r,a,o,i){this.noteA.buffer=e,this.noteA.playbackRate.value=s,this.biquadFilter.frequency.value=r,this.gainA.gain.value=a,this.gain.gain.value=i,t&&(this.noteB.buffer=t,this.noteB.playbackRate.value=n,this.gainB.gain.value=o,this.noteB.start(0)),this.noteA.start(0)}off(e,t,s){var n;this.gain.gain.setTargetAtTime(0,e,t),this.noteA.stop(s),this.noteB.stop(s),(n=this.damp)==null||n.start(0)}}class Mn{constructor(e){return this.bufferlists=[],this.sus=!1,this.sustained=[],this.notes=new Map,this.context=e,this.convolver=e.createConvolver(),this.directGain=e.createGain(),this.convGain=e.createGain(),this.convGainAfter=e.createGain(),this.convGain.connect(this.convolver),this.convolver.connect(this.convGainAfter),this.convGainAfter.connect(e.destination),this.directGain.connect(e.destination),this.directGain.connect(this.convGain),this.directGain.gain.value=.75,this.convGain.gain.value=0,this.convGainAfter.gain.value=0,this}load(e){e.forEach((t,s)=>{this.bufferlists.push(t),s===8?this.damper=t:s===9&&(this.convolver.buffer=t)})}playChord(e,t=80){e.forEach(s=>{this.noteOn(s,t)})}noteOn(e,t=80){if(e<109&&e>20){const s=this.notes.get(e);s&&(s.off(this.context.currentTime,1.1,this.context.currentTime+2),this.sustained.splice(this.sustained.indexOf(e),1));const n=Math.floor((e-21)/12),r=n+1,a=n*12+21,o=2**((e-69)/12)*440,i=t/127;let c=o*(2-(e-21)/50)+3*o*i;e<60&&(c=440*(3-(60-21)/50)+3*o*i);const f=1-(e%12/12+1)/12,d=Math.pow(2,(e-a)/12),_=0,b=0,g=i**1.4,E=new Gn(e,this.context,this.directGain,this.damper);E.on(this.bufferlists[n],this.bufferlists[r],d,_,c,f,b,g),this.notes.set(e,E)}}noteOff(e){if(this.sus)this.sustained.push(e);else{const t=this.notes.get(e);e<90&&t&&t.off(this.context.currentTime+.03,.08,this.context.currentTime+2),this.notes.delete(e)}}sustain(e){if(e==127)this.sus=!0,this.convGain.gain.value=1,this.convGainAfter.gain.value=1;else if(e==0){this.sus=!1,this.convGain.gain.value=0,this.convGainAfter.gain.value=0;for(let t=0;t[Tt(l[0]),Tt(l[1])]),Ps=Pe(void 0),tt=Pe(void 0),Kn=Pe(!0),nt=dt(Pe({fixedVelocity:void 0,keyFadeTimeout:1500,useSound:!0,useKeyboard:!0,useHotkeys:!0,useAutoOctave:!0}),{key:"inputs"}),fe={async openMidi(){return Rt.enable().then(()=>(us.set(!0),Rt.inputs.length>0?(Qt.set(Rt.inputs[0]),{data:Rt.inputs[0]}):{err:"No MIDI device found.",code:400})).catch(l=>({err:l.toString(),code:403}))},disableMidi(){us.set(!1),Qt.set(void 0)},setMidiRange(l){_s.set(l)},setInputValue(l,e){nt.update(t=>({...t,[l]:e})),l==="useSound"&&!e?tt.set(void 0):l==="useSound"&&!_e(tt)&&this.initAudio()},setKeyboardFocus(l){Kn.set(l)},async initAudio(){let l=_e(Ps);if(l||(l=new AudioContext,Ps.set(l)),!_e(tt)){const e=new Mn(l),t=await Bn(`${Vn}audio`,l);e.load(t),tt.set(e)}}};let Ze;const On=rn({A:{note:"C",semitones:0,flats:0,sharps:0},W:{note:"C♯",semitones:1,flats:0,sharps:1},S:{note:"D",semitones:2,flats:0,sharps:0},E:{note:"E♭",semitones:3,flats:1,sharps:0},D:{note:"E",semitones:4,flats:0,sharps:0},F:{note:"F",semitones:5,flats:0,sharps:0},T:{note:"F♯",semitones:6,flats:0,sharps:1},G:{note:"G",semitones:7,flats:0,sharps:0},Y:{note:"G♯",semitones:8,flats:0,sharps:1},H:{note:"A",semitones:9,flats:0,sharps:0},U:{note:"B♭",semitones:10,flats:1,sharps:0},J:{note:"B",semitones:11,flats:0,sharps:0},K:{note:"C",semitones:12,flats:0,sharps:0},O:{note:"C♯",semitones:13,flats:0,sharps:1},L:{note:"D",semitones:14,flats:0,sharps:0},P:{note:"E♭",semitones:15,flats:1,sharps:0},Ö:{note:"E",semitones:16,flats:0,sharps:0},Ä:{note:"F",semitones:17,flats:0,sharps:0},Å:{note:"F♯",semitones:18,flats:0,sharps:1}}),yt=Pe(["C","Major"]),kt=Ct(yt,l=>{const e=Jt(l[0],l[1]);return"data"in e?e.data:{key:l[0],scale:l[1],names:["major"],flats:0,sharps:0,majorSignature:"C",intervals:[],scaleNotes:[],triads:[],notesMap:new Map}}),Fn=Ct([kt,On],([l,e])=>{const t={...e};return Object.entries(e).forEach(([s,n])=>{const r=l.notesMap.get(n.semitones%12);r&&(t[s]={note:r.note,flats:r.flats,sharps:r.sharps,semitones:n.semitones})}),t}),Bs=Pe([]),vt=Pe([]);function fs(l,e){if(l.length>0){const t=Date.now();let s=t;const n=l.filter(r=>(r.started+e>t&&(s=Math.min(s,r.started)),r.started+e>t));return!Ze&&n.length>0&&(Ze=setTimeout(()=>{Ze=void 0,vt.update(r=>fs(r,e))},e-(t-s)+100)),n}return l}const me={setKey(l){yt.update(e=>[l,e[1]])},setScale(l){yt.update(e=>[e[0],l])},setKeyAndScale(l,e){yt.set([l,e])},setTarget(l=[]){Bs.set(l)},findNote(l){return Object.values(_e(Fn)).find(e=>{if(e.note.charAt(0)===l.charAt(0)){const t=l.slice(1).split("").reduce((s,n)=>s+(n.toLowerCase()==="b"||n==="♭"?-1:n.toLowerCase()==="s"||n==="#"||n==="♯"?1:0),0);return t>0?e.sharps===t:t<0?e.flats===t*-1:e.flats===0&&e.sharps===0}})},getNote(l){return{..._e(kt).notesMap.get(l%12),midi:l}},pushPlayed(l,e,t){const n={..._e(kt).notesMap.get(l%12),midi:l},r=Date.now(),a=e===void 0?"default":e?"correct":"wrong";if(vt.update(o=>{const i=o.findIndex(c=>c.midi===l);return i>=0&&o.splice(i,1),[...o,{...n,color:a,started:r}]}),!Ze&&t!==-1){const o=t??_e(nt).keyFadeTimeout;Ze=setTimeout(()=>{Ze=void 0,vt.update(i=>fs(i,o))},o)}},setPlayed(l,e,t){const s=Date.now(),n=e===void 0?"default":e?"correct":"wrong";if(vt.update(r=>[...l.map(a=>({...a,color:n,started:s}))]),!Ze&&t!==-1){const r=t??_e(nt).keyFadeTimeout;Ze=setTimeout(()=>{Ze=void 0,vt.update(a=>fs(a,r))},r)}},clearPlayed(){vt.set([]),clearTimeout(Ze),Ze=void 0},clearScore(l=!1){l&&yt.set(["C","Major"]),Bs.set([]),vt.set([])}};class ps{constructor(e,t,s){this.guesses=[],this.times=[],this.correct=0,this.guessed=0,this.idx=0,this.type=e,this.data=t,this.baseOptions=s;const n=[],{count:r}=s,a=t.map(i=>typeof i=="object"&&i!==null?{...i}:i);let o=s.duplicates;!s.duplicates&&r>a.length&&(console.warn(`Trying to create game with count ${r} larger than available unique values ${t.length}`),o=!0);for(let i=0;i0&&n.push(f[0])}}this.sampled=n,this.timing=performance.now()}get current(){return this.sampled[this.idx]}get latestGuess(){const e=this.sampled[this.idx-1],t=this.guesses[this.idx-1];return{target:e,guessed:t}}get ended(){return this.sampled.length0?l.sharps+e:l.sharps;if(s>0&&n>0){const a=Math.min(s,n);s-=a,n-=a}const r=(l.semitones+e)%12;return{...l,semitones:r<0?r+12:r,note:`${l.note.charAt(0)}${"♭".repeat(s)}${"♯".repeat(n)}`,flats:s,sharps:n,midi:t}}function xn(l,e,t){const s=[];for(let n=0;n_.semitones===a%12),i=r.flats>0,c=r.sharps>0,f=(i?a+1:c?a-1:a)%12,d=i?-1:c?1:0;s.push(Un(o??e.notesMap.get(f),o?0:d,a))}return s}const $n=[{note:"C",semitones:0,sharps:0,flats:0},{note:"C♯",semitones:1,sharps:1,flats:0},{note:"D",semitones:2,sharps:0,flats:0},{note:"E♭",semitones:3,sharps:0,flats:1},{note:"E",semitones:4,sharps:0,flats:0},{note:"F",semitones:5,sharps:0,flats:0},{note:"F♯",semitones:6,sharps:1,flats:0},{note:"G",semitones:7,sharps:0,flats:0},{note:"G♯",semitones:8,sharps:1,flats:0},{note:"A",semitones:9,sharps:0,flats:0},{note:"B♭",semitones:10,sharps:0,flats:1},{note:"B",semitones:11,sharps:0,flats:0}];function Rn(l){const t=(l-12)%12;return{...$n[t],semitones:t,midi:l}}function Hn(l){return`${l.note.trim().charAt(0).toUpperCase()}${"♭".repeat(l.flats)}${"♯".repeat(l.sharps)}`}class ut extends ps{constructor(e,t,s){const n=t.range[0],r=t.range[1],a=new Set(t.scale.scaleNotes.map(i=>i.semitones)),o=s.chords.flatMap(i=>{const c=[],f=i.intervals.reduce((d,_)=>_.semitones>d?_.semitones:d,0);for(let d=n;d<=r-f;d+=1)if((!s.onlyScale||a.has(d%12))&&(!i.allowed||i.allowed.has(d%12))){const _=xn(d,t.scale,i.intervals);c.push({...i,rootNote:_[0].note,chord:`${_[0].note}${i.suffixes[0]}`,notes:_})}return c});super(e,o,t),this.played=new Set,this.opts=s}addPlayedNote(e){this.played.add(e)}guessWrittenChord(e){const t={chord:`${Hn(e)}${e.chord.toLowerCase()}`,notes:[]},s=this.current.chord===t.chord;return this.addGuessed(t,s)}guess(){const e=Array.from(this.played.values()).map(n=>Rn(n)).sort((n,r)=>n.midi-r.midi);this.played.clear();const t={chord:"",notes:e},s=this.current.notes.every(n=>e.find(r=>r.midi%12===n.midi%12));return this.addGuessed(t,s)}}const qn={major:{C:{num:0},F:{acc:"b",num:1},Bb:{acc:"b",num:2},Eb:{acc:"b",num:3},Ab:{acc:"b",num:4},Db:{acc:"b",num:5},Gb:{acc:"b",num:6},Cb:{acc:"b",num:7},G:{acc:"#",num:1},D:{acc:"#",num:2},A:{acc:"#",num:3},E:{acc:"#",num:4},B:{acc:"#",num:5},"F#":{acc:"#",num:6},"C#":{acc:"#",num:7}},minor:{A:{num:0},D:{acc:"b",num:1},G:{acc:"b",num:2},C:{acc:"b",num:3},F:{acc:"b",num:4},Bb:{acc:"b",num:5},Eb:{acc:"b",num:6},Ab:{acc:"b",num:7},E:{acc:"#",num:1},B:{acc:"#",num:2},"F#":{acc:"#",num:3},"C#":{acc:"#",num:4},"G#":{acc:"#",num:5},"D#":{acc:"#",num:6},"A#":{acc:"#",num:7}}};class Dt extends ps{constructor(e,t){const s=e==="keys-major"?"major":"minor";super(e,Object.keys(qn[s]),t)}guess(e){const t=this.current===e;return this.addGuessed(e,t)}}class Nt extends ps{constructor(e,t){const s=t.range[0],n=t.range[1];super(e,Array.from(new Array(n-s+1)).map((r,a)=>s+a),t)}guess(e){const t=this.current===e;return this.addGuessed(e,t)}}const Xl={count:10,duplicates:!0,autoplay:!0,waitSeconds:3},gt=Pe("waiting"),ft=dt(Pe(Xl),{key:"game-options"}),bt=Pe(void 0),vs=Pe(Wl().map(l=>({...l,selected:!0}))),ke={play(...[l,e]){var i,c,f;let t;const s=_e(kt),n=_e(_s),r=_e(ft),a={scale:s,range:n,duplicates:r.duplicates,count:r.count};let o=[s.key,s.scale];if(l==="notes")t=new Nt(l,a),me.setTarget([me.getNote(t.current)]),(i=_e(tt))==null||i.noteOn(t.current);else if(l==="pitches")t=new Nt(l,a),me.setTarget(),fe.setInputValue("useSound",!0),(c=_e(tt))==null||c.noteOn(t.current);else if(l==="keys-major"||l=="keys-minor")t=new Dt(l,a),o=[t.current,l==="keys-major"?"major":"minor"];else if(l==="chords-play"||l==="chords-write")t=new ut(l,a,e);else if(l==="chords-diatonic"){const d=Jl(s.triads).map((_,b)=>({..._,allowed:new Set([s.scaleNotes[b].semitones])}));t=new ut(l,a,{chords:d})}else throw Error("Unknown game type: "+l);return typeof t.current!="number"&&typeof t.current!="string"&&((f=_e(tt))==null||f.playChord(t.current.notes.map(d=>d.midi)),me.setTarget(t.current.notes)),me.setKeyAndScale(o[0],o[1]),me.clearPlayed(),gt.set("waiting"),bt.set(t),t},updateState(l){gt.set(l)},setOptionValue(l,e){ft.update(t=>({...t,[l]:e}))},toggleChords(l){vs.update(e=>e.map(t=>({...t,selected:l(t)})))},nextGuess(){var e,t;const l=_e(bt);l!=null&&l.ended?gt.set("ended"):l instanceof Nt?(l.type==="notes"?me.setTarget([me.getNote(l.current)]):me.setTarget(),me.clearPlayed(),(e=_e(tt))==null||e.noteOn(l.current),ke.updateState("waiting"),l.startTime()):l instanceof ut?(me.setTarget(l.current.notes),me.clearPlayed(),(t=_e(tt))==null||t.playChord(l==null?void 0:l.current.notes.map(s=>s.midi)),gt.set("waiting"),l.startTime()):l instanceof Dt&&(me.setKey(l.current),gt.set("waiting"),l.startTime())},clearGame(l=!1){const e=_e(bt);e&&me.setKeyAndScale(e.baseOptions.scale.key,e.baseOptions.scale.scale),l&&ft.set(Xl),bt.set(void 0),gt.set("waiting"),me.clearScore()}};function Gs(l,e,t){const s=l.slice();return s[29]=e[t],s[31]=t,s}function Ms(l,e,t){const s=l.slice();return s[34]=e[t],s}function Vs(l,e,t){const s=l.slice();return s[8]=e[t],s}function Ks(l,e,t){const s=l.slice();return s[29]=e[t],s[31]=t,s}function Os(l,e,t){const s=l.slice();return s[34]=e[t],s}function Fs(l,e,t){const s=l.slice();return s[8]=e[t],s}function zn(l){let e,t=le(l[29].intervals),s=[];for(let n=0;n0?Wn:zn}let N=C(l),k=N(l);return{c(){e=p("li"),t=p("button"),s=p("span"),ve(n.$$.fragment),r=P(),a=p("div"),i=Q(o),c=P(),f=p("li"),k.c(),_=P(),b=p("li"),E=Q(g),this.h()},l(S){e=v(S,"LI",{});var j=T(e);t=v(j,"BUTTON",{class:!0});var A=T(t);s=v(A,"SPAN",{class:!0});var O=T(s);ge(n.$$.fragment,O),O.forEach(m),r=B(A),a=v(A,"DIV",{class:!0});var w=T(a);i=Y(w,o),w.forEach(m),A.forEach(m),j.forEach(m),c=B(S),f=v(S,"LI",{class:!0,title:!0});var L=T(f);k.l(L),L.forEach(m),_=B(S),b=v(S,"LI",{class:!0});var I=T(b);E=Y(I,g),I.forEach(m),this.h()},h(){h(s,"class","px-1 py-1 rounded"),z(s,"text-green-500",l[29].selected),z(s,"text-gray-400",!l[29].selected),h(a,"class","ml-1 px-1 w-full bg-gray-200 svelte-1j99daw"),h(t,"class","flex items-center justify-center w-full select-btn svelte-1j99daw"),z(t,"hidden",l[7]),h(f,"class","intervals svelte-1j99daw"),h(f,"title",d=l[29].intervals.map(Ws).join("-")),h(b,"class","text-xs")},m(S,j){F(S,e,j),u(e,t),u(t,s),be(n,s,null),u(t,r),u(t,a),u(a,i),F(S,c,j),F(S,f,j),k.m(f,null),F(S,_,j),F(S,b,j),u(b,E),y=!0,D||(G=$(t,"click",K),D=!0)},p(S,j){l=S;const A={};j[0]&64&&(A.icon=l[29].selected?zt:Wt),n.$set(A),(!y||j[0]&64)&&z(s,"text-green-500",l[29].selected),(!y||j[0]&64)&&z(s,"text-gray-400",!l[29].selected),(!y||j[0]&64)&&o!==(o=l[29].suffixes[0]+"")&&ae(i,o),(!y||j[0]&128)&&z(t,"hidden",l[7]),N===(N=C(l))&&k?k.p(l,j):(k.d(1),k=N(l),k&&(k.c(),k.m(f,null))),(!y||j[0]&64&&d!==(d=l[29].intervals.map(Ws).join("-")))&&h(f,"title",d),(!y||j[0]&64)&&g!==(g=l[29].name+"")&&ae(E,g)},i(S){y||(H(n.$$.fragment,S),y=!0)},o(S){J(n.$$.fragment,S),y=!1},d(S){S&&(m(e),m(c),m(f),m(_),m(b)),ye(n),k.d(),D=!1,G()}}}function Jn(l){let e,t=le(l[29].intervals),s=[];for(let n=0;n0?Qn:Jn}let N=C(l),k=N(l);return{c(){e=p("li"),t=p("button"),s=p("span"),ve(n.$$.fragment),r=P(),a=p("div"),i=Q(o),c=P(),f=p("li"),k.c(),_=P(),b=p("li"),E=Q(g),this.h()},l(S){e=v(S,"LI",{});var j=T(e);t=v(j,"BUTTON",{class:!0});var A=T(t);s=v(A,"SPAN",{class:!0});var O=T(s);ge(n.$$.fragment,O),O.forEach(m),r=B(A),a=v(A,"DIV",{class:!0});var w=T(a);i=Y(w,o),w.forEach(m),A.forEach(m),j.forEach(m),c=B(S),f=v(S,"LI",{class:!0,title:!0});var L=T(f);k.l(L),L.forEach(m),_=B(S),b=v(S,"LI",{class:!0});var I=T(b);E=Y(I,g),I.forEach(m),this.h()},h(){h(s,"class","px-1 py-1 rounded"),z(s,"text-green-500",l[29].selected),z(s,"text-gray-400",!l[29].selected),h(a,"class","ml-1 px-1 w-full bg-gray-200 svelte-1j99daw"),h(t,"class","flex items-center justify-center w-full select-btn svelte-1j99daw"),z(t,"hidden",l[7]),h(f,"class","intervals svelte-1j99daw"),h(f,"title",d=l[29].intervals.map(Js).join("-")),h(b,"class","text-xs")},m(S,j){F(S,e,j),u(e,t),u(t,s),be(n,s,null),u(t,r),u(t,a),u(a,i),F(S,c,j),F(S,f,j),k.m(f,null),F(S,_,j),F(S,b,j),u(b,E),y=!0,D||(G=$(t,"click",K),D=!0)},p(S,j){l=S;const A={};j[0]&32&&(A.icon=l[29].selected?zt:Wt),n.$set(A),(!y||j[0]&32)&&z(s,"text-green-500",l[29].selected),(!y||j[0]&32)&&z(s,"text-gray-400",!l[29].selected),(!y||j[0]&32)&&o!==(o=l[29].suffixes[0]+"")&&ae(i,o),(!y||j[0]&128)&&z(t,"hidden",l[7]),N===(N=C(l))&&k?k.p(l,j):(k.d(1),k=N(l),k&&(k.c(),k.m(f,null))),(!y||j[0]&32&&d!==(d=l[29].intervals.map(Js).join("-")))&&h(f,"title",d),(!y||j[0]&32)&&g!==(g=l[29].name+"")&&ae(E,g)},i(S){y||(H(n.$$.fragment,S),y=!0)},o(S){J(n.$$.fragment,S),y=!1},d(S){S&&(m(e),m(c),m(f),m(_),m(b)),ye(n),k.d(),D=!1,G()}}}function Yn(l){let e,t,s,n,r="Chords",a,o,i,c,f,d,_,b,g,E,y,D,G,K,C,N,k,S="Key",j,A,O,w,L="Scale",I,U,M,V,R="Note",te,se,de,ie,Me,xe,Ve,pe,ze,Ue;c=new rt({props:{icon:hn,width:20}}),_=new rt({props:{icon:mn,width:16}}),E=new rt({props:{icon:l[4]?Ts:Ns,width:16}}),G=new rt({props:{icon:Hl,width:16}});let Ie=le(l[6]),re=[];for(let x=0;xJ(re[x],1,1,()=>{re[x]=null});let he=le(l[5]),W=[];for(let x=0;xJ(W[x],1,1,()=>{W[x]=null});return{c(){e=p("div"),t=p("fieldset"),s=p("legend"),n=p("button"),n.textContent=r,a=P(),o=p("div"),i=p("button"),ve(c.$$.fragment),f=P(),d=p("button"),ve(_.$$.fragment),b=P(),g=p("button"),ve(E.$$.fragment),y=P(),D=p("button"),ve(G.$$.fragment),K=P(),C=p("div"),N=p("div"),k=p("label"),k.textContent=S,j=P(),A=p("input"),O=P(),w=p("label"),w.textContent=L,I=P(),U=p("input"),M=P(),V=p("label"),V.textContent=R,te=P(),se=p("input"),de=P(),ie=p("ul");for(let x=0;xl.interval,Js=l=>l.interval;function Xn(l,e,t){let s,n,r,a,o,i;oe(l,vs,M=>t(20,o=M));let c="C",f=Jt(c,zs),d="",_,b=[],g=[];const E=dt(Pe(!0),{key:"chords-hidden"});oe(l,E,M=>t(7,i=M));function y(){E.update(M=>!M)}function D(){const M=_&&60+_.semitones;if("err"in f||!M)t(2,b=[]),t(3,g=[]);else{const V=f.data;t(2,b=n.map(R=>is(M,V,R.intervals))),t(3,g=r.map(R=>is(M,V,R.intervals)))}}function G({currentTarget:{value:M}}){t(0,c=`${M.charAt(0).toUpperCase()}${M.charAt(1).toLowerCase()}`),f=Jt(c,zs),D()}function K({currentTarget:{value:M}}){t(1,d=`${M.charAt(0).toUpperCase()}${M.charAt(1).toLowerCase()}`),t(8,_=Yl(d)),D()}function C(M){ke.toggleChords(V=>V.name===M.name?!V.selected:V.selected)}function N(){const M=R=>R.suffixes[0]==="maj"||R.suffixes[0]==="m",V=o.filter(M).every(R=>R.selected);ke.toggleChords(R=>M(R)?!V:R.selected)}function k(){const M=R=>R.suffixes[0]==="maj7"||R.suffixes[0]==="m7"||R.suffixes[0]==="7"||R.suffixes[0]==="dim7"||R.suffixes[0]==="aug7",V=o.filter(M).every(R=>R.selected);ke.toggleChords(R=>M(R)?!V:R.selected)}function S(){ke.toggleChords(M=>!a)}function j(){ke.toggleChords(M=>!0)}const A=()=>fe.setKeyboardFocus(!1),O=()=>fe.setKeyboardFocus(!0),w=()=>fe.setKeyboardFocus(!1),L=()=>fe.setKeyboardFocus(!0),I=M=>C(M),U=M=>C(M);return l.$$set=M=>{t(18,e=Ce(Ce({},e),we(M)))},l.$$.update=()=>{l.$$.dirty[0]&1048576&&t(19,s=o),l.$$.dirty[0]&524288&&t(6,n=s.filter((M,V)=>VV>=s.length/2)),l.$$.dirty[0]&524288&&t(4,a=s.every(M=>M.selected))},e=we(e),[c,d,b,g,a,r,n,i,_,E,y,G,K,C,N,k,S,j,e,s,o,A,O,w,L,I,U]}class Zn extends Re{constructor(e){super(),He(this,e,Xn,Yn,qe,{},null,[-1,-1])}}function Qs(l,e,t){const s=l.slice();return s[10]=e[t],s}function ea(l){let e;return{c(){e=Q(" ")},l(t){e=Y(t," ")},m(t,s){F(t,e,s)},p:ue,d(t){t&&m(e)}}}function ta(l){let e,t,s="Played:",n,r=le(l[2]),a=[];for(let o=0;o0?ta:ea}let a=r(l),o=a(l);function i(d,_){return d[0]&&d[1]==="ended"?ca:d[0]&&d[3].autoplay?ia:d[0]?oa:ra}let c=i(l),f=c(l);return{c(){e=p("div"),o.c(),s=P(),n=p("div"),f.c(),this.h()},l(d){e=v(d,"DIV",{class:!0});var _=T(e);o.l(_),_.forEach(m),s=B(d),n=v(d,"DIV",{class:!0});var b=T(n);f.l(b),b.forEach(m),this.h()},h(){h(e,"class",t=Te(`${l[8].class||""} min-h-[3.25rem]`)+" svelte-1lxfpqs"),h(n,"class","mt-2 h-8")},m(d,_){F(d,e,_),o.m(e,null),F(d,s,_),F(d,n,_),f.m(n,null)},p(d,[_]){a===(a=r(d))&&o?o.p(d,_):(o.d(1),o=a(d),o&&(o.c(),o.m(e,null))),_&256&&t!==(t=Te(`${d[8].class||""} min-h-[3.25rem]`)+" svelte-1lxfpqs")&&h(e,"class",t),c===(c=i(d))&&f?f.p(d,_):(f.d(1),f=c(d),f&&(f.c(),f.m(n,null)))},i:ue,o:ue,d(d){d&&(m(e),m(s),m(n)),o.d(),f.d()}}}const Xs=l=>l.note,Zs=l=>l.note;function fa(l,e,t){let s,n,r;oe(l,gt,_=>t(1,s=_)),oe(l,vt,_=>t(2,n=_)),oe(l,ft,_=>t(3,r=_));let{game:a}=e;function o(){ke.nextGuess()}function i(){ke.setOptionValue("autoplay",!0),ke.nextGuess()}function c(){a instanceof ut?ke.play(a.type,a.opts):a&&ke.play(a.type,void 0)}function f(){ke.clearGame()}const d=()=>ke.setOptionValue("autoplay",!1);return l.$$set=_=>{t(8,e=Ce(Ce({},e),we(_))),"game"in _&&t(0,a=_.game)},e=we(e),[a,s,n,r,o,i,c,f,e,d]}class da extends Re{constructor(e){super(),He(this,e,fa,ua,qe,{game:0})}}function el(l){let e;return{c(){e=p("li"),this.h()},l(t){e=v(t,"LI",{class:!0}),T(e).forEach(m),this.h()},h(){h(e,"class","m-[0.175rem] mr-0")},m(t,s){F(t,e,s)},d(t){t&&m(e)}}}function tl(l){let e;return{c(){e=p("div"),this.h()},l(t){e=v(t,"DIV",{class:!0}),T(e).forEach(m),this.h()},h(){h(e,"class","enter-part bg-[#ececf1] rounded-l absolute top-[-2px] left-[-12px] w-[13px] h-[2.8rem] svelte-jvhfju")},m(t,s){F(t,e,s)},d(t){t&&m(e)}}}function sl(l){let e,t=l[0].note.note+"",s;return{c(){e=p("div"),s=Q(t),this.h()},l(n){e=v(n,"DIV",{class:!0});var r=T(e);s=Y(r,t),r.forEach(m),this.h()},h(){h(e,"class","absolute top-0 left-0")},m(n,r){F(n,e,r),u(e,s)},p(n,r){r&1&&t!==(t=n[0].note.note+"")&&ae(s,t)},d(n){n&&m(e)}}}function ha(l){let e,t,s,n,r,a,o=l[0].key+"",i,c,f,d,_=l[0].key==="{enter}"&&el(),b=l[0].key==="{enter}"&&tl(),g=l[0].note&&sl(l);return{c(){_&&_.c(),e=P(),t=p("li"),s=p("button"),b&&b.c(),n=P(),g&&g.c(),r=P(),a=p("div"),i=Q(o),this.h()},l(E){_&&_.l(E),e=B(E),t=v(E,"LI",{class:!0});var y=T(t);s=v(y,"BUTTON",{class:!0});var D=T(s);b&&b.l(D),n=B(D),g&&g.l(D),r=B(D),a=v(D,"DIV",{});var G=T(a);i=Y(G,o),G.forEach(m),D.forEach(m),y.forEach(m),this.h()},h(){h(s,"class","relative w-full h-full shadow bg-[#ececf1] rounded flex items-center justify-center svelte-jvhfju"),h(t,"class",c=Te(`${l[1].class||""} m-[0.175rem] ${ll(l[0].size)}`)+" svelte-jvhfju"),z(t,"enter",l[0].key==="{enter}")},m(E,y){_&&_.m(E,y),F(E,e,y),F(E,t,y),u(t,s),b&&b.m(s,null),u(s,n),g&&g.m(s,null),u(s,r),u(s,a),u(a,i),f||(d=$(s,"click",l[2]),f=!0)},p(E,[y]){E[0].key==="{enter}"?_||(_=el(),_.c(),_.m(e.parentNode,e)):_&&(_.d(1),_=null),E[0].key==="{enter}"?b||(b=tl(),b.c(),b.m(s,n)):b&&(b.d(1),b=null),E[0].note?g?g.p(E,y):(g=sl(E),g.c(),g.m(s,r)):g&&(g.d(1),g=null),y&1&&o!==(o=E[0].key+"")&&ae(i,o),y&3&&c!==(c=Te(`${E[1].class||""} m-[0.175rem] ${ll(E[0].size)}`)+" svelte-jvhfju")&&h(t,"class",c),y&3&&z(t,"enter",E[0].key==="{enter}")},i:ue,o:ue,d(E){E&&(m(e),m(t)),_&&_.d(E),b&&b.d(),g&&g.d(),f=!1,d()}}}function ll(l){return l&&Number.isInteger(l)?`size-${l}`:l?`size-${Math.floor(l)}-${Math.floor(l*10)-Math.floor(l)*10}`:"size-1"}function ma(l,e,t){let{value:s}=e;function n(r){hs.call(this,l,r)}return l.$$set=r=>{t(1,e=Ce(Ce({},e),we(r))),"value"in r&&t(0,s=r.value)},e=we(e),[s,e,n]}class _a extends Re{constructor(e){super(),He(this,e,ma,ha,qe,{value:0})}}const pa={layout:{default:["§ 1 2 3 4 5 6 7 8 9 0 + ´ {bksp}","{tab} q w e r t y u i o p å ¨ {enter}","{lock} a s d f g h j k l ö ä '","{shift} < z x c v b n m , . - {shift}",".com @ {space}"],shift:['° ! " # $ % & / ( ) = ? ` {bksp}',"{tab} Q W E R T Y U I O P Å ^","{lock} A S D F G H J K L Ö Ä * {enter}","{shift} > Z X C V B N M ; : _ {shift}",".com @ {space}"]}},va=[["IntlBackslash","Digit1","Digit2","Digit3","Digit4","Digit5","Digit6","Digit7","Digit8","Digit9","Digit0","Minus","Equal","Backspace"],["Tab","KeyQ","KeyW","KeyE","KeyR","KeyT","KeyY","KeyU","KeyI","KeyO","KeyP","BracketLeft","BracketRight","Enter"],["Capslock","KeyA","KeyS","KeyD","KeyF","KeyG","KeyH","KeyJ","KeyK","KeyL","Semicolon","Quote","Backslash"],["ShiftLeft","Backquote","KeyZ","KeyX","KeyC","KeyV","KeyB","KeyN","KeyM","Comma","Period","Slash","ShiftRight"]];function ga(l,e){return l[1].forEach((t,s)=>{let n;s===2?n={...e[1]}:s===3?n={...e[3]}:s===5?n={...e[6]}:s===6?n={...e[8]}:s===7?n={...e[10]}:s===9?(n={...e[1]},n.semitones+=12):s===10&&(n={...e[3]},n.semitones+=12),l[1][s].note=n}),l[2].forEach((t,s)=>{let n;s===1?n={...e[0]}:s===2?n={...e[2]}:s===3?n={...e[4]}:s===4?n={...e[5]}:s===5?n={...e[7]}:s===6?n={...e[9]}:s===7?n={...e[11]}:s===8?(n={...e[0]},n.semitones+=12):s===9?(n={...e[2]},n.semitones+=12):s===10?(n={...e[4]},n.semitones+=12):s===11?(n={...e[5]},n.semitones+=12):s===12&&(n={...e[7]},n.semitones+=12),l[2][s].note=n}),l}class ba{constructor(e={layout:"middle-row"}){this.language="en",this.rows=[[],[],[],[]],this.opts=e,this.setLayout(pa)}setOptions(e){this.opts={...this.opts,...e}}setLayout(e){const t=[[],[],[],[]];e.layout.default.forEach((s,n)=>{s.split(" ").forEach((r,a)=>{n<4&&t[n].push({key:r,code:va[n][a]})})}),this.rows=t}setNotes(e){this.opts.layout==="middle-row"&&(this.rows=ga(this.rows,e))}}const gs=/^[a-gA-G]$/,Zl=/^[♭Bb#♯sS]$/,ya=/^[0-9]$/;let q="",ct;const en=Pe(!0),ka=dt(Pe({layout:"middle-row"}),{key:"keyboard-options"}),tn=Ct([kt,ka],([l,e])=>{const t=new ba(e);return t.setNotes(Array.from(l.notesMap.values())),t}),Ca=Ct(tn,l=>l.rows.map(e=>e.map((t,s)=>{let n;return t.key==="{bksp}"?n=2:t.key==="{tab}"?n=1.5:t.key==="{enter}"?n=2:t.key==="{lock}"?n=1.75:t.key==="{shift}"&&s===0?n=1.5:t.key==="{shift}"&&(n=2.5),n?{...t,size:n}:t}))),Xt=Ct(tn,l=>new Map([...l.rows[0].map(e=>[e.code,e]),...l.rows[1].map(e=>[e.code,e]),...l.rows[2].map(e=>[e.code,e]),...l.rows[3].map(e=>[e.code,e])])),wa=Ct(Xt,l=>Array.from(l.values()).map(e=>e.note).filter(e=>e!==void 0));function Ea(l,e){const{useHotkeys:t}=_e(nt),s=_e(Xt).get(l);if(t&&q.length===0&&s&&s.note)return q="",{e:"guessed-key",data:s.note.note};if(!t&&q.length===0&&gs.test(e))return q+=e.toUpperCase(),{e:"string",data:q};if(!t&&q.length>0&&Zl.test(e))return e==="b"||e==="B"?q+="♭":q+="♯",{e:"string",data:q};if(l==="Backspace"&&q.length>0)return q=q.slice(0,-1),{e:"string",data:q};if(l==="Enter"&&q.length>0){const n=q;return q="",{e:"guessed-key",data:n}}return!1}function Sa(l,e,t){if(l==="Enter"&&q.length>0){const s={note:"",flats:0,sharps:0,chord:""};for(let n=0;n0?s.chord+=q[n].toLowerCase():q[n]==="♭"?(s.note+=q[n],s.flats+=1):q[n]==="♯"?(s.note+=q[n],s.sharps+=1):s.chord+=q[n].toLowerCase();return q="",{e:"guessed-chord",data:s}}else{if(l==="Backspace"&&q.length>0)return q=q.slice(0,-1),{e:"string",data:q};if(q.length===0&&gs.test(e))return q+=e.toUpperCase(),{e:"string",data:q};if(q.length>0&&e.length===1)return q.length===1&&(e==="b"||e==="B")?q+="♭":q.length===1&&e==="#"?q+="♯":q+=e,{e:"string",data:q}}return!1}function Aa(l,e,t){const{useAutoOctave:s,useHotkeys:n}=_e(nt);let r;const o=_e(Xt).get(l),i=(o==null?void 0:o.key)||"";let c=!1;if(!ct&&n&&(o!=null&&o.note)?(ct=o.note,s&&(r=Ql(_e(Yt)[0].midi)),c="note"):!n&&q.length===0&&gs.test(e)?(q+=e.toUpperCase(),c="input"):!n&&q.length>0&&Zl.test(e)&&(e==="b"||e==="B"?q+="♭":q+="♯",c="input"),ya.test(i))try{r=parseInt(i)}catch{}if(ct&&r!==void 0){const f=ct.semitones+(r+1+(t?1:0))*12;return ct=void 0,{e:"guessed-note",data:f}}else if(q&&r!==void 0){const f=sn.findNote(q),d=f?f.semitones+(r+1)*12:void 0;return ct=void 0,q="",d!==void 0?{e:"guessed-note",data:d}:{e:"string",data:q}}else if(l==="Backspace"&&(ct||q.length>0))return ct=void 0,q=q.slice(0,-1),{e:"string",data:q};return c==="note"?{e:"note",data:ct}:c==="input"?{e:"string",data:q}:!1}const sn={setKeyboardFocus(l){en.set(l)},findNote(l){return _e(wa).find(e=>{if(e.note.charAt(0)===l.charAt(0)){const t=l.slice(1).split("").reduce((s,n)=>s+(n.toLowerCase()==="b"||n==="♭"?-1:n.toLowerCase()==="s"||n==="#"||n==="♯"?1:0),0);return t>0?e.sharps===t:t<0?e.flats===t*-1:e.flats===0&&e.sharps===0}})},handleInput(l,e,t=!1){const s=_e(bt);return s instanceof Dt?Ea(l,e.toUpperCase()):s instanceof ut&&s.type==="chords-write"?Sa(l,e):_e(nt).useKeyboard?Aa(l,e.toUpperCase(),t):!1}};function nl(l,e,t){const s=l.slice();return s[7]=e[t],s[9]=t,s}function al(l,e,t){const s=l.slice();return s[10]=e[t],s}function rl(l){let e,t;return e=new _a({props:{value:l[10]}}),{c(){ve(e.$$.fragment)},l(s){ge(e.$$.fragment,s)},m(s,n){be(e,s,n),t=!0},p(s,n){const r={};n&4&&(r.value=s[10]),e.$set(r)},i(s){t||(H(e.$$.fragment,s),t=!0)},o(s){J(e.$$.fragment,s),t=!1},d(s){ye(e,s)}}}function ol(l){let e,t,s,n,r=le(l[7]),a=[];for(let i=0;iJ(a[i],1,1,()=>{a[i]=null});return{c(){e=p("li"),t=P();for(let i=0;iJ(k[j],1,1,()=>{k[j]=null});return{c(){e=p("div"),t=p("div"),s=p("div"),n=p("label"),n.textContent=r,a=P(),o=p("input"),i=P(),c=p("div"),f=p("label"),f.textContent=d,_=P(),b=p("input"),g=P(),E=p("div"),y=p("ul");for(let j=0;jt(6,s=c)),oe(l,Ca,c=>t(2,n=c)),Fl(()=>{console.log(s)});let r=!0,a=!1;function o(){r=this.checked,t(0,r)}function i(){a=this.checked,t(1,a)}return l.$$set=c=>{t(3,e=Ce(Ce({},e),we(c)))},e=we(e),[r,a,n,e,o,i]}class Ia extends Re{constructor(e){super(),He(this,e,Na,Ta,qe,{})}}function il(l){let e,t;return e=new Ia({props:{class:"mt-4"}}),{c(){ve(e.$$.fragment)},l(s){ge(e.$$.fragment,s)},m(s,n){be(e,s,n),t=!0},i(s){t||(H(e.$$.fragment,s),t=!0)},o(s){J(e.$$.fragment,s),t=!1},d(s){ye(e,s)}}}function ja(l){let e,t,s,n,r="I/O",a,o,i,c,f="Device",d,_,b,g,E,y,D="Prompt",G,K,C="Disable",N,k,S,j,A="Sound",O,w,L,I,U,M,V="Fixed velocity",R,te,se,de,ie,Me,xe="Keyboard",Ve,pe,ze,Ue,Ie,re,Ne="Hotkeys",he,W,ne,x,X,ce,Z="Auto-octave",Ee,Be,at,We,Ke,je,Se,It="Set keys",wt,Oe,ht,bs="Fade timeout",Zt,Xe,es,mt,Lt,ts,_t,ys="Reset all",ss,Pt,Je,ls,ks,Ge=l[2]&&il();return{c(){e=p("div"),t=p("fieldset"),s=p("legend"),n=p("button"),n.textContent=r,a=P(),o=p("div"),i=p("div"),c=p("label"),c.textContent=f,d=P(),_=p("input"),g=P(),E=p("div"),y=p("button"),y.textContent=D,G=P(),K=p("button"),K.textContent=C,N=P(),k=p("div"),S=p("div"),j=p("label"),j.textContent=A,O=P(),w=p("input"),I=P(),U=p("div"),M=p("label"),M.textContent=V,R=P(),te=p("input"),se=P(),de=p("div"),ie=p("div"),Me=p("label"),Me.textContent=xe,Ve=P(),pe=p("input"),Ue=P(),Ie=p("div"),re=p("label"),re.textContent=Ne,he=P(),W=p("input"),x=P(),X=p("div"),ce=p("label"),ce.textContent=Z,Ee=P(),Be=p("input"),We=P(),Ke=p("div"),je=p("div"),Se=p("button"),Se.textContent=It,wt=P(),Oe=p("div"),ht=p("label"),ht.textContent=bs,Zt=P(),Xe=p("input"),es=P(),mt=p("div"),Lt=p("div"),ts=P(),_t=p("button"),_t.textContent=ys,ss=P(),Ge&&Ge.c(),this.h()},l(Ae){e=v(Ae,"DIV",{class:!0});var Fe=T(e);t=v(Fe,"FIELDSET",{class:!0});var it=T(t);s=v(it,"LEGEND",{class:!0});var Cs=T(s);n=v(Cs,"BUTTON",{class:!0,"data-svelte-h":!0}),ee(n)!=="svelte-1jbbsti"&&(n.textContent=r),Cs.forEach(m),a=B(it),o=v(it,"DIV",{class:!0});var pt=T(o);i=v(pt,"DIV",{class:!0});var Et=T(i);c=v(Et,"LABEL",{class:!0,for:!0,"data-svelte-h":!0}),ee(c)!=="svelte-crpa7y"&&(c.textContent=f),d=B(Et),_=v(Et,"INPUT",{class:!0,id:!0}),g=B(Et),E=v(Et,"DIV",{class:!0});var Bt=T(E);y=v(Bt,"BUTTON",{class:!0,"data-svelte-h":!0}),ee(y)!=="svelte-mj6mct"&&(y.textContent=D),G=B(Bt),K=v(Bt,"BUTTON",{class:!0,"data-svelte-h":!0}),ee(K)!=="svelte-1sl6oxh"&&(K.textContent=C),Bt.forEach(m),Et.forEach(m),N=B(pt),k=v(pt,"DIV",{class:!0});var Gt=T(k);S=v(Gt,"DIV",{class:!0});var Mt=T(S);j=v(Mt,"LABEL",{class:!0,for:!0,"data-svelte-h":!0}),ee(j)!=="svelte-wgxtkw"&&(j.textContent=A),O=B(Mt),w=v(Mt,"INPUT",{class:!0,id:!0,type:!0}),Mt.forEach(m),I=B(Gt),U=v(Gt,"DIV",{class:!0});var Vt=T(U);M=v(Vt,"LABEL",{class:!0,for:!0,"data-svelte-h":!0}),ee(M)!=="svelte-1tm2bth"&&(M.textContent=V),R=B(Vt),te=v(Vt,"INPUT",{class:!0,id:!0,placeholder:!0}),Vt.forEach(m),Gt.forEach(m),se=B(pt),de=v(pt,"DIV",{class:!0});var St=T(de);ie=v(St,"DIV",{class:!0});var Kt=T(ie);Me=v(Kt,"LABEL",{class:!0,for:!0,"data-svelte-h":!0}),ee(Me)!=="svelte-1js269u"&&(Me.textContent=xe),Ve=B(Kt),pe=v(Kt,"INPUT",{class:!0,id:!0,type:!0}),Kt.forEach(m),Ue=B(St),Ie=v(St,"DIV",{class:!0});var Ot=T(Ie);re=v(Ot,"LABEL",{class:!0,for:!0,"data-svelte-h":!0}),ee(re)!=="svelte-21h39k"&&(re.textContent=Ne),he=B(Ot),W=v(Ot,"INPUT",{class:!0,id:!0,type:!0}),Ot.forEach(m),x=B(St),X=v(St,"DIV",{class:!0});var Ft=T(X);ce=v(Ft,"LABEL",{class:!0,for:!0,"data-svelte-h":!0}),ee(ce)!=="svelte-33lczu"&&(ce.textContent=Z),Ee=B(Ft),Be=v(Ft,"INPUT",{class:!0,id:!0,type:!0}),Ft.forEach(m),St.forEach(m),We=B(pt),Ke=v(pt,"DIV",{class:!0});var At=T(Ke);je=v(At,"DIV",{class:!0});var ws=T(je);Se=v(ws,"BUTTON",{class:!0,"data-svelte-h":!0}),ee(Se)!=="svelte-1npcis2"&&(Se.textContent=It),ws.forEach(m),wt=B(At),Oe=v(At,"DIV",{class:!0});var Ut=T(Oe);ht=v(Ut,"LABEL",{class:!0,for:!0,"data-svelte-h":!0}),ee(ht)!=="svelte-vd5i27"&&(ht.textContent=bs),Zt=B(Ut),Xe=v(Ut,"INPUT",{class:!0,id:!0}),Ut.forEach(m),es=B(At),mt=v(At,"DIV",{class:!0});var xt=T(mt);Lt=v(xt,"DIV",{}),T(Lt).forEach(m),ts=B(xt),_t=v(xt,"BUTTON",{class:!0,"data-svelte-h":!0}),ee(_t)!=="svelte-jjt0c3"&&(_t.textContent=ys),xt.forEach(m),At.forEach(m),pt.forEach(m),ss=B(it),Ge&&Ge.l(it),it.forEach(m),Fe.forEach(m),this.h()},h(){var Ae;h(n,"class","px-1 rounded hover:bg-gray-100"),h(s,"class","text-base"),h(c,"class","font-bold"),h(c,"for","device"),h(_,"class","px-1 my-1 rounded w-50"),h(_,"id","device"),_.disabled=!0,_.value=b=((Ae=l[5])==null?void 0:Ae.name)??"No device",h(y,"class","btn-sm primary mr-2"),h(K,"class","btn-sm primary"),h(E,"class","flex my-[auto]"),h(i,"class","h-full flex flex-col"),h(j,"class","font-bold"),h(j,"for","sound"),h(w,"class","h-[20px]"),h(w,"id","sound"),h(w,"type","checkbox"),w.checked=L=l[3].useSound,h(S,"class","my-1 flex justify-between mr-12"),h(M,"class","font-bold"),h(M,"for","fixed-velocity"),h(te,"class","h-[20px] w-16"),h(te,"id","fixed-velocity"),h(te,"placeholder","0-127"),h(U,"class","flex justify-between"),h(k,"class","flex flex-col h-full"),h(Me,"class","font-bold"),h(Me,"for","keyboard"),h(pe,"class","h-[20px]"),h(pe,"id","keyboard"),h(pe,"type","checkbox"),pe.checked=ze=l[3].useKeyboard,h(ie,"class","my-1 flex justify-between mr-12"),h(re,"class","font-bold"),h(re,"for","hotkeys"),h(W,"class","h-[20px]"),h(W,"id","hotkeys"),h(W,"type","checkbox"),W.checked=ne=l[3].useHotkeys,h(Ie,"class","my-1 flex justify-between mr-12"),h(ce,"class","font-bold"),h(ce,"for","auto-octave"),h(Be,"class","h-[20px]"),h(Be,"id","auto-octave"),h(Be,"type","checkbox"),Be.checked=at=l[3].useAutoOctave,h(X,"class","my-1 flex justify-between mr-12"),h(de,"class","flex flex-col h-full"),h(Se,"class","w-full btn-sm primary"),h(je,"class","flex justify-between"),h(ht,"class","font-bold"),h(ht,"for","fade-timeout"),h(Xe,"class","h-[20px] w-16"),h(Xe,"id","fade-timeout"),Xe.value=l[1],h(Oe,"class","flex justify-between"),h(_t,"class","btn-sm primary"),h(mt,"class","flex justify-between"),h(Ke,"class","flex flex-col justify-between h-full"),h(o,"class","body svelte-1bpw69s"),z(o,"hidden",l[4]),h(t,"class","flex flex-col rounded border-2 px-4 py-2 my-4 text-sm svelte-1bpw69s"),z(t,"collapsed",l[4]),h(e,"class",Pt=Te(`${l[11].class||""}`)+" svelte-1bpw69s")},m(Ae,Fe){F(Ae,e,Fe),u(e,t),u(t,s),u(s,n),u(t,a),u(t,o),u(o,i),u(i,c),u(i,d),u(i,_),u(i,g),u(i,E),u(E,y),u(E,G),u(E,K),u(o,N),u(o,k),u(k,S),u(S,j),u(S,O),u(S,w),u(k,I),u(k,U),u(U,M),u(U,R),u(U,te),Qe(te,l[0]),u(o,se),u(o,de),u(de,ie),u(ie,Me),u(ie,Ve),u(ie,pe),u(de,Ue),u(de,Ie),u(Ie,re),u(Ie,he),u(Ie,W),u(de,x),u(de,X),u(X,ce),u(X,Ee),u(X,Be),u(o,We),u(o,Ke),u(Ke,je),u(je,Se),u(Ke,wt),u(Ke,Oe),u(Oe,ht),u(Oe,Zt),u(Oe,Xe),u(Ke,es),u(Ke,mt),u(mt,Lt),u(mt,ts),u(mt,_t),u(t,ss),Ge&&Ge.m(t,null),Je=!0,ls||(ks=[$(n,"click",l[7]),$(y,"click",fe.openMidi),$(K,"click",fe.disableMidi),$(w,"change",l[12]),$(te,"input",l[13]),$(te,"focus",l[14]),$(te,"change",l[8]),$(pe,"change",l[15]),$(W,"change",l[16]),$(Be,"change",l[17]),$(Se,"click",l[18]),$(Xe,"focus",l[19]),$(Xe,"blur",l[20]),$(Xe,"input",l[9]),$(_t,"click",l[10])],ls=!0)},p(Ae,[Fe]){var it;(!Je||Fe&32&&b!==(b=((it=Ae[5])==null?void 0:it.name)??"No device")&&_.value!==b)&&(_.value=b),(!Je||Fe&8&&L!==(L=Ae[3].useSound))&&(w.checked=L),Fe&1&&te.value!==Ae[0]&&Qe(te,Ae[0]),(!Je||Fe&8&&ze!==(ze=Ae[3].useKeyboard))&&(pe.checked=ze),(!Je||Fe&8&&ne!==(ne=Ae[3].useHotkeys))&&(W.checked=ne),(!Je||Fe&8&&at!==(at=Ae[3].useAutoOctave))&&(Be.checked=at),(!Je||Fe&2&&Xe.value!==Ae[1])&&(Xe.value=Ae[1]),(!Je||Fe&16)&&z(o,"hidden",Ae[4]),Ae[2]?Ge?Fe&4&&H(Ge,1):(Ge=il(),Ge.c(),H(Ge,1),Ge.m(t,null)):Ge&&(st(),J(Ge,1,1,()=>{Ge=null}),lt()),(!Je||Fe&16)&&z(t,"collapsed",Ae[4]),(!Je||Fe&2048&&Pt!==(Pt=Te(`${Ae[11].class||""}`)+" svelte-1bpw69s"))&&h(e,"class",Pt)},i(Ae){Je||(H(Ge),Je=!0)},o(Ae){J(Ge),Je=!1},d(Ae){Ae&&m(e),Ge&&Ge.d(),ls=!1,ot(ks)}}}function Da(l,e,t){let s,n,r;oe(l,nt,S=>t(3,s=S)),oe(l,Qt,S=>t(5,r=S));const a=dt(Pe(!1),{key:"inputs-hidden"});oe(l,a,S=>t(4,n=S));let o=s.fixedVelocity??"",i=s.keyFadeTimeout,c=!1;nt.subscribe(S=>{t(0,o=S.fixedVelocity??""),t(1,i=S.keyFadeTimeout)});function f(){a.update(S=>!S)}function d(S){const{value:j}=S.currentTarget;let A;if(j)try{A=parseInt(j)}catch{}A!==void 0&&A>=0&&A<=127?fe.setInputValue("fixedVelocity",A):j?t(0,o=s.fixedVelocity||""):fe.setInputValue("fixedVelocity",void 0),fe.setKeyboardFocus(!0)}function _(S){try{const j=parseInt(S.currentTarget.value);fe.setInputValue("keyFadeTimeout",j)}catch{t(1,i=s.keyFadeTimeout)}}function b(){Ln()}const g=S=>fe.setInputValue("useSound",S.currentTarget.checked);function E(){o=this.value,t(0,o)}const y=()=>fe.setKeyboardFocus(!1),D=S=>fe.setInputValue("useKeyboard",S.currentTarget.checked),G=S=>fe.setInputValue("useHotkeys",S.currentTarget.checked),K=S=>fe.setInputValue("useAutoOctave",S.currentTarget.checked),C=()=>t(2,c=!c),N=()=>fe.setKeyboardFocus(!1),k=()=>fe.setKeyboardFocus(!0);return l.$$set=S=>{t(11,e=Ce(Ce({},e),we(S)))},e=we(e),[o,i,c,s,n,r,a,f,d,_,b,e,g,E,y,D,G,K,C,N,k]}class La extends Re{constructor(e){super(),He(this,e,Da,ja,qe,{})}}function Pa(l){let e;return{c(){e=Q(" ")},l(t){e=Y(t," ")},m(t,s){F(t,e,s)},p:ue,d(t){t&&m(e)}}}function Ba(l){let e,t=l[1].note+"",s;return{c(){e=Q("Input: "),s=Q(t)},l(n){e=Y(n,"Input: "),s=Y(n,t)},m(n,r){F(n,e,r),F(n,s,r)},p(n,r){r&2&&t!==(t=n[1].note+"")&&ae(s,t)},d(n){n&&(m(e),m(s))}}}function Ga(l){let e,t;return{c(){e=Q("Input: "),t=Q(l[0])},l(s){e=Y(s,"Input: "),t=Y(s,l[0])},m(s,n){F(s,e,n),F(s,t,n)},p(s,n){n&1&&ae(t,s[0])},d(s){s&&(m(e),m(t))}}}function Ma(l){let e;return{c(){e=Q(ds)},l(t){e=Y(t,ds)},m(t,s){F(t,e,s)},p:ue,d(t){t&&m(e)}}}function Va(l){let e,t,s,n;function r(i,c){return i[2].useKeyboard&&ds?Ma:i[2].useKeyboard&&i[0]?Ga:i[2].useKeyboard&&i[1]?Ba:Pa}let a=r(l),o=a(l);return{c(){e=p("div"),o.c(),this.h()},l(i){e=v(i,"DIV",{class:!0});var c=T(e);o.l(c),c.forEach(m),this.h()},h(){h(e,"class",t=`${l[4].class||""}`)},m(i,c){F(i,e,c),o.m(e,null),s||(n=$(window,"keydown",l[3]),s=!0)},p(i,[c]){a===(a=r(i))&&o?o.p(i,c):(o.d(1),o=a(i),o&&(o.c(),o.m(e,null))),c&16&&t!==(t=`${i[4].class||""}`)&&h(e,"class",t)},i:ue,o:ue,d(i){i&&m(e),o.d(),s=!1,n()}}}let ds="";function Ka(l,e,t){let s,n;oe(l,en,f=>t(6,s=f)),oe(l,nt,f=>t(2,n=f));let{debounced:r}=e,a="",o;const i=on();function c(f){if(r||!s)return;const d=sn.handleInput(f.code,f.key,f.shiftKey);d&&d.e==="note"?t(1,o=d.data):d&&d.e==="string"?t(0,a=d.data):d&&i(d.e,d.data)}return l.$$set=f=>{t(4,e=Ce(Ce({},e),we(f))),"debounced"in f&&t(5,r=f.debounced)},e=we(e),[a,o,n,c,e,r]}class Oa extends Re{constructor(e){super(),He(this,e,Ka,Va,qe,{debounced:5})}}function Fa(l){let e,t,s,n="Count",r,a,o,i,c,f="Duplicates",d,_,b,g,E,y,D="Autoplay",G,K,C,N,k,S,j="Wait seconds",A,O,w,L,I;return{c(){e=p("ul"),t=p("li"),s=p("label"),s.textContent=n,r=P(),a=p("input"),o=P(),i=p("li"),c=p("label"),c.textContent=f,d=P(),_=p("input"),g=P(),E=p("li"),y=p("label"),y.textContent=D,G=P(),K=p("input"),N=P(),k=p("li"),S=p("label"),S.textContent=j,A=P(),O=p("input"),this.h()},l(U){e=v(U,"UL",{class:!0});var M=T(e);t=v(M,"LI",{class:!0});var V=T(t);s=v(V,"LABEL",{class:!0,for:!0,"data-svelte-h":!0}),ee(s)!=="svelte-wgq9fc"&&(s.textContent=n),r=B(V),a=v(V,"INPUT",{class:!0,id:!0,type:!0}),V.forEach(m),o=B(M),i=v(M,"LI",{class:!0});var R=T(i);c=v(R,"LABEL",{class:!0,for:!0,"data-svelte-h":!0}),ee(c)!=="svelte-hcg9dq"&&(c.textContent=f),d=B(R),_=v(R,"INPUT",{class:!0,id:!0,type:!0}),R.forEach(m),g=B(M),E=v(M,"LI",{class:!0});var te=T(E);y=v(te,"LABEL",{class:!0,for:!0,"data-svelte-h":!0}),ee(y)!=="svelte-lr68n2"&&(y.textContent=D),G=B(te),K=v(te,"INPUT",{class:!0,id:!0,type:!0}),te.forEach(m),N=B(M),k=v(M,"LI",{class:!0});var se=T(k);S=v(se,"LABEL",{class:!0,for:!0,"data-svelte-h":!0}),ee(S)!=="svelte-1qj2vcy"&&(S.textContent=j),A=B(se),O=v(se,"INPUT",{class:!0,id:!0,type:!0}),se.forEach(m),M.forEach(m),this.h()},h(){h(s,"class","font-bold"),h(s,"for","guess-count"),h(a,"class","h-[20px] w-10"),h(a,"id","guess-count"),h(a,"type","number"),h(t,"class","flex items-center justify-between svelte-1elvih2"),h(c,"class","font-bold"),h(c,"for","duplicates"),h(_,"class","h-[20px]"),h(_,"id","duplicates"),h(_,"type","checkbox"),_.checked=b=l[2].duplicates,h(i,"class","flex items-center justify-between mr-6 svelte-1elvih2"),h(y,"class","font-bold"),h(y,"for","autoplay"),h(K,"class","h-[20px]"),h(K,"id","autoplay"),h(K,"type","checkbox"),K.checked=C=l[2].autoplay,h(E,"class","flex items-center justify-between mr-6 svelte-1elvih2"),h(S,"class","font-bold"),h(S,"for","wait-ms"),h(O,"class","h-[20px] w-10"),h(O,"id","wait-ms"),h(O,"type","number"),h(k,"class","flex items-center justify-between svelte-1elvih2"),h(e,"class",w=Te(`${l[5].class||""}`)+" svelte-1elvih2")},m(U,M){F(U,e,M),u(e,t),u(t,s),u(t,r),u(t,a),Qe(a,l[0]),u(e,o),u(e,i),u(i,c),u(i,d),u(i,_),u(e,g),u(e,E),u(E,y),u(E,G),u(E,K),u(e,N),u(e,k),u(k,S),u(k,A),u(k,O),Qe(O,l[1]),L||(I=[$(a,"input",l[6]),$(a,"input",l[3]),$(_,"input",l[7]),$(K,"input",l[8]),$(O,"input",l[9]),$(O,"input",l[4])],L=!0)},p(U,[M]){M&1&&qt(a.value)!==U[0]&&Qe(a,U[0]),M&4&&b!==(b=U[2].duplicates)&&(_.checked=b),M&4&&C!==(C=U[2].autoplay)&&(K.checked=C),M&2&&qt(O.value)!==U[1]&&Qe(O,U[1]),M&32&&w!==(w=Te(`${U[5].class||""}`)+" svelte-1elvih2")&&h(e,"class",w)},i:ue,o:ue,d(U){U&&m(e),L=!1,ot(I)}}}function Ua(l,e,t){let s;oe(l,ft,_=>t(2,s=_));let n=s.count||"",r=s.waitSeconds||"";ft.subscribe(_=>{t(0,n=_.count||""),t(1,r=_.waitSeconds||"")});function a({currentTarget:{value:_}}){let b;try{b=parseInt(_),b<=0&&(b=1),ke.setOptionValue("count",b)}catch{t(0,n=s.count)}}function o({currentTarget:{value:_}}){let b;try{b=parseInt(_),b<0&&(b=0),ke.setOptionValue("waitSeconds",b)}catch{t(1,r=s.waitSeconds)}}function i(){n=qt(this.value),t(0,n)}const c=_=>ke.setOptionValue("duplicates",_.currentTarget.checked),f=_=>ke.setOptionValue("autoplay",_.currentTarget.checked);function d(){r=qt(this.value),t(1,r)}return l.$$set=_=>{t(5,e=Ce(Ce({},e),we(_)))},e=we(e),[n,r,s,a,o,e,i,c,f,d]}class xa extends Re{constructor(e){super(),He(this,e,Ua,Fa,qe,{})}}function cl(l,e,t){const s=l.slice();return s[20]=e[t].key,s[21]=e[t].value,s}function ul(l,e,t){const s=l.slice();return s[20]=e[t].key,s[21]=e[t].value,s}function fl(l){let e,t,s=l[21]+"",n,r,a,o,i,c,f,d;function _(){return l[13](l[20])}o=new rt({props:{icon:os,width:20}});function b(...g){return l[14](l[20],...g)}return{c(){e=p("li"),t=p("button"),n=Q(s),r=P(),a=p("button"),ve(o.$$.fragment),i=P(),this.h()},l(g){e=v(g,"LI",{class:!0});var E=T(e);t=v(E,"BUTTON",{class:!0});var y=T(t);n=Y(y,s),y.forEach(m),r=B(E),a=v(E,"BUTTON",{class:!0});var D=T(a);ge(o.$$.fragment,D),D.forEach(m),i=B(E),E.forEach(m),this.h()},h(){h(t,"class","px-2 py-1 mr-1 flex items-center w-full h-full rounded hover:bg-[#eee] svelte-1okhpct"),z(t,"selected",l[20]===l[0]),h(a,"class","px-1 py-1 flex items-center justify-center rounded text-[#222] hover:bg-blue-500 hover:text-white"),h(e,"class","flex svelte-1okhpct")},m(g,E){F(g,e,E),u(e,t),u(t,n),u(e,r),u(e,a),be(o,a,null),u(e,i),c=!0,f||(d=[$(t,"click",_),$(a,"click",b)],f=!0)},p(g,E){l=g,(!c||E&17)&&z(t,"selected",l[20]===l[0])},i(g){c||(H(o.$$.fragment,g),c=!0)},o(g){J(o.$$.fragment,g),c=!1},d(g){g&&m(e),ye(o),f=!1,ot(d)}}}function dl(l){let e,t=le(l[2]),s=[];for(let n=0;nJ(O[I],1,1,()=>{O[I]=null});let L=(l[0]==="chords-write"||l[0]==="chords-play")&&dl(l);return f=new xa({props:{class:"game-options"}}),D=new rt({props:{class:"mr-1",icon:l[3]?Is:os,width:20}}),{c(){e=p("fieldset"),t=p("legend"),t.textContent=s,n=P(),r=p("div"),a=p("ul");for(let I=0;It(12,r=C)),oe(l,ft,C=>t(19,a=C)),oe(l,bt,C=>t(3,o=C));const i=[{key:"notes",value:"Play Notes"},{key:"pitches",value:"Guess Pitches"},{key:"keys-major",value:"Guess Major Keys"},{key:"keys-minor",value:"Guess Minor Keys"},{key:"chords-write",value:"Write Chords"},{key:"chords-play",value:"Play Chords"},{key:"chords-diatonic",value:"Play Diatonic Triads"}];let c=i[4].key,f="maj-m";a.count,a.waitSeconds,ft.subscribe(C=>{C.count,C.waitSeconds});function d(){ke.clearGame(!0)}function _(C,N){if(N==="chords-write"||N==="chords-play"||N==="chords-diatonic"){let k=[];f==="selected"?k=r.filter(S=>S.selected):f==="all"?k=r:f==="maj-m"?k=r.filter(S=>S.suffixes[0]==="maj"||S.suffixes[0]==="m"):f==="seventh"&&(k=r.filter(S=>S.suffixes[0]==="maj7"||S.suffixes[0]==="m7"||S.suffixes[0]==="7"||S.suffixes[0]==="dim7"||S.suffixes[0]==="aug7")),ke.play(N,{chords:k})}else ke.play(N,void 0);C.currentTarget instanceof HTMLElement&&C.currentTarget.blur(),setTimeout(()=>{window.scrollTo(0,document.body.scrollHeight)})}function b(C){t(0,c=C)}function g(C,N){t(0,c=N),_(C,N)}function E(C){t(1,f=C)}const y=C=>b(C),D=(C,N)=>g(N,C),G=C=>E(C),K=C=>_(C,c);return l.$$set=C=>{t(10,e=Ce(Ce({},e),we(C)))},l.$$.update=()=>{l.$$.dirty&4096&&t(11,s=r.reduce((C,N)=>N.selected?C+1:C,0)),l.$$.dirty&2048&&t(2,n=[{key:"maj-m",value:"Major/Minor"},{key:"seventh",value:"Seventh"},{key:"selected",value:`Selected ${s} chords`},{key:"all",value:"All"}])},e=we(e),[c,f,n,o,i,d,_,b,g,E,e,s,r,y,D,G,K]}class Ha extends Re{constructor(e){super(),He(this,e,Ra,$a,qe,{})}}function ml(l,e,t){const s=l.slice();return s[7]=e[t],s}function _l(l,e,t){const s=l.slice();return s[4]=e[t],s}function qa(l){let e,t=le(l[1]),s=[];for(let n=0;nl.interval;function Ja(l,e,t){let{scale:s,intervals:n}=e;function r(a){hs.call(this,l,a)}return l.$$set=a=>{t(2,e=Ce(Ce({},e),we(a))),"scale"in a&&t(0,s=a.scale),"intervals"in a&&t(1,n=a.intervals)},e=we(e),[s,n,e,r]}class ln extends Re{constructor(e){super(),He(this,e,Ja,Wa,qe,{scale:0,intervals:1})}}function bl(l,e,t){const s=l.slice();return s[7]=e[t],s}function yl(l,e,t){const s=l.slice();return s[4]=e[t],s}function Qa(l){let e,t=le(l[0]),s=[];for(let n=0;n2),h(e,"class","inline-flex items-baseline svelte-1roj1mi")},m(f,d){F(f,e,d),u(e,t),u(t,n),u(e,r),u(e,a),u(a,i),u(e,c)},p(f,d){d&1&&s!==(s=f[7].roman+"")&&ae(n,s),d&1&&o!==(o=f[7].suffix+"")&&ae(i,o),d&1&&z(a,"super-text",f[7].suffix.length>2)},d(f){f&&m(e)}}}function Cl(l){let e,t,s=l[4]+"",n,r;return{c(){e=p("span"),t=p("span"),n=Q(s),r=P(),this.h()},l(a){e=v(a,"SPAN",{class:!0});var o=T(e);t=v(o,"SPAN",{});var i=T(t);n=Y(i,s),i.forEach(m),r=B(o),o.forEach(m),this.h()},h(){h(e,"class","inline-flex items-baseline svelte-1roj1mi")},m(a,o){F(a,e,o),u(e,t),u(t,n),u(e,r)},p(a,o){o&2&&s!==(s=a[4]+"")&&ae(n,s)},d(a){a&&m(e)}}}function Xa(l){let e,t,s,n,r,a;function o(f,d){return f[1].length>0?Ya:Qa}let i=o(l),c=i(l);return{c(){e=p("div"),t=p("button"),c.c(),this.h()},l(f){e=v(f,"DIV",{class:!0,title:!0});var d=T(e);t=v(d,"BUTTON",{class:!0});var _=T(t);c.l(_),_.forEach(m),d.forEach(m),this.h()},h(){h(t,"class","triads flex flex-wrap svelte-1roj1mi"),h(e,"class",s=Te(`${l[2].class||""} `)+" svelte-1roj1mi"),h(e,"title",n=l[0].map(wl).join("-"))},m(f,d){F(f,e,d),u(e,t),c.m(t,null),r||(a=$(t,"click",l[3]),r=!0)},p(f,[d]){i===(i=o(f))&&c?c.p(f,d):(c.d(1),c=i(f),c&&(c.c(),c.m(t,null))),d&4&&s!==(s=Te(`${f[2].class||""} `)+" svelte-1roj1mi")&&h(e,"class",s),d&1&&n!==(n=f[0].map(wl).join("-"))&&h(e,"title",n)},i:ue,o:ue,d(f){f&&m(e),c.d(),r=!1,a()}}}const wl=l=>l.roman+l.suffix;function Za(l,e,t){let{triads:s,chords:n}=e;function r(a){hs.call(this,l,a)}return l.$$set=a=>{t(2,e=Ce(Ce({},e),we(a))),"triads"in a&&t(0,s=a.triads),"chords"in a&&t(1,n=a.chords)},e=we(e),[s,n,e,r]}class nn extends Re{constructor(e){super(),He(this,e,Za,Xa,qe,{triads:0,chords:1})}}function El(l,e,t){const s=l.slice();return s[25]=e[t],s}function Sl(l,e,t){const s=l.slice();return s[25]=e[t],s}function Al(l){let e,t,s=l[25].raw.names[0]+"",n,r,a,o,i,c,f;function d(){return l[13](l[25])}a=new ln({props:{scale:l[25].scale,intervals:l[25].raw.intervals}}),a.$on("click",d);function _(){return l[14](l[25])}return i=new nn({props:{triads:l[25].triads,chords:l[25].triadChords}}),i.$on("click",_),{c(){e=p("li"),t=p("div"),n=Q(s),r=P(),ve(a.$$.fragment),o=P(),ve(i.$$.fragment),c=P(),this.h()},l(b){e=v(b,"LI",{class:!0});var g=T(e);t=v(g,"DIV",{class:!0});var E=T(t);n=Y(E,s),E.forEach(m),r=B(g),ge(a.$$.fragment,g),o=B(g),ge(i.$$.fragment,g),c=B(g),g.forEach(m),this.h()},h(){h(t,"class","text-xs font-bold"),h(e,"class","svelte-4hctsl")},m(b,g){F(b,e,g),u(e,t),u(t,n),u(e,r),be(a,e,null),u(e,o),be(i,e,null),u(e,c),f=!0},p(b,g){l=b,(!f||g&4)&&s!==(s=l[25].raw.names[0]+"")&&ae(n,s);const E={};g&4&&(E.scale=l[25].scale),g&4&&(E.intervals=l[25].raw.intervals),a.$set(E);const y={};g&4&&(y.triads=l[25].triads),g&4&&(y.chords=l[25].triadChords),i.$set(y)},i(b){f||(H(a.$$.fragment,b),H(i.$$.fragment,b),f=!0)},o(b){J(a.$$.fragment,b),J(i.$$.fragment,b),f=!1},d(b){b&&m(e),ye(a),ye(i)}}}function Tl(l){let e,t,s=l[25].raw.names[0]+"",n,r,a,o,i,c,f;function d(){return l[15](l[25])}a=new ln({props:{scale:l[25].scale,intervals:l[25].raw.intervals}}),a.$on("click",d);function _(){return l[16](l[25])}return i=new nn({props:{triads:l[25].triads,chords:l[25].triadChords}}),i.$on("click",_),{c(){e=p("li"),t=p("div"),n=Q(s),r=P(),ve(a.$$.fragment),o=P(),ve(i.$$.fragment),c=P(),this.h()},l(b){e=v(b,"LI",{class:!0});var g=T(e);t=v(g,"DIV",{class:!0});var E=T(t);n=Y(E,s),E.forEach(m),r=B(g),ge(a.$$.fragment,g),o=B(g),ge(i.$$.fragment,g),c=B(g),g.forEach(m),this.h()},h(){h(t,"class","text-xs font-bold"),h(e,"class","svelte-4hctsl")},m(b,g){F(b,e,g),u(e,t),u(t,n),u(e,r),be(a,e,null),u(e,o),be(i,e,null),u(e,c),f=!0},p(b,g){l=b,(!f||g&2)&&s!==(s=l[25].raw.names[0]+"")&&ae(n,s);const E={};g&2&&(E.scale=l[25].scale),g&2&&(E.intervals=l[25].raw.intervals),a.$set(E);const y={};g&2&&(y.triads=l[25].triads),g&2&&(y.chords=l[25].triadChords),i.$set(y)},i(b){f||(H(a.$$.fragment,b),H(i.$$.fragment,b),f=!0)},o(b){J(a.$$.fragment,b),J(i.$$.fragment,b),f=!1},d(b){b&&m(e),ye(a),ye(i)}}}function er(l){let e,t,s,n,r="Scales",a,o,i,c,f="Key",d,_,b,g,E,y,D,G,K,C,N=le(l[2]),k=[];for(let w=0;wJ(k[w],1,1,()=>{k[w]=null});let j=le(l[1]),A=[];for(let w=0;wJ(A[w],1,1,()=>{A[w]=null});return{c(){e=p("div"),t=p("fieldset"),s=p("legend"),n=p("button"),n.textContent=r,a=P(),o=p("div"),i=p("div"),c=p("label"),c.textContent=f,d=P(),_=p("input"),b=P(),g=p("ul");for(let w=0;wt(19,r=w)),oe(l,kt,w=>t(20,a=w)),oe(l,nt,w=>t(21,o=w)),oe(l,tt,w=>t(22,i=w));let d=ms().map(w=>({key:w.names[0],raw:w,scale:void 0,triads:w.triads,triadChords:[]})),_="",b=[a.key,a.scale],g;const E=dt(Pe(!0),{key:"scales-hidden"});oe(l,E,w=>t(3,c=w));function y(){E.update(w=>!w)}function D({currentTarget:{value:w}}){t(0,_=`${w.charAt(0).toUpperCase()}${w.charAt(1).toLowerCase()}`),t(10,d=d.map(L=>{const I=Jt(_,L.key),U=_&&"data"in I?I.data:void 0;let M=[];return U&&(M=L.triads.map((V,R)=>`${U.scaleNotes[R].note}${!V.suffix.includes("°")&&V.minor?"m":""}${V.suffix}`)),{...L,scale:U,triadChords:M}}))}function G(w,L,I){if(wM.midi),o.fixedVelocity),g=setTimeout(()=>G(w,L,I),I)}else me.setPlayed([]),me.setKeyAndScale(b[0],b[1])}function K(w){clearTimeout(g);let L,I;w.scale?(I=w.scale,b=[a.key,a.scale],me.setKeyAndScale(w.scale.key,w.scale.scale)):I=a;const U=r[0].midi+I.scaleNotes[0].semitones;L=w.raw.intervals.map(M=>[{...I.notesMap.get(M.semitones%12),midi:U+M.semitones}]),L[0][0].semitones!==L[L.length-1][0].semitones&&L.push(L[0].map(M=>({...M,midi:M.midi+12}))),G(0,L,500)}function C(w){clearTimeout(g);const{intervals:L}=w.raw;let I,U;w.scale?(U=w.scale,b=[a.key,a.scale],me.setKeyAndScale(w.scale.key,w.scale.scale)):U=a;const M=r[0].midi+U.scaleNotes[0].semitones;I=Jl(w.triads).map((R,te)=>is(M+U.intervals[te].semitones,U,R.intervals)),L[L.length-1].interval_seq!==1&&I.push(I[0].map(R=>({...R,midi:R.midi+12}))),G(0,I,750)}const N=()=>fe.setKeyboardFocus(!1),k=()=>fe.setKeyboardFocus(!0),S=w=>K(w),j=w=>C(w),A=w=>K(w),O=w=>C(w);return l.$$set=w=>{t(9,e=Ce(Ce({},e),we(w)))},l.$$.update=()=>{l.$$.dirty&1024&&t(2,s=d.filter((w,L)=>LL>=d.length/2))},e=we(e),[_,n,s,c,E,y,D,K,C,e,d,N,k,S,j,A,O]}class sr extends Re{constructor(e){super(),He(this,e,tr,er,qe,{})}}function Nl(l,e,t){const s=l.slice();return s[14]=e[t].key,s[15]=e[t].value,s[16]=e[t].icon,s[18]=t,s}const lr=l=>({}),Il=l=>({}),nr=l=>({}),jl=l=>({});function Dl(l){let e,t,s,n,r,a,o,i,c,f;const d=l[11].header,_=Ul(d,l,l[10],Il);let b=le(l[0]),g=[];for(let y=0;yJ(g[y],1,1,()=>{g[y]=null});return{c(){e=p("button"),s=P(),n=p("ul"),r=p("li"),_&&_.c(),a=P();for(let y=0;y{i&&(t||(t=$t(e,Ss,{duration:Ht},!0)),t.run(1))}),H(_,y);for(let D=0;D{i&&(o||(o=$t(n,As,{duration:Ht},!0)),o.run(1))}),i=!0}},o(y){y&&(t||(t=$t(e,Ss,{duration:Ht},!1)),t.run(0)),J(_,y),g=g.filter(Boolean);for(let D=0;D{g[K]=null}),lt(),n=g[s],n?n.p(l,G):(n=g[s]=b[s](l),n.c()),H(n,1),n.m(t,r)),(!f||G&1)&&o!==(o=l[15]+"")&&ae(i,o),(!f||G&5)&&z(t,"selected",l[14]===l[2])},i(D){f||(H(n),f=!0)},o(D){J(n),f=!1},d(D){D&&m(e),g[s].d(),d=!1,_()}}}function or(l){let e,t,s,n,r,a,o,i;const c=l[11].value,f=Ul(c,l,l[10],jl);let d=l[5]&&Dl(l);return{c(){e=p("div"),t=p("button"),f&&f.c(),r=P(),d&&d.c(),this.h()},l(_){e=v(_,"DIV",{class:!0,id:!0});var b=T(e);t=v(b,"BUTTON",{class:!0,title:!0});var g=T(t);f&&f.l(g),g.forEach(m),r=B(b),d&&d.l(b),b.forEach(m),this.h()},h(){h(t,"class",s=Te(`${l[8].class||""} open-btn w-full text-justify text-sm rounded hover:bg-[#eee]`)+" svelte-h65upg"),h(t,"title",n=l[8].title||""),z(t,"disabled",l[3]),z(t,"open",l[5]),h(e,"class","relative"),h(e,"id",l[1])},m(_,b){F(_,e,b),u(e,t),f&&f.m(t,null),u(e,r),d&&d.m(e,null),l[13](e),a=!0,o||(i=$(t,"click",l[6]),o=!0)},p(_,[b]){f&&f.p&&(!a||b&1024)&&xl(f,c,_,_[10],a?Rl(c,_[10],b,nr):$l(_[10]),jl),(!a||b&256&&s!==(s=Te(`${_[8].class||""} open-btn w-full text-justify text-sm rounded hover:bg-[#eee]`)+" svelte-h65upg"))&&h(t,"class",s),(!a||b&256&&n!==(n=_[8].title||""))&&h(t,"title",n),(!a||b&264)&&z(t,"disabled",_[3]),(!a||b&288)&&z(t,"open",_[5]),_[5]?d?(d.p(_,b),b&32&&H(d,1)):(d=Dl(_),d.c(),H(d,1),d.m(e,null)):d&&(st(),J(d,1,1,()=>{d=null}),lt()),(!a||b&2)&&h(e,"id",_[1])},i(_){a||(H(f,_),H(d),a=!0)},o(_){J(f,_),J(d),a=!1},d(_){_&&m(e),f&&f.d(_),d&&d.d(),l[13](null),o=!1,i()}}}const Ht=400;function ir(l,e,t){let{$$slots:s={},$$scope:n}=e,{options:r,id:a=void 0,selected:o=void 0,disabled:i=void 0,onSelect:c}=e,f,d=!1;function _(){i||t(5,d=!d)}function b(y){t(5,d=c(y))}const g=y=>b(y);function E(y){cn[y?"unshift":"push"](()=>{f=y,t(4,f)})}return l.$$set=y=>{t(8,e=Ce(Ce({},e),we(y))),"options"in y&&t(0,r=y.options),"id"in y&&t(1,a=y.id),"selected"in y&&t(2,o=y.selected),"disabled"in y&&t(3,i=y.disabled),"onSelect"in y&&t(9,c=y.onSelect),"$$scope"in y&&t(10,n=y.$$scope)},e=we(e),[r,a,o,i,f,d,_,b,e,c,n,s,g,E]}class cr extends Re{constructor(e){super(),He(this,e,ir,or,qe,{options:0,id:1,selected:2,disabled:3,onSelect:9})}}function Pl(l,e,t){const s=l.slice();return s[30]=e[t],s}function Bl(l,e,t){const s=l.slice();return s[33]=e[t],s}function Gl(l){let e,t;return{c(){e=p("div"),t=Q(l[3]),this.h()},l(s){e=v(s,"DIV",{class:!0});var n=T(e);t=Y(n,l[3]),n.forEach(m),this.h()},h(){h(e,"class","error svelte-1u7ze7x")},m(s,n){F(s,e,n),u(e,t)},p(s,n){n[0]&8&&ae(t,s[3])},d(s){s&&m(e)}}}function ur(l){let e,t;return{c(){e=p("div"),t=Q(l[0]),this.h()},l(s){e=v(s,"DIV",{slot:!0});var n=T(e);t=Y(n,l[0]),n.forEach(m),this.h()},h(){h(e,"slot","value")},m(s,n){F(s,e,n),u(e,t)},p(s,n){n[0]&1&&ae(t,s[0])},d(s){s&&m(e)}}}function Ml(l){let e,t=le(l[5]),s=[];for(let n=0;nt(27,n=V)),oe(l,yt,V=>t(28,r=V)),oe(l,bt,V=>t(7,o=V)),oe(l,kt,V=>t(8,i=V));let c=Ye(n[0]),f=Ye(n[1]),d="";const _=dt(Pe(!1),{key:"score-options-hidden"});oe(l,_,V=>t(6,a=V));let b=r[0],g=r[1];const E=ms(),y=E.map(V=>({key:V.names[0],value:V.names[0]}));Yt.subscribe(V=>{t(1,c=Ye(V[0])),t(2,f=Ye(V[1]))}),yt.subscribe(V=>{t(4,b=V[0]),t(0,g=V[1])});function D(V,R){const te=An(R.currentTarget.value,!0,!0);if("data"in te){const{midi:se}=te.data,de=n,ie=[V==="min"?se:de[0].midi,V==="max"?se:de[1].midi];fe.setMidiRange(ie),t(3,d="")}else t(3,d=te.err),V==="min"?t(1,c=Ye(n[0])):t(2,f=Ye(n[1]))}function G(){t(3,d=""),fe.setKeyboardFocus(!1)}function K({currentTarget:{value:V}}){t(4,b=`${V.charAt(0).toUpperCase()}${V.charAt(1).toLowerCase()}`),me.setKey(b)}function C(V){var R;return t(0,g=(R=y.find(te=>V===te.key))==null?void 0:R.value),me.setScale(g),!1}function N(){_.update(V=>!V)}function k(){me.clearScore(!0),fe.setMidiRange([60,84])}function S(){c=this.value,t(1,c)}const j=V=>D("min",V),A=()=>fe.setKeyboardFocus(!0);function O(){f=this.value,t(2,f)}const w=V=>D("max",V),L=()=>fe.setKeyboardFocus(!0);function I(){b=this.value,t(4,b)}const U=()=>fe.setKeyboardFocus(!1),M=()=>fe.setKeyboardFocus(!0);return l.$$set=V=>{t(17,e=Ce(Ce({},e),we(V)))},l.$$.update=()=>{var V;l.$$.dirty[0]&1&&t(5,s=((V=E.find(R=>R.names[0]===g))==null?void 0:V.intervals)||[])},e=we(e),[g,c,f,d,b,s,a,o,i,_,y,D,G,K,C,N,k,e,S,j,A,O,w,L,I,U,M]}class hr extends Re{constructor(e){super(),He(this,e,dr,fr,qe,{},null,[-1,-1])}}function mr(l){l[19]=l[20].default}function _r(l){return{c:ue,l:ue,m:ue,i:ue,o:ue,d:ue}}function pr(l){mr(l);let e,t,s;var n=l[19];function r(a,o){return{props:{class:"px-4 md:px-0"}}}return n&&(e=dn(n,r())),{c(){e&&ve(e.$$.fragment),t=Le()},l(a){e&&ge(e.$$.fragment,a),t=Le()},m(a,o){e&&be(e,a,o),F(a,t,o),s=!0},i(a){s||(e&&H(e.$$.fragment,a),s=!0)},o(a){e&&J(e.$$.fragment,a),s=!1},d(a){a&&m(t),e&&ye(e,a)}}}function vr(l){let e;return{c(){e=Q(" ")},l(t){e=Y(t," ")},m(t,s){F(t,e,s)},i:ue,o:ue,d(t){t&&m(e)}}}function gr(l){let e,t,s,n='MIDI Note Trainer',r,a,o,i,c,f,d,_,b,g,E,y,D,G,K,C,N,k,S;o=new La({}),c=new sr({}),d=new Zn({}),g=new hr({props:{class:"score-options mr-4"}}),y=new Ha({props:{class:"play-form"}});let j={ctx:l,current:null,token:null,hasCatch:!1,pending:vr,then:pr,catch:_r,value:20,blocks:[,,,]};return un(an(()=>import("./Score.8ff28522.js"),["./Score.8ff28522.js","./vendor_svelte.565aa2ba.js","./vendor.1acf520b.js","./vendor_vexflow.2dfca40b.js","../assets/Score.04e240b8.css"],import.meta.url),j),C=new Oa({props:{class:"min-h-32",debounced:!!l[0]}}),C.$on("guessed-chord",l[2]),C.$on("guessed-key",l[3]),C.$on("guessed-note",l[4]),k=new da({props:{game:l[1]}}),{c(){e=p("meta"),t=P(),s=p("h1"),s.innerHTML=n,r=P(),a=p("section"),ve(o.$$.fragment),i=P(),ve(c.$$.fragment),f=P(),ve(d.$$.fragment),_=P(),b=p("div"),ve(g.$$.fragment),E=P(),ve(y.$$.fragment),D=P(),j.block.c(),G=P(),K=p("section"),ve(C.$$.fragment),N=P(),ve(k.$$.fragment),this.h()},l(A){const O=fn("svelte-1w2oado",document.head);e=v(O,"META",{name:!0,content:!0}),O.forEach(m),t=B(A),s=v(A,"H1",{class:!0,"data-svelte-h":!0}),ee(s)!=="svelte-1l8ebwf"&&(s.innerHTML=n),r=B(A),a=v(A,"SECTION",{class:!0});var w=T(a);ge(o.$$.fragment,w),i=B(w),ge(c.$$.fragment,w),f=B(w),ge(d.$$.fragment,w),_=B(w),b=v(w,"DIV",{class:!0});var L=T(b);ge(g.$$.fragment,L),E=B(L),ge(y.$$.fragment,L),L.forEach(m),w.forEach(m),D=B(A),j.block.l(A),G=B(A),K=v(A,"SECTION",{class:!0});var I=T(K);ge(C.$$.fragment,I),N=B(I),ge(k.$$.fragment,I),I.forEach(m),this.h()},h(){h(e,"name","description"),h(e,"content","App to practise music notation, scales and chords using MIDI"),h(s,"class","my-8 md:text-5xl mt-12 px-4 md:px-0 text-3xl font-cursive tracking-tight"),h(b,"class","play svelte-qjpqy3"),h(a,"class","px-4 md:px-0"),h(K,"class","mb-8 px-4 md:px-0 flex flex-col")},m(A,O){u(document.head,e),F(A,t,O),F(A,s,O),F(A,r,O),F(A,a,O),be(o,a,null),u(a,i),be(c,a,null),u(a,f),be(d,a,null),u(a,_),u(a,b),be(g,b,null),u(b,E),be(y,b,null),F(A,D,O),j.block.m(A,j.anchor=O),j.mount=()=>G.parentNode,j.anchor=G,F(A,G,O),F(A,K,O),be(C,K,null),u(K,N),be(k,K,null),S=!0},p(A,[O]){l=A;const w={};O&1&&(w.debounced=!!l[0]),C.$set(w);const L={};O&2&&(L.game=l[1]),k.$set(L)},i(A){S||(H(o.$$.fragment,A),H(c.$$.fragment,A),H(d.$$.fragment,A),H(g.$$.fragment,A),H(y.$$.fragment,A),H(j.block),H(C.$$.fragment,A),H(k.$$.fragment,A),S=!0)},o(A){J(o.$$.fragment,A),J(c.$$.fragment,A),J(d.$$.fragment,A),J(g.$$.fragment,A),J(y.$$.fragment,A);for(let O=0;O<3;O+=1){const w=j.blocks[O];J(w)}J(C.$$.fragment,A),J(k.$$.fragment,A),S=!1},d(A){A&&(m(t),m(s),m(r),m(a),m(D),m(G),m(K)),m(e),ye(o),ye(c),ye(d),ye(g),ye(y),j.block.d(A),j.token=null,j=null,ye(C),ye(k)}}}function br(l,e,t){let s,n,r,a,o,i;oe(l,gt,N=>t(7,s=N)),oe(l,bt,N=>t(1,n=N)),oe(l,ft,N=>t(8,r=N)),oe(l,nt,N=>t(9,a=N)),oe(l,tt,N=>t(10,o=N)),oe(l,us,N=>t(11,i=N));let c,f;Fl(()=>(i&&C(),window.addEventListener("keydown",d),window.addEventListener("mousedown",d),window.addEventListener("touchstart",d),()=>{window.removeEventListener("keydown",d),window.removeEventListener("mousedown",d),window.removeEventListener("touchstart",d)})),Qt.subscribe(N=>{N&&N.channels[1].addListener("noteon",_)});function d(){fe.initAudio(),window.removeEventListener("keydown",d),window.removeEventListener("mousedown",d),window.removeEventListener("touchstart",d)}function _(N){if(c)return;const k=N.rawData;b(k[1],k[2])}function b(N,k){const S=n;S instanceof Nt&&!(S!=null&&S.ended)&&s==="waiting"?y(N):S instanceof ut&&!(S!=null&&S.ended)&&s==="waiting"?(S.addPlayedNote(N),f||(f=setTimeout(E,2e3))):S||me.pushPlayed(N),o&&o.noteOn(N,a.fixedVelocity??k)}function g(){r.autoplay&&r.waitSeconds>0?t(0,c=setTimeout(()=>{r.autoplay&&ke.nextGuess(),t(0,c=void 0)},r.waitSeconds*1e3)):r.autoplay?ke.nextGuess():t(0,c=void 0)}function E(){var k;const N=n;if(N instanceof ut){const S=N.guess();me.setPlayed(((k=N.latestGuess.guessed)==null?void 0:k.notes)||[],S,-1),ke.updateState(S?"correct":"wrong"),g()}f=void 0}function y(N){const k=n;if(k instanceof Nt&&s==="waiting"){me.setTarget([me.getNote(k.current)]);const S=k.guess(N);ke.updateState(S?"correct":"wrong"),me.pushPlayed(N,S,4e3),g()}}function D(N){const k=n;if(k instanceof ut&&s==="waiting"){const S=k.guessWrittenChord(N.detail);ke.updateState(S?"correct":"wrong"),g()}}function G(N){const k=n;if(k instanceof Dt&&s==="waiting"){const S=N.detail.replaceAll("♭","b").replaceAll("♯","#"),j=k.guess(S);ke.updateState(j?"correct":"wrong"),g()}}function K(N){b(N.detail,80)}async function C(){const N=await fe.openMidi();"data"in N?N.data.name:(N.err,console.error(N.err))}return[c,n,D,G,K]}class wr extends Re{constructor(e){super(),He(this,e,br,gr,qe,{})}}export{Ds as F,ut as G,wr as P,vn as S,Nt as a,ke as b,bt as c,vt as d,Ql as e,gt as g,tt as p,kt as s,Bs as t}; diff --git a/_app/immutable/chunks/Score.8ff28522.js b/_app/immutable/chunks/Score.f16aa8fe.js similarity index 98% rename from _app/immutable/chunks/Score.8ff28522.js rename to _app/immutable/chunks/Score.f16aa8fe.js index 7dfb285d..d4fc17fb 100644 --- a/_app/immutable/chunks/Score.8ff28522.js +++ b/_app/immutable/chunks/Score.f16aa8fe.js @@ -1 +1 @@ -import{S as Q,i as U,s as J,O as ne,e as A,H as F,a as C,b as E,I,d as y,f as S,L as B,g as W,h as V,J as j,p as re,t as D,l as $,K,M as X,N as G,P as q,m as te,o as se,Q as ue,r as de,F as he}from"./vendor_svelte.565aa2ba.js";import{F as v}from"./vendor_vexflow.2dfca40b.js";import{p as me,g as oe,c as Y,G as H,a as L,b as ge,s as be,d as pe,t as we,e as ae,F as _e,S as ve}from"./3.d6344dfb.js";import{d as ye,a as Se}from"./vendor.1acf520b.js";function Ne(i){let t,s,l,a,n,f,g;return l=new ne({props:{icon:ye,width:32}}),{c(){t=A("div"),s=A("button"),F(l.$$.fragment),this.h()},l(e){t=C(e,"DIV",{class:!0});var c=E(t);s=C(c,"BUTTON",{class:!0});var p=E(s);I(l.$$.fragment,p),p.forEach(y),c.forEach(y),this.h()},h(){S(s,"class","flex items-center justify-center rounded px-1 py-1 hover:bg-gray-200"),S(t,"class",a=`${i[2].class||""}`),B(t,"hidden",!i[0])},m(e,c){W(e,t,c),V(t,s),j(l,s,null),n=!0,f||(g=re(s,"click",i[1]),f=!0)},p(e,[c]){(!n||c&4&&a!==(a=`${e[2].class||""}`))&&S(t,"class",a),(!n||c&5)&&B(t,"hidden",!e[0])},i(e){n||(D(l.$$.fragment,e),n=!0)},o(e){$(l.$$.fragment,e),n=!1},d(e){e&&y(t),K(l),f=!1,g()}}}function ke(i,t,s){let l,a,n,f;X(i,me,e=>s(4,a=e)),X(i,oe,e=>s(5,n=e)),X(i,Y,e=>s(3,f=e));function g(){var c;const e=f;e instanceof H&&n==="waiting"?a==null||a.playChord(e.current.notes.map(p=>p.midi)):e instanceof H?a==null||a.playChord((((c=e.latestGuess.target)==null?void 0:c.notes)||[]).map(p=>p.midi)):e instanceof L&&n==="waiting"?a==null||a.noteOn(e.current):e instanceof L&&(a==null||a.noteOn(e.latestGuess.target||0))}return i.$$set=e=>{s(2,t=G(G({},t),q(e)))},i.$$.update=()=>{i.$$.dirty&8&&s(0,l=f instanceof H||f instanceof L)},t=q(t),[l,g,t,f]}class Ae extends Q{constructor(t){super(),U(this,t,ke,Ne,J,{})}}function Ce(i){let t,s,l,a,n,f,g;return l=new ne({props:{icon:Se,width:32}}),{c(){t=A("div"),s=A("button"),F(l.$$.fragment),this.h()},l(e){t=C(e,"DIV",{class:!0});var c=E(t);s=C(c,"BUTTON",{class:!0});var p=E(s);I(l.$$.fragment,p),p.forEach(y),c.forEach(y),this.h()},h(){S(s,"class","flex items-center justify-center rounded px-1 py-1 hover:bg-gray-200"),S(t,"class",a=`${i[2].class||""}`),B(t,"hidden",!i[0])},m(e,c){W(e,t,c),V(t,s),j(l,s,null),n=!0,f||(g=re(s,"click",i[1]),f=!0)},p(e,[c]){(!n||c&4&&a!==(a=`${e[2].class||""}`))&&S(t,"class",a),(!n||c&5)&&B(t,"hidden",!e[0])},i(e){n||(D(l.$$.fragment,e),n=!0)},o(e){$(l.$$.fragment,e),n=!1},d(e){e&&y(t),K(l),f=!1,g()}}}function Ee(i,t,s){let l;X(i,Y,n=>s(0,l=n));function a(){ge.clearGame()}return i.$$set=n=>{s(2,t=G(G({},t),q(n)))},t=q(t),[l,a,t]}class Te extends Q{constructor(t){super(),U(this,t,Ee,Ce,J,{})}}function Ve(i){let t,s,l,a,n,f,g,e,c,p;return f=new Ae({props:{class:"mr-2"}}),e=new Te({}),{c(){t=A("section"),s=A("div"),l=te(),a=A("div"),n=A("div"),F(f.$$.fragment),g=te(),F(e.$$.fragment),this.h()},l(u){t=C(u,"SECTION",{class:!0});var N=E(t);s=C(N,"DIV",{id:!0}),E(s).forEach(y),l=se(N),a=C(N,"DIV",{class:!0});var M=E(a);n=C(M,"DIV",{class:!0});var x=E(n);I(f.$$.fragment,x),g=se(x),I(e.$$.fragment,x),x.forEach(y),M.forEach(y),N.forEach(y),this.h()},h(){S(s,"id","output"),S(n,"class","flex"),S(a,"class","absolute left-0 top-[18.5rem]"),S(t,"class",c=`${i[1].class||""} relative`)},m(u,N){W(u,t,N),V(t,s),i[2](s),V(t,l),V(t,a),V(a,n),j(f,n,null),V(n,g),j(e,n,null),p=!0},p(u,[N]){(!p||N&2&&c!==(c=`${u[1].class||""} relative`))&&S(t,"class",c)},i(u){p||(D(f.$$.fragment,u),D(e.$$.fragment,u),p=!0)},o(u){$(f.$$.fragment,u),$(e.$$.fragment,u),p=!1},d(u){u&&y(t),i[2](null),K(f),K(e)}}}function xe(i,t,s){const{Accidental:l,Formatter:a,Renderer:n,Stave:f,StaveNote:g}=v;let e=200,c,p,u;const N=ue([Y,oe,be,pe,we],([o,w,d,b,h])=>({game:o,guessed:w,scale:d,played:b,target:h}));de(()=>{x(),N.subscribe(o=>ce(o))});function M(o,w){const d=w.flats>0?w.flats:w.sharps,b=o.flats>0?o.flats:o.sharps,h=o.flats>0?"b":"#",m=(w.flats>0?_e:ve).slice(0,d),r=m.find(T=>T===o.note.slice(0,2))?b-1:b,_=o.note.length===1&&m.find(T=>T.charAt(0)===o.note.charAt(0));return{...o,parts:[o.note.charAt(0),`${_?"n":h.repeat(r)}`,ae(o.midi)]}}function x(){p=new n(c,n.Backends.SVG),p.resize(732,360),u=p.getContext(),u.scale(2,2),new v.TickContext;const o=new f(0,0,e).addClef("treble").addKeySignature("B"),w=new f(0,60,e).addClef("bass").addKeySignature("B"),d=[new g({keys:["g#/4"],duration:"q"}),new g({keys:["b/4"],duration:"qr"}),new g({keys:["c/4"],duration:"q"}),new g({keys:["a/4","c/5","e/5"],duration:"q"})],b=[new g({clef:"bass",keys:["f/3"],duration:"q"}),new g({clef:"bass",keys:["b/3"],duration:"qr"}),new g({clef:"bass",keys:["b/2"],duration:"q"}),new g({clef:"bass",keys:["c/3","e/3","g/3"],duration:"q"})];d[0].addModifier(new l("#"),0);const h=new v.Voice({num_beats:4,beat_value:4}).addTickables(d),m=new v.Voice({num_beats:4,beat_value:4}).addTickables(b),r=Math.max(o.getNoteStartX(),w.getNoteStartX());o.setNoteStartX(r),w.setNoteStartX(r);const _=new v.Formatter;_.joinVoices([h]),_.joinVoices([m]),_.format([h,m],e-10-r),h.draw(u,o),m.draw(u,w),o.setContext(u).draw(),w.setContext(u).draw()}function Z(o,w){const d=[],b=[];for(let m=0;m0){const m=new v.StaveNote({clef:"bass",keys:d.map(r=>`${r.parts[0]}${r.parts[1]}/${r.parts[2]}`),duration:"w"}).setAttribute("clef","bass");d.forEach((r,_)=>{r.parts[1]&&m.addModifier(new l(r.parts[1]),_),r.color&&m.setStyle({fillStyle:r.color})}),h.push(m)}if(b.length>0){const m=new v.StaveNote({clef:"treble",keys:b.map(r=>`${r.parts[0]}${r.parts[1]}/${r.parts[2]}`),duration:"w"}).setAttribute("clef","treble");b.forEach((r,_)=>{r.parts[1]&&m.addModifier(new l(r.parts[1]),_),r.color&&m.setStyle({fillStyle:r.color})}),h.push(m)}return h}function le(o,w){const d=[],b=[];return o.forEach(h=>{h.getAttribute("clef")==="treble"?d.push(h):b.push(h)}),d.length===0&&b.length>0&&w.length>0?d.push(new v.StaveNote({clef:"treble",keys:["G/4"],duration:"w"}).setStyle({fillStyle:"#fff"})):b.length===0&&d.length>0&&w.length>0&&b.push(new v.StaveNote({clef:"bass",keys:["F/3"],duration:"w"}).setStyle({fillStyle:"#fff"})),d.push(...w.filter(h=>h.getAttribute("clef")==="treble")),b.push(...w.filter(h=>h.getAttribute("clef")==="bass")),[d,b]}function ce({game:o,guessed:w,scale:d,played:b,target:h}){const m=d.majorSignature.replaceAll("♭","b").replaceAll("♯","#");e=200+Math.max(d.flats,d.sharps)*10,u.clear(),u.scale(.5,.5);const r=new f(0,0,e).addClef("treble").addKeySignature(m),_=new f(0,60,e).addClef("bass"),T=Z(h,d),O=Z(b,d),[P,R]=le(T,O),k=[];P.length>0&&k.push(new v.Voice({num_beats:4,beat_value:4}).setMode(2).addTickables(P)),R.length>0&&k.push(new v.Voice({num_beats:4,beat_value:4}).setMode(2).addTickables(R));const z=Math.max(r.getNoteStartX(),_.getNoteStartX());r.setNoteStartX(z),_.setNoteStartX(z);const ee=new v.Formatter;k.forEach(fe=>{ee.joinVoices([fe])}),k.length>0&&ee.format(k,e-10-z),P.length>0&&k[0].draw(u,r),R.length>0&&k[k.length-1].draw(u,_),r.setContext(u).draw(),_.setContext(u).draw()}function ie(o){he[o?"unshift":"push"](()=>{c=o,s(0,c)})}return i.$$set=o=>{s(1,t=G(G({},t),q(o)))},t=q(t),[c,t,ie]}class Xe extends Q{constructor(t){super(),U(this,t,xe,Ve,J,{})}}export{Xe as default}; +import{S as Q,i as U,s as J,O as ne,e as A,H as F,a as C,b as E,I,d as y,f as S,L as B,g as W,h as V,J as j,p as re,t as D,l as $,K,M as X,N as G,P as q,m as te,o as se,Q as ue,r as de,F as he}from"./vendor_svelte.517cf6ee.js";import{F as v}from"./vendor_vexflow.2dfca40b.js";import{p as me,g as oe,c as Y,G as H,a as L,b as ge,s as be,d as pe,t as we,e as ae,F as _e,S as ve}from"./3.813f8056.js";import{d as ye,a as Se}from"./vendor.1acf520b.js";function Ne(i){let t,s,l,a,n,f,g;return l=new ne({props:{icon:ye,width:32}}),{c(){t=A("div"),s=A("button"),F(l.$$.fragment),this.h()},l(e){t=C(e,"DIV",{class:!0});var c=E(t);s=C(c,"BUTTON",{class:!0});var p=E(s);I(l.$$.fragment,p),p.forEach(y),c.forEach(y),this.h()},h(){S(s,"class","flex items-center justify-center rounded px-1 py-1 hover:bg-gray-200"),S(t,"class",a=`${i[2].class||""}`),B(t,"hidden",!i[0])},m(e,c){W(e,t,c),V(t,s),j(l,s,null),n=!0,f||(g=re(s,"click",i[1]),f=!0)},p(e,[c]){(!n||c&4&&a!==(a=`${e[2].class||""}`))&&S(t,"class",a),(!n||c&5)&&B(t,"hidden",!e[0])},i(e){n||(D(l.$$.fragment,e),n=!0)},o(e){$(l.$$.fragment,e),n=!1},d(e){e&&y(t),K(l),f=!1,g()}}}function ke(i,t,s){let l,a,n,f;X(i,me,e=>s(4,a=e)),X(i,oe,e=>s(5,n=e)),X(i,Y,e=>s(3,f=e));function g(){var c;const e=f;e instanceof H&&n==="waiting"?a==null||a.playChord(e.current.notes.map(p=>p.midi)):e instanceof H?a==null||a.playChord((((c=e.latestGuess.target)==null?void 0:c.notes)||[]).map(p=>p.midi)):e instanceof L&&n==="waiting"?a==null||a.noteOn(e.current):e instanceof L&&(a==null||a.noteOn(e.latestGuess.target||0))}return i.$$set=e=>{s(2,t=G(G({},t),q(e)))},i.$$.update=()=>{i.$$.dirty&8&&s(0,l=f instanceof H||f instanceof L)},t=q(t),[l,g,t,f]}class Ae extends Q{constructor(t){super(),U(this,t,ke,Ne,J,{})}}function Ce(i){let t,s,l,a,n,f,g;return l=new ne({props:{icon:Se,width:32}}),{c(){t=A("div"),s=A("button"),F(l.$$.fragment),this.h()},l(e){t=C(e,"DIV",{class:!0});var c=E(t);s=C(c,"BUTTON",{class:!0});var p=E(s);I(l.$$.fragment,p),p.forEach(y),c.forEach(y),this.h()},h(){S(s,"class","flex items-center justify-center rounded px-1 py-1 hover:bg-gray-200"),S(t,"class",a=`${i[2].class||""}`),B(t,"hidden",!i[0])},m(e,c){W(e,t,c),V(t,s),j(l,s,null),n=!0,f||(g=re(s,"click",i[1]),f=!0)},p(e,[c]){(!n||c&4&&a!==(a=`${e[2].class||""}`))&&S(t,"class",a),(!n||c&5)&&B(t,"hidden",!e[0])},i(e){n||(D(l.$$.fragment,e),n=!0)},o(e){$(l.$$.fragment,e),n=!1},d(e){e&&y(t),K(l),f=!1,g()}}}function Ee(i,t,s){let l;X(i,Y,n=>s(0,l=n));function a(){ge.clearGame()}return i.$$set=n=>{s(2,t=G(G({},t),q(n)))},t=q(t),[l,a,t]}class Te extends Q{constructor(t){super(),U(this,t,Ee,Ce,J,{})}}function Ve(i){let t,s,l,a,n,f,g,e,c,p;return f=new Ae({props:{class:"mr-2"}}),e=new Te({}),{c(){t=A("section"),s=A("div"),l=te(),a=A("div"),n=A("div"),F(f.$$.fragment),g=te(),F(e.$$.fragment),this.h()},l(u){t=C(u,"SECTION",{class:!0});var N=E(t);s=C(N,"DIV",{id:!0}),E(s).forEach(y),l=se(N),a=C(N,"DIV",{class:!0});var M=E(a);n=C(M,"DIV",{class:!0});var x=E(n);I(f.$$.fragment,x),g=se(x),I(e.$$.fragment,x),x.forEach(y),M.forEach(y),N.forEach(y),this.h()},h(){S(s,"id","output"),S(n,"class","flex"),S(a,"class","absolute left-0 top-[18.5rem]"),S(t,"class",c=`${i[1].class||""} relative`)},m(u,N){W(u,t,N),V(t,s),i[2](s),V(t,l),V(t,a),V(a,n),j(f,n,null),V(n,g),j(e,n,null),p=!0},p(u,[N]){(!p||N&2&&c!==(c=`${u[1].class||""} relative`))&&S(t,"class",c)},i(u){p||(D(f.$$.fragment,u),D(e.$$.fragment,u),p=!0)},o(u){$(f.$$.fragment,u),$(e.$$.fragment,u),p=!1},d(u){u&&y(t),i[2](null),K(f),K(e)}}}function xe(i,t,s){const{Accidental:l,Formatter:a,Renderer:n,Stave:f,StaveNote:g}=v;let e=200,c,p,u;const N=ue([Y,oe,be,pe,we],([o,w,d,b,h])=>({game:o,guessed:w,scale:d,played:b,target:h}));de(()=>{x(),N.subscribe(o=>ce(o))});function M(o,w){const d=w.flats>0?w.flats:w.sharps,b=o.flats>0?o.flats:o.sharps,h=o.flats>0?"b":"#",m=(w.flats>0?_e:ve).slice(0,d),r=m.find(T=>T===o.note.slice(0,2))?b-1:b,_=o.note.length===1&&m.find(T=>T.charAt(0)===o.note.charAt(0));return{...o,parts:[o.note.charAt(0),`${_?"n":h.repeat(r)}`,ae(o.midi)]}}function x(){p=new n(c,n.Backends.SVG),p.resize(732,360),u=p.getContext(),u.scale(2,2),new v.TickContext;const o=new f(0,0,e).addClef("treble").addKeySignature("B"),w=new f(0,60,e).addClef("bass").addKeySignature("B"),d=[new g({keys:["g#/4"],duration:"q"}),new g({keys:["b/4"],duration:"qr"}),new g({keys:["c/4"],duration:"q"}),new g({keys:["a/4","c/5","e/5"],duration:"q"})],b=[new g({clef:"bass",keys:["f/3"],duration:"q"}),new g({clef:"bass",keys:["b/3"],duration:"qr"}),new g({clef:"bass",keys:["b/2"],duration:"q"}),new g({clef:"bass",keys:["c/3","e/3","g/3"],duration:"q"})];d[0].addModifier(new l("#"),0);const h=new v.Voice({num_beats:4,beat_value:4}).addTickables(d),m=new v.Voice({num_beats:4,beat_value:4}).addTickables(b),r=Math.max(o.getNoteStartX(),w.getNoteStartX());o.setNoteStartX(r),w.setNoteStartX(r);const _=new v.Formatter;_.joinVoices([h]),_.joinVoices([m]),_.format([h,m],e-10-r),h.draw(u,o),m.draw(u,w),o.setContext(u).draw(),w.setContext(u).draw()}function Z(o,w){const d=[],b=[];for(let m=0;m0){const m=new v.StaveNote({clef:"bass",keys:d.map(r=>`${r.parts[0]}${r.parts[1]}/${r.parts[2]}`),duration:"w"}).setAttribute("clef","bass");d.forEach((r,_)=>{r.parts[1]&&m.addModifier(new l(r.parts[1]),_),r.color&&m.setStyle({fillStyle:r.color})}),h.push(m)}if(b.length>0){const m=new v.StaveNote({clef:"treble",keys:b.map(r=>`${r.parts[0]}${r.parts[1]}/${r.parts[2]}`),duration:"w"}).setAttribute("clef","treble");b.forEach((r,_)=>{r.parts[1]&&m.addModifier(new l(r.parts[1]),_),r.color&&m.setStyle({fillStyle:r.color})}),h.push(m)}return h}function le(o,w){const d=[],b=[];return o.forEach(h=>{h.getAttribute("clef")==="treble"?d.push(h):b.push(h)}),d.length===0&&b.length>0&&w.length>0?d.push(new v.StaveNote({clef:"treble",keys:["G/4"],duration:"w"}).setStyle({fillStyle:"#fff"})):b.length===0&&d.length>0&&w.length>0&&b.push(new v.StaveNote({clef:"bass",keys:["F/3"],duration:"w"}).setStyle({fillStyle:"#fff"})),d.push(...w.filter(h=>h.getAttribute("clef")==="treble")),b.push(...w.filter(h=>h.getAttribute("clef")==="bass")),[d,b]}function ce({game:o,guessed:w,scale:d,played:b,target:h}){const m=d.majorSignature.replaceAll("♭","b").replaceAll("♯","#");e=200+Math.max(d.flats,d.sharps)*10,u.clear(),u.scale(.5,.5);const r=new f(0,0,e).addClef("treble").addKeySignature(m),_=new f(0,60,e).addClef("bass"),T=Z(h,d),O=Z(b,d),[P,R]=le(T,O),k=[];P.length>0&&k.push(new v.Voice({num_beats:4,beat_value:4}).setMode(2).addTickables(P)),R.length>0&&k.push(new v.Voice({num_beats:4,beat_value:4}).setMode(2).addTickables(R));const z=Math.max(r.getNoteStartX(),_.getNoteStartX());r.setNoteStartX(z),_.setNoteStartX(z);const ee=new v.Formatter;k.forEach(fe=>{ee.joinVoices([fe])}),k.length>0&&ee.format(k,e-10-z),P.length>0&&k[0].draw(u,r),R.length>0&&k[k.length-1].draw(u,_),r.setContext(u).draw(),_.setContext(u).draw()}function ie(o){he[o?"unshift":"push"](()=>{c=o,s(0,c)})}return i.$$set=o=>{s(1,t=G(G({},t),q(o)))},t=q(t),[c,t,ie]}class Xe extends Q{constructor(t){super(),U(this,t,xe,Ve,J,{})}}export{Xe as default}; diff --git a/_app/immutable/chunks/vendor_svelte.565aa2ba.js b/_app/immutable/chunks/vendor_svelte.517cf6ee.js similarity index 60% rename from _app/immutable/chunks/vendor_svelte.565aa2ba.js rename to _app/immutable/chunks/vendor_svelte.517cf6ee.js index ab64de1e..0659658a 100644 --- a/_app/immutable/chunks/vendor_svelte.565aa2ba.js +++ b/_app/immutable/chunks/vendor_svelte.517cf6ee.js @@ -1,6 +1,6 @@ var Rn=Object.defineProperty;var Tn=(t,e,n)=>e in t?Rn(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n;var G=(t,e,n)=>(Tn(t,typeof e!="symbol"?e+"":e,n),n);import{u as Ln}from"./vendor.1acf520b.js";function z(){}const Xe=t=>t;function bt(t,e){for(const n in e)t[n]=e[n];return t}function Pn(t){return!!t&&(typeof t=="object"||typeof t=="function")&&typeof t.then=="function"}function Qe(t){return t()}function Ae(){return Object.create(null)}function rt(t){t.forEach(Qe)}function Mt(t){return typeof t=="function"}function ce(t,e){return t!=t?e==e:t!==e||t&&typeof t=="object"||typeof t=="function"}function On(t){return Object.keys(t).length===0}function le(t,...e){if(t==null){for(const r of e)r(void 0);return z}const n=t.subscribe(...e);return n.unsubscribe?()=>n.unsubscribe():n}function yi(t){let e;return le(t,n=>e=n)(),e}function Nn(t,e,n){t.$$.on_destroy.push(le(e,n))}function wi(t,e,n,r){if(t){const i=Ze(t,e,n,r);return t[0](i)}}function Ze(t,e,n,r){return t[1]&&r?bt(n.ctx.slice(),t[1](r(e))):n.ctx}function bi(t,e,n,r){if(t[2]&&r){const i=t[2](r(n));if(e.dirty===void 0)return i;if(typeof i=="object"){const a=[],s=Math.max(e.dirty.length,i.length);for(let o=0;o32){const e=[],n=t.ctx.length/32;for(let r=0;rwindow.performance.now():()=>Date.now(),fe=tn?t=>requestAnimationFrame(t):z;const ct=new Set;function en(t){ct.forEach(e=>{e.c(t)||(ct.delete(e),e.f())}),ct.size!==0&&fe(en)}function Cn(t){let e;return ct.size===0&&fe(en),{promise:new Promise(n=>{ct.add(e={c:t,f:n})}),abort(){ct.delete(e)}}}let Ht=!1;function In(){Ht=!0}function Un(){Ht=!1}function Dn(t,e,n,r){for(;t>1);n(i)<=r?t=i+1:e=i}return t}function Fn(t){if(t.hydrate_init)return;t.hydrate_init=!0;let e=t.childNodes;if(t.nodeName==="HEAD"){const c=[];for(let l=0;l0&&e[n[i]].claim_order<=l?i+1:Dn(1,i,S=>e[n[S]].claim_order,l))-1;r[c]=n[d]+1;const m=d+1;n[m]=c,i=Math.max(m,i)}const a=[],s=[];let o=e.length-1;for(let c=n[i]+1;c!=0;c=r[c-1]){for(a.push(e[c-1]);o>=c;o--)s.push(e[o]);o--}for(;o>=0;o--)s.push(e[o]);a.reverse(),s.sort((c,l)=>c.claim_order-l.claim_order);for(let c=0,l=0;c=a[l].claim_order;)l++;const d=lt.removeEventListener(e,n,r)}function rn(t,e,n){n==null?t.removeAttribute(e):t.getAttribute(e)!==n&&t.setAttribute(e,n)}const Bn=["width","height"];function Te(t,e){const n=Object.getOwnPropertyDescriptors(t.__proto__);for(const r in e)e[r]==null?t.removeAttribute(r):r==="style"?t.style.cssText=e[r]:r==="__value"?t.value=t[r]=e[r]:n[r]&&n[r].set&&Bn.indexOf(r)===-1?t[r]=e[r]:rn(t,r,e[r])}function Le(t,e){for(const n in e)rn(t,n,e[n])}function Ei(t){return t.dataset.svelteH}function Ai(t){return t===""?null:+t}function xt(t){return Array.from(t.childNodes)}function an(t){t.claim_info===void 0&&(t.claim_info={last_index:0,total_claimed:0})}function on(t,e,n,r,i=!1){an(t);const a=(()=>{for(let s=t.claim_info.last_index;s=0;s--){const o=t[s];if(e(o)){const c=n(o);return c===void 0?t.splice(s,1):t[s]=c,i?c===void 0&&t.claim_info.last_index--:t.claim_info.last_index=s,o}}return r()})();return a.claim_order=t.claim_info.total_claimed,t.claim_info.total_claimed+=1,a}function sn(t,e,n,r){return on(t,i=>i.nodeName===e,i=>{const a=[];for(let s=0;si.removeAttribute(s))},()=>r(e))}function ie(t,e,n){return sn(t,e,n,ft)}function Gn(t,e,n){return sn(t,e,n,ue)}function ae(t,e){return on(t,n=>n.nodeType===3,n=>{const r=""+e;if(n.data.startsWith(r)){if(n.data.length!==r.length)return n.splitText(r.length)}else n.data=r},()=>vt(e),!0)}function Wn(t){return ae(t," ")}function Pe(t,e,n){for(let r=n;r0&&n.push(i);return n}class Jn{constructor(e=!1){G(this,"is_svg",!1);G(this,"e");G(this,"n");G(this,"t");G(this,"a");this.is_svg=e,this.e=this.n=null}c(e){this.h(e)}m(e,n,r=null){this.e||(this.is_svg?this.e=ue(n.nodeName):this.e=ft(n.nodeType===11?"TEMPLATE":n.nodeName),this.t=n.tagName!=="TEMPLATE"?n:n.content,this.c(e)),this.i(r)}h(e){this.e.innerHTML=e,this.n=Array.from(this.e.nodeName==="TEMPLATE"?this.e.content.childNodes:this.e.childNodes)}i(e){for(let n=0;n>>0}function Xn(t,e){const n={stylesheet:Hn(e),rules:{}};return jt.set(t,n),n}function Ne(t,e,n,r,i,a,s,o=0){const c=16.666/r;let l=`{ `;for(let R=0;R<=1;R+=c){const x=e+(n-e)*a(R);l+=R*100+`%{${s(x,1-x)}} `}const d=l+`100% {${s(n,1-n)}} -}`,m=`__svelte_${Yn(d)}_${o}`,S=nn(t),{stylesheet:P,rules:y}=jt.get(S)||Xn(S,t);y[m]||(y[m]=!0,P.insertRule(`@keyframes ${m} ${d}`,P.cssRules.length));const w=t.style.animation||"";return t.style.animation=`${w?`${w}, `:""}${m} ${r}ms linear ${i}ms 1 both`,Ct+=1,m}function Qn(t,e){const n=(t.style.animation||"").split(", "),r=n.filter(e?a=>a.indexOf(e)<0:a=>a.indexOf("__svelte")===-1),i=n.length-r.length;i&&(t.style.animation=r.join(", "),Ct-=i,Ct||Zn())}function Zn(){fe(()=>{Ct||(jt.forEach(t=>{const{ownerNode:e}=t.stylesheet;e&&H(e)}),jt.clear())})}let kt;function K(t){kt=t}function zt(){if(!kt)throw new Error("Function called outside component initialization");return kt}function Jt(t){zt().$$.on_mount.push(t)}function Ni(t){zt().$$.after_update.push(t)}function ji(){const t=zt();return(e,n,{cancelable:r=!1}={})=>{const i=t.$$.callbacks[e];if(i){const a=cn(e,n,{cancelable:r});return i.slice().forEach(s=>{s.call(t,a)}),!a.defaultPrevented}return!0}}function Ci(t,e){const n=t.$$.callbacks[e.type];n&&n.slice().forEach(r=>r.call(this,e))}const st=[],je=[];let lt=[];const Ce=[],ln=Promise.resolve();let oe=!1;function fn(){oe||(oe=!0,ln.then(de))}function Yt(){return fn(),ln}function It(t){lt.push(t)}const Xt=new Set;let it=0;function de(){if(it!==0)return;const t=kt;do{try{for(;itt.indexOf(r)===-1?e.push(r):n.push(r)),n.forEach(r=>r()),lt=e}let _t;function nr(){return _t||(_t=Promise.resolve(),_t.then(()=>{_t=null})),_t}function Qt(t,e,n){t.dispatchEvent(cn(`${e?"intro":"outro"}${n}`))}const Pt=new Set;let J;function rr(){J={r:0,c:[],p:J}}function ir(){J.r||rt(J.c),J=J.p}function un(t,e){t&&t.i&&(Pt.delete(t),t.i(e))}function ar(t,e,n,r){if(t&&t.o){if(Pt.has(t))return;Pt.add(t),J.c.push(()=>{Pt.delete(t),r&&(n&&t.d(1),r())}),t.o(e)}else r&&r()}const or={duration:0};function Ii(t,e,n,r){let a=e(t,n,{direction:"both"}),s=r?0:1,o=null,c=null,l=null,d;function m(){l&&Qn(t,l)}function S(y,w){const R=y.b-s;return w*=Math.abs(R),{a:s,b:y.b,d:R,duration:w,start:y.start,end:y.start+w,group:y.group}}function P(y){const{delay:w=0,duration:R=300,easing:x=Xe,tick:v=z,css:L}=a||or,Z={start:jn()+w,b:y};y||(Z.group=J,J.r+=1),"inert"in t&&(y?d!==void 0&&(t.inert=d):(d=t.inert,t.inert=!0)),o||c?c=Z:(L&&(m(),l=Ne(t,s,y,R,w,x,L)),y&&v(0,1),o=S(Z,R),It(()=>Qt(t,y,"start")),Cn(V=>{if(c&&V>c.start&&(o=S(c,R),c=null,Qt(t,o.b,"start"),L&&(m(),l=Ne(t,s,o.b,o.duration,0,x,a.css))),o){if(V>=o.end)v(s=o.b,1-s),Qt(t,o.b,"end"),c||(o.b?m():--o.group.r||rt(o.group.c)),o=null;else if(V>=o.start){const Y=V-o.start;s=o.a+o.d*x(Y/o.duration),v(s,1-s)}}return!!(o||c)}))}return{run(y){Mt(a)?nr().then(()=>{a=a({direction:y?"in":"out"}),P(y)}):P(y)},end(){m(),o=c=null}}}function Ui(t,e){const n=e.token={};function r(i,a,s,o){if(e.token!==n)return;e.resolved=o;let c=e.ctx;s!==void 0&&(c=c.slice(),c[s]=o);const l=i&&(e.current=i)(c);let d=!1;e.block&&(e.blocks?e.blocks.forEach((m,S)=>{S!==a&&m&&(rr(),ar(m,1,1,()=>{e.blocks[S]===m&&(e.blocks[S]=null)}),ir())}):e.block.d(1),l.c(),un(l,1),l.m(e.mount(),e.anchor),d=!0),e.block=l,e.blocks&&(e.blocks[a]=l),d&&de()}if(Pn(t)){const i=zt();if(t.then(a=>{K(i),r(e.then,1,e.value,a),K(null)},a=>{if(K(i),r(e.catch,2,e.error,a),K(null),!e.hasCatch)throw a}),e.current!==e.pending)return r(e.pending,0),!0}else{if(e.current!==e.then)return r(e.then,1,e.value,t),!0;e.resolved=t}}function Di(t){return(t==null?void 0:t.length)!==void 0?t:Array.from(t)}function dn(t,e){const n={},r={},i={$$scope:1};let a=t.length;for(;a--;){const s=t[a],o=e[a];if(o){for(const c in s)c in o||(r[c]=1);for(const c in o)i[c]||(n[c]=o[c],i[c]=1);t[a]=o}else for(const c in s)i[c]=1}for(const s in r)s in n||(n[s]=void 0);return n}function Fi(t){t&&t.c()}function Mi(t,e){t&&t.l(e)}function sr(t,e,n){const{fragment:r,after_update:i}=t.$$;r&&r.m(e,n),It(()=>{const a=t.$$.on_mount.map(Qe).filter(Mt);t.$$.on_destroy?t.$$.on_destroy.push(...a):rt(a),t.$$.on_mount=[]}),i.forEach(It)}function cr(t,e){const n=t.$$;n.fragment!==null&&(er(n.after_update),rt(n.on_destroy),n.fragment&&n.fragment.d(e),n.on_destroy=n.fragment=null,n.ctx=[])}function lr(t,e){t.$$.dirty[0]===-1&&(st.push(t),fn(),t.$$.dirty.fill(0)),t.$$.dirty[e/31|0]|=1<{const y=P.length?P[0]:S;return l.ctx&&i(l.ctx[m],l.ctx[m]=y)&&(!l.skip_bound&&l.bound[m]&&l.bound[m](y),d&&lr(t,m)),S}):[],l.update(),d=!0,rt(l.before_update),l.fragment=r?r(l.ctx):!1,e.target){if(e.hydrate){In();const m=xt(e.target);l.fragment&&l.fragment.l(m),m.forEach(H)}else l.fragment&&l.fragment.c();e.intro&&un(t.$$.fragment),sr(t,e.target,e.anchor),Un(),de()}K(c)}class pn{constructor(){G(this,"$$");G(this,"$$set")}$destroy(){cr(this,1),this.$destroy=z}$on(e,n){if(!Mt(n))return z;const r=this.$$.callbacks[e]||(this.$$.callbacks[e]=[]);return r.push(n),()=>{const i=r.indexOf(n);i!==-1&&r.splice(i,1)}}$set(e){this.$$set&&!On(e)&&(this.$$.skip_bound=!0,this.$$set(e),this.$$.skip_bound=!1)}}const fr="4";function ur(t,e){return t==="/"||e==="ignore"?t:e==="never"?t.endsWith("/")?t.slice(0,-1):t:e==="always"&&!t.endsWith("/")?t+"/":t}function dr(t){return t.split("%25").map(decodeURI).join("%25")}function hr(t){for(const e in t)t[e]=decodeURIComponent(t[e]);return t}const pr=["href","pathname","search","searchParams","toString","toJSON"];function _r(t,e){const n=new URL(t);for(const r of pr)Object.defineProperty(n,r,{get(){return e(),t[r]},enumerable:!0,configurable:!0});return gr(n),n}function gr(t){Object.defineProperty(t,"hash",{get(){throw new Error("Cannot access event.url.hash. Consider using `$page.url.hash` inside a component instead")}})}const mr="/__data.json";function yr(t){return t.replace(/\/$/,"")+mr}function wr(...t){let e=5381;for(const n of t)if(typeof n=="string"){let r=n.length;for(;r;)e=e*33^n.charCodeAt(--r)}else if(ArrayBuffer.isView(n)){const r=new Uint8Array(n.buffer,n.byteOffset,n.byteLength);let i=r.length;for(;i;)e=e*33^r[--i]}else throw new TypeError("value must be a string or TypedArray");return(e>>>0).toString(36)}const _n=window.fetch;window.fetch=(t,e)=>((t instanceof Request?t.method:(e==null?void 0:e.method)||"GET")!=="GET"&&wt.delete(he(t)),_n(t,e));const wt=new Map;function br(t,e){const n=he(t,e),r=document.querySelector(n);if(r!=null&&r.textContent){const{body:i,...a}=JSON.parse(r.textContent),s=r.getAttribute("data-ttl");return s&&wt.set(n,{body:i,init:a,ttl:1e3*Number(s)}),Promise.resolve(new Response(i,a))}return window.fetch(t,e)}function vr(t,e,n){if(wt.size>0){const r=he(t,n),i=wt.get(r);if(i){if(performance.now(){const i=/^\[\.\.\.(\w+)(?:=(\w+))?\]$/.exec(r);if(i)return e.push({name:i[1],matcher:i[2],optional:!1,rest:!0,chained:!0}),"(?:/(.*))?";const a=/^\[\[(\w+)(?:=(\w+))?\]\]$/.exec(r);if(a)return e.push({name:a[1],matcher:a[2],optional:!0,rest:!1,chained:!0}),"(?:/([^/]+))?";if(!r)return;const s=r.split(/\[(.+?)\](?!\])/);return"/"+s.map((c,l)=>{if(l%2){if(c.startsWith("x+"))return Zt(String.fromCharCode(parseInt(c.slice(2),16)));if(c.startsWith("u+"))return Zt(String.fromCharCode(...c.slice(2).split("-").map(w=>parseInt(w,16))));const d=xr.exec(c);if(!d)throw new Error(`Invalid param: ${c}. Params and matcher names can only have underscores and alphanumeric characters.`);const[,m,S,P,y]=d;return e.push({name:P,matcher:y,optional:!!m,rest:!!S,chained:S?l===1&&s[0]==="":!1}),S?"(.*?)":m?"([^/]*)?":"([^/]+?)"}return Zt(c)}).join("")}).join("")}/?$`),params:e}}function $r(t){return!/^\([^)]+\)$/.test(t)}function Sr(t){return t.slice(1).split("/").filter($r)}function Er(t,e,n){const r={},i=t.slice(1),a=i.filter(o=>o!==void 0);let s=0;for(let o=0;od).join("/"),s=0),l===void 0){c.rest&&(r[c.name]="");continue}if(!c.matcher||n[c.matcher](l)){r[c.name]=l;const d=e[o+1],m=i[o+1];d&&!d.rest&&d.optional&&m&&c.chained&&(s=0),!d&&!m&&Object.keys(r).length===a.length&&(s=0);continue}if(c.optional&&c.chained){s++;continue}return}if(!s)return r}function Zt(t){return t.normalize().replace(/[[\]]/g,"\\$&").replace(/%/g,"%25").replace(/\//g,"%2[Ff]").replace(/\?/g,"%3[Ff]").replace(/#/g,"%23").replace(/[.*+?^${}()|\\]/g,"\\$&")}function Ar({nodes:t,server_loads:e,dictionary:n,matchers:r}){const i=new Set(e);return Object.entries(n).map(([o,[c,l,d]])=>{const{pattern:m,params:S}=kr(o),P={id:o,exec:y=>{const w=m.exec(y);if(w)return Er(w,S,r)},errors:[1,...d||[]].map(y=>t[y]),layouts:[0,...l||[]].map(s),leaf:a(c)};return P.errors.length=P.layouts.length=Math.max(P.errors.length,P.layouts.length),P});function a(o){const c=o<0;return c&&(o=~o),[c,t[o]]}function s(o){return o===void 0?o:[i.has(o),t[o]]}}function gn(t){try{return JSON.parse(sessionStorage[t])}catch{}}function Ie(t,e){const n=JSON.stringify(e);try{sessionStorage[t]=n}catch{}}const at=[];function Rr(t,e){return{subscribe:Vt(t,e).subscribe}}function Vt(t,e=z){let n;const r=new Set;function i(o){if(ce(t,o)&&(t=o,n)){const c=!at.length;for(const l of r)l[1](),at.push(l,t);if(c){for(let l=0;l{r.delete(l),r.size===0&&n&&(n(),n=null)}}return{set:i,update:a,subscribe:s}}function Hi(t,e,n){const r=!Array.isArray(t),i=r?[t]:t;if(!i.every(Boolean))throw new Error("derived() expects stores as input, got a falsy value");const a=e.length<2;return Rr(n,(s,o)=>{let c=!1;const l=[];let d=0,m=z;const S=()=>{if(d)return;m();const y=e(r?l[0]:l,s,o);a?s(y):m=Mt(y)?y:z},P=i.map((y,w)=>le(y,R=>{l[w]=R,d&=~(1<{d|=1<s)}function i(s){n=!1,e.set(s)}function a(s){let o;return e.subscribe(c=>{(o===void 0||n&&c!==o)&&s(o=c)})}return{notify:r,set:i,subscribe:a}}function Pr(){const{set:t,subscribe:e}=Vt(!1);let n;async function r(){clearTimeout(n);try{const i=await fetch(`${Tr}/_app/version.json`,{headers:{pragma:"no-cache","cache-control":"no-cache"}});if(!i.ok)return!1;const s=(await i.json()).version!==Lr;return s&&(t(!0),clearTimeout(n)),s}catch{return!1}}return{subscribe:e,check:r}}function Ot(t,e){return t.origin!==Dt||!t.pathname.startsWith(e)}function Or(t){return t.filter(e=>e!=null)}const bn=new Set(["load","prerender","csr","ssr","trailingSlash","config"]);[...bn];const Nr=new Set([...bn]);[...Nr];async function jr(t,e){var n;for(const r in t)if(typeof((n=t[r])==null?void 0:n.then)=="function")return Object.fromEntries(await Promise.all(Object.entries(t).map(async([i,a])=>[i,await a])));return t}class yt{constructor(e,n){this.status=e,typeof n=="string"?this.body={message:n}:n?this.body=n:this.body={message:`Error: ${e}`}}toString(){return JSON.stringify(this.body)}}class He{constructor(e,n){this.status=e,this.location=n}}const Cr="x-sveltekit-invalidated",Ir="x-sveltekit-trailing-slash";function Ur(t){t.client}const W={url:Me({}),page:Me({}),navigating:Vt(null),updated:Pr()},et=gn(yn)??{},gt=gn(mn)??{};function ee(t){et[t]=mt()}function nt(t){return location.href=t.href,new Promise(()=>{})}function Dr(t,e){var $e;const n=Ar(t),r=t.nodes[0],i=t.nodes[1];r(),i();const a=document.documentElement,s=[],o=[];let c=null;const l={before_navigate:[],on_navigate:[],after_navigate:[]};let d={branch:[],error:null,url:null},m=!1,S=!1,P=!0,y=!1,w=!1,R=!1,x=!1,v,L=($e=history.state)==null?void 0:$e[B];L||(L=Date.now(),history.replaceState({...history.state,[B]:L},"",location.href));const Z=et[L];Z&&(history.scrollRestoration="manual",scrollTo(Z.x,Z.y));let V,Y,ut;async function pe(){if(ut=ut||Promise.resolve(),await ut,!ut)return;ut=null;const f=new URL(location.href),_=ht(f,!0);c=null;const u=Y={},p=_&&await Gt(_);if(u===Y&&p){if(p.type==="redirect")return $t(new URL(p.location,f).href,{},1,u);p.props.page!==void 0&&(V=p.props.page),v.$set(p.props)}}function _e(f){o.some(_=>_==null?void 0:_.snapshot)&&(gt[f]=o.map(_=>{var u;return(u=_==null?void 0:_.snapshot)==null?void 0:u.capture()}))}function ge(f){var _;(_=gt[f])==null||_.forEach((u,p)=>{var h,g;(g=(h=o[p])==null?void 0:h.snapshot)==null||g.restore(u)})}function me(){ee(L),Ie(yn,et),_e(L),Ie(mn,gt)}async function $t(f,{noScroll:_=!1,replaceState:u=!1,keepFocus:p=!1,state:h={},invalidateAll:g=!1},b,A){return typeof f=="string"&&(f=new URL(f,Ue(document))),Rt({url:f,scroll:_?mt():null,keepfocus:p,redirect_count:b,details:{state:h,replaceState:u},nav_token:A,accepted:()=>{g&&(x=!0)},blocked:()=>{},type:"goto"})}async function ye(f){return c={id:f.id,promise:Gt(f).then(_=>(_.type==="loaded"&&_.state.error&&(c=null),_))},c.promise}async function St(...f){const u=n.filter(p=>f.some(h=>p.exec(h))).map(p=>Promise.all([...p.layouts,p.leaf].map(h=>h==null?void 0:h[1]())));await Promise.all(u)}function we(f){var p;d=f.state;const _=document.querySelector("style[data-sveltekit]");_&&_.remove(),V=f.props.page,v=new t.root({target:e,props:{...f.props,stores:W,components:o},hydrate:!0}),ge(L);const u={from:null,to:{params:d.params,route:{id:((p=d.route)==null?void 0:p.id)??null},url:new URL(location.href)},willUnload:!1,type:"enter",complete:Promise.resolve()};l.after_navigate.forEach(h=>h(u)),S=!0}async function dt({url:f,params:_,branch:u,status:p,error:h,route:g,form:b}){let A="never";for(const $ of u)($==null?void 0:$.slash)!==void 0&&(A=$.slash);f.pathname=ur(f.pathname,A),f.search=f.search;const T={type:"loaded",state:{url:f,params:_,branch:u,error:h,route:g},props:{constructors:Or(u).map($=>$.node.component)}};b!==void 0&&(T.props.form=b);let E={},I=!V,j=0;for(let $=0;$(A.route=!0,k[D])}),params:new Proxy(p,{get:(k,D)=>(A.params.add(D),k[D])}),data:(g==null?void 0:g.data)??null,url:_r(u,()=>{A.url=!0}),async fetch(k,D){let F;k instanceof Request?(F=k.url,D={body:k.method==="GET"||k.method==="HEAD"?void 0:await k.blob(),cache:k.cache,credentials:k.credentials,headers:k.headers,integrity:k.integrity,keepalive:k.keepalive,method:k.method,mode:k.mode,redirect:k.redirect,referrer:k.referrer,referrerPolicy:k.referrerPolicy,signal:k.signal,...D}):F=k;const q=new URL(F,u);return U(q.href),q.origin===u.origin&&(F=q.href.slice(u.origin.length)),S?vr(F,q.href,D):br(F,D)},setHeaders:()=>{},depends:U,parent(){return A.parent=!0,_()}};b=await T.universal.load.call(null,$)??null,b=b?await jr(b,h.id):null}return{node:T,loader:f,server:g,universal:(I=T.universal)!=null&&I.load?{type:"data",data:b,uses:A}:null,data:b??(g==null?void 0:g.data)??null,slash:((j=T.universal)==null?void 0:j.trailingSlash)??(g==null?void 0:g.slash)}}function be(f,_,u,p,h){if(x)return!0;if(!p)return!1;if(p.parent&&f||p.route&&_||p.url&&u)return!0;for(const g of p.params)if(h[g]!==d.params[g])return!0;for(const g of p.dependencies)if(s.some(b=>b(new URL(g))))return!0;return!1}function Bt(f,_){return(f==null?void 0:f.type)==="data"?f:(f==null?void 0:f.type)==="skip"?_??null:null}async function Gt({id:f,invalidating:_,url:u,params:p,route:h}){if((c==null?void 0:c.id)===f)return c.promise;const{errors:g,layouts:b,leaf:A}=h,T=[...b,A];g.forEach(O=>O==null?void 0:O().catch(()=>{})),T.forEach(O=>O==null?void 0:O[1]().catch(()=>{}));let E=null;const I=d.url?f!==d.url.pathname+d.url.search:!1,j=d.route?h.id!==d.route.id:!1;let U=!1;const $=T.map((O,C)=>{var tt;const N=d.branch[C],M=!!(O!=null&&O[0])&&((N==null?void 0:N.loader)!==O[1]||be(U,j,I,(tt=N.server)==null?void 0:tt.uses,p));return M&&(U=!0),M});if($.some(Boolean)){try{E=await ze(u,$)}catch(O){return Et({status:O instanceof yt?O.status:500,error:await pt(O,{url:u,params:p,route:{id:h.id}}),url:u,route:h})}if(E.type==="redirect")return E}const k=E==null?void 0:E.nodes;let D=!1;const F=T.map(async(O,C)=>{var Wt;if(!O)return;const N=d.branch[C],M=k==null?void 0:k[C];if((!M||M.type==="skip")&&O[1]===(N==null?void 0:N.loader)&&!be(D,j,I,(Wt=N.universal)==null?void 0:Wt.uses,p))return N;if(D=!0,(M==null?void 0:M.type)==="error")throw M;return qt({loader:O[1],url:u,params:p,route:h,parent:async()=>{var Ee;const Se={};for(let Kt=0;Kt{});const q=[];for(let O=0;OPromise.resolve({}),server_data_node:Bt(g)}),T={node:await i(),loader:i,universal:null,server:null,data:null};return await dt({url:u,params:h,branch:[A,T],status:f,error:_,route:null})}function ht(f,_){if(Ot(f,X))return;const u=At(f);for(const p of n){const h=p.exec(u);if(h)return{id:f.pathname+f.search,invalidating:_,route:p,params:hr(h),url:f}}}function At(f){return dr(f.pathname.slice(X.length)||"/")}function xe({url:f,type:_,intent:u,delta:p}){let h=!1;const g=Ve(d,u,f,_);p!==void 0&&(g.navigation.delta=p);const b={...g.navigation,cancel:()=>{h=!0,g.reject(new Error("navigation was cancelled"))}};return w||l.before_navigate.forEach(A=>A(b)),h?null:g}async function Rt({url:f,scroll:_,keepfocus:u,redirect_count:p,details:h,type:g,delta:b,nav_token:A={},accepted:T,blocked:E}){var F,q,O;const I=ht(f,!1),j=xe({url:f,type:g,delta:b,intent:I});if(!j){E();return}const U=L;T(),w=!0,S&&W.navigating.set(j.navigation),Y=A;let $=I&&await Gt(I);if(!$){if(Ot(f,X))return await nt(f);$=await ke(f,{id:null},await pt(new Error(`Not found: ${f.pathname}`),{url:f,params:{},route:{id:null}}),404)}if(f=(I==null?void 0:I.url)||f,Y!==A)return j.reject(new Error("navigation was aborted")),!1;if($.type==="redirect")if(p>=20)$=await Et({status:500,error:await pt(new Error("Redirect loop"),{url:f,params:{},route:{id:null}}),url:f,route:{id:null}});else return $t(new URL($.location,f).href,{},p+1,A),!1;else((F=$.props.page)==null?void 0:F.status)>=400&&await W.updated.check()&&await nt(f);if(s.length=0,x=!1,y=!0,ee(U),_e(U),(q=$.props.page)!=null&&q.url&&$.props.page.url.pathname!==f.pathname&&(f.pathname=(O=$.props.page)==null?void 0:O.url.pathname),h){const C=h.replaceState?0:1;if(h.state[B]=L+=C,history[h.replaceState?"replaceState":"pushState"](h.state,"",f),!h.replaceState){let N=L+1;for(;gt[N]||et[N];)delete gt[N],delete et[N],N+=1}}if(c=null,S){d=$.state,$.props.page&&($.props.page.url=f);const C=(await Promise.all(l.on_navigate.map(N=>N(j.navigation)))).filter(N=>typeof N=="function");if(C.length>0){let N=function(){l.after_navigate=l.after_navigate.filter(M=>!C.includes(M))};C.push(N),l.after_navigate.push(...C)}v.$set($.props)}else we($);const{activeElement:k}=document;if(await Yt(),P){const C=f.hash&&document.getElementById(decodeURIComponent(f.hash.slice(1)));_?scrollTo(_.x,_.y):C?C.scrollIntoView():scrollTo(0,0)}const D=document.activeElement!==k&&document.activeElement!==document.body;!u&&!D&&ne(),P=!0,$.props.page&&(V=$.props.page),w=!1,g==="popstate"&&ge(L),j.fulfil(void 0),l.after_navigate.forEach(C=>C(j.navigation)),W.navigating.set(null),y=!1}async function ke(f,_,u,p){return f.origin===Dt&&f.pathname===location.pathname&&!m?await Et({status:p,error:u,url:f,route:_}):await nt(f)}function An(){let f;a.addEventListener("mousemove",g=>{const b=g.target;clearTimeout(f),f=setTimeout(()=>{p(b,2)},20)});function _(g){p(g.composedPath()[0],1)}a.addEventListener("mousedown",_),a.addEventListener("touchstart",_,{passive:!0});const u=new IntersectionObserver(g=>{for(const b of g)b.isIntersecting&&(St(At(new URL(b.target.href))),u.unobserve(b.target))},{threshold:0});function p(g,b){const A=Fe(g,a);if(!A)return;const{url:T,external:E,download:I}=te(A,X);if(E||I)return;const j=Tt(A);if(!j.reload)if(b<=j.preload_data){const U=ht(T,!1);U&&ye(U)}else b<=j.preload_code&&St(At(T))}function h(){u.disconnect();for(const g of a.querySelectorAll("a")){const{url:b,external:A,download:T}=te(g,X);if(A||T)continue;const E=Tt(g);E.reload||(E.preload_code===Ut.viewport&&u.observe(g),E.preload_code===Ut.eager&&St(At(b)))}}l.after_navigate.push(h),h()}function pt(f,_){return f instanceof yt?f.body:t.hooks.handleError({error:f,event:_})??{message:_.route.id!=null?"Internal Error":"Not Found"}}return{after_navigate:f=>{Jt(()=>(l.after_navigate.push(f),()=>{const _=l.after_navigate.indexOf(f);l.after_navigate.splice(_,1)}))},before_navigate:f=>{Jt(()=>(l.before_navigate.push(f),()=>{const _=l.before_navigate.indexOf(f);l.before_navigate.splice(_,1)}))},on_navigate:f=>{Jt(()=>(l.on_navigate.push(f),()=>{const _=l.on_navigate.indexOf(f);l.on_navigate.splice(_,1)}))},disable_scroll_handling:()=>{(y||!S)&&(P=!1)},goto:(f,_={})=>$t(f,_,0),invalidate:f=>{if(typeof f=="function")s.push(f);else{const{href:_}=new URL(f,location.href);s.push(u=>u.href===_)}return pe()},invalidate_all:()=>(x=!0,pe()),preload_data:async f=>{const _=new URL(f,Ue(document)),u=ht(_,!1);if(!u)throw new Error(`Attempted to preload a URL that does not belong to this app: ${_}`);await ye(u)},preload_code:St,apply_action:async f=>{if(f.type==="error"){const _=new URL(location.href),{branch:u,route:p}=d;if(!p)return;const h=await ve(d.branch.length,u,p.errors);if(h){const g=await dt({url:_,params:d.params,branch:u.slice(0,h.idx).concat(h.node),status:f.status??500,error:f.error,route:p});d=g.state,v.$set(g.props),Yt().then(ne)}}else f.type==="redirect"?$t(f.location,{invalidateAll:!0},0):(v.$set({form:null,page:{...V,form:f.data,status:f.status}}),await Yt(),v.$set({form:f.data}),f.type==="success"&&ne())},_start_router:()=>{var _;history.scrollRestoration="manual",addEventListener("beforeunload",u=>{let p=!1;if(me(),!w){const h=Ve(d,void 0,null,"leave"),g={...h.navigation,cancel:()=>{p=!0,h.reject(new Error("navigation was cancelled"))}};l.before_navigate.forEach(b=>b(g))}p?(u.preventDefault(),u.returnValue=""):history.scrollRestoration="auto"}),addEventListener("visibilitychange",()=>{document.visibilityState==="hidden"&&me()}),(_=navigator.connection)!=null&&_.saveData||An(),a.addEventListener("click",u=>{var U;if(u.button||u.which!==1||u.metaKey||u.ctrlKey||u.shiftKey||u.altKey||u.defaultPrevented)return;const p=Fe(u.composedPath()[0],a);if(!p)return;const{url:h,external:g,target:b,download:A}=te(p,X);if(!h)return;if(b==="_parent"||b==="_top"){if(window.parent!==window)return}else if(b&&b!=="_self")return;const T=Tt(p);if(!(p instanceof SVGAElement)&&h.protocol!==location.protocol&&!(h.protocol==="https:"||h.protocol==="http:")||A)return;if(g||T.reload){xe({url:h,type:"link"})?w=!0:u.preventDefault();return}const[I,j]=h.href.split("#");if(j!==void 0&&I===location.href.split("#")[0]){if(d.url.hash===h.hash){u.preventDefault(),(U=p.ownerDocument.getElementById(j))==null||U.scrollIntoView();return}if(R=!0,ee(L),f(h),!T.replace_state)return;R=!1,u.preventDefault()}Rt({url:h,scroll:T.noscroll?mt():null,keepfocus:T.keep_focus??!1,redirect_count:0,details:{state:{},replaceState:T.replace_state??h.href===location.href},accepted:()=>u.preventDefault(),blocked:()=>u.preventDefault(),type:"link"})}),a.addEventListener("submit",u=>{if(u.defaultPrevented)return;const p=HTMLFormElement.prototype.cloneNode.call(u.target),h=u.submitter;if(((h==null?void 0:h.formMethod)||p.method)!=="get")return;const b=new URL((h==null?void 0:h.hasAttribute("formaction"))&&(h==null?void 0:h.formAction)||p.action);if(Ot(b,X))return;const A=u.target,{keep_focus:T,noscroll:E,reload:I,replace_state:j}=Tt(A);if(I)return;u.preventDefault(),u.stopPropagation();const U=new FormData(A),$=h==null?void 0:h.getAttribute("name");$&&U.append($,(h==null?void 0:h.getAttribute("value"))??""),b.search=new URLSearchParams(U).toString(),Rt({url:b,scroll:E?mt():null,keepfocus:T??!1,redirect_count:0,details:{state:{},replaceState:j??b.href===location.href},nav_token:{},accepted:()=>{},blocked:()=>{},type:"form"})}),addEventListener("popstate",async u=>{var p;if(Y={},(p=u.state)!=null&&p[B]){if(u.state[B]===L)return;const h=et[u.state[B]],g=new URL(location.href);if(d.url.href.split("#")[0]===location.href.split("#")[0]){f(g),et[L]=mt(),L=u.state[B],scrollTo(h.x,h.y);return}const b=u.state[B]-L;await Rt({url:g,scroll:h,keepfocus:!1,redirect_count:0,details:null,accepted:()=>{L=u.state[B]},blocked:()=>{history.go(-b)},type:"popstate",delta:b,nav_token:Y})}else if(!R){const h=new URL(location.href);f(h)}}),addEventListener("hashchange",()=>{R&&(R=!1,history.replaceState({...history.state,[B]:++L},"",location.href))});for(const u of document.querySelectorAll("link"))u.rel==="icon"&&(u.href=u.href);addEventListener("pageshow",u=>{u.persisted&&W.navigating.set(null)});function f(u){d.url=u,W.page.set({...V,url:u}),W.page.notify()}},_hydrate:async({status:f=200,error:_,node_ids:u,params:p,route:h,data:g,form:b})=>{m=!0;const A=new URL(location.href);({params:p={},route:h={id:null}}=ht(A,!1)||{});let T;try{const E=u.map(async(U,$)=>{const k=g[$];return k!=null&&k.uses&&(k.uses=vn(k.uses)),qt({loader:t.nodes[U],url:A,params:p,route:h,parent:async()=>{const D={};for(let F=0;F<$;F+=1)Object.assign(D,(await E[F]).data);return D},server_data_node:Bt(k)})}),I=await Promise.all(E),j=n.find(({id:U})=>U===h.id);if(j){const U=j.layouts;for(let $=0;$a?"1":"0").join(""));const r=await _n(n.href);if((i=r.headers.get("content-type"))!=null&&i.includes("text/html")&&await nt(t),!r.ok)throw new yt(r.status,await r.json());return new Promise(async a=>{var m;const s=new Map,o=r.body.getReader(),c=new TextDecoder;function l(S){return Ln(S,{Promise:P=>new Promise((y,w)=>{s.set(P,{fulfil:y,reject:w})})})}let d="";for(;;){const{done:S,value:P}=await o.read();if(S&&!d)break;for(d+=!P&&d?` +}`,m=`__svelte_${Yn(d)}_${o}`,S=nn(t),{stylesheet:P,rules:y}=jt.get(S)||Xn(S,t);y[m]||(y[m]=!0,P.insertRule(`@keyframes ${m} ${d}`,P.cssRules.length));const w=t.style.animation||"";return t.style.animation=`${w?`${w}, `:""}${m} ${r}ms linear ${i}ms 1 both`,Ct+=1,m}function Qn(t,e){const n=(t.style.animation||"").split(", "),r=n.filter(e?a=>a.indexOf(e)<0:a=>a.indexOf("__svelte")===-1),i=n.length-r.length;i&&(t.style.animation=r.join(", "),Ct-=i,Ct||Zn())}function Zn(){fe(()=>{Ct||(jt.forEach(t=>{const{ownerNode:e}=t.stylesheet;e&&H(e)}),jt.clear())})}let kt;function K(t){kt=t}function zt(){if(!kt)throw new Error("Function called outside component initialization");return kt}function Jt(t){zt().$$.on_mount.push(t)}function Ni(t){zt().$$.after_update.push(t)}function ji(){const t=zt();return(e,n,{cancelable:r=!1}={})=>{const i=t.$$.callbacks[e];if(i){const a=cn(e,n,{cancelable:r});return i.slice().forEach(s=>{s.call(t,a)}),!a.defaultPrevented}return!0}}function Ci(t,e){const n=t.$$.callbacks[e.type];n&&n.slice().forEach(r=>r.call(this,e))}const st=[],je=[];let lt=[];const Ce=[],ln=Promise.resolve();let oe=!1;function fn(){oe||(oe=!0,ln.then(de))}function Yt(){return fn(),ln}function It(t){lt.push(t)}const Xt=new Set;let it=0;function de(){if(it!==0)return;const t=kt;do{try{for(;itt.indexOf(r)===-1?e.push(r):n.push(r)),n.forEach(r=>r()),lt=e}let _t;function nr(){return _t||(_t=Promise.resolve(),_t.then(()=>{_t=null})),_t}function Qt(t,e,n){t.dispatchEvent(cn(`${e?"intro":"outro"}${n}`))}const Pt=new Set;let J;function rr(){J={r:0,c:[],p:J}}function ir(){J.r||rt(J.c),J=J.p}function un(t,e){t&&t.i&&(Pt.delete(t),t.i(e))}function ar(t,e,n,r){if(t&&t.o){if(Pt.has(t))return;Pt.add(t),J.c.push(()=>{Pt.delete(t),r&&(n&&t.d(1),r())}),t.o(e)}else r&&r()}const or={duration:0};function Ii(t,e,n,r){let a=e(t,n,{direction:"both"}),s=r?0:1,o=null,c=null,l=null,d;function m(){l&&Qn(t,l)}function S(y,w){const R=y.b-s;return w*=Math.abs(R),{a:s,b:y.b,d:R,duration:w,start:y.start,end:y.start+w,group:y.group}}function P(y){const{delay:w=0,duration:R=300,easing:x=Xe,tick:v=z,css:L}=a||or,Z={start:jn()+w,b:y};y||(Z.group=J,J.r+=1),"inert"in t&&(y?d!==void 0&&(t.inert=d):(d=t.inert,t.inert=!0)),o||c?c=Z:(L&&(m(),l=Ne(t,s,y,R,w,x,L)),y&&v(0,1),o=S(Z,R),It(()=>Qt(t,y,"start")),Cn(V=>{if(c&&V>c.start&&(o=S(c,R),c=null,Qt(t,o.b,"start"),L&&(m(),l=Ne(t,s,o.b,o.duration,0,x,a.css))),o){if(V>=o.end)v(s=o.b,1-s),Qt(t,o.b,"end"),c||(o.b?m():--o.group.r||rt(o.group.c)),o=null;else if(V>=o.start){const Y=V-o.start;s=o.a+o.d*x(Y/o.duration),v(s,1-s)}}return!!(o||c)}))}return{run(y){Mt(a)?nr().then(()=>{a=a({direction:y?"in":"out"}),P(y)}):P(y)},end(){m(),o=c=null}}}function Ui(t,e){const n=e.token={};function r(i,a,s,o){if(e.token!==n)return;e.resolved=o;let c=e.ctx;s!==void 0&&(c=c.slice(),c[s]=o);const l=i&&(e.current=i)(c);let d=!1;e.block&&(e.blocks?e.blocks.forEach((m,S)=>{S!==a&&m&&(rr(),ar(m,1,1,()=>{e.blocks[S]===m&&(e.blocks[S]=null)}),ir())}):e.block.d(1),l.c(),un(l,1),l.m(e.mount(),e.anchor),d=!0),e.block=l,e.blocks&&(e.blocks[a]=l),d&&de()}if(Pn(t)){const i=zt();if(t.then(a=>{K(i),r(e.then,1,e.value,a),K(null)},a=>{if(K(i),r(e.catch,2,e.error,a),K(null),!e.hasCatch)throw a}),e.current!==e.pending)return r(e.pending,0),!0}else{if(e.current!==e.then)return r(e.then,1,e.value,t),!0;e.resolved=t}}function Di(t){return(t==null?void 0:t.length)!==void 0?t:Array.from(t)}function dn(t,e){const n={},r={},i={$$scope:1};let a=t.length;for(;a--;){const s=t[a],o=e[a];if(o){for(const c in s)c in o||(r[c]=1);for(const c in o)i[c]||(n[c]=o[c],i[c]=1);t[a]=o}else for(const c in s)i[c]=1}for(const s in r)s in n||(n[s]=void 0);return n}function Fi(t){t&&t.c()}function Mi(t,e){t&&t.l(e)}function sr(t,e,n){const{fragment:r,after_update:i}=t.$$;r&&r.m(e,n),It(()=>{const a=t.$$.on_mount.map(Qe).filter(Mt);t.$$.on_destroy?t.$$.on_destroy.push(...a):rt(a),t.$$.on_mount=[]}),i.forEach(It)}function cr(t,e){const n=t.$$;n.fragment!==null&&(er(n.after_update),rt(n.on_destroy),n.fragment&&n.fragment.d(e),n.on_destroy=n.fragment=null,n.ctx=[])}function lr(t,e){t.$$.dirty[0]===-1&&(st.push(t),fn(),t.$$.dirty.fill(0)),t.$$.dirty[e/31|0]|=1<{const y=P.length?P[0]:S;return l.ctx&&i(l.ctx[m],l.ctx[m]=y)&&(!l.skip_bound&&l.bound[m]&&l.bound[m](y),d&&lr(t,m)),S}):[],l.update(),d=!0,rt(l.before_update),l.fragment=r?r(l.ctx):!1,e.target){if(e.hydrate){In();const m=xt(e.target);l.fragment&&l.fragment.l(m),m.forEach(H)}else l.fragment&&l.fragment.c();e.intro&&un(t.$$.fragment),sr(t,e.target,e.anchor),Un(),de()}K(c)}class pn{constructor(){G(this,"$$");G(this,"$$set")}$destroy(){cr(this,1),this.$destroy=z}$on(e,n){if(!Mt(n))return z;const r=this.$$.callbacks[e]||(this.$$.callbacks[e]=[]);return r.push(n),()=>{const i=r.indexOf(n);i!==-1&&r.splice(i,1)}}$set(e){this.$$set&&!On(e)&&(this.$$.skip_bound=!0,this.$$set(e),this.$$.skip_bound=!1)}}const fr="4";function ur(t,e){return t==="/"||e==="ignore"?t:e==="never"?t.endsWith("/")?t.slice(0,-1):t:e==="always"&&!t.endsWith("/")?t+"/":t}function dr(t){return t.split("%25").map(decodeURI).join("%25")}function hr(t){for(const e in t)t[e]=decodeURIComponent(t[e]);return t}const pr=["href","pathname","search","searchParams","toString","toJSON"];function _r(t,e){const n=new URL(t);for(const r of pr)Object.defineProperty(n,r,{get(){return e(),t[r]},enumerable:!0,configurable:!0});return gr(n),n}function gr(t){Object.defineProperty(t,"hash",{get(){throw new Error("Cannot access event.url.hash. Consider using `$page.url.hash` inside a component instead")}})}const mr="/__data.json";function yr(t){return t.replace(/\/$/,"")+mr}function wr(...t){let e=5381;for(const n of t)if(typeof n=="string"){let r=n.length;for(;r;)e=e*33^n.charCodeAt(--r)}else if(ArrayBuffer.isView(n)){const r=new Uint8Array(n.buffer,n.byteOffset,n.byteLength);let i=r.length;for(;i;)e=e*33^r[--i]}else throw new TypeError("value must be a string or TypedArray");return(e>>>0).toString(36)}const _n=window.fetch;window.fetch=(t,e)=>((t instanceof Request?t.method:(e==null?void 0:e.method)||"GET")!=="GET"&&wt.delete(he(t)),_n(t,e));const wt=new Map;function br(t,e){const n=he(t,e),r=document.querySelector(n);if(r!=null&&r.textContent){const{body:i,...a}=JSON.parse(r.textContent),s=r.getAttribute("data-ttl");return s&&wt.set(n,{body:i,init:a,ttl:1e3*Number(s)}),Promise.resolve(new Response(i,a))}return window.fetch(t,e)}function vr(t,e,n){if(wt.size>0){const r=he(t,n),i=wt.get(r);if(i){if(performance.now(){const i=/^\[\.\.\.(\w+)(?:=(\w+))?\]$/.exec(r);if(i)return e.push({name:i[1],matcher:i[2],optional:!1,rest:!0,chained:!0}),"(?:/(.*))?";const a=/^\[\[(\w+)(?:=(\w+))?\]\]$/.exec(r);if(a)return e.push({name:a[1],matcher:a[2],optional:!0,rest:!1,chained:!0}),"(?:/([^/]+))?";if(!r)return;const s=r.split(/\[(.+?)\](?!\])/);return"/"+s.map((c,l)=>{if(l%2){if(c.startsWith("x+"))return Zt(String.fromCharCode(parseInt(c.slice(2),16)));if(c.startsWith("u+"))return Zt(String.fromCharCode(...c.slice(2).split("-").map(w=>parseInt(w,16))));const d=xr.exec(c);if(!d)throw new Error(`Invalid param: ${c}. Params and matcher names can only have underscores and alphanumeric characters.`);const[,m,S,P,y]=d;return e.push({name:P,matcher:y,optional:!!m,rest:!!S,chained:S?l===1&&s[0]==="":!1}),S?"(.*?)":m?"([^/]*)?":"([^/]+?)"}return Zt(c)}).join("")}).join("")}/?$`),params:e}}function $r(t){return!/^\([^)]+\)$/.test(t)}function Sr(t){return t.slice(1).split("/").filter($r)}function Er(t,e,n){const r={},i=t.slice(1),a=i.filter(o=>o!==void 0);let s=0;for(let o=0;od).join("/"),s=0),l===void 0){c.rest&&(r[c.name]="");continue}if(!c.matcher||n[c.matcher](l)){r[c.name]=l;const d=e[o+1],m=i[o+1];d&&!d.rest&&d.optional&&m&&c.chained&&(s=0),!d&&!m&&Object.keys(r).length===a.length&&(s=0);continue}if(c.optional&&c.chained){s++;continue}return}if(!s)return r}function Zt(t){return t.normalize().replace(/[[\]]/g,"\\$&").replace(/%/g,"%25").replace(/\//g,"%2[Ff]").replace(/\?/g,"%3[Ff]").replace(/#/g,"%23").replace(/[.*+?^${}()|\\]/g,"\\$&")}function Ar({nodes:t,server_loads:e,dictionary:n,matchers:r}){const i=new Set(e);return Object.entries(n).map(([o,[c,l,d]])=>{const{pattern:m,params:S}=kr(o),P={id:o,exec:y=>{const w=m.exec(y);if(w)return Er(w,S,r)},errors:[1,...d||[]].map(y=>t[y]),layouts:[0,...l||[]].map(s),leaf:a(c)};return P.errors.length=P.layouts.length=Math.max(P.errors.length,P.layouts.length),P});function a(o){const c=o<0;return c&&(o=~o),[c,t[o]]}function s(o){return o===void 0?o:[i.has(o),t[o]]}}function gn(t){try{return JSON.parse(sessionStorage[t])}catch{}}function Ie(t,e){const n=JSON.stringify(e);try{sessionStorage[t]=n}catch{}}const at=[];function Rr(t,e){return{subscribe:Vt(t,e).subscribe}}function Vt(t,e=z){let n;const r=new Set;function i(o){if(ce(t,o)&&(t=o,n)){const c=!at.length;for(const l of r)l[1](),at.push(l,t);if(c){for(let l=0;l{r.delete(l),r.size===0&&n&&(n(),n=null)}}return{set:i,update:a,subscribe:s}}function Hi(t,e,n){const r=!Array.isArray(t),i=r?[t]:t;if(!i.every(Boolean))throw new Error("derived() expects stores as input, got a falsy value");const a=e.length<2;return Rr(n,(s,o)=>{let c=!1;const l=[];let d=0,m=z;const S=()=>{if(d)return;m();const y=e(r?l[0]:l,s,o);a?s(y):m=Mt(y)?y:z},P=i.map((y,w)=>le(y,R=>{l[w]=R,d&=~(1<{d|=1<s)}function i(s){n=!1,e.set(s)}function a(s){let o;return e.subscribe(c=>{(o===void 0||n&&c!==o)&&s(o=c)})}return{notify:r,set:i,subscribe:a}}function Pr(){const{set:t,subscribe:e}=Vt(!1);let n;async function r(){clearTimeout(n);try{const i=await fetch(`${Tr}/_app/version.json`,{headers:{pragma:"no-cache","cache-control":"no-cache"}});if(!i.ok)return!1;const s=(await i.json()).version!==Lr;return s&&(t(!0),clearTimeout(n)),s}catch{return!1}}return{subscribe:e,check:r}}function Ot(t,e){return t.origin!==Dt||!t.pathname.startsWith(e)}function Or(t){return t.filter(e=>e!=null)}const bn=new Set(["load","prerender","csr","ssr","trailingSlash","config"]);[...bn];const Nr=new Set([...bn]);[...Nr];async function jr(t,e){var n;for(const r in t)if(typeof((n=t[r])==null?void 0:n.then)=="function")return Object.fromEntries(await Promise.all(Object.entries(t).map(async([i,a])=>[i,await a])));return t}class yt{constructor(e,n){this.status=e,typeof n=="string"?this.body={message:n}:n?this.body=n:this.body={message:`Error: ${e}`}}toString(){return JSON.stringify(this.body)}}class He{constructor(e,n){this.status=e,this.location=n}}const Cr="x-sveltekit-invalidated",Ir="x-sveltekit-trailing-slash";function Ur(t){t.client}const W={url:Me({}),page:Me({}),navigating:Vt(null),updated:Pr()},et=gn(yn)??{},gt=gn(mn)??{};function ee(t){et[t]=mt()}function nt(t){return location.href=t.href,new Promise(()=>{})}function Dr(t,e){var $e;const n=Ar(t),r=t.nodes[0],i=t.nodes[1];r(),i();const a=document.documentElement,s=[],o=[];let c=null;const l={before_navigate:[],on_navigate:[],after_navigate:[]};let d={branch:[],error:null,url:null},m=!1,S=!1,P=!0,y=!1,w=!1,R=!1,x=!1,v,L=($e=history.state)==null?void 0:$e[B];L||(L=Date.now(),history.replaceState({...history.state,[B]:L},"",location.href));const Z=et[L];Z&&(history.scrollRestoration="manual",scrollTo(Z.x,Z.y));let V,Y,ut;async function pe(){if(ut=ut||Promise.resolve(),await ut,!ut)return;ut=null;const f=new URL(location.href),_=ht(f,!0);c=null;const u=Y={},p=_&&await Gt(_);if(u===Y&&p){if(p.type==="redirect")return $t(new URL(p.location,f).href,{},1,u);p.props.page!==void 0&&(V=p.props.page),v.$set(p.props)}}function _e(f){o.some(_=>_==null?void 0:_.snapshot)&&(gt[f]=o.map(_=>{var u;return(u=_==null?void 0:_.snapshot)==null?void 0:u.capture()}))}function ge(f){var _;(_=gt[f])==null||_.forEach((u,p)=>{var h,g;(g=(h=o[p])==null?void 0:h.snapshot)==null||g.restore(u)})}function me(){ee(L),Ie(yn,et),_e(L),Ie(mn,gt)}async function $t(f,{noScroll:_=!1,replaceState:u=!1,keepFocus:p=!1,state:h={},invalidateAll:g=!1},b,A){return typeof f=="string"&&(f=new URL(f,Ue(document))),Rt({url:f,scroll:_?mt():null,keepfocus:p,redirect_count:b,details:{state:h,replaceState:u},nav_token:A,accepted:()=>{g&&(x=!0)},blocked:()=>{},type:"goto"})}async function ye(f){return c={id:f.id,promise:Gt(f).then(_=>(_.type==="loaded"&&_.state.error&&(c=null),_))},c.promise}async function St(...f){const u=n.filter(p=>f.some(h=>p.exec(h))).map(p=>Promise.all([...p.layouts,p.leaf].map(h=>h==null?void 0:h[1]())));await Promise.all(u)}function we(f){var p;d=f.state;const _=document.querySelector("style[data-sveltekit]");_&&_.remove(),V=f.props.page,v=new t.root({target:e,props:{...f.props,stores:W,components:o},hydrate:!0}),ge(L);const u={from:null,to:{params:d.params,route:{id:((p=d.route)==null?void 0:p.id)??null},url:new URL(location.href)},willUnload:!1,type:"enter",complete:Promise.resolve()};l.after_navigate.forEach(h=>h(u)),S=!0}async function dt({url:f,params:_,branch:u,status:p,error:h,route:g,form:b}){let A="never";for(const $ of u)($==null?void 0:$.slash)!==void 0&&(A=$.slash);f.pathname=ur(f.pathname,A),f.search=f.search;const T={type:"loaded",state:{url:f,params:_,branch:u,error:h,route:g},props:{constructors:Or(u).map($=>$.node.component)}};b!==void 0&&(T.props.form=b);let E={},I=!V,j=0;for(let $=0;$(A.route=!0,k[D])}),params:new Proxy(p,{get:(k,D)=>(A.params.add(D),k[D])}),data:(g==null?void 0:g.data)??null,url:_r(u,()=>{A.url=!0}),async fetch(k,D){let F;k instanceof Request?(F=k.url,D={body:k.method==="GET"||k.method==="HEAD"?void 0:await k.blob(),cache:k.cache,credentials:k.credentials,headers:k.headers,integrity:k.integrity,keepalive:k.keepalive,method:k.method,mode:k.mode,redirect:k.redirect,referrer:k.referrer,referrerPolicy:k.referrerPolicy,signal:k.signal,...D}):F=k;const q=new URL(F,u);return U(q.href),q.origin===u.origin&&(F=q.href.slice(u.origin.length)),S?vr(F,q.href,D):br(F,D)},setHeaders:()=>{},depends:U,parent(){return A.parent=!0,_()}};b=await T.universal.load.call(null,$)??null,b=b?await jr(b,h.id):null}return{node:T,loader:f,server:g,universal:(I=T.universal)!=null&&I.load?{type:"data",data:b,uses:A}:null,data:b??(g==null?void 0:g.data)??null,slash:((j=T.universal)==null?void 0:j.trailingSlash)??(g==null?void 0:g.slash)}}function be(f,_,u,p,h){if(x)return!0;if(!p)return!1;if(p.parent&&f||p.route&&_||p.url&&u)return!0;for(const g of p.params)if(h[g]!==d.params[g])return!0;for(const g of p.dependencies)if(s.some(b=>b(new URL(g))))return!0;return!1}function Bt(f,_){return(f==null?void 0:f.type)==="data"?f:(f==null?void 0:f.type)==="skip"?_??null:null}async function Gt({id:f,invalidating:_,url:u,params:p,route:h}){if((c==null?void 0:c.id)===f)return c.promise;const{errors:g,layouts:b,leaf:A}=h,T=[...b,A];g.forEach(O=>O==null?void 0:O().catch(()=>{})),T.forEach(O=>O==null?void 0:O[1]().catch(()=>{}));let E=null;const I=d.url?f!==d.url.pathname+d.url.search:!1,j=d.route?h.id!==d.route.id:!1;let U=!1;const $=T.map((O,C)=>{var tt;const N=d.branch[C],M=!!(O!=null&&O[0])&&((N==null?void 0:N.loader)!==O[1]||be(U,j,I,(tt=N.server)==null?void 0:tt.uses,p));return M&&(U=!0),M});if($.some(Boolean)){try{E=await ze(u,$)}catch(O){return Et({status:O instanceof yt?O.status:500,error:await pt(O,{url:u,params:p,route:{id:h.id}}),url:u,route:h})}if(E.type==="redirect")return E}const k=E==null?void 0:E.nodes;let D=!1;const F=T.map(async(O,C)=>{var Wt;if(!O)return;const N=d.branch[C],M=k==null?void 0:k[C];if((!M||M.type==="skip")&&O[1]===(N==null?void 0:N.loader)&&!be(D,j,I,(Wt=N.universal)==null?void 0:Wt.uses,p))return N;if(D=!0,(M==null?void 0:M.type)==="error")throw M;return qt({loader:O[1],url:u,params:p,route:h,parent:async()=>{var Ee;const Se={};for(let Kt=0;Kt{});const q=[];for(let O=0;OPromise.resolve({}),server_data_node:Bt(g)}),T={node:await i(),loader:i,universal:null,server:null,data:null};return await dt({url:u,params:h,branch:[A,T],status:f,error:_,route:null})}function ht(f,_){if(Ot(f,X))return;const u=At(f);for(const p of n){const h=p.exec(u);if(h)return{id:f.pathname+f.search,invalidating:_,route:p,params:hr(h),url:f}}}function At(f){return dr(f.pathname.slice(X.length)||"/")}function xe({url:f,type:_,intent:u,delta:p}){let h=!1;const g=Ve(d,u,f,_);p!==void 0&&(g.navigation.delta=p);const b={...g.navigation,cancel:()=>{h=!0,g.reject(new Error("navigation was cancelled"))}};return w||l.before_navigate.forEach(A=>A(b)),h?null:g}async function Rt({url:f,scroll:_,keepfocus:u,redirect_count:p,details:h,type:g,delta:b,nav_token:A={},accepted:T,blocked:E}){var F,q,O;const I=ht(f,!1),j=xe({url:f,type:g,delta:b,intent:I});if(!j){E();return}const U=L;T(),w=!0,S&&W.navigating.set(j.navigation),Y=A;let $=I&&await Gt(I);if(!$){if(Ot(f,X))return await nt(f);$=await ke(f,{id:null},await pt(new Error(`Not found: ${f.pathname}`),{url:f,params:{},route:{id:null}}),404)}if(f=(I==null?void 0:I.url)||f,Y!==A)return j.reject(new Error("navigation was aborted")),!1;if($.type==="redirect")if(p>=20)$=await Et({status:500,error:await pt(new Error("Redirect loop"),{url:f,params:{},route:{id:null}}),url:f,route:{id:null}});else return $t(new URL($.location,f).href,{},p+1,A),!1;else((F=$.props.page)==null?void 0:F.status)>=400&&await W.updated.check()&&await nt(f);if(s.length=0,x=!1,y=!0,ee(U),_e(U),(q=$.props.page)!=null&&q.url&&$.props.page.url.pathname!==f.pathname&&(f.pathname=(O=$.props.page)==null?void 0:O.url.pathname),h){const C=h.replaceState?0:1;if(h.state[B]=L+=C,history[h.replaceState?"replaceState":"pushState"](h.state,"",f),!h.replaceState){let N=L+1;for(;gt[N]||et[N];)delete gt[N],delete et[N],N+=1}}if(c=null,S){d=$.state,$.props.page&&($.props.page.url=f);const C=(await Promise.all(l.on_navigate.map(N=>N(j.navigation)))).filter(N=>typeof N=="function");if(C.length>0){let N=function(){l.after_navigate=l.after_navigate.filter(M=>!C.includes(M))};C.push(N),l.after_navigate.push(...C)}v.$set($.props)}else we($);const{activeElement:k}=document;if(await Yt(),P){const C=f.hash&&document.getElementById(decodeURIComponent(f.hash.slice(1)));_?scrollTo(_.x,_.y):C?C.scrollIntoView():scrollTo(0,0)}const D=document.activeElement!==k&&document.activeElement!==document.body;!u&&!D&&ne(),P=!0,$.props.page&&(V=$.props.page),w=!1,g==="popstate"&&ge(L),j.fulfil(void 0),l.after_navigate.forEach(C=>C(j.navigation)),W.navigating.set(null),y=!1}async function ke(f,_,u,p){return f.origin===Dt&&f.pathname===location.pathname&&!m?await Et({status:p,error:u,url:f,route:_}):await nt(f)}function An(){let f;a.addEventListener("mousemove",g=>{const b=g.target;clearTimeout(f),f=setTimeout(()=>{p(b,2)},20)});function _(g){p(g.composedPath()[0],1)}a.addEventListener("mousedown",_),a.addEventListener("touchstart",_,{passive:!0});const u=new IntersectionObserver(g=>{for(const b of g)b.isIntersecting&&(St(At(new URL(b.target.href))),u.unobserve(b.target))},{threshold:0});function p(g,b){const A=Fe(g,a);if(!A)return;const{url:T,external:E,download:I}=te(A,X);if(E||I)return;const j=Tt(A);if(!j.reload)if(b<=j.preload_data){const U=ht(T,!1);U&&ye(U)}else b<=j.preload_code&&St(At(T))}function h(){u.disconnect();for(const g of a.querySelectorAll("a")){const{url:b,external:A,download:T}=te(g,X);if(A||T)continue;const E=Tt(g);E.reload||(E.preload_code===Ut.viewport&&u.observe(g),E.preload_code===Ut.eager&&St(At(b)))}}l.after_navigate.push(h),h()}function pt(f,_){return f instanceof yt?f.body:t.hooks.handleError({error:f,event:_})??{message:_.route.id!=null?"Internal Error":"Not Found"}}return{after_navigate:f=>{Jt(()=>(l.after_navigate.push(f),()=>{const _=l.after_navigate.indexOf(f);l.after_navigate.splice(_,1)}))},before_navigate:f=>{Jt(()=>(l.before_navigate.push(f),()=>{const _=l.before_navigate.indexOf(f);l.before_navigate.splice(_,1)}))},on_navigate:f=>{Jt(()=>(l.on_navigate.push(f),()=>{const _=l.on_navigate.indexOf(f);l.on_navigate.splice(_,1)}))},disable_scroll_handling:()=>{(y||!S)&&(P=!1)},goto:(f,_={})=>$t(f,_,0),invalidate:f=>{if(typeof f=="function")s.push(f);else{const{href:_}=new URL(f,location.href);s.push(u=>u.href===_)}return pe()},invalidate_all:()=>(x=!0,pe()),preload_data:async f=>{const _=new URL(f,Ue(document)),u=ht(_,!1);if(!u)throw new Error(`Attempted to preload a URL that does not belong to this app: ${_}`);await ye(u)},preload_code:St,apply_action:async f=>{if(f.type==="error"){const _=new URL(location.href),{branch:u,route:p}=d;if(!p)return;const h=await ve(d.branch.length,u,p.errors);if(h){const g=await dt({url:_,params:d.params,branch:u.slice(0,h.idx).concat(h.node),status:f.status??500,error:f.error,route:p});d=g.state,v.$set(g.props),Yt().then(ne)}}else f.type==="redirect"?$t(f.location,{invalidateAll:!0},0):(v.$set({form:null,page:{...V,form:f.data,status:f.status}}),await Yt(),v.$set({form:f.data}),f.type==="success"&&ne())},_start_router:()=>{var _;history.scrollRestoration="manual",addEventListener("beforeunload",u=>{let p=!1;if(me(),!w){const h=Ve(d,void 0,null,"leave"),g={...h.navigation,cancel:()=>{p=!0,h.reject(new Error("navigation was cancelled"))}};l.before_navigate.forEach(b=>b(g))}p?(u.preventDefault(),u.returnValue=""):history.scrollRestoration="auto"}),addEventListener("visibilitychange",()=>{document.visibilityState==="hidden"&&me()}),(_=navigator.connection)!=null&&_.saveData||An(),a.addEventListener("click",u=>{var U;if(u.button||u.which!==1||u.metaKey||u.ctrlKey||u.shiftKey||u.altKey||u.defaultPrevented)return;const p=Fe(u.composedPath()[0],a);if(!p)return;const{url:h,external:g,target:b,download:A}=te(p,X);if(!h)return;if(b==="_parent"||b==="_top"){if(window.parent!==window)return}else if(b&&b!=="_self")return;const T=Tt(p);if(!(p instanceof SVGAElement)&&h.protocol!==location.protocol&&!(h.protocol==="https:"||h.protocol==="http:")||A)return;if(g||T.reload){xe({url:h,type:"link"})?w=!0:u.preventDefault();return}const[I,j]=h.href.split("#");if(j!==void 0&&I===location.href.split("#")[0]){if(d.url.hash===h.hash){u.preventDefault(),(U=p.ownerDocument.getElementById(j))==null||U.scrollIntoView();return}if(R=!0,ee(L),f(h),!T.replace_state)return;R=!1,u.preventDefault()}Rt({url:h,scroll:T.noscroll?mt():null,keepfocus:T.keep_focus??!1,redirect_count:0,details:{state:{},replaceState:T.replace_state??h.href===location.href},accepted:()=>u.preventDefault(),blocked:()=>u.preventDefault(),type:"link"})}),a.addEventListener("submit",u=>{if(u.defaultPrevented)return;const p=HTMLFormElement.prototype.cloneNode.call(u.target),h=u.submitter;if(((h==null?void 0:h.formMethod)||p.method)!=="get")return;const b=new URL((h==null?void 0:h.hasAttribute("formaction"))&&(h==null?void 0:h.formAction)||p.action);if(Ot(b,X))return;const A=u.target,{keep_focus:T,noscroll:E,reload:I,replace_state:j}=Tt(A);if(I)return;u.preventDefault(),u.stopPropagation();const U=new FormData(A),$=h==null?void 0:h.getAttribute("name");$&&U.append($,(h==null?void 0:h.getAttribute("value"))??""),b.search=new URLSearchParams(U).toString(),Rt({url:b,scroll:E?mt():null,keepfocus:T??!1,redirect_count:0,details:{state:{},replaceState:j??b.href===location.href},nav_token:{},accepted:()=>{},blocked:()=>{},type:"form"})}),addEventListener("popstate",async u=>{var p;if(Y={},(p=u.state)!=null&&p[B]){if(u.state[B]===L)return;const h=et[u.state[B]],g=new URL(location.href);if(d.url.href.split("#")[0]===location.href.split("#")[0]){f(g),et[L]=mt(),L=u.state[B],scrollTo(h.x,h.y);return}const b=u.state[B]-L;await Rt({url:g,scroll:h,keepfocus:!1,redirect_count:0,details:null,accepted:()=>{L=u.state[B]},blocked:()=>{history.go(-b)},type:"popstate",delta:b,nav_token:Y})}else if(!R){const h=new URL(location.href);f(h)}}),addEventListener("hashchange",()=>{R&&(R=!1,history.replaceState({...history.state,[B]:++L},"",location.href))});for(const u of document.querySelectorAll("link"))u.rel==="icon"&&(u.href=u.href);addEventListener("pageshow",u=>{u.persisted&&W.navigating.set(null)});function f(u){d.url=u,W.page.set({...V,url:u}),W.page.notify()}},_hydrate:async({status:f=200,error:_,node_ids:u,params:p,route:h,data:g,form:b})=>{m=!0;const A=new URL(location.href);({params:p={},route:h={id:null}}=ht(A,!1)||{});let T;try{const E=u.map(async(U,$)=>{const k=g[$];return k!=null&&k.uses&&(k.uses=vn(k.uses)),qt({loader:t.nodes[U],url:A,params:p,route:h,parent:async()=>{const D={};for(let F=0;F<$;F+=1)Object.assign(D,(await E[F]).data);return D},server_data_node:Bt(k)})}),I=await Promise.all(E),j=n.find(({id:U})=>U===h.id);if(j){const U=j.layouts;for(let $=0;$a?"1":"0").join(""));const r=await _n(n.href);if((i=r.headers.get("content-type"))!=null&&i.includes("text/html")&&await nt(t),!r.ok)throw new yt(r.status,await r.json());return new Promise(async a=>{var m;const s=new Map,o=r.body.getReader(),c=new TextDecoder;function l(S){return Ln(S,{Promise:P=>new Promise((y,w)=>{s.set(P,{fulfil:y,reject:w})})})}let d="";for(;;){const{done:S,value:P}=await o.read();if(S&&!d)break;for(d+=!P&&d?` `:c.decode(P);;){const y=d.indexOf(` `);if(y===-1)break;const w=JSON.parse(d.slice(0,y));if(d=d.slice(y+1),w.type==="redirect")return a(w);if(w.type==="data")(m=w.nodes)==null||m.forEach(R=>{(R==null?void 0:R.type)==="data"&&(R.uses=vn(R.uses),R.data=l(R.data))}),a(w);else if(w.type==="chunk"){const{id:R,data:x,error:v}=w,L=s.get(R);s.delete(R),v?L.reject(l(v)):L.fulfil(l(x))}}}})}function vn(t){return{dependencies:new Set((t==null?void 0:t.dependencies)??[]),params:new Set((t==null?void 0:t.params)??[]),parent:!!(t!=null&&t.parent),route:!!(t!=null&&t.route),url:!!(t!=null&&t.url)}}function ne(){const t=document.querySelector("[autofocus]");if(t)t.focus();else{const e=document.body,n=e.getAttribute("tabindex");e.tabIndex=-1,e.focus({preventScroll:!0,focusVisible:!1}),n!==null?e.setAttribute("tabindex",n):e.removeAttribute("tabindex");const r=getSelection();if(r&&r.type!=="None"){const i=[];for(let a=0;a{if(r.rangeCount===i.length){for(let a=0;a{i=d,a=m});return s.catch(()=>{}),{navigation:{from:{params:t.params,route:{id:((c=t.route)==null?void 0:c.id)??null},url:t.url},to:n&&{params:(e==null?void 0:e.params)??null,route:{id:((l=e==null?void 0:e.route)==null?void 0:l.id)??null},url:n},willUnload:!e,type:r,complete:s},fulfil:i,reject:a}}async function zi(t,e,n){const r=Dr(t,e);Ur({client:r}),n?await r._hydrate(n):r.goto(location.href,{replaceState:!0}),r._start_router()}typeof window<"u"&&(window.__svelte||(window.__svelte={v:new Set})).v.add(fr);const Fr=()=>{const t=W;return{page:{subscribe:t.page.subscribe},navigating:{subscribe:t.navigating.subscribe},updated:t.updated}},Mr={subscribe(t){return Fr().page.subscribe(t)}};function Hr(t){var c;let e,n=t[0].status+"",r,i,a,s=((c=t[0].error)==null?void 0:c.message)+"",o;return{c(){e=ft("h1"),r=vt(n),i=qn(),a=ft("p"),o=vt(s)},l(l){e=ie(l,"H1",{});var d=xt(e);r=ae(d,n),d.forEach(H),i=Wn(l),a=ie(l,"P",{});var m=xt(a);o=ae(m,s),m.forEach(H)},m(l,d){Q(l,e,d),re(e,r),Q(l,i,d),Q(l,a,d),re(a,o)},p(l,[d]){var m;d&1&&n!==(n=l[0].status+"")&&Oe(r,n),d&1&&s!==(s=((m=l[0].error)==null?void 0:m.message)+"")&&Oe(o,s)},i:z,o:z,d(l){l&&(H(e),H(i),H(a))}}}function zr(t,e,n){let r;return Nn(t,Mr,i=>n(0,r=i)),[r]}let Vi=class extends pn{constructor(e){super(),hn(this,e,zr,Hr,ce,{})}};const xn=Object.freeze({left:0,top:0,width:16,height:16}),kn=Object.freeze({rotate:0,vFlip:!1,hFlip:!1}),Ft=Object.freeze({...xn,...kn});Object.freeze({...Ft,body:"",hidden:!1});({...xn});const $n=Object.freeze({width:null,height:null}),Sn=Object.freeze({...$n,...kn});function Vr(t,e){const n={...t};for(const r in e){const i=e[r],a=typeof i;r in $n?(i===null||i&&(a==="string"||a==="number"))&&(n[r]=i):a===typeof n[r]&&(n[r]=r==="rotate"?i%4:i)}return n}const qr=/[\s,]+/;function Br(t,e){e.split(qr).forEach(n=>{switch(n.trim()){case"horizontal":t.hFlip=!0;break;case"vertical":t.vFlip=!0;break}})}function Gr(t,e=0){const n=t.replace(/^-?[0-9.]*/,"");function r(i){for(;i<0;)i+=4;return i%4}if(n===""){const i=parseInt(t);return isNaN(i)?0:r(i)}else if(n!==t){let i=0;switch(n){case"%":i=25;break;case"deg":i=90}if(i){let a=parseFloat(t.slice(0,t.length-n.length));return isNaN(a)?0:(a=a/i,a%1===0?r(a):0)}}return e}const Wr=/(-?[0-9.]*[0-9]+[0-9.]*)/g,Kr=/^-?[0-9.]*[0-9]+[0-9.]*$/g;function qe(t,e,n){if(e===1)return t;if(n=n||100,typeof t=="number")return Math.ceil(t*e*n)/n;if(typeof t!="string")return t;const r=t.split(Wr);if(r===null||!r.length)return t;const i=[];let a=r.shift(),s=Kr.test(a);for(;;){if(s){const o=parseFloat(a);isNaN(o)?i.push(a):i.push(Math.ceil(o*e*n)/n)}else i.push(a);if(a=r.shift(),a===void 0)return i.join("");s=!s}}const Jr=t=>t==="unset"||t==="undefined"||t==="none";function Yr(t,e){const n={...Ft,...t},r={...Sn,...e},i={left:n.left,top:n.top,width:n.width,height:n.height};let a=n.body;[n,r].forEach(y=>{const w=[],R=y.hFlip,x=y.vFlip;let v=y.rotate;R?x?v+=2:(w.push("translate("+(i.width+i.left).toString()+" "+(0-i.top).toString()+")"),w.push("scale(-1 1)"),i.top=i.left=0):x&&(w.push("translate("+(0-i.left).toString()+" "+(i.height+i.top).toString()+")"),w.push("scale(1 -1)"),i.top=i.left=0);let L;switch(v<0&&(v-=Math.floor(v/4)*4),v=v%4,v){case 1:L=i.height/2+i.top,w.unshift("rotate(90 "+L.toString()+" "+L.toString()+")");break;case 2:w.unshift("rotate(180 "+(i.width/2+i.left).toString()+" "+(i.height/2+i.top).toString()+")");break;case 3:L=i.width/2+i.left,w.unshift("rotate(-90 "+L.toString()+" "+L.toString()+")");break}v%2===1&&(i.left!==i.top&&(L=i.left,i.left=i.top,i.top=L),i.width!==i.height&&(L=i.width,i.width=i.height,i.height=L)),w.length&&(a=''+a+"")});const s=r.width,o=r.height,c=i.width,l=i.height;let d,m;s===null?(m=o===null?"1em":o==="auto"?l:o,d=qe(m,c/l)):(d=s==="auto"?c:s,m=o===null?qe(d,l/c):o==="auto"?l:o);const S={},P=(y,w)=>{Jr(w)||(S[y]=w.toString())};return P("width",d),P("height",m),S.viewBox=i.left.toString()+" "+i.top.toString()+" "+c.toString()+" "+l.toString(),{attributes:S,body:a}}const Xr=/\sid="(\S+)"/g,Qr="IconifyId"+Date.now().toString(16)+(Math.random()*16777216|0).toString(16);let Zr=0;function ti(t,e=Qr){const n=[];let r;for(;r=Xr.exec(t);)n.push(r[1]);if(!n.length)return t;const i="suffix"+(Math.random()*16777216|Date.now()).toString(16);return n.forEach(a=>{const s=typeof e=="function"?e(a):e+(Zr++).toString(),o=a.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");t=t.replace(new RegExp('([#;"])('+o+')([")]|\\.[a-z])',"g"),"$1"+s+i+"$3")}),t=t.replace(new RegExp(i,"g"),""),t}function ei(t,e){let n=t.indexOf("xlink:")===-1?"":' xmlns:xlink="http://www.w3.org/1999/xlink"';for(const r in e)n+=" "+r+'="'+e[r]+'"';return'"+t+""}function ni(t){return t.replace(/"/g,"'").replace(/%/g,"%25").replace(/#/g,"%23").replace(//g,"%3E").replace(/\s+/g," ")}function ri(t){return"data:image/svg+xml,"+ni(t)}function ii(t){return'url("'+ri(t)+'")'}const Be={...Sn,inline:!1},ai={xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink","aria-hidden":!0,role:"img"},oi={display:"inline-block"},se={"background-color":"currentColor"},En={"background-color":"transparent"},Ge={image:"var(--svg)",repeat:"no-repeat",size:"100% 100%"},We={"-webkit-mask":se,mask:se,background:En};for(const t in We){const e=We[t];for(const n in Ge)e[t+"-"+n]=Ge[n]}function si(t){return t+(t.match(/^[-0-9.]+$/)?"px":"")}function ci(t,e){const n=Vr(Be,e),r=e.mode||"svg",i=r==="svg"?{...ai}:{};t.body.indexOf("xlink:")===-1&&delete i["xmlns:xlink"];let a=typeof e.style=="string"?e.style:"";for(let x in e){const v=e[x];if(v!==void 0)switch(x){case"icon":case"style":case"onLoad":case"mode":break;case"inline":case"hFlip":case"vFlip":n[x]=v===!0||v==="true"||v===1;break;case"flip":typeof v=="string"&&Br(n,v);break;case"color":a=a+(a.length>0&&a.trim().slice(-1)!==";"?";":"")+"color: "+v+"; ";break;case"rotate":typeof v=="string"?n[x]=Gr(v):typeof v=="number"&&(n[x]=v);break;case"ariaHidden":case"aria-hidden":v!==!0&&v!=="true"&&delete i["aria-hidden"];break;default:if(x.slice(0,3)==="on:")break;Be[x]===void 0&&(i[x]=v)}}const s=Yr(t,n),o=s.attributes;if(n.inline&&(a="vertical-align: -0.125em; "+a),r==="svg"){Object.assign(i,o),a!==""&&(i.style=a);let x=0,v=e.id;return typeof v=="string"&&(v=v.replace(/-/g,"_")),{svg:!0,attributes:i,body:ti(s.body,v?()=>v+"ID"+x++:"iconifySvelte")}}const{body:c,width:l,height:d}=t,m=r==="mask"||(r==="bg"?!1:c.indexOf("currentColor")!==-1),S=ei(c,{...o,width:l+"",height:d+""}),y={"--svg":ii(S)},w=x=>{const v=o[x];v&&(y[x]=si(v))};w("width"),w("height"),Object.assign(y,oi,m?se:En);let R="";for(const x in y)R+=x+": "+y[x]+";";return i.style=R+a,{svg:!1,attributes:i}}const li=Object.create(null);function fi(t){const e=typeof t.icon=="string"?li[t.icon]:typeof t.icon=="object"?{...Ft,...t.icon}:null;return e===null||typeof e!="object"||typeof e.body!="string"?null:ci({...Ft,...e},t)}function Ke(t){let e;function n(a,s){return a[0].svg?di:ui}let r=n(t),i=r(t);return{c(){i.c(),e=Nt()},l(a){i.l(a),e=Nt()},m(a,s){i.m(a,s),Q(a,e,s)},p(a,s){r===(r=n(a))&&i?i.p(a,s):(i.d(1),i=r(a),i&&(i.c(),i.m(e.parentNode,e)))},d(a){a&&H(e),i.d(a)}}}function ui(t){let e,n=[t[0].attributes],r={};for(let i=0;i{n(1,e=bt(bt({},e),Re(i)))},t.$$.update=()=>{n(0,r=fi(e))},e=Re(e),[r]}class Bi extends pn{constructor(e){super(),hn(this,e,pi,hi,ce,{})}}function _i(t){const e=t-1;return e*e*e+1}function Gi(t,{delay:e=0,duration:n=400,easing:r=Xe}={}){const i=+getComputedStyle(t).opacity;return{delay:e,duration:n,easing:r,css:a=>`opacity: ${a*i}`}}function Wi(t,{delay:e=0,duration:n=400,easing:r=_i,axis:i="y"}={}){const a=getComputedStyle(t),s=+a.opacity,o=i==="y"?"height":"width",c=parseFloat(a[o]),l=i==="y"?["top","bottom"]:["left","right"],d=l.map(x=>`${x[0].toUpperCase()}${x.slice(1)}`),m=parseFloat(a[`padding${d[0]}`]),S=parseFloat(a[`padding${d[1]}`]),P=parseFloat(a[`margin${d[0]}`]),y=parseFloat(a[`margin${d[1]}`]),w=parseFloat(a[`border${d[0]}Width`]),R=parseFloat(a[`border${d[1]}Width`]);return{delay:e,duration:n,easing:r,css:x=>`overflow: hidden;opacity: ${Math.min(x*20,1)*s};${o}: ${x*c}px;padding-${l[0]}: ${x*m}px;padding-${l[1]}: ${x*S}px;margin-${l[0]}: ${x*P}px;margin-${l[1]}: ${x*y}px;border-${l[0]}-width: ${x*w}px;border-${l[1]}-width: ${x*R}px;`}}export{ji as $,ae as A,Oe as B,rr as C,Yt as D,Vi as E,je as F,Oi as G,Fi as H,Mi as I,sr as J,cr as K,Li as L,Nn as M,bt as N,Bi as O,Re as P,Hi as Q,yi as R,pn as S,Vt as T,Rr as U,Di as V,ki as W,$i as X,rt as Y,Ci as Z,Ri as _,ie as a,Ai as a0,It as a1,Ii as a2,Gi as a3,Wi as a4,Ui as a5,Pi as a6,zi as a7,xt as b,wi as c,H as d,ft as e,rn as f,Q as g,re as h,hn as i,xi as j,bi as k,ar as l,qn as m,Ei as n,Wn as o,Si as p,z as q,Jt as r,ce as s,un as t,vi as u,Nt as v,ir as w,Ni as x,Ti as y,vt as z}; diff --git a/_app/immutable/entry/app.e4be08bc.js b/_app/immutable/entry/app.9b71e76a.js similarity index 89% rename from _app/immutable/entry/app.e4be08bc.js rename to _app/immutable/entry/app.9b71e76a.js index 68a5276e..10719f2d 100644 --- a/_app/immutable/entry/app.e4be08bc.js +++ b/_app/immutable/entry/app.9b71e76a.js @@ -1 +1 @@ -import{_ as y}from"../chunks/preload-helper.a4192956.js";import{S as z,i as B,s as F,m as G,v as u,o as H,g as w,l as m,w as N,t as p,d,x as J,r as K,e as M,a as U,b as j,f as R,y as E,z as Q,A as W,B as X,C as D,D as Y,F as A,G as g,H as b,I as P,J as k,K as v}from"../chunks/vendor_svelte.565aa2ba.js";const ae={};function Z(o){let e,n,r;var i=o[1][0];function c(t,f){return{props:{data:t[3],form:t[2]}}}return i&&(e=g(i,c(o)),o[15](e)),{c(){e&&b(e.$$.fragment),n=u()},l(t){e&&P(e.$$.fragment,t),n=u()},m(t,f){e&&k(e,t,f),w(t,n,f),r=!0},p(t,f){if(f&2&&i!==(i=t[1][0])){if(e){D();const s=e;m(s.$$.fragment,1,0,()=>{v(s,1)}),N()}i?(e=g(i,c(t)),t[15](e),b(e.$$.fragment),p(e.$$.fragment,1),k(e,n.parentNode,n)):e=null}else if(i){const s={};f&8&&(s.data=t[3]),f&4&&(s.form=t[2]),e.$set(s)}},i(t){r||(e&&p(e.$$.fragment,t),r=!0)},o(t){e&&m(e.$$.fragment,t),r=!1},d(t){t&&d(n),o[15](null),e&&v(e,t)}}}function x(o){let e,n,r;var i=o[1][0];function c(t,f){return{props:{data:t[3],$$slots:{default:[ie]},$$scope:{ctx:t}}}}return i&&(e=g(i,c(o)),o[14](e)),{c(){e&&b(e.$$.fragment),n=u()},l(t){e&&P(e.$$.fragment,t),n=u()},m(t,f){e&&k(e,t,f),w(t,n,f),r=!0},p(t,f){if(f&2&&i!==(i=t[1][0])){if(e){D();const s=e;m(s.$$.fragment,1,0,()=>{v(s,1)}),N()}i?(e=g(i,c(t)),t[14](e),b(e.$$.fragment),p(e.$$.fragment,1),k(e,n.parentNode,n)):e=null}else if(i){const s={};f&8&&(s.data=t[3]),f&65591&&(s.$$scope={dirty:f,ctx:t}),e.$set(s)}},i(t){r||(e&&p(e.$$.fragment,t),r=!0)},o(t){e&&m(e.$$.fragment,t),r=!1},d(t){t&&d(n),o[14](null),e&&v(e,t)}}}function ee(o){let e,n,r;var i=o[1][1];function c(t,f){return{props:{data:t[4],form:t[2]}}}return i&&(e=g(i,c(o)),o[13](e)),{c(){e&&b(e.$$.fragment),n=u()},l(t){e&&P(e.$$.fragment,t),n=u()},m(t,f){e&&k(e,t,f),w(t,n,f),r=!0},p(t,f){if(f&2&&i!==(i=t[1][1])){if(e){D();const s=e;m(s.$$.fragment,1,0,()=>{v(s,1)}),N()}i?(e=g(i,c(t)),t[13](e),b(e.$$.fragment),p(e.$$.fragment,1),k(e,n.parentNode,n)):e=null}else if(i){const s={};f&16&&(s.data=t[4]),f&4&&(s.form=t[2]),e.$set(s)}},i(t){r||(e&&p(e.$$.fragment,t),r=!0)},o(t){e&&m(e.$$.fragment,t),r=!1},d(t){t&&d(n),o[13](null),e&&v(e,t)}}}function te(o){let e,n,r;var i=o[1][1];function c(t,f){return{props:{data:t[4],$$slots:{default:[ne]},$$scope:{ctx:t}}}}return i&&(e=g(i,c(o)),o[12](e)),{c(){e&&b(e.$$.fragment),n=u()},l(t){e&&P(e.$$.fragment,t),n=u()},m(t,f){e&&k(e,t,f),w(t,n,f),r=!0},p(t,f){if(f&2&&i!==(i=t[1][1])){if(e){D();const s=e;m(s.$$.fragment,1,0,()=>{v(s,1)}),N()}i?(e=g(i,c(t)),t[12](e),b(e.$$.fragment),p(e.$$.fragment,1),k(e,n.parentNode,n)):e=null}else if(i){const s={};f&16&&(s.data=t[4]),f&65575&&(s.$$scope={dirty:f,ctx:t}),e.$set(s)}},i(t){r||(e&&p(e.$$.fragment,t),r=!0)},o(t){e&&m(e.$$.fragment,t),r=!1},d(t){t&&d(n),o[12](null),e&&v(e,t)}}}function ne(o){let e,n,r;var i=o[1][2];function c(t,f){return{props:{data:t[5],form:t[2]}}}return i&&(e=g(i,c(o)),o[11](e)),{c(){e&&b(e.$$.fragment),n=u()},l(t){e&&P(e.$$.fragment,t),n=u()},m(t,f){e&&k(e,t,f),w(t,n,f),r=!0},p(t,f){if(f&2&&i!==(i=t[1][2])){if(e){D();const s=e;m(s.$$.fragment,1,0,()=>{v(s,1)}),N()}i?(e=g(i,c(t)),t[11](e),b(e.$$.fragment),p(e.$$.fragment,1),k(e,n.parentNode,n)):e=null}else if(i){const s={};f&32&&(s.data=t[5]),f&4&&(s.form=t[2]),e.$set(s)}},i(t){r||(e&&p(e.$$.fragment,t),r=!0)},o(t){e&&m(e.$$.fragment,t),r=!1},d(t){t&&d(n),o[11](null),e&&v(e,t)}}}function ie(o){let e,n,r,i;const c=[te,ee],t=[];function f(s,_){return s[1][2]?0:1}return e=f(o),n=t[e]=c[e](o),{c(){n.c(),r=u()},l(s){n.l(s),r=u()},m(s,_){t[e].m(s,_),w(s,r,_),i=!0},p(s,_){let l=e;e=f(s),e===l?t[e].p(s,_):(D(),m(t[l],1,1,()=>{t[l]=null}),N(),n=t[e],n?n.p(s,_):(n=t[e]=c[e](s),n.c()),p(n,1),n.m(r.parentNode,r))},i(s){i||(p(n),i=!0)},o(s){m(n),i=!1},d(s){s&&d(r),t[e].d(s)}}}function L(o){let e,n=o[7]&&O(o);return{c(){e=M("div"),n&&n.c(),this.h()},l(r){e=U(r,"DIV",{id:!0,"aria-live":!0,"aria-atomic":!0,style:!0});var i=j(e);n&&n.l(i),i.forEach(d),this.h()},h(){R(e,"id","svelte-announcer"),R(e,"aria-live","assertive"),R(e,"aria-atomic","true"),E(e,"position","absolute"),E(e,"left","0"),E(e,"top","0"),E(e,"clip","rect(0 0 0 0)"),E(e,"clip-path","inset(50%)"),E(e,"overflow","hidden"),E(e,"white-space","nowrap"),E(e,"width","1px"),E(e,"height","1px")},m(r,i){w(r,e,i),n&&n.m(e,null)},p(r,i){r[7]?n?n.p(r,i):(n=O(r),n.c(),n.m(e,null)):n&&(n.d(1),n=null)},d(r){r&&d(e),n&&n.d()}}}function O(o){let e;return{c(){e=Q(o[8])},l(n){e=W(n,o[8])},m(n,r){w(n,e,r)},p(n,r){r&256&&X(e,n[8])},d(n){n&&d(e)}}}function se(o){let e,n,r,i,c;const t=[x,Z],f=[];function s(l,h){return l[1][1]?0:1}e=s(o),n=f[e]=t[e](o);let _=o[6]&&L(o);return{c(){n.c(),r=G(),_&&_.c(),i=u()},l(l){n.l(l),r=H(l),_&&_.l(l),i=u()},m(l,h){f[e].m(l,h),w(l,r,h),_&&_.m(l,h),w(l,i,h),c=!0},p(l,[h]){let I=e;e=s(l),e===I?f[e].p(l,h):(D(),m(f[I],1,1,()=>{f[I]=null}),N(),n=f[e],n?n.p(l,h):(n=f[e]=t[e](l),n.c()),p(n,1),n.m(r.parentNode,r)),l[6]?_?_.p(l,h):(_=L(l),_.c(),_.m(i.parentNode,i)):_&&(_.d(1),_=null)},i(l){c||(p(n),c=!0)},o(l){m(n),c=!1},d(l){l&&(d(r),d(i)),f[e].d(l),_&&_.d(l)}}}function re(o,e,n){let{stores:r}=e,{page:i}=e,{constructors:c}=e,{components:t=[]}=e,{form:f}=e,{data_0:s=null}=e,{data_1:_=null}=e,{data_2:l=null}=e;J(r.page.notify);let h=!1,I=!1,V=null;K(()=>{const a=r.page.subscribe(()=>{h&&(n(7,I=!0),Y().then(()=>{n(8,V=document.title||"untitled page")}))});return n(6,h=!0),a});function T(a){A[a?"unshift":"push"](()=>{t[2]=a,n(0,t)})}function $(a){A[a?"unshift":"push"](()=>{t[1]=a,n(0,t)})}function C(a){A[a?"unshift":"push"](()=>{t[1]=a,n(0,t)})}function S(a){A[a?"unshift":"push"](()=>{t[0]=a,n(0,t)})}function q(a){A[a?"unshift":"push"](()=>{t[0]=a,n(0,t)})}return o.$$set=a=>{"stores"in a&&n(9,r=a.stores),"page"in a&&n(10,i=a.page),"constructors"in a&&n(1,c=a.constructors),"components"in a&&n(0,t=a.components),"form"in a&&n(2,f=a.form),"data_0"in a&&n(3,s=a.data_0),"data_1"in a&&n(4,_=a.data_1),"data_2"in a&&n(5,l=a.data_2)},o.$$.update=()=>{o.$$.dirty&1536&&r.page.set(i)},[t,c,f,s,_,l,h,I,V,r,i,T,$,C,S,q]}class le extends z{constructor(e){super(),B(this,e,re,se,F,{stores:9,page:10,constructors:1,components:0,form:2,data_0:3,data_1:4,data_2:5})}}const _e=[()=>y(()=>import("../nodes/0.e0dca262.js"),["../nodes/0.e0dca262.js","../chunks/vendor_svelte.565aa2ba.js","../chunks/vendor.1acf520b.js","../assets/tailwind.51d3662c.css"],import.meta.url),()=>y(()=>import("../nodes/1.d66e543d.js"),["../nodes/1.d66e543d.js","../chunks/vendor_svelte.565aa2ba.js","../chunks/vendor.1acf520b.js"],import.meta.url),()=>y(()=>import("../nodes/2.a70baab8.js"),["../nodes/2.a70baab8.js","../chunks/vendor_svelte.565aa2ba.js","../chunks/vendor.1acf520b.js","../assets/tailwind.51d3662c.css"],import.meta.url),()=>y(()=>import("../nodes/3.87cd87c6.js"),["../nodes/3.87cd87c6.js","../chunks/3.d6344dfb.js","../chunks/preload-helper.a4192956.js","../chunks/vendor_svelte.565aa2ba.js","../chunks/vendor.1acf520b.js","../assets/3.012379e0.css"],import.meta.url),()=>y(()=>import("../nodes/4.de270ce7.js"),["../nodes/4.de270ce7.js","../chunks/vendor_svelte.565aa2ba.js","../chunks/vendor.1acf520b.js"],import.meta.url)],ce=[],ue={"/(site)":[3,[2]],"/(site)/synth":[4,[2]]},me={handleError:({error:o})=>{console.error(o)}};export{ue as dictionary,me as hooks,ae as matchers,_e as nodes,le as root,ce as server_loads}; +import{_ as y}from"../chunks/preload-helper.a4192956.js";import{S as z,i as B,s as F,m as G,v as u,o as H,g as w,l as m,w as N,t as p,d,x as J,r as K,e as M,a as U,b as j,f as R,y as E,z as Q,A as W,B as X,C as D,D as Y,F as A,G as g,H as b,I as P,J as k,K as v}from"../chunks/vendor_svelte.517cf6ee.js";const ae={};function Z(o){let e,n,r;var i=o[1][0];function c(t,f){return{props:{data:t[3],form:t[2]}}}return i&&(e=g(i,c(o)),o[15](e)),{c(){e&&b(e.$$.fragment),n=u()},l(t){e&&P(e.$$.fragment,t),n=u()},m(t,f){e&&k(e,t,f),w(t,n,f),r=!0},p(t,f){if(f&2&&i!==(i=t[1][0])){if(e){D();const s=e;m(s.$$.fragment,1,0,()=>{v(s,1)}),N()}i?(e=g(i,c(t)),t[15](e),b(e.$$.fragment),p(e.$$.fragment,1),k(e,n.parentNode,n)):e=null}else if(i){const s={};f&8&&(s.data=t[3]),f&4&&(s.form=t[2]),e.$set(s)}},i(t){r||(e&&p(e.$$.fragment,t),r=!0)},o(t){e&&m(e.$$.fragment,t),r=!1},d(t){t&&d(n),o[15](null),e&&v(e,t)}}}function x(o){let e,n,r;var i=o[1][0];function c(t,f){return{props:{data:t[3],$$slots:{default:[ie]},$$scope:{ctx:t}}}}return i&&(e=g(i,c(o)),o[14](e)),{c(){e&&b(e.$$.fragment),n=u()},l(t){e&&P(e.$$.fragment,t),n=u()},m(t,f){e&&k(e,t,f),w(t,n,f),r=!0},p(t,f){if(f&2&&i!==(i=t[1][0])){if(e){D();const s=e;m(s.$$.fragment,1,0,()=>{v(s,1)}),N()}i?(e=g(i,c(t)),t[14](e),b(e.$$.fragment),p(e.$$.fragment,1),k(e,n.parentNode,n)):e=null}else if(i){const s={};f&8&&(s.data=t[3]),f&65591&&(s.$$scope={dirty:f,ctx:t}),e.$set(s)}},i(t){r||(e&&p(e.$$.fragment,t),r=!0)},o(t){e&&m(e.$$.fragment,t),r=!1},d(t){t&&d(n),o[14](null),e&&v(e,t)}}}function ee(o){let e,n,r;var i=o[1][1];function c(t,f){return{props:{data:t[4],form:t[2]}}}return i&&(e=g(i,c(o)),o[13](e)),{c(){e&&b(e.$$.fragment),n=u()},l(t){e&&P(e.$$.fragment,t),n=u()},m(t,f){e&&k(e,t,f),w(t,n,f),r=!0},p(t,f){if(f&2&&i!==(i=t[1][1])){if(e){D();const s=e;m(s.$$.fragment,1,0,()=>{v(s,1)}),N()}i?(e=g(i,c(t)),t[13](e),b(e.$$.fragment),p(e.$$.fragment,1),k(e,n.parentNode,n)):e=null}else if(i){const s={};f&16&&(s.data=t[4]),f&4&&(s.form=t[2]),e.$set(s)}},i(t){r||(e&&p(e.$$.fragment,t),r=!0)},o(t){e&&m(e.$$.fragment,t),r=!1},d(t){t&&d(n),o[13](null),e&&v(e,t)}}}function te(o){let e,n,r;var i=o[1][1];function c(t,f){return{props:{data:t[4],$$slots:{default:[ne]},$$scope:{ctx:t}}}}return i&&(e=g(i,c(o)),o[12](e)),{c(){e&&b(e.$$.fragment),n=u()},l(t){e&&P(e.$$.fragment,t),n=u()},m(t,f){e&&k(e,t,f),w(t,n,f),r=!0},p(t,f){if(f&2&&i!==(i=t[1][1])){if(e){D();const s=e;m(s.$$.fragment,1,0,()=>{v(s,1)}),N()}i?(e=g(i,c(t)),t[12](e),b(e.$$.fragment),p(e.$$.fragment,1),k(e,n.parentNode,n)):e=null}else if(i){const s={};f&16&&(s.data=t[4]),f&65575&&(s.$$scope={dirty:f,ctx:t}),e.$set(s)}},i(t){r||(e&&p(e.$$.fragment,t),r=!0)},o(t){e&&m(e.$$.fragment,t),r=!1},d(t){t&&d(n),o[12](null),e&&v(e,t)}}}function ne(o){let e,n,r;var i=o[1][2];function c(t,f){return{props:{data:t[5],form:t[2]}}}return i&&(e=g(i,c(o)),o[11](e)),{c(){e&&b(e.$$.fragment),n=u()},l(t){e&&P(e.$$.fragment,t),n=u()},m(t,f){e&&k(e,t,f),w(t,n,f),r=!0},p(t,f){if(f&2&&i!==(i=t[1][2])){if(e){D();const s=e;m(s.$$.fragment,1,0,()=>{v(s,1)}),N()}i?(e=g(i,c(t)),t[11](e),b(e.$$.fragment),p(e.$$.fragment,1),k(e,n.parentNode,n)):e=null}else if(i){const s={};f&32&&(s.data=t[5]),f&4&&(s.form=t[2]),e.$set(s)}},i(t){r||(e&&p(e.$$.fragment,t),r=!0)},o(t){e&&m(e.$$.fragment,t),r=!1},d(t){t&&d(n),o[11](null),e&&v(e,t)}}}function ie(o){let e,n,r,i;const c=[te,ee],t=[];function f(s,_){return s[1][2]?0:1}return e=f(o),n=t[e]=c[e](o),{c(){n.c(),r=u()},l(s){n.l(s),r=u()},m(s,_){t[e].m(s,_),w(s,r,_),i=!0},p(s,_){let l=e;e=f(s),e===l?t[e].p(s,_):(D(),m(t[l],1,1,()=>{t[l]=null}),N(),n=t[e],n?n.p(s,_):(n=t[e]=c[e](s),n.c()),p(n,1),n.m(r.parentNode,r))},i(s){i||(p(n),i=!0)},o(s){m(n),i=!1},d(s){s&&d(r),t[e].d(s)}}}function L(o){let e,n=o[7]&&O(o);return{c(){e=M("div"),n&&n.c(),this.h()},l(r){e=U(r,"DIV",{id:!0,"aria-live":!0,"aria-atomic":!0,style:!0});var i=j(e);n&&n.l(i),i.forEach(d),this.h()},h(){R(e,"id","svelte-announcer"),R(e,"aria-live","assertive"),R(e,"aria-atomic","true"),E(e,"position","absolute"),E(e,"left","0"),E(e,"top","0"),E(e,"clip","rect(0 0 0 0)"),E(e,"clip-path","inset(50%)"),E(e,"overflow","hidden"),E(e,"white-space","nowrap"),E(e,"width","1px"),E(e,"height","1px")},m(r,i){w(r,e,i),n&&n.m(e,null)},p(r,i){r[7]?n?n.p(r,i):(n=O(r),n.c(),n.m(e,null)):n&&(n.d(1),n=null)},d(r){r&&d(e),n&&n.d()}}}function O(o){let e;return{c(){e=Q(o[8])},l(n){e=W(n,o[8])},m(n,r){w(n,e,r)},p(n,r){r&256&&X(e,n[8])},d(n){n&&d(e)}}}function se(o){let e,n,r,i,c;const t=[x,Z],f=[];function s(l,h){return l[1][1]?0:1}e=s(o),n=f[e]=t[e](o);let _=o[6]&&L(o);return{c(){n.c(),r=G(),_&&_.c(),i=u()},l(l){n.l(l),r=H(l),_&&_.l(l),i=u()},m(l,h){f[e].m(l,h),w(l,r,h),_&&_.m(l,h),w(l,i,h),c=!0},p(l,[h]){let I=e;e=s(l),e===I?f[e].p(l,h):(D(),m(f[I],1,1,()=>{f[I]=null}),N(),n=f[e],n?n.p(l,h):(n=f[e]=t[e](l),n.c()),p(n,1),n.m(r.parentNode,r)),l[6]?_?_.p(l,h):(_=L(l),_.c(),_.m(i.parentNode,i)):_&&(_.d(1),_=null)},i(l){c||(p(n),c=!0)},o(l){m(n),c=!1},d(l){l&&(d(r),d(i)),f[e].d(l),_&&_.d(l)}}}function re(o,e,n){let{stores:r}=e,{page:i}=e,{constructors:c}=e,{components:t=[]}=e,{form:f}=e,{data_0:s=null}=e,{data_1:_=null}=e,{data_2:l=null}=e;J(r.page.notify);let h=!1,I=!1,V=null;K(()=>{const a=r.page.subscribe(()=>{h&&(n(7,I=!0),Y().then(()=>{n(8,V=document.title||"untitled page")}))});return n(6,h=!0),a});function T(a){A[a?"unshift":"push"](()=>{t[2]=a,n(0,t)})}function $(a){A[a?"unshift":"push"](()=>{t[1]=a,n(0,t)})}function C(a){A[a?"unshift":"push"](()=>{t[1]=a,n(0,t)})}function S(a){A[a?"unshift":"push"](()=>{t[0]=a,n(0,t)})}function q(a){A[a?"unshift":"push"](()=>{t[0]=a,n(0,t)})}return o.$$set=a=>{"stores"in a&&n(9,r=a.stores),"page"in a&&n(10,i=a.page),"constructors"in a&&n(1,c=a.constructors),"components"in a&&n(0,t=a.components),"form"in a&&n(2,f=a.form),"data_0"in a&&n(3,s=a.data_0),"data_1"in a&&n(4,_=a.data_1),"data_2"in a&&n(5,l=a.data_2)},o.$$.update=()=>{o.$$.dirty&1536&&r.page.set(i)},[t,c,f,s,_,l,h,I,V,r,i,T,$,C,S,q]}class le extends z{constructor(e){super(),B(this,e,re,se,F,{stores:9,page:10,constructors:1,components:0,form:2,data_0:3,data_1:4,data_2:5})}}const _e=[()=>y(()=>import("../nodes/0.c5d273aa.js"),["../nodes/0.c5d273aa.js","../chunks/vendor_svelte.517cf6ee.js","../chunks/vendor.1acf520b.js","../assets/tailwind.51d3662c.css"],import.meta.url),()=>y(()=>import("../nodes/1.770ef7ea.js"),["../nodes/1.770ef7ea.js","../chunks/vendor_svelte.517cf6ee.js","../chunks/vendor.1acf520b.js"],import.meta.url),()=>y(()=>import("../nodes/2.8529615c.js"),["../nodes/2.8529615c.js","../chunks/vendor_svelte.517cf6ee.js","../chunks/vendor.1acf520b.js","../assets/tailwind.51d3662c.css"],import.meta.url),()=>y(()=>import("../nodes/3.18d1ed73.js"),["../nodes/3.18d1ed73.js","../chunks/3.813f8056.js","../chunks/preload-helper.a4192956.js","../chunks/vendor_svelte.517cf6ee.js","../chunks/vendor.1acf520b.js","../assets/3.012379e0.css"],import.meta.url),()=>y(()=>import("../nodes/4.ede1c09a.js"),["../nodes/4.ede1c09a.js","../chunks/vendor_svelte.517cf6ee.js","../chunks/vendor.1acf520b.js"],import.meta.url)],ce=[],ue={"/(site)":[3,[2]],"/(site)/synth":[4,[2]]},me={handleError:({error:o})=>{console.error(o)}};export{ue as dictionary,me as hooks,ae as matchers,_e as nodes,le as root,ce as server_loads}; diff --git a/_app/immutable/entry/start.334f9b87.js b/_app/immutable/entry/start.334f9b87.js new file mode 100644 index 00000000..4aeab98e --- /dev/null +++ b/_app/immutable/entry/start.334f9b87.js @@ -0,0 +1 @@ +import{a7 as t}from"../chunks/vendor_svelte.517cf6ee.js";export{t as start}; diff --git a/_app/immutable/entry/start.fdf02517.js b/_app/immutable/entry/start.fdf02517.js deleted file mode 100644 index 51b89028..00000000 --- a/_app/immutable/entry/start.fdf02517.js +++ /dev/null @@ -1 +0,0 @@ -import{a7 as t}from"../chunks/vendor_svelte.565aa2ba.js";export{t as start}; diff --git a/_app/immutable/nodes/0.e0dca262.js b/_app/immutable/nodes/0.c5d273aa.js similarity index 91% rename from _app/immutable/nodes/0.e0dca262.js rename to _app/immutable/nodes/0.c5d273aa.js index 634bbe25..3befa962 100644 --- a/_app/immutable/nodes/0.e0dca262.js +++ b/_app/immutable/nodes/0.c5d273aa.js @@ -1 +1 @@ -import{S as a,i as r,s as i,c as u,u as _,j as f,k as c,t as p,l as m}from"../chunks/vendor_svelte.565aa2ba.js";/* empty css */const d=!0,S=Object.freeze(Object.defineProperty({__proto__:null,prerender:d},Symbol.toStringTag,{value:"Module"}));function $(n){let s;const l=n[1].default,e=u(l,n,n[0],null);return{c(){e&&e.c()},l(t){e&&e.l(t)},m(t,o){e&&e.m(t,o),s=!0},p(t,[o]){e&&e.p&&(!s||o&1)&&_(e,l,t,t[0],s?c(l,t[0],o,null):f(t[0]),null)},i(t){s||(p(e,t),s=!0)},o(t){m(e,t),s=!1},d(t){e&&e.d(t)}}}function g(n,s,l){let{$$slots:e={},$$scope:t}=s;return n.$$set=o=>{"$$scope"in o&&l(0,t=o.$$scope)},[t,e]}class j extends a{constructor(s){super(),r(this,s,g,$,i,{})}}export{j as component,S as universal}; +import{S as a,i as r,s as i,c as u,u as _,j as f,k as c,t as p,l as m}from"../chunks/vendor_svelte.517cf6ee.js";/* empty css */const d=!0,S=Object.freeze(Object.defineProperty({__proto__:null,prerender:d},Symbol.toStringTag,{value:"Module"}));function $(n){let s;const l=n[1].default,e=u(l,n,n[0],null);return{c(){e&&e.c()},l(t){e&&e.l(t)},m(t,o){e&&e.m(t,o),s=!0},p(t,[o]){e&&e.p&&(!s||o&1)&&_(e,l,t,t[0],s?c(l,t[0],o,null):f(t[0]),null)},i(t){s||(p(e,t),s=!0)},o(t){m(e,t),s=!1},d(t){e&&e.d(t)}}}function g(n,s,l){let{$$slots:e={},$$scope:t}=s;return n.$$set=o=>{"$$scope"in o&&l(0,t=o.$$scope)},[t,e]}class j extends a{constructor(s){super(),r(this,s,g,$,i,{})}}export{j as component,S as universal}; diff --git a/_app/immutable/nodes/1.770ef7ea.js b/_app/immutable/nodes/1.770ef7ea.js new file mode 100644 index 00000000..5b4bb88c --- /dev/null +++ b/_app/immutable/nodes/1.770ef7ea.js @@ -0,0 +1 @@ +import{E as m}from"../chunks/vendor_svelte.517cf6ee.js";export{m as component}; diff --git a/_app/immutable/nodes/1.d66e543d.js b/_app/immutable/nodes/1.d66e543d.js deleted file mode 100644 index baf4792c..00000000 --- a/_app/immutable/nodes/1.d66e543d.js +++ /dev/null @@ -1 +0,0 @@ -import{E as m}from"../chunks/vendor_svelte.565aa2ba.js";export{m as component}; diff --git a/_app/immutable/nodes/2.a70baab8.js b/_app/immutable/nodes/2.8529615c.js similarity index 93% rename from _app/immutable/nodes/2.a70baab8.js rename to _app/immutable/nodes/2.8529615c.js index fcedb6e3..6d476dc0 100644 --- a/_app/immutable/nodes/2.a70baab8.js +++ b/_app/immutable/nodes/2.8529615c.js @@ -1 +1 @@ -import{S as d,i as h,s as p,c as $,e as u,a as f,b as _,d as r,f as m,g as v,h as y,u as g,j,k as b,t as x,l as E}from"../chunks/vendor_svelte.565aa2ba.js";/* empty css */function I(i){let s,a,n;const o=i[1].default,e=$(o,i,i[0],null);return{c(){s=u("div"),a=u("main"),e&&e.c(),this.h()},l(t){s=f(t,"DIV",{class:!0});var l=_(s);a=f(l,"MAIN",{class:!0});var c=_(a);e&&e.l(c),c.forEach(r),l.forEach(r),this.h()},h(){m(a,"class","flex-col items-center justify-center h-full min-h-screen max-w-[764px] mx-[auto]"),m(s,"class","flex-col items-center justify-center")},m(t,l){v(t,s,l),y(s,a),e&&e.m(a,null),n=!0},p(t,[l]){e&&e.p&&(!n||l&1)&&g(e,o,t,t[0],n?b(o,t[0],l,null):j(t[0]),null)},i(t){n||(x(e,t),n=!0)},o(t){E(e,t),n=!1},d(t){t&&r(s),e&&e.d(t)}}}function S(i,s,a){let{$$slots:n={},$$scope:o}=s;return i.$$set=e=>{"$$scope"in e&&a(0,o=e.$$scope)},[o,n]}class w extends d{constructor(s){super(),h(this,s,S,I,p,{})}}export{w as component}; +import{S as d,i as h,s as p,c as $,e as u,a as f,b as _,d as r,f as m,g as v,h as y,u as g,j,k as b,t as x,l as E}from"../chunks/vendor_svelte.517cf6ee.js";/* empty css */function I(i){let s,a,n;const o=i[1].default,e=$(o,i,i[0],null);return{c(){s=u("div"),a=u("main"),e&&e.c(),this.h()},l(t){s=f(t,"DIV",{class:!0});var l=_(s);a=f(l,"MAIN",{class:!0});var c=_(a);e&&e.l(c),c.forEach(r),l.forEach(r),this.h()},h(){m(a,"class","flex-col items-center justify-center h-full min-h-screen max-w-[764px] mx-[auto]"),m(s,"class","flex-col items-center justify-center")},m(t,l){v(t,s,l),y(s,a),e&&e.m(a,null),n=!0},p(t,[l]){e&&e.p&&(!n||l&1)&&g(e,o,t,t[0],n?b(o,t[0],l,null):j(t[0]),null)},i(t){n||(x(e,t),n=!0)},o(t){E(e,t),n=!1},d(t){t&&r(s),e&&e.d(t)}}}function S(i,s,a){let{$$slots:n={},$$scope:o}=s;return i.$$set=e=>{"$$scope"in e&&a(0,o=e.$$scope)},[o,n]}class w extends d{constructor(s){super(),h(this,s,S,I,p,{})}}export{w as component}; diff --git a/_app/immutable/nodes/3.18d1ed73.js b/_app/immutable/nodes/3.18d1ed73.js new file mode 100644 index 00000000..c8d3bc85 --- /dev/null +++ b/_app/immutable/nodes/3.18d1ed73.js @@ -0,0 +1 @@ +import{P as m}from"../chunks/3.813f8056.js";export{m as component}; diff --git a/_app/immutable/nodes/3.87cd87c6.js b/_app/immutable/nodes/3.87cd87c6.js deleted file mode 100644 index f6513f34..00000000 --- a/_app/immutable/nodes/3.87cd87c6.js +++ /dev/null @@ -1 +0,0 @@ -import{P as m}from"../chunks/3.d6344dfb.js";export{m as component}; diff --git a/_app/immutable/nodes/4.de270ce7.js b/_app/immutable/nodes/4.ede1c09a.js similarity index 93% rename from _app/immutable/nodes/4.de270ce7.js rename to _app/immutable/nodes/4.ede1c09a.js index d801f6ee..14ec2516 100644 --- a/_app/immutable/nodes/4.de270ce7.js +++ b/_app/immutable/nodes/4.ede1c09a.js @@ -1 +1 @@ -import{S as y,i as C,s as v,e as u,m as b,a as m,n as _,o as g,b as k,d as c,f as p,g as d,h as S,p as P,q as x,r as T}from"../chunks/vendor_svelte.565aa2ba.js";function q(i){let t,l="Synth",o,n,s,h="Play",r,f;return{c(){t=u("h1"),t.textContent=l,o=b(),n=u("section"),s=u("button"),s.textContent=h,this.h()},l(e){t=m(e,"H1",{class:!0,"data-svelte-h":!0}),_(t)!=="svelte-5kacpm"&&(t.textContent=l),o=g(e),n=m(e,"SECTION",{class:!0});var a=k(n);s=m(a,"BUTTON",{class:!0,"data-svelte-h":!0}),_(s)!=="svelte-12ba69d"&&(s.textContent=h),a.forEach(c),this.h()},h(){p(t,"class","my-8 md:text-5xl mt-12 px-4 md:px-0 text-3xl font-cursive tracking-tight"),p(s,"class","btn primary"),p(n,"class","px-4 md:px-0")},m(e,a){d(e,t,a),d(e,o,a),d(e,n,a),S(n,s),r||(f=P(s,"click",i[0]),r=!0)},p:x,i:x,o:x,d(e){e&&(c(t),c(o),c(n)),r=!1,f()}}}function E(i){let t;T(()=>{t=new AudioContext});function l(){t.resume().then(()=>{console.log("Playback resumed successfully")})}return[l]}class O extends y{constructor(t){super(),C(this,t,E,q,v,{})}}export{O as component}; +import{S as y,i as C,s as v,e as u,m as b,a as m,n as _,o as g,b as k,d as c,f as p,g as d,h as S,p as P,q as x,r as T}from"../chunks/vendor_svelte.517cf6ee.js";function q(i){let t,l="Synth",o,n,s,h="Play",r,f;return{c(){t=u("h1"),t.textContent=l,o=b(),n=u("section"),s=u("button"),s.textContent=h,this.h()},l(e){t=m(e,"H1",{class:!0,"data-svelte-h":!0}),_(t)!=="svelte-5kacpm"&&(t.textContent=l),o=g(e),n=m(e,"SECTION",{class:!0});var a=k(n);s=m(a,"BUTTON",{class:!0,"data-svelte-h":!0}),_(s)!=="svelte-12ba69d"&&(s.textContent=h),a.forEach(c),this.h()},h(){p(t,"class","my-8 md:text-5xl mt-12 px-4 md:px-0 text-3xl font-cursive tracking-tight"),p(s,"class","btn primary"),p(n,"class","px-4 md:px-0")},m(e,a){d(e,t,a),d(e,o,a),d(e,n,a),S(n,s),r||(f=P(s,"click",i[0]),r=!0)},p:x,i:x,o:x,d(e){e&&(c(t),c(o),c(n)),r=!1,f()}}}function E(i){let t;T(()=>{t=new AudioContext});function l(){t.resume().then(()=>{console.log("Playback resumed successfully")})}return[l]}class O extends y{constructor(t){super(),C(this,t,E,q,v,{})}}export{O as component}; diff --git a/_app/version.json b/_app/version.json index ecc60c9a..a311cae9 100644 --- a/_app/version.json +++ b/_app/version.json @@ -1 +1 @@ -{"version":"1709719390483"} \ No newline at end of file +{"version":"1709719599484"} \ No newline at end of file diff --git a/index.html b/index.html index e8ad8329..e0b39da3 100644 --- a/index.html +++ b/index.html @@ -22,10 +22,10 @@ - - + + - + @@ -33,7 +33,7 @@