(function(l, r) { if (l.getElementById('livereloadscript')) return; r = l.createElement('script'); r.async = 1; r.src = '//' + (window.location.host || 'localhost').split(':')[0] + ':35729/livereload.js?snipver=1'; r.id = 'livereloadscript'; l.getElementsByTagName('head')[0].appendChild(r) })(window.document); var app = (function () { 'use strict'; function noop() { } function add_location(element, file, line, column, char) { element.__svelte_meta = { loc: { file, line, column, char } }; } function run(fn) { return fn(); } function blank_object() { return Object.create(null); } function run_all(fns) { fns.forEach(run); } function is_function(thing) { return typeof thing === 'function'; } function safe_not_equal(a, b) { return a != a ? b == b : a !== b || ((a && typeof a === 'object') || typeof a === 'function'); } function is_empty(obj) { return Object.keys(obj).length === 0; } function append(target, node) { target.appendChild(node); } function insert(target, node, anchor) { target.insertBefore(node, anchor || null); } function detach(node) { node.parentNode.removeChild(node); } function element(name) { return document.createElement(name); } function text(data) { return document.createTextNode(data); } function space() { return text(' '); } function listen(node, event, handler, options) { node.addEventListener(event, handler, options); return () => node.removeEventListener(event, handler, options); } function attr(node, attribute, value) { if (value == null) node.removeAttribute(attribute); else if (node.getAttribute(attribute) !== value) node.setAttribute(attribute, value); } function children(element) { return Array.from(element.childNodes); } function set_style(node, key, value, important) { node.style.setProperty(key, value, important ? 'important' : ''); } function toggle_class(element, name, toggle) { element.classList[toggle ? 'add' : 'remove'](name); } function custom_event(type, detail) { const e = document.createEvent('CustomEvent'); e.initCustomEvent(type, false, false, detail); return e; } let current_component; function set_current_component(component) { current_component = component; } function get_current_component() { if (!current_component) throw new Error(`Function called outside component initialization`); return current_component; } function createEventDispatcher() { const component = get_current_component(); return (type, detail) => { const callbacks = component.$$.callbacks[type]; if (callbacks) { // TODO are there situations where events could be dispatched // in a server (non-DOM) environment? const event = custom_event(type, detail); callbacks.slice().forEach(fn => { fn.call(component, event); }); } }; } const dirty_components = []; const binding_callbacks = []; const render_callbacks = []; const flush_callbacks = []; const resolved_promise = Promise.resolve(); let update_scheduled = false; function schedule_update() { if (!update_scheduled) { update_scheduled = true; resolved_promise.then(flush); } } function add_render_callback(fn) { render_callbacks.push(fn); } function add_flush_callback(fn) { flush_callbacks.push(fn); } let flushing = false; const seen_callbacks = new Set(); function flush() { if (flushing) return; flushing = true; do { // first, call beforeUpdate functions // and update components for (let i = 0; i < dirty_components.length; i += 1) { const component = dirty_components[i]; set_current_component(component); update(component.$$); } set_current_component(null); dirty_components.length = 0; while (binding_callbacks.length) binding_callbacks.pop()(); // then, once components are updated, call // afterUpdate functions. This may cause // subsequent updates... for (let i = 0; i < render_callbacks.length; i += 1) { const callback = render_callbacks[i]; if (!seen_callbacks.has(callback)) { // ...so guard against infinite loops seen_callbacks.add(callback); callback(); } } render_callbacks.length = 0; } while (dirty_components.length); while (flush_callbacks.length) { flush_callbacks.pop()(); } update_scheduled = false; flushing = false; seen_callbacks.clear(); } function update($$) { if ($$.fragment !== null) { $$.update(); run_all($$.before_update); const dirty = $$.dirty; $$.dirty = [-1]; $$.fragment && $$.fragment.p($$.ctx, dirty); $$.after_update.forEach(add_render_callback); } } const outroing = new Set(); let outros; function transition_in(block, local) { if (block && block.i) { outroing.delete(block); block.i(local); } } function transition_out(block, local, detach, callback) { if (block && block.o) { if (outroing.has(block)) return; outroing.add(block); outros.c.push(() => { outroing.delete(block); if (callback) { if (detach) block.d(1); callback(); } }); block.o(local); } } const globals = (typeof window !== 'undefined' ? window : typeof globalThis !== 'undefined' ? globalThis : global); function bind(component, name, callback) { const index = component.$$.props[name]; if (index !== undefined) { component.$$.bound[index] = callback; callback(component.$$.ctx[index]); } } function create_component(block) { block && block.c(); } function mount_component(component, target, anchor) { const { fragment, on_mount, on_destroy, after_update } = component.$$; fragment && fragment.m(target, anchor); // onMount happens before the initial afterUpdate add_render_callback(() => { const new_on_destroy = on_mount.map(run).filter(is_function); if (on_destroy) { on_destroy.push(...new_on_destroy); } else { // Edge case - component was destroyed immediately, // most likely as a result of a binding initialising run_all(new_on_destroy); } component.$$.on_mount = []; }); after_update.forEach(add_render_callback); } function destroy_component(component, detaching) { const $$ = component.$$; if ($$.fragment !== null) { run_all($$.on_destroy); $$.fragment && $$.fragment.d(detaching); // TODO null out other refs, including component.$$ (but need to // preserve final state?) $$.on_destroy = $$.fragment = null; $$.ctx = []; } } function make_dirty(component, i) { if (component.$$.dirty[0] === -1) { dirty_components.push(component); schedule_update(); component.$$.dirty.fill(0); } component.$$.dirty[(i / 31) | 0] |= (1 << (i % 31)); } function init(component, options, instance, create_fragment, not_equal, props, dirty = [-1]) { const parent_component = current_component; set_current_component(component); const prop_values = options.props || {}; const $$ = component.$$ = { fragment: null, ctx: null, // state props, update: noop, not_equal, bound: blank_object(), // lifecycle on_mount: [], on_destroy: [], before_update: [], after_update: [], context: new Map(parent_component ? parent_component.$$.context : []), // everything else callbacks: blank_object(), dirty, skip_bound: false }; let ready = false; $$.ctx = instance ? instance(component, prop_values, (i, ret, ...rest) => { const value = rest.length ? rest[0] : ret; if ($$.ctx && not_equal($$.ctx[i], $$.ctx[i] = value)) { if (!$$.skip_bound && $$.bound[i]) $$.bound[i](value); if (ready) make_dirty(component, i); } return ret; }) : []; $$.update(); ready = true; run_all($$.before_update); // `false` as a special case of no DOM component $$.fragment = create_fragment ? create_fragment($$.ctx) : false; if (options.target) { if (options.hydrate) { const nodes = children(options.target); // eslint-disable-next-line @typescript-eslint/no-non-null-assertion $$.fragment && $$.fragment.l(nodes); nodes.forEach(detach); } else { // eslint-disable-next-line @typescript-eslint/no-non-null-assertion $$.fragment && $$.fragment.c(); } if (options.intro) transition_in(component.$$.fragment); mount_component(component, options.target, options.anchor); flush(); } set_current_component(parent_component); } class SvelteComponent { $destroy() { destroy_component(this, 1); this.$destroy = noop; } $on(type, callback) { const callbacks = (this.$$.callbacks[type] || (this.$$.callbacks[type] = [])); callbacks.push(callback); return () => { const index = callbacks.indexOf(callback); if (index !== -1) callbacks.splice(index, 1); }; } $set($$props) { if (this.$$set && !is_empty($$props)) { this.$$.skip_bound = true; this.$$set($$props); this.$$.skip_bound = false; } } } function dispatch_dev(type, detail) { document.dispatchEvent(custom_event(type, Object.assign({ version: '3.25.1' }, detail))); } function append_dev(target, node) { dispatch_dev("SvelteDOMInsert", { target, node }); append(target, node); } function insert_dev(target, node, anchor) { dispatch_dev("SvelteDOMInsert", { target, node, anchor }); insert(target, node, anchor); } function detach_dev(node) { dispatch_dev("SvelteDOMRemove", { node }); detach(node); } function listen_dev(node, event, handler, options, has_prevent_default, has_stop_propagation) { const modifiers = options === true ? ["capture"] : options ? Array.from(Object.keys(options)) : []; if (has_prevent_default) modifiers.push('preventDefault'); if (has_stop_propagation) modifiers.push('stopPropagation'); dispatch_dev("SvelteDOMAddEventListener", { node, event, handler, modifiers }); const dispose = listen(node, event, handler, options); return () => { dispatch_dev("SvelteDOMRemoveEventListener", { node, event, handler, modifiers }); dispose(); }; } function attr_dev(node, attribute, value) { attr(node, attribute, value); if (value == null) dispatch_dev("SvelteDOMRemoveAttribute", { node, attribute }); else dispatch_dev("SvelteDOMSetAttribute", { node, attribute, value }); } function set_data_dev(text, data) { data = '' + data; if (text.wholeText === data) return; dispatch_dev("SvelteDOMSetData", { node: text, data }); text.data = data; } function validate_slots(name, slot, keys) { for (const slot_key of Object.keys(slot)) { if (!~keys.indexOf(slot_key)) { console.warn(`<${name}> received an unexpected slot "${slot_key}".`); } } } class SvelteComponentDev extends SvelteComponent { constructor(options) { if (!options || (!options.target && !options.$$inline)) { throw new Error(`'target' is a required option`); } super(); } $destroy() { super.$destroy(); this.$destroy = () => { console.warn(`Component was already destroyed`); // eslint-disable-line no-console }; } $capture_state() { } $inject_state() { } } /* src\Menu.svelte generated by Svelte v3.25.1 */ const { console: console_1 } = globals; const file = "src\\Menu.svelte"; // (99:8) {#if song} function create_if_block_1(ctx) { let div3; let h2; let t0_value = /*song*/ ctx[0].artist + ""; let t0; let t1; let t2_value = /*song*/ ctx[0].song + ""; let t2; let t3; let div2; let div0; let img0; let img0_src_value; let img0_alt_value; let img0_title_value; let t4; let div1; let img1; let img1_src_value; let mounted; let dispose; const block = { c: function create() { div3 = element("div"); h2 = element("h2"); t0 = text(t0_value); t1 = text(" - "); t2 = text(t2_value); t3 = space(); div2 = element("div"); div0 = element("div"); img0 = element("img"); t4 = space(); div1 = element("div"); img1 = element("img"); attr_dev(h2, "class", "svelte-1j9fr45"); add_location(h2, file, 100, 16, 3079); if (img0.src !== (img0_src_value = "images/music_" + (/*playing*/ ctx[4] ? "pause" : "play") + ".svg")) attr_dev(img0, "src", img0_src_value); attr_dev(img0, "alt", img0_alt_value = "" + ((/*playing*/ ctx[4] ? "Pause" : "Play") + " music")); attr_dev(img0, "title", img0_title_value = "" + ((/*playing*/ ctx[4] ? "Pause" : "Play") + " music")); attr_dev(img0, "class", "svelte-1j9fr45"); add_location(img0, file, 103, 24, 3243); attr_dev(div0, "class", "play svelte-1j9fr45"); add_location(div0, file, 102, 20, 3177); if (img1.src !== (img1_src_value = "images/music_forward.svg")) attr_dev(img1, "src", img1_src_value); attr_dev(img1, "alt", "Skip the song"); attr_dev(img1, "title", "Skip the song"); attr_dev(img1, "class", "svelte-1j9fr45"); add_location(img1, file, 106, 24, 3501); attr_dev(div1, "class", "forward svelte-1j9fr45"); add_location(div1, file, 105, 20, 3434); attr_dev(div2, "class", "controls svelte-1j9fr45"); add_location(div2, file, 101, 16, 3133); attr_dev(div3, "class", "song svelte-1j9fr45"); add_location(div3, file, 99, 12, 3043); }, m: function mount(target, anchor) { insert_dev(target, div3, anchor); append_dev(div3, h2); append_dev(h2, t0); append_dev(h2, t1); append_dev(h2, t2); append_dev(div3, t3); append_dev(div3, div2); append_dev(div2, div0); append_dev(div0, img0); append_dev(div2, t4); append_dev(div2, div1); append_dev(div1, img1); if (!mounted) { dispose = [ listen_dev(div0, "click", /*togglePlay*/ ctx[6], false, false, false), listen_dev(div1, "click", /*playNext*/ ctx[5], false, false, false) ]; mounted = true; } }, p: function update(ctx, dirty) { if (dirty & /*song*/ 1 && t0_value !== (t0_value = /*song*/ ctx[0].artist + "")) set_data_dev(t0, t0_value); if (dirty & /*song*/ 1 && t2_value !== (t2_value = /*song*/ ctx[0].song + "")) set_data_dev(t2, t2_value); if (dirty & /*playing*/ 16 && img0.src !== (img0_src_value = "images/music_" + (/*playing*/ ctx[4] ? "pause" : "play") + ".svg")) { attr_dev(img0, "src", img0_src_value); } if (dirty & /*playing*/ 16 && img0_alt_value !== (img0_alt_value = "" + ((/*playing*/ ctx[4] ? "Pause" : "Play") + " music"))) { attr_dev(img0, "alt", img0_alt_value); } if (dirty & /*playing*/ 16 && img0_title_value !== (img0_title_value = "" + ((/*playing*/ ctx[4] ? "Pause" : "Play") + " music"))) { attr_dev(img0, "title", img0_title_value); } }, d: function destroy(detaching) { if (detaching) detach_dev(div3); mounted = false; run_all(dispose); } }; dispatch_dev("SvelteRegisterBlock", { block, id: create_if_block_1.name, type: "if", source: "(99:8) {#if song}", ctx }); return block; } // (113:4) {#if now - lastVolumeUpdate < 4000 && song && song.audio} function create_if_block(ctx) { let div2; let div1; let div0; let t0_value = Math.round(/*song*/ ctx[0].audio.volume * 100) + ""; let t0; let t1; const block = { c: function create() { div2 = element("div"); div1 = element("div"); div0 = element("div"); t0 = text(t0_value); t1 = text("%"); attr_dev(div0, "class", "percent"); add_location(div0, file, 115, 16, 3868); attr_dev(div1, "class", "slider"); add_location(div1, file, 114, 12, 3830); attr_dev(div2, "class", "volume svelte-1j9fr45"); toggle_class(div2, "hidden", /*now*/ ctx[3] - /*lastVolumeUpdate*/ ctx[2] > 2000); add_location(div2, file, 113, 8, 3751); }, m: function mount(target, anchor) { insert_dev(target, div2, anchor); append_dev(div2, div1); append_dev(div1, div0); append_dev(div0, t0); append_dev(div0, t1); }, p: function update(ctx, dirty) { if (dirty & /*song*/ 1 && t0_value !== (t0_value = Math.round(/*song*/ ctx[0].audio.volume * 100) + "")) set_data_dev(t0, t0_value); if (dirty & /*now, lastVolumeUpdate*/ 12) { toggle_class(div2, "hidden", /*now*/ ctx[3] - /*lastVolumeUpdate*/ ctx[2] > 2000); } }, d: function destroy(detaching) { if (detaching) detach_dev(div2); } }; dispatch_dev("SvelteRegisterBlock", { block, id: create_if_block.name, type: "if", source: "(113:4) {#if now - lastVolumeUpdate < 4000 && song && song.audio}", ctx }); return block; } function create_fragment(ctx) { let div1; let div0; let t; let mounted; let dispose; let if_block0 = /*song*/ ctx[0] && create_if_block_1(ctx); let if_block1 = /*now*/ ctx[3] - /*lastVolumeUpdate*/ ctx[2] < 4000 && /*song*/ ctx[0] && /*song*/ ctx[0].audio && create_if_block(ctx); const block = { c: function create() { div1 = element("div"); div0 = element("div"); if (if_block0) if_block0.c(); t = space(); if (if_block1) if_block1.c(); attr_dev(div0, "class", "info svelte-1j9fr45"); toggle_class(div0, "hidden", /*now*/ ctx[3] - /*last*/ ctx[1] > 2000); add_location(div0, file, 97, 4, 2958); attr_dev(div1, "class", "menu"); add_location(div1, file, 96, 0, 2934); }, l: function claim(nodes) { throw new Error("options.hydrate only works if the component was compiled with the `hydratable: true` option"); }, m: function mount(target, anchor) { insert_dev(target, div1, anchor); append_dev(div1, div0); if (if_block0) if_block0.m(div0, null); append_dev(div1, t); if (if_block1) if_block1.m(div1, null); if (!mounted) { dispose = [ listen_dev(window, "mousemove", /*mousemove_handler*/ ctx[9], false, false, false), listen_dev(window, "wheel", /*wheel_handler*/ ctx[10], false, false, false) ]; mounted = true; } }, p: function update(ctx, [dirty]) { if (/*song*/ ctx[0]) { if (if_block0) { if_block0.p(ctx, dirty); } else { if_block0 = create_if_block_1(ctx); if_block0.c(); if_block0.m(div0, null); } } else if (if_block0) { if_block0.d(1); if_block0 = null; } if (dirty & /*now, last*/ 10) { toggle_class(div0, "hidden", /*now*/ ctx[3] - /*last*/ ctx[1] > 2000); } if (/*now*/ ctx[3] - /*lastVolumeUpdate*/ ctx[2] < 4000 && /*song*/ ctx[0] && /*song*/ ctx[0].audio) { if (if_block1) { if_block1.p(ctx, dirty); } else { if_block1 = create_if_block(ctx); if_block1.c(); if_block1.m(div1, null); } } else if (if_block1) { if_block1.d(1); if_block1 = null; } }, i: noop, o: noop, d: function destroy(detaching) { if (detaching) detach_dev(div1); if (if_block0) if_block0.d(); if (if_block1) if_block1.d(); mounted = false; run_all(dispose); } }; dispatch_dev("SvelteRegisterBlock", { block, id: create_fragment.name, type: "component", source: "", ctx }); return block; } function instance($$self, $$props, $$invalidate) { let { $$slots: slots = {}, $$scope } = $$props; validate_slots("Menu", slots, []); var { osuData } = $$props; var { song } = $$props; var last = Date.now(); var lastVolumeUpdate = Date.now() - 5000; var dialogActive = false; var now = Date.now(); setInterval( () => { $$invalidate(3, now = Date.now()); }, 500 ); var playing = true; function resetPool() { if (!osuData.songs) return false; $$invalidate(8, osuData.songPool = osuData.songs.filter(v => true), osuData); let a = osuData.songPool; for (let i = a.length - 1; i > 0; i--) { // shuffle const j = Math.floor(Math.random() * (i + 1)); [a[i], a[j]] = [a[j], a[i]]; } $$invalidate(0, song = osuData.songPool.shift()); } function playNext() { if (song.audio) { song.audio.pause(); } if (osuData.songPool.length) { $$invalidate(0, song = osuData.songPool.shift()); } else { resetPool(); } } function togglePlay() { $$invalidate(4, playing = !playing); if (playing) { song.audio.play(); } else { song.audio.pause(); } } function updateVolume(e) { if (!song || !song.audio || !e.altKey) return; $$invalidate(2, lastVolumeUpdate = Date.now()); var volume = song.audio.volume; volume += e.deltaY * -0.0005; $$invalidate(0, song.audio.volume = Math.min(1, Math.max(volume, 0)), song); } setTimeout( () => { $$invalidate(0, song); }, 200 ); const writable_props = ["osuData", "song"]; Object.keys($$props).forEach(key => { if (!~writable_props.indexOf(key) && key.slice(0, 2) !== "$$") console_1.warn(`