From 253315a9b7f70666c5221221305a25adfabf903f Mon Sep 17 00:00:00 2001 From: Wim Brand Date: Wed, 11 Nov 2020 00:00:54 +0100 Subject: [PATCH] implement directory navigator in svelte --- .gitignore | 3 + res/include/script/form.vue | 45 - res/include/script/user_settings.vue | 3 - res/include/style/layout.css | 7 +- res/include/style/modal.css | 2 +- res/static/svelte/filesystem.css | 7 + res/static/svelte/filesystem.js | 2989 +++++++++++++++++ res/static/svelte/modal.css | 3 + res/static/svelte/modal.js | 1567 +++++++++ res/template/filesystem.html | 3 + res/template/filesystem_svelte.html | 33 + svelte/package-lock.json | 769 +++++ svelte/package.json | 21 + svelte/rollup.config.js | 83 + svelte/src/filesystem.js | 8 + svelte/src/filesystem/Filesystem.svelte | 322 ++ svelte/src/filesystem/Sharebar.svelte | 45 + svelte/src/filesystem/Toolbar.svelte | 112 + .../src/filesystem/viewers/Directory.svelte | 127 + svelte/src/modal.js | 10 + svelte/src/modal/App.svelte | 45 + svelte/src/util/Formatting.svelte | 61 + svelte/src/util/Modal.svelte | 117 + svelte/src/util/Spinner.svelte | 39 + webcontroller/filesystem.go | 39 +- webcontroller/web_controller.go | 1 + 26 files changed, 6406 insertions(+), 55 deletions(-) delete mode 100644 res/include/script/form.vue delete mode 100644 res/include/script/user_settings.vue create mode 100644 res/static/svelte/filesystem.css create mode 100644 res/static/svelte/filesystem.js create mode 100644 res/static/svelte/modal.css create mode 100644 res/static/svelte/modal.js create mode 100644 res/template/filesystem_svelte.html create mode 100644 svelte/package-lock.json create mode 100644 svelte/package.json create mode 100644 svelte/rollup.config.js create mode 100644 svelte/src/filesystem.js create mode 100644 svelte/src/filesystem/Filesystem.svelte create mode 100644 svelte/src/filesystem/Sharebar.svelte create mode 100644 svelte/src/filesystem/Toolbar.svelte create mode 100644 svelte/src/filesystem/viewers/Directory.svelte create mode 100644 svelte/src/modal.js create mode 100644 svelte/src/modal/App.svelte create mode 100644 svelte/src/util/Formatting.svelte create mode 100644 svelte/src/util/Modal.svelte create mode 100644 svelte/src/util/Spinner.svelte diff --git a/.gitignore b/.gitignore index 9d1dca5..372177d 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,6 @@ main pdwebconf.toml go.sum +svelte/node_modules +*.js.map +*.css.map diff --git a/res/include/script/form.vue b/res/include/script/form.vue deleted file mode 100644 index 63d745c..0000000 --- a/res/include/script/form.vue +++ /dev/null @@ -1,45 +0,0 @@ -Vue.component("vform", { - template: ` -

TEST FORM

-
- - - - - - - - - - - - - - - - - - - - - -
Old Password - -
New Password - -
New Password again - -
- we need you to repeat your password so you won't be locked out of your account if you make a typing error -
- -
-
- ` -}) - -Vue.component("form_field", { - template: ` - - ` -}) diff --git a/res/include/script/user_settings.vue b/res/include/script/user_settings.vue deleted file mode 100644 index 85e1a21..0000000 --- a/res/include/script/user_settings.vue +++ /dev/null @@ -1,3 +0,0 @@ -const appTestForm = new Vue({ - el: "#test_form" -}) diff --git a/res/include/style/layout.css b/res/include/style/layout.css index 922ea36..5159d36 100644 --- a/res/include/style/layout.css +++ b/res/include/style/layout.css @@ -401,7 +401,7 @@ select { border: none; margin: 3px; background: linear-gradient(var(--input_color), var(--input_color_dark)); - padding: .3em .4em .3em .4em; + padding: 4px 5px 4px 5px; box-shadow: 2px 2px 6px -3px var(--shadow_color); line-height: 1em; overflow: hidden; @@ -412,7 +412,7 @@ select { outline: 0; vertical-align: middle; cursor: pointer; - transition: padding 0.25s, box-shadow 0.25s; + transition: padding 0.2s, box-shadow 0.2s; } button:hover, .button:hover, @@ -439,7 +439,8 @@ input[type="color"]:active, select:active{ background: linear-gradient(var(--input_color_dark), var(--input_color)); box-shadow: inset 4px 4px 8px var(--shadow_color); - padding: .5em .2em .1em .6em; /* Exactly .2em offset compared to the inactive padding to give a depth effect */ + /* Exactly 4px offset compared to the inactive padding to give a depth effect */ + padding: 8px 1px 0px 9px; } .button_full_width {width: calc(100% - 6px);} .button_highlight {background: linear-gradient(var(--highlight_color), var(--highlight_color_dark)) !important; color: var(--highlight_text_color) !important;} diff --git a/res/include/style/modal.css b/res/include/style/modal.css index 9ba2b93..95248c8 100644 --- a/res/include/style/modal.css +++ b/res/include/style/modal.css @@ -31,7 +31,7 @@ flex-shrink: 0; display: flex; flex-direction: row; - padding: 4px; + padding: 1px; } .modal_title { diff --git a/res/static/svelte/filesystem.css b/res/static/svelte/filesystem.css new file mode 100644 index 0000000..e96cf11 --- /dev/null +++ b/res/static/svelte/filesystem.css @@ -0,0 +1,7 @@ +.file_viewer.svelte-1vxdz33.svelte-1vxdz33.svelte-1vxdz33.svelte-1vxdz33{position:absolute;display:flex;flex-direction:column;top:0;right:0;bottom:0;left:0;overflow:hidden}.file_viewer.svelte-1vxdz33>.file_viewer_headerbar.svelte-1vxdz33.svelte-1vxdz33.svelte-1vxdz33{flex-grow:0;flex-shrink:0;display:flex;flex-direction:row;text-align:left;z-index:10;box-shadow:none}.file_viewer.svelte-1vxdz33>.file_viewer_headerbar.svelte-1vxdz33>.svelte-1vxdz33.svelte-1vxdz33{flex-grow:0;flex-shrink:0;margin-left:6px;margin-right:6px;display:inline}.file_viewer.svelte-1vxdz33>.file_viewer_headerbar.svelte-1vxdz33>.file_viewer_headerbar_title.svelte-1vxdz33.svelte-1vxdz33{flex-grow:1;flex-shrink:1;display:flex;flex-direction:column;overflow:hidden;line-height:1.2em;white-space:nowrap;text-overflow:ellipsis;justify-content:center}.button_home.svelte-1vxdz33.svelte-1vxdz33.svelte-1vxdz33.svelte-1vxdz33::after{content:"pixeldrain"}@media(max-width: 600px){.button_home.svelte-1vxdz33.svelte-1vxdz33.svelte-1vxdz33.svelte-1vxdz33::after{content:"pd"}}.file_viewer.svelte-1vxdz33>.list_navigator.svelte-1vxdz33.svelte-1vxdz33.svelte-1vxdz33{flex-grow:0;flex-shrink:0;position:relative;display:none;width:100%;background-color:var(--layer_1_color);text-align:center;line-height:1em;overflow-x:auto;overflow-y:hidden;z-index:50;white-space:nowrap}.file_viewer.svelte-1vxdz33>.file_viewer_window.svelte-1vxdz33.svelte-1vxdz33.svelte-1vxdz33{flex-grow:1;flex-shrink:1;position:relative;display:inline-block;width:auto;height:auto;margin:0;z-index:9}.file_viewer.svelte-1vxdz33>.file_viewer_window.svelte-1vxdz33>.file_viewer_file_preview.svelte-1vxdz33.svelte-1vxdz33{position:absolute;left:0;right:0;top:0;bottom:0;display:inline-block;min-height:100px;min-width:100px;text-align:center;vertical-align:middle;transition:left 0.5s;overflow:hidden;box-shadow:inset 2px 2px 8px var(--shadow_color)}.file_viewer.svelte-1vxdz33>.file_viewer_window.svelte-1vxdz33>.file_viewer_file_preview.svelte-1vxdz33>.center.svelte-1vxdz33{position:relative;display:block;margin:auto;max-width:100%;max-height:100%;top:50%;transform:translateY(-50%)}.toolbar.svelte-1vxdz33.svelte-1vxdz33.svelte-1vxdz33.svelte-1vxdz33{position:absolute;width:8em;z-index:49;overflow:hidden;float:left;background-color:var(--layer_1_color);left:-8em;bottom:0;top:0;padding:0;text-align:left;transition:left 0.5s}.toolbar.toolbar_visible.svelte-1vxdz33.svelte-1vxdz33.svelte-1vxdz33.svelte-1vxdz33{left:0}.file_viewer.svelte-1vxdz33>.file_viewer_window.svelte-1vxdz33>.file_viewer_file_preview.toolbar_visible.svelte-1vxdz33.svelte-1vxdz33{left:8em}.toolbar.svelte-1vxdz33>div.svelte-1vxdz33.svelte-1vxdz33.svelte-1vxdz33{position:absolute;left:0;top:0;bottom:0;right:-30px;overflow-y:scroll;overflow-x:hidden}.toolbar.svelte-1vxdz33>div.svelte-1vxdz33>div.svelte-1vxdz33.svelte-1vxdz33{position:absolute;left:0;top:0;width:8em;height:auto;text-align:center}.toolbar_button.svelte-1vxdz33.svelte-1vxdz33.svelte-1vxdz33.svelte-1vxdz33{text-align:left}.toolbar_label.svelte-1vxdz33.svelte-1vxdz33.svelte-1vxdz33.svelte-1vxdz33{text-align:left;padding-left:10px;font-size:0.8em;line-height:0.7em;margin-top:0.5em}.toolbar_statistic.svelte-1vxdz33.svelte-1vxdz33.svelte-1vxdz33.svelte-1vxdz33{text-align:center} +.sharebar.svelte-gnq1s2{position:absolute;width:7em;left:-8em;bottom:0;top:0;overflow-y:scroll;overflow-x:hidden;float:left;background-color:var(--layer_1_color);box-shadow:inset 1px 1px var(--layer_1_shadow) var(--shadow_color);text-align:center;z-index:48;overflow:hidden;transition:left 0.5s}.visible.svelte-gnq1s2{left:8em} +.container.svelte-1afjvoj.svelte-1afjvoj{height:100%;width:100%;padding:0;overflow-y:auto;text-align:center}.toolbar.svelte-1afjvoj.svelte-1afjvoj{position:relative;display:inline-block;max-width:800px;width:100%;margin:20px 0 0 0;box-sizing:border-box}.directory.svelte-1afjvoj.svelte-1afjvoj{position:relative;display:inline-block;max-width:800px;width:100%;margin:20px 0 40px 0;text-align:left;background-color:var(--layer_2_color);box-shadow:1px 1px var(--layer_2_shadow) var(--shadow_color);box-sizing:border-box}.node.svelte-1afjvoj.svelte-1afjvoj{position:relative;height:40px;overflow:hidden;margin:4px;padding:4px;box-sizing:border-box;cursor:pointer}.node.svelte-1afjvoj.svelte-1afjvoj:hover:not(.node_selected){background-color:var(--input_color_dark);color:var(--input_text_color);text-decoration:none}.node.svelte-1afjvoj>div.svelte-1afjvoj{height:100%;overflow:hidden;padding:0;line-height:32px;box-sizing:border-box;display:inline-block;text-overflow:ellipsis;white-space:nowrap}.node.svelte-1afjvoj>img.svelte-1afjvoj{max-height:100%;margin-right:6px;width:auto;min-width:auto;float:left;display:block} +.background.svelte-tirhyp{position:fixed;text-align:center;top:0;right:0;bottom:0;left:0;background-color:rgba(0, 0, 0, 0.5)}.window.svelte-tirhyp{position:absolute;z-index:inherit;display:flex;flex-direction:column;background-color:var(--layer_2_color);max-height:100%;max-width:100%;margin:0 auto;top:20%;left:50%;transform:translate(-50%, -20%);padding:0;box-sizing:border-box;text-align:left;box-shadow:var(--shadow_color) 0px 0px 50px}.header.svelte-tirhyp{flex-grow:0;flex-shrink:0;display:flex;flex-direction:row;padding:1px}.title.svelte-tirhyp{flex-grow:1;flex-shrink:1;display:flex;flex-direction:row;align-items:center;justify-content:center;font-size:1.2em;white-space:nowrap;text-overflow:ellipsis;overflow:hidden}.button_close.svelte-tirhyp{flex-grow:0;flex-shrink:0}.body.svelte-tirhyp{flex-grow:1;flex-shrink:1;overflow:auto;padding:10px} +svg.svelte-1pco739{color:var(--highlight_color);fill:currentColor} + +/*# sourceMappingURL=filesystem.css.map */ \ No newline at end of file diff --git a/res/static/svelte/filesystem.js b/res/static/svelte/filesystem.js new file mode 100644 index 0000000..3f38cc7 --- /dev/null +++ b/res/static/svelte/filesystem.js @@ -0,0 +1,2989 @@ + +(function(l, r) { if (l.getElementById('livereloadscript')) return; r = l.createElement('script'); r.async = 1; r.src = '//' + (window.location.host || 'localhost').split(':')[0] + ':5000/livereload.js?snipver=1'; r.id = 'livereloadscript'; l.getElementsByTagName('head')[0].appendChild(r) })(window.document); +var app = (function () { + 'use strict'; + + function noop() { } + const identity = x => x; + function assign(tar, src) { + // @ts-ignore + for (const k in src) + tar[k] = src[k]; + return tar; + } + 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 create_slot(definition, ctx, $$scope, fn) { + if (definition) { + const slot_ctx = get_slot_context(definition, ctx, $$scope, fn); + return definition[0](slot_ctx); + } + } + function get_slot_context(definition, ctx, $$scope, fn) { + return definition[1] && fn + ? assign($$scope.ctx.slice(), definition[1](fn(ctx))) + : $$scope.ctx; + } + function get_slot_changes(definition, $$scope, dirty, fn) { + if (definition[2] && fn) { + const lets = definition[2](fn(dirty)); + if ($$scope.dirty === undefined) { + return lets; + } + if (typeof lets === 'object') { + const merged = []; + const len = Math.max($$scope.dirty.length, lets.length); + for (let i = 0; i < len; i += 1) { + merged[i] = $$scope.dirty[i] | lets[i]; + } + return merged; + } + return $$scope.dirty | lets; + } + return $$scope.dirty; + } + function update_slot(slot, slot_definition, ctx, $$scope, dirty, get_slot_changes_fn, get_slot_context_fn) { + const slot_changes = get_slot_changes(slot_definition, $$scope, dirty, get_slot_changes_fn); + if (slot_changes) { + const slot_context = get_slot_context(slot_definition, ctx, $$scope, get_slot_context_fn); + slot.p(slot_context, slot_changes); + } + } + function action_destroyer(action_result) { + return action_result && is_function(action_result.destroy) ? action_result.destroy : noop; + } + + const is_client = typeof window !== 'undefined'; + let now = is_client + ? () => window.performance.now() + : () => Date.now(); + let raf = is_client ? cb => requestAnimationFrame(cb) : noop; + + const tasks = new Set(); + function run_tasks(now) { + tasks.forEach(task => { + if (!task.c(now)) { + tasks.delete(task); + task.f(); + } + }); + if (tasks.size !== 0) + raf(run_tasks); + } + /** + * Creates a new task that runs on each raf frame + * until it returns a falsy value or is aborted + */ + function loop(callback) { + let task; + if (tasks.size === 0) + raf(run_tasks); + return { + promise: new Promise(fulfill => { + tasks.add(task = { c: callback, f: fulfill }); + }), + abort() { + tasks.delete(task); + } + }; + } + + 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 destroy_each(iterations, detaching) { + for (let i = 0; i < iterations.length; i += 1) { + if (iterations[i]) + iterations[i].d(detaching); + } + } + function element(name) { + return document.createElement(name); + } + function svg_element(name) { + return document.createElementNS('http://www.w3.org/2000/svg', name); + } + function text(data) { + return document.createTextNode(data); + } + function space() { + return text(' '); + } + function empty() { + return text(''); + } + function listen(node, event, handler, options) { + node.addEventListener(event, handler, options); + return () => node.removeEventListener(event, handler, options); + } + function stop_propagation(fn) { + return function (event) { + event.stopPropagation(); + // @ts-ignore + return fn.call(this, event); + }; + } + 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; + } + + const active_docs = new Set(); + let active = 0; + // https://github.com/darkskyapp/string-hash/blob/master/index.js + function hash(str) { + let hash = 5381; + let i = str.length; + while (i--) + hash = ((hash << 5) - hash) ^ str.charCodeAt(i); + return hash >>> 0; + } + function create_rule(node, a, b, duration, delay, ease, fn, uid = 0) { + const step = 16.666 / duration; + let keyframes = '{\n'; + for (let p = 0; p <= 1; p += step) { + const t = a + (b - a) * ease(p); + keyframes += p * 100 + `%{${fn(t, 1 - t)}}\n`; + } + const rule = keyframes + `100% {${fn(b, 1 - b)}}\n}`; + const name = `__svelte_${hash(rule)}_${uid}`; + const doc = node.ownerDocument; + active_docs.add(doc); + const stylesheet = doc.__svelte_stylesheet || (doc.__svelte_stylesheet = doc.head.appendChild(element('style')).sheet); + const current_rules = doc.__svelte_rules || (doc.__svelte_rules = {}); + if (!current_rules[name]) { + current_rules[name] = true; + stylesheet.insertRule(`@keyframes ${name} ${rule}`, stylesheet.cssRules.length); + } + const animation = node.style.animation || ''; + node.style.animation = `${animation ? `${animation}, ` : ''}${name} ${duration}ms linear ${delay}ms 1 both`; + active += 1; + return name; + } + function delete_rule(node, name) { + const previous = (node.style.animation || '').split(', '); + const next = previous.filter(name + ? anim => anim.indexOf(name) < 0 // remove specific animation + : anim => anim.indexOf('__svelte') === -1 // remove all Svelte animations + ); + const deleted = previous.length - next.length; + if (deleted) { + node.style.animation = next.join(', '); + active -= deleted; + if (!active) + clear_rules(); + } + } + function clear_rules() { + raf(() => { + if (active) + return; + active_docs.forEach(doc => { + const stylesheet = doc.__svelte_stylesheet; + let i = stylesheet.cssRules.length; + while (i--) + stylesheet.deleteRule(i); + doc.__svelte_rules = {}; + }); + active_docs.clear(); + }); + } + + 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 onMount(fn) { + get_current_component().$$.on_mount.push(fn); + } + 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); + }); + } + }; + } + // TODO figure out if we still want to support + // shorthand events, or if we want to implement + // a real bubbling mechanism + function bubble(component, event) { + const callbacks = component.$$.callbacks[event.type]; + if (callbacks) { + callbacks.slice().forEach(fn => fn(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); + } + 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); + } + } + + let promise; + function wait() { + if (!promise) { + promise = Promise.resolve(); + promise.then(() => { + promise = null; + }); + } + return promise; + } + function dispatch(node, direction, kind) { + node.dispatchEvent(custom_event(`${direction ? 'intro' : 'outro'}${kind}`)); + } + const outroing = new Set(); + let outros; + function group_outros() { + outros = { + r: 0, + c: [], + p: outros // parent group + }; + } + function check_outros() { + if (!outros.r) { + run_all(outros.c); + } + outros = outros.p; + } + 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 null_transition = { duration: 0 }; + function create_bidirectional_transition(node, fn, params, intro) { + let config = fn(node, params); + let t = intro ? 0 : 1; + let running_program = null; + let pending_program = null; + let animation_name = null; + function clear_animation() { + if (animation_name) + delete_rule(node, animation_name); + } + function init(program, duration) { + const d = program.b - t; + duration *= Math.abs(d); + return { + a: t, + b: program.b, + d, + duration, + start: program.start, + end: program.start + duration, + group: program.group + }; + } + function go(b) { + const { delay = 0, duration = 300, easing = identity, tick = noop, css } = config || null_transition; + const program = { + start: now() + delay, + b + }; + if (!b) { + // @ts-ignore todo: improve typings + program.group = outros; + outros.r += 1; + } + if (running_program || pending_program) { + pending_program = program; + } + else { + // if this is an intro, and there's a delay, we need to do + // an initial tick and/or apply CSS animation immediately + if (css) { + clear_animation(); + animation_name = create_rule(node, t, b, duration, delay, easing, css); + } + if (b) + tick(0, 1); + running_program = init(program, duration); + add_render_callback(() => dispatch(node, b, 'start')); + loop(now => { + if (pending_program && now > pending_program.start) { + running_program = init(pending_program, duration); + pending_program = null; + dispatch(node, running_program.b, 'start'); + if (css) { + clear_animation(); + animation_name = create_rule(node, t, running_program.b, running_program.duration, 0, easing, config.css); + } + } + if (running_program) { + if (now >= running_program.end) { + tick(t = running_program.b, 1 - t); + dispatch(node, running_program.b, 'end'); + if (!pending_program) { + // we're done + if (running_program.b) { + // intro — we can tidy up immediately + clear_animation(); + } + else { + // outro — needs to be coordinated + if (!--running_program.group.r) + run_all(running_program.group.c); + } + } + running_program = null; + } + else if (now >= running_program.start) { + const p = now - running_program.start; + t = running_program.a + running_program.d * easing(p / running_program.duration); + tick(t, 1 - t); + } + } + return !!(running_program || pending_program); + }); + } + } + return { + run(b) { + if (is_function(config)) { + wait().then(() => { + // @ts-ignore + config = config(); + go(b); + }); + } + else { + go(b); + } + }, + end() { + clear_animation(); + running_program = pending_program = null; + } + }; + } + + const globals = (typeof window !== 'undefined' + ? window + : typeof globalThis !== 'undefined' + ? globalThis + : global); + 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.29.6' }, 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_each_argument(arg) { + if (typeof arg !== 'string' && !(arg && typeof arg === 'object' && 'length' in arg)) { + let msg = '{#each} only iterates over array-like objects.'; + if (typeof Symbol === 'function' && arg && Symbol.iterator in arg) { + msg += ' You can use a spread to convert this iterable into an array.'; + } + throw new Error(msg); + } + } + 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/util/Formatting.svelte generated by Svelte v3.29.6 */ + + const formatThousands = x => { + return x.toString().replace(/\B(?=(\d{3})+(?!\d))/g, " "); + }; + + const formatDataVolume = (amt, precision) => { + if (precision < 3) { + precision = 3; + } + + if (amt >= 1000000000000000000) { + return (amt / 1000000000000000000).toPrecision(precision) + " EB"; + } else if (amt >= 1000000000000000) { + return (amt / 1000000000000000).toPrecision(precision) + " PB"; + } else if (amt >= 1000000000000) { + return (amt / 1000000000000).toPrecision(precision) + " TB"; + } else if (amt >= 1000000000) { + return (amt / 1000000000).toPrecision(precision) + " GB"; + } else if (amt >= 1000000) { + return (amt / 1000000).toPrecision(precision) + " MB"; + } else if (amt >= 1000) { + return (amt / 1000).toPrecision(precision) + " kB"; + } + + return amt + " B"; + }; + + const formatDate = (date, hours, minutes, seconds) => { + if (!(date instanceof Date)) { + date = new Date(date); + } + + let dateStr = date.getFullYear() + "-" + ("00" + (date.getMonth() + 1)).slice(-2) + "-" + ("00" + date.getDate()).slice(-2); + + if (hours) { + dateStr += " " + ("00" + date.getHours()).slice(-2); + } + + if (minutes) { + dateStr += ":" + ("00" + date.getMinutes()).slice(-2); + } + + if (seconds) { + dateStr += ":" + ("00" + date.getMinutes()).slice(-2); + } + + return dateStr; + }; + + /* src/filesystem/Sharebar.svelte generated by Svelte v3.29.6 */ + + const file = "src/filesystem/Sharebar.svelte"; + + function create_fragment(ctx) { + let div; + let t0; + let br; + let t1; + let button0; + let t3; + let button1; + let t5; + let button2; + let t7; + let button3; + let t9; + let button4; + + const block = { + c: function create() { + div = element("div"); + t0 = text("Share on:"); + br = element("br"); + t1 = space(); + button0 = element("button"); + button0.textContent = "E-Mail"; + t3 = space(); + button1 = element("button"); + button1.textContent = "Reddit"; + t5 = space(); + button2 = element("button"); + button2.textContent = "Twitter"; + t7 = space(); + button3 = element("button"); + button3.textContent = "Facebook"; + t9 = space(); + button4 = element("button"); + button4.textContent = "Tumblr"; + add_location(br, file, 8, 10, 230); + attr_dev(button0, "class", "sharebar-button button_full_width"); + attr_dev(button0, "onclick", "window.open('mailto:please@set.address?subject=File%20on%20pixeldrain&body=' + window.location.href);"); + add_location(button0, file, 9, 1, 237); + attr_dev(button1, "class", "sharebar-button button_full_width"); + attr_dev(button1, "onclick", "window.open('https://www.reddit.com/submit?url=' + window.location.href);"); + add_location(button1, file, 12, 1, 421); + attr_dev(button2, "class", "sharebar-button button_full_width"); + attr_dev(button2, "onclick", "window.open('https://twitter.com/share?url=' + window.location.href);"); + add_location(button2, file, 15, 1, 577); + attr_dev(button3, "class", "sharebar-button button_full_width"); + attr_dev(button3, "onclick", "window.open('http://www.facebook.com/sharer.php?u=' + window.location.href);"); + add_location(button3, file, 18, 1, 730); + attr_dev(button4, "class", "sharebar-button button_full_width"); + attr_dev(button4, "onclick", "window.open('http://www.tumblr.com/share/link?url=' + window.location.href);"); + add_location(button4, file, 21, 1, 891); + attr_dev(div, "class", "sharebar svelte-gnq1s2"); + toggle_class(div, "visible", /*visible*/ ctx[0]); + add_location(div, file, 7, 0, 162); + }, + 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, div, anchor); + append_dev(div, t0); + append_dev(div, br); + append_dev(div, t1); + append_dev(div, button0); + append_dev(div, t3); + append_dev(div, button1); + append_dev(div, t5); + append_dev(div, button2); + append_dev(div, t7); + append_dev(div, button3); + append_dev(div, t9); + append_dev(div, button4); + /*div_binding*/ ctx[4](div); + }, + p: function update(ctx, [dirty]) { + if (dirty & /*visible*/ 1) { + toggle_class(div, "visible", /*visible*/ ctx[0]); + } + }, + i: noop, + o: noop, + d: function destroy(detaching) { + if (detaching) detach_dev(div); + /*div_binding*/ ctx[4](null); + } + }; + + 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("Sharebar", slots, []); + let sharebar; + let { visible = false } = $$props; + + const setVisible = v => { + $$invalidate(0, visible = v); + }; + + const toggle = () => { + setVisible(!visible); + }; + + const writable_props = ["visible"]; + + Object.keys($$props).forEach(key => { + if (!~writable_props.indexOf(key) && key.slice(0, 2) !== "$$") console.warn(` was created with unknown prop '${key}'`); + }); + + function div_binding($$value) { + binding_callbacks[$$value ? "unshift" : "push"](() => { + sharebar = $$value; + $$invalidate(1, sharebar); + }); + } + + $$self.$$set = $$props => { + if ("visible" in $$props) $$invalidate(0, visible = $$props.visible); + }; + + $$self.$capture_state = () => ({ sharebar, visible, setVisible, toggle }); + + $$self.$inject_state = $$props => { + if ("sharebar" in $$props) $$invalidate(1, sharebar = $$props.sharebar); + if ("visible" in $$props) $$invalidate(0, visible = $$props.visible); + }; + + if ($$props && "$$inject" in $$props) { + $$self.$inject_state($$props.$$inject); + } + + return [visible, sharebar, setVisible, toggle, div_binding]; + } + + class Sharebar extends SvelteComponentDev { + constructor(options) { + super(options); + init(this, options, instance, create_fragment, safe_not_equal, { visible: 0, setVisible: 2, toggle: 3 }); + + dispatch_dev("SvelteRegisterComponent", { + component: this, + tagName: "Sharebar", + options, + id: create_fragment.name + }); + } + + get visible() { + throw new Error(": Props cannot be read directly from the component instance unless compiling with 'accessors: true' or ''"); + } + + set visible(value) { + throw new Error(": Props cannot be set directly on the component instance unless compiling with 'accessors: true' or ''"); + } + + get setVisible() { + return this.$$.ctx[2]; + } + + set setVisible(value) { + throw new Error(": Props cannot be set directly on the component instance unless compiling with 'accessors: true' or ''"); + } + + get toggle() { + return this.$$.ctx[3]; + } + + set toggle(value) { + throw new Error(": Props cannot be set directly on the component instance unless compiling with 'accessors: true' or ''"); + } + } + + /* src/util/Spinner.svelte generated by Svelte v3.29.6 */ + + const file$1 = "src/util/Spinner.svelte"; + + function create_fragment$1(ctx) { + let svg; + let path; + let animateTransform; + + const block = { + c: function create() { + svg = svg_element("svg"); + path = svg_element("path"); + animateTransform = svg_element("animateTransform"); + attr_dev(animateTransform, "attributeType", "xml"); + attr_dev(animateTransform, "attributeName", "transform"); + attr_dev(animateTransform, "type", "rotate"); + attr_dev(animateTransform, "from", "0 40 40"); + attr_dev(animateTransform, "to", "360 40 40"); + attr_dev(animateTransform, "dur", "0.6s"); + attr_dev(animateTransform, "repeatCount", "indefinite"); + add_location(animateTransform, file$1, 22, 2, 1719); + attr_dev(path, "d", "M10,40c0,0,0-0.4,0-1.1c0-0.3,0-0.8,0-1.3c0-0.3,0-0.5,0-0.8c0-0.3,0.1-0.6,0.1-0.9c0.1-0.6,0.1-1.4,0.2-2.1\n\t\tc0.2-0.8,0.3-1.6,0.5-2.5c0.2-0.9,0.6-1.8,0.8-2.8c0.3-1,0.8-1.9,1.2-3c0.5-1,1.1-2,1.7-3.1c0.7-1,1.4-2.1,2.2-3.1\n\t\tc1.6-2.1,3.7-3.9,6-5.6c2.3-1.7,5-3,7.9-4.1c0.7-0.2,1.5-0.4,2.2-0.7c0.7-0.3,1.5-0.3,2.3-0.5c0.8-0.2,1.5-0.3,2.3-0.4l1.2-0.1\n\t\tl0.6-0.1l0.3,0l0.1,0l0.1,0l0,0c0.1,0-0.1,0,0.1,0c1.5,0,2.9-0.1,4.5,0.2c0.8,0.1,1.6,0.1,2.4,0.3c0.8,0.2,1.5,0.3,2.3,0.5\n\t\tc3,0.8,5.9,2,8.5,3.6c2.6,1.6,4.9,3.4,6.8,5.4c1,1,1.8,2.1,2.7,3.1c0.8,1.1,1.5,2.1,2.1,3.2c0.6,1.1,1.2,2.1,1.6,3.1\n\t\tc0.4,1,0.9,2,1.2,3c0.3,1,0.6,1.9,0.8,2.7c0.2,0.9,0.3,1.6,0.5,2.4c0.1,0.4,0.1,0.7,0.2,1c0,0.3,0.1,0.6,0.1,0.9\n\t\tc0.1,0.6,0.1,1,0.1,1.4C74,39.6,74,40,74,40c0.2,2.2-1.5,4.1-3.7,4.3s-4.1-1.5-4.3-3.7c0-0.1,0-0.2,0-0.3l0-0.4c0,0,0-0.3,0-0.9\n\t\tc0-0.3,0-0.7,0-1.1c0-0.2,0-0.5,0-0.7c0-0.2-0.1-0.5-0.1-0.8c-0.1-0.6-0.1-1.2-0.2-1.9c-0.1-0.7-0.3-1.4-0.4-2.2\n\t\tc-0.2-0.8-0.5-1.6-0.7-2.4c-0.3-0.8-0.7-1.7-1.1-2.6c-0.5-0.9-0.9-1.8-1.5-2.7c-0.6-0.9-1.2-1.8-1.9-2.7c-1.4-1.8-3.2-3.4-5.2-4.9\n\t\tc-2-1.5-4.4-2.7-6.9-3.6c-0.6-0.2-1.3-0.4-1.9-0.6c-0.7-0.2-1.3-0.3-1.9-0.4c-1.2-0.3-2.8-0.4-4.2-0.5l-2,0c-0.7,0-1.4,0.1-2.1,0.1\n\t\tc-0.7,0.1-1.4,0.1-2,0.3c-0.7,0.1-1.3,0.3-2,0.4c-2.6,0.7-5.2,1.7-7.5,3.1c-2.2,1.4-4.3,2.9-6,4.7c-0.9,0.8-1.6,1.8-2.4,2.7\n\t\tc-0.7,0.9-1.3,1.9-1.9,2.8c-0.5,1-1,1.9-1.4,2.8c-0.4,0.9-0.8,1.8-1,2.6c-0.3,0.9-0.5,1.6-0.7,2.4c-0.2,0.7-0.3,1.4-0.4,2.1\n\t\tc-0.1,0.3-0.1,0.6-0.2,0.9c0,0.3-0.1,0.6-0.1,0.8c0,0.5-0.1,0.9-0.1,1.3C10,39.6,10,40,10,40z"); + add_location(path, file$1, 8, 1, 183); + attr_dev(svg, "version", "1.1"); + attr_dev(svg, "class", "svg_spinner svelte-1pco739"); + attr_dev(svg, "xmlns", "http://www.w3.org/2000/svg"); + attr_dev(svg, "xmlns:xlink", "http://www.w3.org/1999/xlink"); + attr_dev(svg, "x", "0px"); + attr_dev(svg, "y", "0px"); + attr_dev(svg, "viewBox", "0 0 80 80"); + attr_dev(svg, "xml:space", "preserve"); + add_location(svg, file$1, 0, 0, 0); + }, + 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, svg, anchor); + append_dev(svg, path); + append_dev(path, animateTransform); + }, + p: noop, + i: noop, + o: noop, + d: function destroy(detaching) { + if (detaching) detach_dev(svg); + } + }; + + dispatch_dev("SvelteRegisterBlock", { + block, + id: create_fragment$1.name, + type: "component", + source: "", + ctx + }); + + return block; + } + + function instance$1($$self, $$props) { + let { $$slots: slots = {}, $$scope } = $$props; + validate_slots("Spinner", slots, []); + const writable_props = []; + + Object.keys($$props).forEach(key => { + if (!~writable_props.indexOf(key) && key.slice(0, 2) !== "$$") console.warn(` was created with unknown prop '${key}'`); + }); + + return []; + } + + class Spinner extends SvelteComponentDev { + constructor(options) { + super(options); + init(this, options, instance$1, create_fragment$1, safe_not_equal, {}); + + dispatch_dev("SvelteRegisterComponent", { + component: this, + tagName: "Spinner", + options, + id: create_fragment$1.name + }); + } + } + + function fade(node, { delay = 0, duration = 400, easing = identity }) { + const o = +getComputedStyle(node).opacity; + return { + delay, + duration, + easing, + css: t => `opacity: ${t * o}` + }; + } + + /* src/util/Modal.svelte generated by Svelte v3.29.6 */ + const file$2 = "src/util/Modal.svelte"; + + // (45:0) {#if visible} + function create_if_block(ctx) { + let div4; + let div3; + let div1; + let div0; + let t0; + let t1; + let button; + let i; + let t3; + let div2; + let load_modal_action; + let load_bg_action; + let div4_transition; + let current; + let mounted; + let dispose; + const default_slot_template = /*#slots*/ ctx[11].default; + const default_slot = create_slot(default_slot_template, ctx, /*$$scope*/ ctx[10], null); + + const block = { + c: function create() { + div4 = element("div"); + div3 = element("div"); + div1 = element("div"); + div0 = element("div"); + t0 = text(/*title*/ ctx[0]); + t1 = space(); + button = element("button"); + i = element("i"); + i.textContent = "close"; + t3 = space(); + div2 = element("div"); + if (default_slot) default_slot.c(); + attr_dev(div0, "class", "title svelte-tirhyp"); + add_location(div0, file$2, 48, 3, 1188); + attr_dev(i, "class", "icon"); + add_location(i, file$2, 50, 4, 1285); + attr_dev(button, "class", "button_close button_red svelte-tirhyp"); + add_location(button, file$2, 49, 3, 1224); + attr_dev(div1, "class", "header highlight_1 svelte-tirhyp"); + add_location(div1, file$2, 47, 2, 1152); + attr_dev(div2, "class", "body svelte-tirhyp"); + add_location(div2, file$2, 53, 2, 1335); + attr_dev(div3, "class", "window svelte-tirhyp"); + attr_dev(div3, "role", "dialog"); + attr_dev(div3, "aria-modal", "true"); + add_location(div3, file$2, 46, 1, 1057); + attr_dev(div4, "class", "background svelte-tirhyp"); + add_location(div4, file$2, 45, 0, 969); + }, + m: function mount(target, anchor) { + insert_dev(target, div4, anchor); + append_dev(div4, div3); + append_dev(div3, div1); + append_dev(div1, div0); + append_dev(div0, t0); + append_dev(div1, t1); + append_dev(div1, button); + append_dev(button, i); + append_dev(div3, t3); + append_dev(div3, div2); + + if (default_slot) { + default_slot.m(div2, null); + } + + current = true; + + if (!mounted) { + dispose = [ + listen_dev(button, "click", /*hide*/ ctx[1], false, false, false), + action_destroyer(load_modal_action = /*load_modal*/ ctx[4].call(null, div3)), + listen_dev(div3, "click", stop_propagation(/*click_handler*/ ctx[12]), false, false, true), + action_destroyer(load_bg_action = /*load_bg*/ ctx[3].call(null, div4)), + listen_dev(div4, "click", /*hide*/ ctx[1], false, false, false) + ]; + + mounted = true; + } + }, + p: function update(ctx, dirty) { + if (!current || dirty & /*title*/ 1) set_data_dev(t0, /*title*/ ctx[0]); + + if (default_slot) { + if (default_slot.p && dirty & /*$$scope*/ 1024) { + update_slot(default_slot, default_slot_template, ctx, /*$$scope*/ ctx[10], dirty, null, null); + } + } + }, + i: function intro(local) { + if (current) return; + transition_in(default_slot, local); + + add_render_callback(() => { + if (!div4_transition) div4_transition = create_bidirectional_transition(div4, fade, { duration: 200 }, true); + div4_transition.run(1); + }); + + current = true; + }, + o: function outro(local) { + transition_out(default_slot, local); + if (!div4_transition) div4_transition = create_bidirectional_transition(div4, fade, { duration: 200 }, false); + div4_transition.run(0); + current = false; + }, + d: function destroy(detaching) { + if (detaching) detach_dev(div4); + if (default_slot) default_slot.d(detaching); + if (detaching && div4_transition) div4_transition.end(); + mounted = false; + run_all(dispose); + } + }; + + dispatch_dev("SvelteRegisterBlock", { + block, + id: create_if_block.name, + type: "if", + source: "(45:0) {#if visible}", + ctx + }); + + return block; + } + + function create_fragment$2(ctx) { + let if_block_anchor; + let current; + let mounted; + let dispose; + let if_block = /*visible*/ ctx[2] && create_if_block(ctx); + + const block = { + c: function create() { + if (if_block) if_block.c(); + if_block_anchor = empty(); + }, + 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) { + if (if_block) if_block.m(target, anchor); + insert_dev(target, if_block_anchor, anchor); + current = true; + + if (!mounted) { + dispose = listen_dev(window, "keydown", /*keydown*/ ctx[5], false, false, false); + mounted = true; + } + }, + p: function update(ctx, [dirty]) { + if (/*visible*/ ctx[2]) { + if (if_block) { + if_block.p(ctx, dirty); + + if (dirty & /*visible*/ 4) { + transition_in(if_block, 1); + } + } else { + if_block = create_if_block(ctx); + if_block.c(); + transition_in(if_block, 1); + if_block.m(if_block_anchor.parentNode, if_block_anchor); + } + } else if (if_block) { + group_outros(); + + transition_out(if_block, 1, 1, () => { + if_block = null; + }); + + check_outros(); + } + }, + i: function intro(local) { + if (current) return; + transition_in(if_block); + current = true; + }, + o: function outro(local) { + transition_out(if_block); + current = false; + }, + d: function destroy(detaching) { + if (if_block) if_block.d(detaching); + if (detaching) detach_dev(if_block_anchor); + mounted = false; + dispose(); + } + }; + + dispatch_dev("SvelteRegisterBlock", { + block, + id: create_fragment$2.name, + type: "component", + source: "", + ctx + }); + + return block; + } + + let global_index = 10000; + + function instance$2($$self, $$props, $$invalidate) { + let { $$slots: slots = {}, $$scope } = $$props; + validate_slots("Modal", slots, ['default']); + let { title = "" } = $$props; + let { width = "800px" } = $$props; + let { height = "auto" } = $$props; + let visible = false; + + const load_bg = background => { + background.style.zIndex = global_index.valueOf(); + global_index++; + }; + + const load_modal = modal => { + modal.style.width = width; + modal.style.height = height; + }; + + const dispatch = createEventDispatcher(); + + const show = () => { + $$invalidate(2, visible = true); + dispatch("shown"); + }; + + const hide = () => { + $$invalidate(2, visible = false); + dispatch("hidden"); + }; + + const toggle = () => { + if (visible) { + hide(); + } else { + show(); + } + }; + + const keydown = e => { + if (e.key === "Escape") { + hide(); + return; + } + }; + + const writable_props = ["title", "width", "height"]; + + Object.keys($$props).forEach(key => { + if (!~writable_props.indexOf(key) && key.slice(0, 2) !== "$$") console.warn(` was created with unknown prop '${key}'`); + }); + + function click_handler(event) { + bubble($$self, event); + } + + $$self.$$set = $$props => { + if ("title" in $$props) $$invalidate(0, title = $$props.title); + if ("width" in $$props) $$invalidate(6, width = $$props.width); + if ("height" in $$props) $$invalidate(7, height = $$props.height); + if ("$$scope" in $$props) $$invalidate(10, $$scope = $$props.$$scope); + }; + + $$self.$capture_state = () => ({ + global_index, + createEventDispatcher, + fade, + title, + width, + height, + visible, + load_bg, + load_modal, + dispatch, + show, + hide, + toggle, + keydown + }); + + $$self.$inject_state = $$props => { + if ("title" in $$props) $$invalidate(0, title = $$props.title); + if ("width" in $$props) $$invalidate(6, width = $$props.width); + if ("height" in $$props) $$invalidate(7, height = $$props.height); + if ("visible" in $$props) $$invalidate(2, visible = $$props.visible); + }; + + if ($$props && "$$inject" in $$props) { + $$self.$inject_state($$props.$$inject); + } + + return [ + title, + hide, + visible, + load_bg, + load_modal, + keydown, + width, + height, + show, + toggle, + $$scope, + slots, + click_handler + ]; + } + + class Modal extends SvelteComponentDev { + constructor(options) { + super(options); + + init(this, options, instance$2, create_fragment$2, safe_not_equal, { + title: 0, + width: 6, + height: 7, + show: 8, + hide: 1, + toggle: 9 + }); + + dispatch_dev("SvelteRegisterComponent", { + component: this, + tagName: "Modal", + options, + id: create_fragment$2.name + }); + } + + get title() { + throw new Error(": Props cannot be read directly from the component instance unless compiling with 'accessors: true' or ''"); + } + + set title(value) { + throw new Error(": Props cannot be set directly on the component instance unless compiling with 'accessors: true' or ''"); + } + + get width() { + throw new Error(": Props cannot be read directly from the component instance unless compiling with 'accessors: true' or ''"); + } + + set width(value) { + throw new Error(": Props cannot be set directly on the component instance unless compiling with 'accessors: true' or ''"); + } + + get height() { + throw new Error(": Props cannot be read directly from the component instance unless compiling with 'accessors: true' or ''"); + } + + set height(value) { + throw new Error(": Props cannot be set directly on the component instance unless compiling with 'accessors: true' or ''"); + } + + get show() { + return this.$$.ctx[8]; + } + + set show(value) { + throw new Error(": Props cannot be set directly on the component instance unless compiling with 'accessors: true' or ''"); + } + + get hide() { + return this.$$.ctx[1]; + } + + set hide(value) { + throw new Error(": Props cannot be set directly on the component instance unless compiling with 'accessors: true' or ''"); + } + + get toggle() { + return this.$$.ctx[9]; + } + + set toggle(value) { + throw new Error(": Props cannot be set directly on the component instance unless compiling with 'accessors: true' or ''"); + } + } + + /* src/filesystem/viewers/Directory.svelte generated by Svelte v3.29.6 */ + const file$3 = "src/filesystem/viewers/Directory.svelte"; + + function get_each_context(ctx, list, i) { + const child_ctx = ctx.slice(); + child_ctx[5] = list[i]; + return child_ctx; + } + + // (53:2) {#if Array.isArray(node.base.children)} + function create_if_block$1(ctx) { + let each_1_anchor; + let each_value = /*node*/ ctx[0].base.children; + validate_each_argument(each_value); + let each_blocks = []; + + for (let i = 0; i < each_value.length; i += 1) { + each_blocks[i] = create_each_block(get_each_context(ctx, each_value, i)); + } + + const block = { + c: function create() { + for (let i = 0; i < each_blocks.length; i += 1) { + each_blocks[i].c(); + } + + each_1_anchor = empty(); + }, + m: function mount(target, anchor) { + for (let i = 0; i < each_blocks.length; i += 1) { + each_blocks[i].m(target, anchor); + } + + insert_dev(target, each_1_anchor, anchor); + }, + p: function update(ctx, dirty) { + if (dirty & /*navigate_to, node, node_icon*/ 11) { + each_value = /*node*/ ctx[0].base.children; + validate_each_argument(each_value); + let i; + + for (i = 0; i < each_value.length; i += 1) { + const child_ctx = get_each_context(ctx, each_value, i); + + if (each_blocks[i]) { + each_blocks[i].p(child_ctx, dirty); + } else { + each_blocks[i] = create_each_block(child_ctx); + each_blocks[i].c(); + each_blocks[i].m(each_1_anchor.parentNode, each_1_anchor); + } + } + + for (; i < each_blocks.length; i += 1) { + each_blocks[i].d(1); + } + + each_blocks.length = each_value.length; + } + }, + d: function destroy(detaching) { + destroy_each(each_blocks, detaching); + if (detaching) detach_dev(each_1_anchor); + } + }; + + dispatch_dev("SvelteRegisterBlock", { + block, + id: create_if_block$1.name, + type: "if", + source: "(53:2) {#if Array.isArray(node.base.children)}", + ctx + }); + + return block; + } + + // (54:3) {#each node.base.children as child} + function create_each_block(ctx) { + let div1; + let img; + let img_src_value; + let t0; + let div0; + let t1_value = /*child*/ ctx[5].name + ""; + let t1; + let t2; + let mounted; + let dispose; + + const block = { + c: function create() { + div1 = element("div"); + img = element("img"); + t0 = space(); + div0 = element("div"); + t1 = text(t1_value); + t2 = space(); + if (img.src !== (img_src_value = /*node_icon*/ ctx[3](/*child*/ ctx[5]))) attr_dev(img, "src", img_src_value); + attr_dev(img, "alt", "icon"); + attr_dev(img, "class", "svelte-1afjvoj"); + add_location(img, file$3, 55, 4, 1473); + attr_dev(div0, "class", "svelte-1afjvoj"); + add_location(div0, file$3, 56, 4, 1518); + attr_dev(div1, "class", "node svelte-1afjvoj"); + add_location(div1, file$3, 54, 3, 1415); + }, + m: function mount(target, anchor) { + insert_dev(target, div1, anchor); + append_dev(div1, img); + append_dev(div1, t0); + append_dev(div1, div0); + append_dev(div0, t1); + append_dev(div1, t2); + + if (!mounted) { + dispose = listen_dev( + div1, + "click", + function () { + if (is_function(/*navigate_to*/ ctx[1](/*child*/ ctx[5].path))) /*navigate_to*/ ctx[1](/*child*/ ctx[5].path).apply(this, arguments); + }, + false, + false, + false + ); + + mounted = true; + } + }, + p: function update(new_ctx, dirty) { + ctx = new_ctx; + + if (dirty & /*node*/ 1 && img.src !== (img_src_value = /*node_icon*/ ctx[3](/*child*/ ctx[5]))) { + attr_dev(img, "src", img_src_value); + } + + if (dirty & /*node*/ 1 && t1_value !== (t1_value = /*child*/ ctx[5].name + "")) set_data_dev(t1, t1_value); + }, + d: function destroy(detaching) { + if (detaching) detach_dev(div1); + mounted = false; + dispose(); + } + }; + + dispatch_dev("SvelteRegisterBlock", { + block, + id: create_each_block.name, + type: "each", + source: "(54:3) {#each node.base.children as child}", + ctx + }); + + return block; + } + + function create_fragment$3(ctx) { + let div2; + let div0; + let button; + let i; + let t1; + let t2; + let br; + let t3; + let div1; + let show_if = Array.isArray(/*node*/ ctx[0].base.children); + let mounted; + let dispose; + let if_block = show_if && create_if_block$1(ctx); + + const block = { + c: function create() { + div2 = element("div"); + div0 = element("div"); + button = element("button"); + i = element("i"); + i.textContent = "arrow_upward"; + t1 = text(" up"); + t2 = space(); + br = element("br"); + t3 = space(); + div1 = element("div"); + if (if_block) if_block.c(); + attr_dev(i, "class", "icon"); + add_location(i, file$3, 48, 33, 1246); + add_location(button, file$3, 48, 2, 1215); + attr_dev(div0, "class", "toolbar svelte-1afjvoj"); + add_location(div0, file$3, 47, 1, 1191); + add_location(br, file$3, 50, 1, 1300); + attr_dev(div1, "class", "directory svelte-1afjvoj"); + add_location(div1, file$3, 51, 1, 1307); + attr_dev(div2, "class", "container svelte-1afjvoj"); + add_location(div2, file$3, 46, 0, 1166); + }, + 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, div2, anchor); + append_dev(div2, div0); + append_dev(div0, button); + append_dev(button, i); + append_dev(button, t1); + append_dev(div2, t2); + append_dev(div2, br); + append_dev(div2, t3); + append_dev(div2, div1); + if (if_block) if_block.m(div1, null); + + if (!mounted) { + dispose = listen_dev(button, "click", /*navigate_up*/ ctx[2], false, false, false); + mounted = true; + } + }, + p: function update(ctx, [dirty]) { + if (dirty & /*node*/ 1) show_if = Array.isArray(/*node*/ ctx[0].base.children); + + if (show_if) { + if (if_block) { + if_block.p(ctx, dirty); + } else { + if_block = create_if_block$1(ctx); + if_block.c(); + if_block.m(div1, null); + } + } else if (if_block) { + if_block.d(1); + if_block = null; + } + }, + i: noop, + o: noop, + d: function destroy(detaching) { + if (detaching) detach_dev(div2); + if (if_block) if_block.d(); + mounted = false; + dispose(); + } + }; + + dispatch_dev("SvelteRegisterBlock", { + block, + id: create_fragment$3.name, + type: "component", + source: "", + ctx + }); + + return block; + } + + function instance$3($$self, $$props, $$invalidate) { + let { $$slots: slots = {}, $$scope } = $$props; + validate_slots("Directory", slots, []); + let dispatch = createEventDispatcher(); + let { node } = $$props; + + const navigate_to = path => { + dispatch("navigate", path); + }; + + const navigate_up = () => { + if (node.parents.length !== 0) { + navigate_to(node.parents[node.parents.length - 1].path); + } + }; + + const node_icon = node => { + if (node.type === "dir") { + return "/res/img/mime/folder.png"; + } + + switch (node.file_type) { + case "image/gif": + return "/res/img/mime/image-gif.png"; + case ("image/apng"): + return "/res/img/mime/image-png.png"; + case "image/jpeg": + return "/res/img/mime/image-jpeg.png"; + case "application/pdf": + return "/res/img/mime/pdf.png"; + } + + if (node.file_type.startsWith("audio/")) { + return "/res/img/mime/audio.png"; + } else if (node.file_type.startsWith("video/")) { + return "/res/img/mime/video.png"; + } else if (node.file_type.startsWith("text/")) { + return "/res/img/mime/text.png"; + } else if (node.file_type.startsWith("image/")) { + return "/res/img/mime/image-png.png"; + } else if (node.file_type.startsWith("application/")) { + return "/res/img/mime/archive.png"; + } + + return "/res/img/mime/empty.png"; + }; + + const writable_props = ["node"]; + + Object.keys($$props).forEach(key => { + if (!~writable_props.indexOf(key) && key.slice(0, 2) !== "$$") console.warn(` was created with unknown prop '${key}'`); + }); + + $$self.$$set = $$props => { + if ("node" in $$props) $$invalidate(0, node = $$props.node); + }; + + $$self.$capture_state = () => ({ + createEventDispatcher, + dispatch, + node, + navigate_to, + navigate_up, + node_icon + }); + + $$self.$inject_state = $$props => { + if ("dispatch" in $$props) dispatch = $$props.dispatch; + if ("node" in $$props) $$invalidate(0, node = $$props.node); + }; + + if ($$props && "$$inject" in $$props) { + $$self.$inject_state($$props.$$inject); + } + + return [node, navigate_to, navigate_up, node_icon]; + } + + class Directory extends SvelteComponentDev { + constructor(options) { + super(options); + init(this, options, instance$3, create_fragment$3, safe_not_equal, { node: 0 }); + + dispatch_dev("SvelteRegisterComponent", { + component: this, + tagName: "Directory", + options, + id: create_fragment$3.name + }); + + const { ctx } = this.$$; + const props = options.props || {}; + + if (/*node*/ ctx[0] === undefined && !("node" in props)) { + console.warn(" was created without expected prop 'node'"); + } + } + + get node() { + throw new Error(": Props cannot be read directly from the component instance unless compiling with 'accessors: true' or ''"); + } + + set node(value) { + throw new Error(": Props cannot be set directly on the component instance unless compiling with 'accessors: true' or ''"); + } + } + + /* src/filesystem/Filesystem.svelte generated by Svelte v3.29.6 */ + + const { console: console_1, window: window_1 } = globals; + const file_1 = "src/filesystem/Filesystem.svelte"; + + // (91:4) {#if currentNode.parents.length > 0} + function create_if_block_3(ctx) { + let t_value = /*currentNode*/ ctx[7].parents[/*currentNode*/ ctx[7].parents.length - 1].path + ""; + let t; + + const block = { + c: function create() { + t = text(t_value); + }, + m: function mount(target, anchor) { + insert_dev(target, t, anchor); + }, + p: function update(ctx, dirty) { + if (dirty & /*currentNode*/ 128 && t_value !== (t_value = /*currentNode*/ ctx[7].parents[/*currentNode*/ ctx[7].parents.length - 1].path + "")) set_data_dev(t, t_value); + }, + d: function destroy(detaching) { + if (detaching) detach_dev(t); + } + }; + + dispatch_dev("SvelteRegisterBlock", { + block, + id: create_if_block_3.name, + type: "if", + source: "(91:4) {#if currentNode.parents.length > 0}", + ctx + }); + + return block; + } + + // (134:35) + function create_if_block_2(ctx) { + let directory; + let current; + let directory_props = { node: /*currentNode*/ ctx[7] }; + directory = new Directory({ props: directory_props, $$inline: true }); + /*directory_binding*/ ctx[18](directory); + directory.$on("navigate", /*navigate_handler*/ ctx[19]); + + const block = { + c: function create() { + create_component(directory.$$.fragment); + }, + m: function mount(target, anchor) { + mount_component(directory, target, anchor); + current = true; + }, + p: function update(ctx, dirty) { + const directory_changes = {}; + if (dirty & /*currentNode*/ 128) directory_changes.node = /*currentNode*/ ctx[7]; + directory.$set(directory_changes); + }, + i: function intro(local) { + if (current) return; + transition_in(directory.$$.fragment, local); + current = true; + }, + o: function outro(local) { + transition_out(directory.$$.fragment, local); + current = false; + }, + d: function destroy(detaching) { + /*directory_binding*/ ctx[18](null); + destroy_component(directory, detaching); + } + }; + + dispatch_dev("SvelteRegisterBlock", { + block, + id: create_if_block_2.name, + type: "if", + source: "(134:35) ", + ctx + }); + + return block; + } + + // (130:3) {#if loading} + function create_if_block_1(ctx) { + let div; + let spinner; + let current; + spinner = new Spinner({ $$inline: true }); + + const block = { + c: function create() { + div = element("div"); + create_component(spinner.$$.fragment); + attr_dev(div, "class", "center svelte-1vxdz33"); + set_style(div, "width", "128px"); + set_style(div, "height", "128px"); + add_location(div, file_1, 130, 3, 3731); + }, + m: function mount(target, anchor) { + insert_dev(target, div, anchor); + mount_component(spinner, div, null); + current = true; + }, + p: noop, + i: function intro(local) { + if (current) return; + transition_in(spinner.$$.fragment, local); + current = true; + }, + o: function outro(local) { + transition_out(spinner.$$.fragment, local); + current = false; + }, + d: function destroy(detaching) { + if (detaching) detach_dev(div); + destroy_component(spinner); + } + }; + + dispatch_dev("SvelteRegisterBlock", { + block, + id: create_if_block_1.name, + type: "if", + source: "(130:3) {#if loading}", + ctx + }); + + return block; + } + + // (151:3) {#if currentNode.base.type === "file"} + function create_if_block$2(ctx) { + let tr0; + let td0; + let td1; + let t1_value = /*currentNode*/ ctx[7].base.file_type + ""; + let t1; + let t2; + let tr1; + let td2; + let td3; + let t4_value = formatDataVolume(/*currentNode*/ ctx[7].base.file_size) + ""; + let t4; + + const block = { + c: function create() { + tr0 = element("tr"); + td0 = element("td"); + td0.textContent = "File type"; + td1 = element("td"); + t1 = text(t1_value); + t2 = space(); + tr1 = element("tr"); + td2 = element("td"); + td2.textContent = "File size"; + td3 = element("td"); + t4 = text(t4_value); + add_location(td0, file_1, 151, 7, 4760); + add_location(td1, file_1, 151, 25, 4778); + add_location(tr0, file_1, 151, 3, 4756); + add_location(td2, file_1, 152, 7, 4828); + add_location(td3, file_1, 152, 25, 4846); + add_location(tr1, file_1, 152, 3, 4824); + }, + m: function mount(target, anchor) { + insert_dev(target, tr0, anchor); + append_dev(tr0, td0); + append_dev(tr0, td1); + append_dev(td1, t1); + insert_dev(target, t2, anchor); + insert_dev(target, tr1, anchor); + append_dev(tr1, td2); + append_dev(tr1, td3); + append_dev(td3, t4); + }, + p: function update(ctx, dirty) { + if (dirty & /*currentNode*/ 128 && t1_value !== (t1_value = /*currentNode*/ ctx[7].base.file_type + "")) set_data_dev(t1, t1_value); + if (dirty & /*currentNode*/ 128 && t4_value !== (t4_value = formatDataVolume(/*currentNode*/ ctx[7].base.file_size) + "")) set_data_dev(t4, t4_value); + }, + d: function destroy(detaching) { + if (detaching) detach_dev(tr0); + if (detaching) detach_dev(t2); + if (detaching) detach_dev(tr1); + } + }; + + dispatch_dev("SvelteRegisterBlock", { + block, + id: create_if_block$2.name, + type: "if", + source: "(151:3) {#if currentNode.base.type === \\\"file\\\"}", + ctx + }); + + return block; + } + + // (143:1) + function create_default_slot(ctx) { + let table; + let tr0; + let td0; + let h30; + let t1; + let tr1; + let td1; + let td2; + let t3_value = /*currentNode*/ ctx[7].base.name + ""; + let t3; + let t4; + let tr2; + let td3; + let td4; + let t6_value = /*currentNode*/ ctx[7].base.path + ""; + let t6; + let t7; + let tr3; + let td5; + let td6; + let t9_value = /*currentNode*/ ctx[7].base.type + ""; + let t9; + let t10; + let tr4; + let td7; + let td8; + let t12_value = formatDate(/*currentNode*/ ctx[7].base.date_created, true, true, true) + ""; + let t12; + let t13; + let tr5; + let td9; + let td10; + let t15_value = formatDate(/*currentNode*/ ctx[7].base.date_modified, true, true, true) + ""; + let t15; + let t16; + let t17; + let tr6; + let td11; + let h31; + let t19; + let tr7; + let td12; + let td13; + let t21_value = /*currentNode*/ ctx[7].bucket.id + ""; + let t21; + let t22; + let tr8; + let td14; + let td15; + let t24_value = /*currentNode*/ ctx[7].bucket.name + ""; + let t24; + let t25; + let tr9; + let td16; + let td17; + let t27_value = formatDate(/*currentNode*/ ctx[7].bucket.date_created, true, true, true) + ""; + let t27; + let t28; + let tr10; + let td18; + let td19; + let t30_value = formatDate(/*currentNode*/ ctx[7].bucket.date_modified, true, true, true) + ""; + let t30; + let if_block = /*currentNode*/ ctx[7].base.type === "file" && create_if_block$2(ctx); + + const block = { + c: function create() { + table = element("table"); + tr0 = element("tr"); + td0 = element("td"); + h30 = element("h3"); + h30.textContent = "Node details"; + t1 = space(); + tr1 = element("tr"); + td1 = element("td"); + td1.textContent = "Name"; + td2 = element("td"); + t3 = text(t3_value); + t4 = space(); + tr2 = element("tr"); + td3 = element("td"); + td3.textContent = "Path"; + td4 = element("td"); + t6 = text(t6_value); + t7 = space(); + tr3 = element("tr"); + td5 = element("td"); + td5.textContent = "Type"; + td6 = element("td"); + t9 = text(t9_value); + t10 = space(); + tr4 = element("tr"); + td7 = element("td"); + td7.textContent = "Date created"; + td8 = element("td"); + t12 = text(t12_value); + t13 = space(); + tr5 = element("tr"); + td9 = element("td"); + td9.textContent = "Date modified"; + td10 = element("td"); + t15 = text(t15_value); + t16 = space(); + if (if_block) if_block.c(); + t17 = space(); + tr6 = element("tr"); + td11 = element("td"); + h31 = element("h3"); + h31.textContent = "Bucket details"; + t19 = space(); + tr7 = element("tr"); + td12 = element("td"); + td12.textContent = "ID"; + td13 = element("td"); + t21 = text(t21_value); + t22 = space(); + tr8 = element("tr"); + td14 = element("td"); + td14.textContent = "Name"; + td15 = element("td"); + t24 = text(t24_value); + t25 = space(); + tr9 = element("tr"); + td16 = element("td"); + td16.textContent = "Date created"; + td17 = element("td"); + t27 = text(t27_value); + t28 = space(); + tr10 = element("tr"); + td18 = element("td"); + td18.textContent = "Date modified"; + td19 = element("td"); + t30 = text(t30_value); + add_location(h30, file_1, 144, 23, 4295); + attr_dev(td0, "colspan", "2"); + add_location(td0, file_1, 144, 7, 4279); + add_location(tr0, file_1, 144, 3, 4275); + add_location(td1, file_1, 145, 7, 4334); + add_location(td2, file_1, 145, 20, 4347); + add_location(tr1, file_1, 145, 3, 4330); + add_location(td3, file_1, 146, 7, 4392); + add_location(td4, file_1, 146, 20, 4405); + add_location(tr2, file_1, 146, 3, 4388); + add_location(td5, file_1, 147, 7, 4450); + add_location(td6, file_1, 147, 20, 4463); + add_location(tr3, file_1, 147, 3, 4446); + add_location(td7, file_1, 148, 7, 4508); + add_location(td8, file_1, 148, 28, 4529); + add_location(tr4, file_1, 148, 3, 4504); + add_location(td9, file_1, 149, 7, 4612); + add_location(td10, file_1, 149, 29, 4634); + add_location(tr5, file_1, 149, 3, 4608); + add_location(h31, file_1, 154, 23, 4939); + attr_dev(td11, "colspan", "2"); + add_location(td11, file_1, 154, 7, 4923); + add_location(tr6, file_1, 154, 3, 4919); + add_location(td12, file_1, 155, 7, 4980); + add_location(td13, file_1, 155, 18, 4991); + add_location(tr7, file_1, 155, 3, 4976); + add_location(td14, file_1, 156, 7, 5036); + add_location(td15, file_1, 156, 20, 5049); + add_location(tr8, file_1, 156, 3, 5032); + add_location(td16, file_1, 157, 7, 5096); + add_location(td17, file_1, 157, 28, 5117); + add_location(tr9, file_1, 157, 3, 5092); + add_location(td18, file_1, 158, 7, 5202); + add_location(td19, file_1, 158, 29, 5224); + add_location(tr10, file_1, 158, 3, 5198); + set_style(table, "min-width", "100%"); + add_location(table, file_1, 143, 2, 4239); + }, + m: function mount(target, anchor) { + insert_dev(target, table, anchor); + append_dev(table, tr0); + append_dev(tr0, td0); + append_dev(td0, h30); + append_dev(table, t1); + append_dev(table, tr1); + append_dev(tr1, td1); + append_dev(tr1, td2); + append_dev(td2, t3); + append_dev(table, t4); + append_dev(table, tr2); + append_dev(tr2, td3); + append_dev(tr2, td4); + append_dev(td4, t6); + append_dev(table, t7); + append_dev(table, tr3); + append_dev(tr3, td5); + append_dev(tr3, td6); + append_dev(td6, t9); + append_dev(table, t10); + append_dev(table, tr4); + append_dev(tr4, td7); + append_dev(tr4, td8); + append_dev(td8, t12); + append_dev(table, t13); + append_dev(table, tr5); + append_dev(tr5, td9); + append_dev(tr5, td10); + append_dev(td10, t15); + append_dev(table, t16); + if (if_block) if_block.m(table, null); + append_dev(table, t17); + append_dev(table, tr6); + append_dev(tr6, td11); + append_dev(td11, h31); + append_dev(table, t19); + append_dev(table, tr7); + append_dev(tr7, td12); + append_dev(tr7, td13); + append_dev(td13, t21); + append_dev(table, t22); + append_dev(table, tr8); + append_dev(tr8, td14); + append_dev(tr8, td15); + append_dev(td15, t24); + append_dev(table, t25); + append_dev(table, tr9); + append_dev(tr9, td16); + append_dev(tr9, td17); + append_dev(td17, t27); + append_dev(table, t28); + append_dev(table, tr10); + append_dev(tr10, td18); + append_dev(tr10, td19); + append_dev(td19, t30); + }, + p: function update(ctx, dirty) { + if (dirty & /*currentNode*/ 128 && t3_value !== (t3_value = /*currentNode*/ ctx[7].base.name + "")) set_data_dev(t3, t3_value); + if (dirty & /*currentNode*/ 128 && t6_value !== (t6_value = /*currentNode*/ ctx[7].base.path + "")) set_data_dev(t6, t6_value); + if (dirty & /*currentNode*/ 128 && t9_value !== (t9_value = /*currentNode*/ ctx[7].base.type + "")) set_data_dev(t9, t9_value); + if (dirty & /*currentNode*/ 128 && t12_value !== (t12_value = formatDate(/*currentNode*/ ctx[7].base.date_created, true, true, true) + "")) set_data_dev(t12, t12_value); + if (dirty & /*currentNode*/ 128 && t15_value !== (t15_value = formatDate(/*currentNode*/ ctx[7].base.date_modified, true, true, true) + "")) set_data_dev(t15, t15_value); + + if (/*currentNode*/ ctx[7].base.type === "file") { + if (if_block) { + if_block.p(ctx, dirty); + } else { + if_block = create_if_block$2(ctx); + if_block.c(); + if_block.m(table, t17); + } + } else if (if_block) { + if_block.d(1); + if_block = null; + } + + if (dirty & /*currentNode*/ 128 && t21_value !== (t21_value = /*currentNode*/ ctx[7].bucket.id + "")) set_data_dev(t21, t21_value); + if (dirty & /*currentNode*/ 128 && t24_value !== (t24_value = /*currentNode*/ ctx[7].bucket.name + "")) set_data_dev(t24, t24_value); + if (dirty & /*currentNode*/ 128 && t27_value !== (t27_value = formatDate(/*currentNode*/ ctx[7].bucket.date_created, true, true, true) + "")) set_data_dev(t27, t27_value); + if (dirty & /*currentNode*/ 128 && t30_value !== (t30_value = formatDate(/*currentNode*/ ctx[7].bucket.date_modified, true, true, true) + "")) set_data_dev(t30, t30_value); + }, + d: function destroy(detaching) { + if (detaching) detach_dev(table); + if (if_block) if_block.d(); + } + }; + + dispatch_dev("SvelteRegisterBlock", { + block, + id: create_default_slot.name, + type: "slot", + source: "(143:1) ", + ctx + }); + + return block; + } + + function create_fragment$4(ctx) { + let div15; + let div2; + let button0; + let i0; + let t1; + let a; + let i1; + let t3; + let div1; + let div0; + let t4; + let t5_value = /*currentNode*/ ctx[7].base.name + ""; + let t5; + let t6; + let div3; + let t7; + let div14; + let div12; + let div11; + let div10; + let div4; + let t9; + let div5; + let t10_value = formatThousands(/*file*/ ctx[0].views) + ""; + let t10; + let t11; + let div6; + let t13; + let div7; + let t14_value = formatThousands(/*file*/ ctx[0].downloads) + ""; + let t14; + let t15; + let div8; + let t17; + let div9; + let t18_value = formatDataVolume(/*file*/ ctx[0].size) + ""; + let t18; + let t19; + let button1; + let i2; + let t21; + let t22; + let button2; + let i3; + let t24; + let t25; + let button3; + let i4; + let t27; + let u0; + let t29; + let t30; + let button4; + let i5; + let t32; + let t33; + let button5; + let i6; + let t35; + let u1; + let t37; + let t38; + let button6; + let i7; + let t40; + let u2; + let t42; + let t43; + let sharebar_1; + let t44; + let div13; + let current_block_type_index; + let if_block1; + let t45; + let iframe; + let t46; + let modal; + let current; + let mounted; + let dispose; + let if_block0 = /*currentNode*/ ctx[7].parents.length > 0 && create_if_block_3(ctx); + let sharebar_1_props = {}; + sharebar_1 = new Sharebar({ props: sharebar_1_props, $$inline: true }); + /*sharebar_1_binding*/ ctx[17](sharebar_1); + const if_block_creators = [create_if_block_1, create_if_block_2]; + const if_blocks = []; + + function select_block_type(ctx, dirty) { + if (/*loading*/ ctx[8]) return 0; + if (/*viewer_type*/ ctx[9] === "dir") return 1; + return -1; + } + + if (~(current_block_type_index = select_block_type(ctx))) { + if_block1 = if_blocks[current_block_type_index] = if_block_creators[current_block_type_index](ctx); + } + + let modal_props = { + title: "Details", + width: "600px", + $$slots: { default: [create_default_slot] }, + $$scope: { ctx } + }; + + modal = new Modal({ props: modal_props, $$inline: true }); + /*modal_binding*/ ctx[21](modal); + + const block = { + c: function create() { + div15 = element("div"); + div2 = element("div"); + button0 = element("button"); + i0 = element("i"); + i0.textContent = "menu"; + t1 = space(); + a = element("a"); + i1 = element("i"); + i1.textContent = "home"; + t3 = space(); + div1 = element("div"); + div0 = element("div"); + if (if_block0) if_block0.c(); + t4 = text("\n\t\t\t\t/"); + t5 = text(t5_value); + t6 = space(); + div3 = element("div"); + t7 = space(); + div14 = element("div"); + div12 = element("div"); + div11 = element("div"); + div10 = element("div"); + div4 = element("div"); + div4.textContent = "Views"; + t9 = space(); + div5 = element("div"); + t10 = text(t10_value); + t11 = space(); + div6 = element("div"); + div6.textContent = "Downloads"; + t13 = space(); + div7 = element("div"); + t14 = text(t14_value); + t15 = space(); + div8 = element("div"); + div8.textContent = "Size"; + t17 = space(); + div9 = element("div"); + t18 = text(t18_value); + t19 = space(); + button1 = element("button"); + i2 = element("i"); + i2.textContent = "save"; + t21 = text(" Download"); + t22 = space(); + button2 = element("button"); + i3 = element("i"); + i3.textContent = "save"; + t24 = text(" DL all files"); + t25 = space(); + button3 = element("button"); + i4 = element("i"); + i4.textContent = "content_copy"; + t27 = space(); + u0 = element("u"); + u0.textContent = "C"; + t29 = text("opy Link"); + t30 = space(); + button4 = element("button"); + i5 = element("i"); + i5.textContent = "share"; + t32 = text(" Share"); + t33 = space(); + button5 = element("button"); + i6 = element("i"); + i6.textContent = "help"; + t35 = text(" Deta"); + u1 = element("u"); + u1.textContent = "i"; + t37 = text("ls"); + t38 = space(); + button6 = element("button"); + i7 = element("i"); + i7.textContent = "edit"; + t40 = space(); + u2 = element("u"); + u2.textContent = "E"; + t42 = text("dit"); + t43 = space(); + create_component(sharebar_1.$$.fragment); + t44 = space(); + div13 = element("div"); + if (if_block1) if_block1.c(); + t45 = space(); + iframe = element("iframe"); + t46 = space(); + create_component(modal.$$.fragment); + attr_dev(i0, "class", "icon"); + add_location(i0, file_1, 85, 3, 1841); + attr_dev(button0, "class", "button_toggle_toolbar svelte-1vxdz33"); + toggle_class(button0, "button_highlight", /*toolbar_visible*/ ctx[3]); + add_location(button0, file_1, 84, 2, 1732); + attr_dev(i1, "class", "icon"); + add_location(i1, file_1, 87, 58, 1936); + attr_dev(a, "href", "/"); + attr_dev(a, "id", "button_home"); + attr_dev(a, "class", "button button_home svelte-1vxdz33"); + add_location(a, file_1, 87, 2, 1880); + add_location(div0, file_1, 89, 3, 2012); + attr_dev(div1, "class", "file_viewer_headerbar_title svelte-1vxdz33"); + add_location(div1, file_1, 88, 2, 1967); + attr_dev(div2, "class", "file_viewer_headerbar highlight_1 svelte-1vxdz33"); + add_location(div2, file_1, 83, 1, 1659); + attr_dev(div3, "class", "list_navigator svelte-1vxdz33"); + add_location(div3, file_1, 97, 1, 2188); + attr_dev(div4, "class", "toolbar_label svelte-1vxdz33"); + add_location(div4, file_1, 100, 3, 2316); + attr_dev(div5, "class", "toolbar_statistic svelte-1vxdz33"); + add_location(div5, file_1, 101, 3, 2358); + attr_dev(div6, "class", "toolbar_label svelte-1vxdz33"); + add_location(div6, file_1, 102, 3, 2428); + attr_dev(div7, "class", "toolbar_statistic svelte-1vxdz33"); + add_location(div7, file_1, 103, 3, 2474); + attr_dev(div8, "class", "toolbar_label svelte-1vxdz33"); + add_location(div8, file_1, 104, 3, 2548); + attr_dev(div9, "class", "toolbar_statistic svelte-1vxdz33"); + add_location(div9, file_1, 105, 3, 2589); + attr_dev(i2, "class", "icon"); + add_location(i2, file_1, 108, 4, 2734); + attr_dev(button1, "class", "toolbar_button button_full_width svelte-1vxdz33"); + add_location(button1, file_1, 107, 3, 2660); + attr_dev(i3, "class", "icon"); + add_location(i3, file_1, 111, 4, 2884); + attr_dev(button2, "id", "btn_download_list"); + attr_dev(button2, "class", "toolbar_button button_full_width svelte-1vxdz33"); + set_style(button2, "display", "none"); + add_location(button2, file_1, 110, 3, 2784); + attr_dev(i4, "class", "icon"); + add_location(i4, file_1, 114, 4, 3006); + add_location(u0, file_1, 114, 37, 3039); + attr_dev(button3, "id", "btn_copy"); + attr_dev(button3, "class", "toolbar_button button_full_width svelte-1vxdz33"); + add_location(button3, file_1, 113, 3, 2938); + attr_dev(i5, "class", "icon"); + add_location(i5, file_1, 117, 4, 3195); + attr_dev(button4, "class", "toolbar_button button_full_width svelte-1vxdz33"); + toggle_class(button4, "button_highlight", /*sharebar_visible*/ ctx[11]); + add_location(button4, file_1, 116, 3, 3072); + attr_dev(i6, "class", "icon"); + add_location(i6, file_1, 120, 4, 3364); + add_location(u1, file_1, 120, 33, 3393); + attr_dev(button5, "class", "toolbar_button button_full_width svelte-1vxdz33"); + toggle_class(button5, "button_highlight", /*details_visible*/ ctx[12]); + add_location(button5, file_1, 119, 3, 3243); + attr_dev(i7, "class", "icon"); + add_location(i7, file_1, 123, 4, 3511); + add_location(u2, file_1, 123, 29, 3536); + attr_dev(button6, "id", "btn_edit"); + attr_dev(button6, "class", "toolbar_button button_full_width svelte-1vxdz33"); + set_style(button6, "display", "none"); + add_location(button6, file_1, 122, 3, 3420); + attr_dev(div10, "class", "svelte-1vxdz33"); + add_location(div10, file_1, 99, 50, 2307); + attr_dev(div11, "class", "svelte-1vxdz33"); + add_location(div11, file_1, 99, 45, 2302); + attr_dev(div12, "class", "toolbar svelte-1vxdz33"); + toggle_class(div12, "toolbar_visible", /*toolbar_visible*/ ctx[3]); + add_location(div12, file_1, 99, 2, 2259); + attr_dev(div13, "class", "file_viewer_file_preview svelte-1vxdz33"); + toggle_class(div13, "toolbar_visible", /*toolbar_visible*/ ctx[3]); + add_location(div13, file_1, 128, 2, 3630); + attr_dev(div14, "class", "file_viewer_window svelte-1vxdz33"); + add_location(div14, file_1, 98, 1, 2224); + attr_dev(iframe, "title", "Frame for downloading files"); + set_style(iframe, "display", "none"); + set_style(iframe, "width", "1px"); + set_style(iframe, "height", "1px"); + add_location(iframe, file_1, 140, 1, 4075); + attr_dev(div15, "class", "file_viewer svelte-1vxdz33"); + add_location(div15, file_1, 82, 0, 1608); + }, + 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, div15, anchor); + append_dev(div15, div2); + append_dev(div2, button0); + append_dev(button0, i0); + append_dev(div2, t1); + append_dev(div2, a); + append_dev(a, i1); + append_dev(div2, t3); + append_dev(div2, div1); + append_dev(div1, div0); + if (if_block0) if_block0.m(div0, null); + append_dev(div0, t4); + append_dev(div0, t5); + /*div2_binding*/ ctx[16](div2); + append_dev(div15, t6); + append_dev(div15, div3); + append_dev(div15, t7); + append_dev(div15, div14); + append_dev(div14, div12); + append_dev(div12, div11); + append_dev(div11, div10); + append_dev(div10, div4); + append_dev(div10, t9); + append_dev(div10, div5); + append_dev(div5, t10); + append_dev(div10, t11); + append_dev(div10, div6); + append_dev(div10, t13); + append_dev(div10, div7); + append_dev(div7, t14); + append_dev(div10, t15); + append_dev(div10, div8); + append_dev(div10, t17); + append_dev(div10, div9); + append_dev(div9, t18); + append_dev(div10, t19); + append_dev(div10, button1); + append_dev(button1, i2); + append_dev(button1, t21); + append_dev(div10, t22); + append_dev(div10, button2); + append_dev(button2, i3); + append_dev(button2, t24); + append_dev(div10, t25); + append_dev(div10, button3); + append_dev(button3, i4); + append_dev(button3, t27); + append_dev(button3, u0); + append_dev(button3, t29); + append_dev(div10, t30); + append_dev(div10, button4); + append_dev(button4, i5); + append_dev(button4, t32); + append_dev(div10, t33); + append_dev(div10, button5); + append_dev(button5, i6); + append_dev(button5, t35); + append_dev(button5, u1); + append_dev(button5, t37); + append_dev(div10, t38); + append_dev(div10, button6); + append_dev(button6, i7); + append_dev(button6, t40); + append_dev(button6, u2); + append_dev(button6, t42); + append_dev(div14, t43); + mount_component(sharebar_1, div14, null); + append_dev(div14, t44); + append_dev(div14, div13); + + if (~current_block_type_index) { + if_blocks[current_block_type_index].m(div13, null); + } + + /*div13_binding*/ ctx[20](div13); + append_dev(div15, t45); + append_dev(div15, iframe); + append_dev(div15, t46); + mount_component(modal, div15, null); + /*div15_binding*/ ctx[22](div15); + current = true; + + if (!mounted) { + dispose = [ + listen_dev(window_1, "keydown", /*keydown*/ ctx[15], false, false, false), + listen_dev(button0, "click", /*toolbar_toggle*/ ctx[10], false, false, false), + listen_dev(button1, "click", /*download*/ ctx[13], false, false, false), + listen_dev( + button4, + "click", + function () { + if (is_function(/*sharebar*/ ctx[4].toggle)) /*sharebar*/ ctx[4].toggle.apply(this, arguments); + }, + false, + false, + false + ), + listen_dev( + button5, + "click", + function () { + if (is_function(/*details*/ ctx[5].toggle)) /*details*/ ctx[5].toggle.apply(this, arguments); + }, + false, + false, + false + ) + ]; + + mounted = true; + } + }, + p: function update(new_ctx, [dirty]) { + ctx = new_ctx; + + if (dirty & /*toolbar_visible*/ 8) { + toggle_class(button0, "button_highlight", /*toolbar_visible*/ ctx[3]); + } + + if (/*currentNode*/ ctx[7].parents.length > 0) { + if (if_block0) { + if_block0.p(ctx, dirty); + } else { + if_block0 = create_if_block_3(ctx); + if_block0.c(); + if_block0.m(div0, t4); + } + } else if (if_block0) { + if_block0.d(1); + if_block0 = null; + } + + if ((!current || dirty & /*currentNode*/ 128) && t5_value !== (t5_value = /*currentNode*/ ctx[7].base.name + "")) set_data_dev(t5, t5_value); + if ((!current || dirty & /*file*/ 1) && t10_value !== (t10_value = formatThousands(/*file*/ ctx[0].views) + "")) set_data_dev(t10, t10_value); + if ((!current || dirty & /*file*/ 1) && t14_value !== (t14_value = formatThousands(/*file*/ ctx[0].downloads) + "")) set_data_dev(t14, t14_value); + if ((!current || dirty & /*file*/ 1) && t18_value !== (t18_value = formatDataVolume(/*file*/ ctx[0].size) + "")) set_data_dev(t18, t18_value); + + if (dirty & /*sharebar_visible*/ 2048) { + toggle_class(button4, "button_highlight", /*sharebar_visible*/ ctx[11]); + } + + if (dirty & /*details_visible*/ 4096) { + toggle_class(button5, "button_highlight", /*details_visible*/ ctx[12]); + } + + if (dirty & /*toolbar_visible*/ 8) { + toggle_class(div12, "toolbar_visible", /*toolbar_visible*/ ctx[3]); + } + + const sharebar_1_changes = {}; + sharebar_1.$set(sharebar_1_changes); + let previous_block_index = current_block_type_index; + current_block_type_index = select_block_type(ctx); + + if (current_block_type_index === previous_block_index) { + if (~current_block_type_index) { + if_blocks[current_block_type_index].p(ctx, dirty); + } + } else { + if (if_block1) { + group_outros(); + + transition_out(if_blocks[previous_block_index], 1, 1, () => { + if_blocks[previous_block_index] = null; + }); + + check_outros(); + } + + if (~current_block_type_index) { + if_block1 = if_blocks[current_block_type_index]; + + if (!if_block1) { + if_block1 = if_blocks[current_block_type_index] = if_block_creators[current_block_type_index](ctx); + if_block1.c(); + } else { + if_block1.p(ctx, dirty); + } + + transition_in(if_block1, 1); + if_block1.m(div13, null); + } else { + if_block1 = null; + } + } + + if (dirty & /*toolbar_visible*/ 8) { + toggle_class(div13, "toolbar_visible", /*toolbar_visible*/ ctx[3]); + } + + const modal_changes = {}; + + if (dirty & /*$$scope, currentNode*/ 16777344) { + modal_changes.$$scope = { dirty, ctx }; + } + + modal.$set(modal_changes); + }, + i: function intro(local) { + if (current) return; + transition_in(sharebar_1.$$.fragment, local); + transition_in(if_block1); + transition_in(modal.$$.fragment, local); + current = true; + }, + o: function outro(local) { + transition_out(sharebar_1.$$.fragment, local); + transition_out(if_block1); + transition_out(modal.$$.fragment, local); + current = false; + }, + d: function destroy(detaching) { + if (detaching) detach_dev(div15); + if (if_block0) if_block0.d(); + /*div2_binding*/ ctx[16](null); + /*sharebar_1_binding*/ ctx[17](null); + destroy_component(sharebar_1); + + if (~current_block_type_index) { + if_blocks[current_block_type_index].d(); + } + + /*div13_binding*/ ctx[20](null); + /*modal_binding*/ ctx[21](null); + destroy_component(modal); + /*div15_binding*/ ctx[22](null); + mounted = false; + run_all(dispose); + } + }; + + dispatch_dev("SvelteRegisterBlock", { + block, + id: create_fragment$4.name, + type: "component", + source: "", + ctx + }); + + return block; + } + + function instance$4($$self, $$props, $$invalidate) { + let { $$slots: slots = {}, $$scope } = $$props; + validate_slots("Filesystem", slots, []); + let file = { views: 6, downloads: 12, size: 24 }; + + // Elements + let file_viewer; + + let header_bar; + let toolbar_visible = window.innerWidth > 800; + + let toolbar_toggle = () => { + $$invalidate(3, toolbar_visible = !toolbar_visible); + + if (!toolbar_visible) { + sharebar.setVisible(false); + } + }; + + let sharebar; + let sharebar_visible = false; + let details; + let details_visible = false; + let preview; + + // State + let currentNode = initialNode; + + let loading = true; + let viewer_type = ""; + + const download = () => { + $$invalidate(0, file.downloads++, file); + }; + + const navigate = path => { + fetch(apiEndpoint + "/filesystem/" + currentNode.bucket.id + "/" + encodeURIComponent(path) + "?stat").then(resp => resp.json()).then(resp => { + window.history.pushState("page2", resp.base.name + " in " + resp.bucket.name + " ~ pixeldrain", "/d/" + resp.bucket.id + resp.base.path); + $$invalidate(7, currentNode = resp); + openPath(); + }).catch(err => { + $$invalidate(8, loading = false); + alert(err); + }); + }; + + const openPath = () => { + console.log(currentNode.base.type); + + if (currentNode.base.type === "bucket" || currentNode.base.type === "dir") { + $$invalidate(9, viewer_type = "dir"); + } + + $$invalidate(8, loading = false); + }; + + const keydown = e => { + switch (e.key) { + case "Escape": + hide(); + return; + case "i": + details_window.toggle(); + } + + console.log(e.key); + }; + + onMount(openPath); + const writable_props = []; + + Object.keys($$props).forEach(key => { + if (!~writable_props.indexOf(key) && key.slice(0, 2) !== "$$") console_1.warn(` was created with unknown prop '${key}'`); + }); + + function div2_binding($$value) { + binding_callbacks[$$value ? "unshift" : "push"](() => { + header_bar = $$value; + $$invalidate(2, header_bar); + }); + } + + function sharebar_1_binding($$value) { + binding_callbacks[$$value ? "unshift" : "push"](() => { + sharebar = $$value; + $$invalidate(4, sharebar); + }); + } + + function directory_binding($$value) { + binding_callbacks[$$value ? "unshift" : "push"](() => { + preview = $$value; + $$invalidate(6, preview); + }); + } + + const navigate_handler = e => { + navigate(e.detail); + }; + + function div13_binding($$value) { + binding_callbacks[$$value ? "unshift" : "push"](() => { + preview = $$value; + $$invalidate(6, preview); + }); + } + + function modal_binding($$value) { + binding_callbacks[$$value ? "unshift" : "push"](() => { + details = $$value; + $$invalidate(5, details); + }); + } + + function div15_binding($$value) { + binding_callbacks[$$value ? "unshift" : "push"](() => { + file_viewer = $$value; + $$invalidate(1, file_viewer); + }); + } + + $$self.$capture_state = () => ({ + onMount, + formatDate, + formatDataVolume, + formatThousands, + Sharebar, + Spinner, + Modal, + Directory, + file, + file_viewer, + header_bar, + toolbar_visible, + toolbar_toggle, + sharebar, + sharebar_visible, + details, + details_visible, + preview, + currentNode, + loading, + viewer_type, + download, + navigate, + openPath, + keydown + }); + + $$self.$inject_state = $$props => { + if ("file" in $$props) $$invalidate(0, file = $$props.file); + if ("file_viewer" in $$props) $$invalidate(1, file_viewer = $$props.file_viewer); + if ("header_bar" in $$props) $$invalidate(2, header_bar = $$props.header_bar); + if ("toolbar_visible" in $$props) $$invalidate(3, toolbar_visible = $$props.toolbar_visible); + if ("toolbar_toggle" in $$props) $$invalidate(10, toolbar_toggle = $$props.toolbar_toggle); + if ("sharebar" in $$props) $$invalidate(4, sharebar = $$props.sharebar); + if ("sharebar_visible" in $$props) $$invalidate(11, sharebar_visible = $$props.sharebar_visible); + if ("details" in $$props) $$invalidate(5, details = $$props.details); + if ("details_visible" in $$props) $$invalidate(12, details_visible = $$props.details_visible); + if ("preview" in $$props) $$invalidate(6, preview = $$props.preview); + if ("currentNode" in $$props) $$invalidate(7, currentNode = $$props.currentNode); + if ("loading" in $$props) $$invalidate(8, loading = $$props.loading); + if ("viewer_type" in $$props) $$invalidate(9, viewer_type = $$props.viewer_type); + }; + + if ($$props && "$$inject" in $$props) { + $$self.$inject_state($$props.$$inject); + } + + return [ + file, + file_viewer, + header_bar, + toolbar_visible, + sharebar, + details, + preview, + currentNode, + loading, + viewer_type, + toolbar_toggle, + sharebar_visible, + details_visible, + download, + navigate, + keydown, + div2_binding, + sharebar_1_binding, + directory_binding, + navigate_handler, + div13_binding, + modal_binding, + div15_binding + ]; + } + + class Filesystem extends SvelteComponentDev { + constructor(options) { + super(options); + init(this, options, instance$4, create_fragment$4, safe_not_equal, {}); + + dispatch_dev("SvelteRegisterComponent", { + component: this, + tagName: "Filesystem", + options, + id: create_fragment$4.name + }); + } + } + + const app = new Filesystem({ + target: document.body, + props: {} + }); + + return app; + +}()); +//# sourceMappingURL=filesystem.js.map diff --git a/res/static/svelte/modal.css b/res/static/svelte/modal.css new file mode 100644 index 0000000..87217b3 --- /dev/null +++ b/res/static/svelte/modal.css @@ -0,0 +1,3 @@ +.background.svelte-tirhyp{position:fixed;text-align:center;top:0;right:0;bottom:0;left:0;background-color:rgba(0, 0, 0, 0.5)}.window.svelte-tirhyp{position:absolute;z-index:inherit;display:flex;flex-direction:column;background-color:var(--layer_2_color);max-height:100%;max-width:100%;margin:0 auto;top:20%;left:50%;transform:translate(-50%, -20%);padding:0;box-sizing:border-box;text-align:left;box-shadow:var(--shadow_color) 0px 0px 50px}.header.svelte-tirhyp{flex-grow:0;flex-shrink:0;display:flex;flex-direction:row;padding:1px}.title.svelte-tirhyp{flex-grow:1;flex-shrink:1;display:flex;flex-direction:row;align-items:center;justify-content:center;font-size:1.2em;white-space:nowrap;text-overflow:ellipsis;overflow:hidden}.button_close.svelte-tirhyp{flex-grow:0;flex-shrink:0}.body.svelte-tirhyp{flex-grow:1;flex-shrink:1;overflow:auto;padding:10px} + +/*# sourceMappingURL=modal.css.map */ \ No newline at end of file diff --git a/res/static/svelte/modal.js b/res/static/svelte/modal.js new file mode 100644 index 0000000..92ee994 --- /dev/null +++ b/res/static/svelte/modal.js @@ -0,0 +1,1567 @@ + +(function(l, r) { if (l.getElementById('livereloadscript')) return; r = l.createElement('script'); r.async = 1; r.src = '//' + (window.location.host || 'localhost').split(':')[0] + ':5001/livereload.js?snipver=1'; r.id = 'livereloadscript'; l.getElementsByTagName('head')[0].appendChild(r) })(window.document); +var app = (function () { + 'use strict'; + + function noop() { } + const identity = x => x; + function assign(tar, src) { + // @ts-ignore + for (const k in src) + tar[k] = src[k]; + return tar; + } + 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 create_slot(definition, ctx, $$scope, fn) { + if (definition) { + const slot_ctx = get_slot_context(definition, ctx, $$scope, fn); + return definition[0](slot_ctx); + } + } + function get_slot_context(definition, ctx, $$scope, fn) { + return definition[1] && fn + ? assign($$scope.ctx.slice(), definition[1](fn(ctx))) + : $$scope.ctx; + } + function get_slot_changes(definition, $$scope, dirty, fn) { + if (definition[2] && fn) { + const lets = definition[2](fn(dirty)); + if ($$scope.dirty === undefined) { + return lets; + } + if (typeof lets === 'object') { + const merged = []; + const len = Math.max($$scope.dirty.length, lets.length); + for (let i = 0; i < len; i += 1) { + merged[i] = $$scope.dirty[i] | lets[i]; + } + return merged; + } + return $$scope.dirty | lets; + } + return $$scope.dirty; + } + function update_slot(slot, slot_definition, ctx, $$scope, dirty, get_slot_changes_fn, get_slot_context_fn) { + const slot_changes = get_slot_changes(slot_definition, $$scope, dirty, get_slot_changes_fn); + if (slot_changes) { + const slot_context = get_slot_context(slot_definition, ctx, $$scope, get_slot_context_fn); + slot.p(slot_context, slot_changes); + } + } + function action_destroyer(action_result) { + return action_result && is_function(action_result.destroy) ? action_result.destroy : noop; + } + + const is_client = typeof window !== 'undefined'; + let now = is_client + ? () => window.performance.now() + : () => Date.now(); + let raf = is_client ? cb => requestAnimationFrame(cb) : noop; + + const tasks = new Set(); + function run_tasks(now) { + tasks.forEach(task => { + if (!task.c(now)) { + tasks.delete(task); + task.f(); + } + }); + if (tasks.size !== 0) + raf(run_tasks); + } + /** + * Creates a new task that runs on each raf frame + * until it returns a falsy value or is aborted + */ + function loop(callback) { + let task; + if (tasks.size === 0) + raf(run_tasks); + return { + promise: new Promise(fulfill => { + tasks.add(task = { c: callback, f: fulfill }); + }), + abort() { + tasks.delete(task); + } + }; + } + + 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 empty() { + return text(''); + } + function listen(node, event, handler, options) { + node.addEventListener(event, handler, options); + return () => node.removeEventListener(event, handler, options); + } + function stop_propagation(fn) { + return function (event) { + event.stopPropagation(); + // @ts-ignore + return fn.call(this, event); + }; + } + 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 custom_event(type, detail) { + const e = document.createEvent('CustomEvent'); + e.initCustomEvent(type, false, false, detail); + return e; + } + + const active_docs = new Set(); + let active = 0; + // https://github.com/darkskyapp/string-hash/blob/master/index.js + function hash(str) { + let hash = 5381; + let i = str.length; + while (i--) + hash = ((hash << 5) - hash) ^ str.charCodeAt(i); + return hash >>> 0; + } + function create_rule(node, a, b, duration, delay, ease, fn, uid = 0) { + const step = 16.666 / duration; + let keyframes = '{\n'; + for (let p = 0; p <= 1; p += step) { + const t = a + (b - a) * ease(p); + keyframes += p * 100 + `%{${fn(t, 1 - t)}}\n`; + } + const rule = keyframes + `100% {${fn(b, 1 - b)}}\n}`; + const name = `__svelte_${hash(rule)}_${uid}`; + const doc = node.ownerDocument; + active_docs.add(doc); + const stylesheet = doc.__svelte_stylesheet || (doc.__svelte_stylesheet = doc.head.appendChild(element('style')).sheet); + const current_rules = doc.__svelte_rules || (doc.__svelte_rules = {}); + if (!current_rules[name]) { + current_rules[name] = true; + stylesheet.insertRule(`@keyframes ${name} ${rule}`, stylesheet.cssRules.length); + } + const animation = node.style.animation || ''; + node.style.animation = `${animation ? `${animation}, ` : ''}${name} ${duration}ms linear ${delay}ms 1 both`; + active += 1; + return name; + } + function delete_rule(node, name) { + const previous = (node.style.animation || '').split(', '); + const next = previous.filter(name + ? anim => anim.indexOf(name) < 0 // remove specific animation + : anim => anim.indexOf('__svelte') === -1 // remove all Svelte animations + ); + const deleted = previous.length - next.length; + if (deleted) { + node.style.animation = next.join(', '); + active -= deleted; + if (!active) + clear_rules(); + } + } + function clear_rules() { + raf(() => { + if (active) + return; + active_docs.forEach(doc => { + const stylesheet = doc.__svelte_stylesheet; + let i = stylesheet.cssRules.length; + while (i--) + stylesheet.deleteRule(i); + doc.__svelte_rules = {}; + }); + active_docs.clear(); + }); + } + + 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); + }); + } + }; + } + // TODO figure out if we still want to support + // shorthand events, or if we want to implement + // a real bubbling mechanism + function bubble(component, event) { + const callbacks = component.$$.callbacks[event.type]; + if (callbacks) { + callbacks.slice().forEach(fn => fn(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); + } + 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); + } + } + + let promise; + function wait() { + if (!promise) { + promise = Promise.resolve(); + promise.then(() => { + promise = null; + }); + } + return promise; + } + function dispatch(node, direction, kind) { + node.dispatchEvent(custom_event(`${direction ? 'intro' : 'outro'}${kind}`)); + } + const outroing = new Set(); + let outros; + function group_outros() { + outros = { + r: 0, + c: [], + p: outros // parent group + }; + } + function check_outros() { + if (!outros.r) { + run_all(outros.c); + } + outros = outros.p; + } + 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 null_transition = { duration: 0 }; + function create_bidirectional_transition(node, fn, params, intro) { + let config = fn(node, params); + let t = intro ? 0 : 1; + let running_program = null; + let pending_program = null; + let animation_name = null; + function clear_animation() { + if (animation_name) + delete_rule(node, animation_name); + } + function init(program, duration) { + const d = program.b - t; + duration *= Math.abs(d); + return { + a: t, + b: program.b, + d, + duration, + start: program.start, + end: program.start + duration, + group: program.group + }; + } + function go(b) { + const { delay = 0, duration = 300, easing = identity, tick = noop, css } = config || null_transition; + const program = { + start: now() + delay, + b + }; + if (!b) { + // @ts-ignore todo: improve typings + program.group = outros; + outros.r += 1; + } + if (running_program || pending_program) { + pending_program = program; + } + else { + // if this is an intro, and there's a delay, we need to do + // an initial tick and/or apply CSS animation immediately + if (css) { + clear_animation(); + animation_name = create_rule(node, t, b, duration, delay, easing, css); + } + if (b) + tick(0, 1); + running_program = init(program, duration); + add_render_callback(() => dispatch(node, b, 'start')); + loop(now => { + if (pending_program && now > pending_program.start) { + running_program = init(pending_program, duration); + pending_program = null; + dispatch(node, running_program.b, 'start'); + if (css) { + clear_animation(); + animation_name = create_rule(node, t, running_program.b, running_program.duration, 0, easing, config.css); + } + } + if (running_program) { + if (now >= running_program.end) { + tick(t = running_program.b, 1 - t); + dispatch(node, running_program.b, 'end'); + if (!pending_program) { + // we're done + if (running_program.b) { + // intro — we can tidy up immediately + clear_animation(); + } + else { + // outro — needs to be coordinated + if (!--running_program.group.r) + run_all(running_program.group.c); + } + } + running_program = null; + } + else if (now >= running_program.start) { + const p = now - running_program.start; + t = running_program.a + running_program.d * easing(p / running_program.duration); + tick(t, 1 - t); + } + } + return !!(running_program || pending_program); + }); + } + } + return { + run(b) { + if (is_function(config)) { + wait().then(() => { + // @ts-ignore + config = config(); + go(b); + }); + } + else { + go(b); + } + }, + end() { + clear_animation(); + running_program = pending_program = null; + } + }; + } + 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.29.6' }, 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() { } + } + + function fade(node, { delay = 0, duration = 400, easing = identity }) { + const o = +getComputedStyle(node).opacity; + return { + delay, + duration, + easing, + css: t => `opacity: ${t * o}` + }; + } + + /* src/util/Modal.svelte generated by Svelte v3.29.6 */ + const file = "src/util/Modal.svelte"; + + // (45:0) {#if visible} + function create_if_block(ctx) { + let div4; + let div3; + let div1; + let div0; + let t0; + let t1; + let button; + let i; + let t3; + let div2; + let load_modal_action; + let load_bg_action; + let div4_transition; + let current; + let mounted; + let dispose; + const default_slot_template = /*#slots*/ ctx[11].default; + const default_slot = create_slot(default_slot_template, ctx, /*$$scope*/ ctx[10], null); + + const block = { + c: function create() { + div4 = element("div"); + div3 = element("div"); + div1 = element("div"); + div0 = element("div"); + t0 = text(/*title*/ ctx[0]); + t1 = space(); + button = element("button"); + i = element("i"); + i.textContent = "close"; + t3 = space(); + div2 = element("div"); + if (default_slot) default_slot.c(); + attr_dev(div0, "class", "title svelte-tirhyp"); + add_location(div0, file, 48, 3, 1188); + attr_dev(i, "class", "icon"); + add_location(i, file, 50, 4, 1285); + attr_dev(button, "class", "button_close button_red svelte-tirhyp"); + add_location(button, file, 49, 3, 1224); + attr_dev(div1, "class", "header highlight_1 svelte-tirhyp"); + add_location(div1, file, 47, 2, 1152); + attr_dev(div2, "class", "body svelte-tirhyp"); + add_location(div2, file, 53, 2, 1335); + attr_dev(div3, "class", "window svelte-tirhyp"); + attr_dev(div3, "role", "dialog"); + attr_dev(div3, "aria-modal", "true"); + add_location(div3, file, 46, 1, 1057); + attr_dev(div4, "class", "background svelte-tirhyp"); + add_location(div4, file, 45, 0, 969); + }, + m: function mount(target, anchor) { + insert_dev(target, div4, anchor); + append_dev(div4, div3); + append_dev(div3, div1); + append_dev(div1, div0); + append_dev(div0, t0); + append_dev(div1, t1); + append_dev(div1, button); + append_dev(button, i); + append_dev(div3, t3); + append_dev(div3, div2); + + if (default_slot) { + default_slot.m(div2, null); + } + + current = true; + + if (!mounted) { + dispose = [ + listen_dev(button, "click", /*hide*/ ctx[1], false, false, false), + action_destroyer(load_modal_action = /*load_modal*/ ctx[4].call(null, div3)), + listen_dev(div3, "click", stop_propagation(/*click_handler*/ ctx[12]), false, false, true), + action_destroyer(load_bg_action = /*load_bg*/ ctx[3].call(null, div4)), + listen_dev(div4, "click", /*hide*/ ctx[1], false, false, false) + ]; + + mounted = true; + } + }, + p: function update(ctx, dirty) { + if (!current || dirty & /*title*/ 1) set_data_dev(t0, /*title*/ ctx[0]); + + if (default_slot) { + if (default_slot.p && dirty & /*$$scope*/ 1024) { + update_slot(default_slot, default_slot_template, ctx, /*$$scope*/ ctx[10], dirty, null, null); + } + } + }, + i: function intro(local) { + if (current) return; + transition_in(default_slot, local); + + add_render_callback(() => { + if (!div4_transition) div4_transition = create_bidirectional_transition(div4, fade, { duration: 200 }, true); + div4_transition.run(1); + }); + + current = true; + }, + o: function outro(local) { + transition_out(default_slot, local); + if (!div4_transition) div4_transition = create_bidirectional_transition(div4, fade, { duration: 200 }, false); + div4_transition.run(0); + current = false; + }, + d: function destroy(detaching) { + if (detaching) detach_dev(div4); + if (default_slot) default_slot.d(detaching); + if (detaching && div4_transition) div4_transition.end(); + mounted = false; + run_all(dispose); + } + }; + + dispatch_dev("SvelteRegisterBlock", { + block, + id: create_if_block.name, + type: "if", + source: "(45:0) {#if visible}", + ctx + }); + + return block; + } + + function create_fragment(ctx) { + let if_block_anchor; + let current; + let mounted; + let dispose; + let if_block = /*visible*/ ctx[2] && create_if_block(ctx); + + const block = { + c: function create() { + if (if_block) if_block.c(); + if_block_anchor = empty(); + }, + 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) { + if (if_block) if_block.m(target, anchor); + insert_dev(target, if_block_anchor, anchor); + current = true; + + if (!mounted) { + dispose = listen_dev(window, "keydown", /*keydown*/ ctx[5], false, false, false); + mounted = true; + } + }, + p: function update(ctx, [dirty]) { + if (/*visible*/ ctx[2]) { + if (if_block) { + if_block.p(ctx, dirty); + + if (dirty & /*visible*/ 4) { + transition_in(if_block, 1); + } + } else { + if_block = create_if_block(ctx); + if_block.c(); + transition_in(if_block, 1); + if_block.m(if_block_anchor.parentNode, if_block_anchor); + } + } else if (if_block) { + group_outros(); + + transition_out(if_block, 1, 1, () => { + if_block = null; + }); + + check_outros(); + } + }, + i: function intro(local) { + if (current) return; + transition_in(if_block); + current = true; + }, + o: function outro(local) { + transition_out(if_block); + current = false; + }, + d: function destroy(detaching) { + if (if_block) if_block.d(detaching); + if (detaching) detach_dev(if_block_anchor); + mounted = false; + dispose(); + } + }; + + dispatch_dev("SvelteRegisterBlock", { + block, + id: create_fragment.name, + type: "component", + source: "", + ctx + }); + + return block; + } + + let global_index = 10000; + + function instance($$self, $$props, $$invalidate) { + let { $$slots: slots = {}, $$scope } = $$props; + validate_slots("Modal", slots, ['default']); + let { title = "" } = $$props; + let { width = "800px" } = $$props; + let { height = "auto" } = $$props; + let visible = false; + + const load_bg = background => { + background.style.zIndex = global_index.valueOf(); + global_index++; + }; + + const load_modal = modal => { + modal.style.width = width; + modal.style.height = height; + }; + + const dispatch = createEventDispatcher(); + + const show = () => { + $$invalidate(2, visible = true); + dispatch("shown"); + }; + + const hide = () => { + $$invalidate(2, visible = false); + dispatch("hidden"); + }; + + const toggle = () => { + if (visible) { + hide(); + } else { + show(); + } + }; + + const keydown = e => { + if (e.key === "Escape") { + hide(); + return; + } + }; + + const writable_props = ["title", "width", "height"]; + + Object.keys($$props).forEach(key => { + if (!~writable_props.indexOf(key) && key.slice(0, 2) !== "$$") console.warn(` was created with unknown prop '${key}'`); + }); + + function click_handler(event) { + bubble($$self, event); + } + + $$self.$$set = $$props => { + if ("title" in $$props) $$invalidate(0, title = $$props.title); + if ("width" in $$props) $$invalidate(6, width = $$props.width); + if ("height" in $$props) $$invalidate(7, height = $$props.height); + if ("$$scope" in $$props) $$invalidate(10, $$scope = $$props.$$scope); + }; + + $$self.$capture_state = () => ({ + global_index, + createEventDispatcher, + fade, + title, + width, + height, + visible, + load_bg, + load_modal, + dispatch, + show, + hide, + toggle, + keydown + }); + + $$self.$inject_state = $$props => { + if ("title" in $$props) $$invalidate(0, title = $$props.title); + if ("width" in $$props) $$invalidate(6, width = $$props.width); + if ("height" in $$props) $$invalidate(7, height = $$props.height); + if ("visible" in $$props) $$invalidate(2, visible = $$props.visible); + }; + + if ($$props && "$$inject" in $$props) { + $$self.$inject_state($$props.$$inject); + } + + return [ + title, + hide, + visible, + load_bg, + load_modal, + keydown, + width, + height, + show, + toggle, + $$scope, + slots, + click_handler + ]; + } + + class Modal extends SvelteComponentDev { + constructor(options) { + super(options); + + init(this, options, instance, create_fragment, safe_not_equal, { + title: 0, + width: 6, + height: 7, + show: 8, + hide: 1, + toggle: 9 + }); + + dispatch_dev("SvelteRegisterComponent", { + component: this, + tagName: "Modal", + options, + id: create_fragment.name + }); + } + + get title() { + throw new Error(": Props cannot be read directly from the component instance unless compiling with 'accessors: true' or ''"); + } + + set title(value) { + throw new Error(": Props cannot be set directly on the component instance unless compiling with 'accessors: true' or ''"); + } + + get width() { + throw new Error(": Props cannot be read directly from the component instance unless compiling with 'accessors: true' or ''"); + } + + set width(value) { + throw new Error(": Props cannot be set directly on the component instance unless compiling with 'accessors: true' or ''"); + } + + get height() { + throw new Error(": Props cannot be read directly from the component instance unless compiling with 'accessors: true' or ''"); + } + + set height(value) { + throw new Error(": Props cannot be set directly on the component instance unless compiling with 'accessors: true' or ''"); + } + + get show() { + return this.$$.ctx[8]; + } + + set show(value) { + throw new Error(": Props cannot be set directly on the component instance unless compiling with 'accessors: true' or ''"); + } + + get hide() { + return this.$$.ctx[1]; + } + + set hide(value) { + throw new Error(": Props cannot be set directly on the component instance unless compiling with 'accessors: true' or ''"); + } + + get toggle() { + return this.$$.ctx[9]; + } + + set toggle(value) { + throw new Error(": Props cannot be set directly on the component instance unless compiling with 'accessors: true' or ''"); + } + } + + /* src/modal/App.svelte generated by Svelte v3.29.6 */ + const file$1 = "src/modal/App.svelte"; + + // (14:0) + function create_default_slot_2(ctx) { + let img; + let img_src_value; + + const block = { + c: function create() { + img = element("img"); + if (img.src !== (img_src_value = "https://pixeldrain.com/res/img/header_orbitron_wide.png")) attr_dev(img, "src", img_src_value); + attr_dev(img, "alt", "logo"); + set_style(img, "max-width", "100%"); + add_location(img, file$1, 14, 1, 226); + }, + m: function mount(target, anchor) { + insert_dev(target, img, anchor); + }, + d: function destroy(detaching) { + if (detaching) detach_dev(img); + } + }; + + dispatch_dev("SvelteRegisterBlock", { + block, + id: create_default_slot_2.name, + type: "slot", + source: "(14:0) ", + ctx + }); + + return block; + } + + // (17:0) + function create_default_slot_1(ctx) { + let ol; + let li0; + let t1; + let li1; + let t3; + let li2; + let t5; + let li3; + let t7; + let li4; + let button; + let t9; + let li5; + let t11; + let li6; + let t13; + let a; + let mounted; + let dispose; + + const block = { + c: function create() { + ol = element("ol"); + li0 = element("li"); + li0.textContent = "of or relating to modality in logic"; + t1 = space(); + li1 = element("li"); + li1.textContent = "containing provisions as to the mode of procedure or the manner of taking effect —used of a contract or legacy"; + t3 = space(); + li2 = element("li"); + li2.textContent = "of or relating to a musical mode"; + t5 = space(); + li3 = element("li"); + li3.textContent = "of or relating to structure as opposed to substance"; + t7 = space(); + li4 = element("li"); + button = element("button"); + button.textContent = "third modal"; + t9 = space(); + li5 = element("li"); + li5.textContent = "of, relating to, or constituting a grammatical form or category characteristically indicating predication"; + t11 = space(); + li6 = element("li"); + li6.textContent = "of or relating to a statistical mode"; + t13 = space(); + a = element("a"); + a.textContent = "merriam-webster.com"; + add_location(li0, file$1, 18, 2, 427); + add_location(li1, file$1, 19, 2, 474); + add_location(li2, file$1, 20, 2, 596); + add_location(li3, file$1, 21, 2, 640); + add_location(button, file$1, 22, 6, 707); + add_location(li4, file$1, 22, 2, 703); + add_location(li5, file$1, 23, 2, 766); + add_location(li6, file$1, 24, 2, 883); + attr_dev(ol, "class", "definition-list"); + add_location(ol, file$1, 17, 1, 396); + attr_dev(a, "href", "https://www.merriam-webster.com/dictionary/modal"); + add_location(a, file$1, 27, 1, 938); + }, + m: function mount(target, anchor) { + insert_dev(target, ol, anchor); + append_dev(ol, li0); + append_dev(ol, t1); + append_dev(ol, li1); + append_dev(ol, t3); + append_dev(ol, li2); + append_dev(ol, t5); + append_dev(ol, li3); + append_dev(ol, t7); + append_dev(ol, li4); + append_dev(li4, button); + append_dev(ol, t9); + append_dev(ol, li5); + append_dev(ol, t11); + append_dev(ol, li6); + insert_dev(target, t13, anchor); + insert_dev(target, a, anchor); + + if (!mounted) { + dispose = listen_dev( + button, + "click", + function () { + if (is_function(/*modal3*/ ctx[2].show)) /*modal3*/ ctx[2].show.apply(this, arguments); + }, + false, + false, + false + ); + + mounted = true; + } + }, + p: function update(new_ctx, dirty) { + ctx = new_ctx; + }, + d: function destroy(detaching) { + if (detaching) detach_dev(ol); + if (detaching) detach_dev(t13); + if (detaching) detach_dev(a); + mounted = false; + dispose(); + } + }; + + dispatch_dev("SvelteRegisterBlock", { + block, + id: create_default_slot_1.name, + type: "slot", + source: "(17:0) ", + ctx + }); + + return block; + } + + // (31:0) + function create_default_slot(ctx) { + let ol; + let li0; + let t1; + let li1; + let t3; + let li2; + let t5; + let li3; + let t7; + let li4; + let t9; + let li5; + let t11; + let a; + let t13; + let br; + let t14; + let button; + let mounted; + let dispose; + + const block = { + c: function create() { + ol = element("ol"); + li0 = element("li"); + li0.textContent = "of or relating to modality in logic"; + t1 = space(); + li1 = element("li"); + li1.textContent = "containing provisions as to the mode of procedure or the manner of taking effect —used of a contract or legacy"; + t3 = space(); + li2 = element("li"); + li2.textContent = "of or relating to a musical mode"; + t5 = space(); + li3 = element("li"); + li3.textContent = "of or relating to structure as opposed to substance"; + t7 = space(); + li4 = element("li"); + li4.textContent = "of, relating to, or constituting a grammatical form or category characteristically indicating predication"; + t9 = space(); + li5 = element("li"); + li5.textContent = "of or relating to a statistical mode"; + t11 = space(); + a = element("a"); + a.textContent = "merriam-webster.com"; + t13 = space(); + br = element("br"); + t14 = space(); + button = element("button"); + button.textContent = "show modal"; + add_location(li0, file$1, 32, 2, 1105); + add_location(li1, file$1, 33, 2, 1152); + add_location(li2, file$1, 34, 2, 1274); + add_location(li3, file$1, 35, 2, 1318); + add_location(li4, file$1, 36, 2, 1381); + add_location(li5, file$1, 37, 2, 1498); + attr_dev(ol, "class", "definition-list"); + add_location(ol, file$1, 31, 1, 1074); + attr_dev(a, "href", "https://www.merriam-webster.com/dictionary/modal"); + add_location(a, file$1, 40, 1, 1553); + add_location(br, file$1, 41, 1, 1637); + add_location(button, file$1, 43, 1, 1645); + }, + m: function mount(target, anchor) { + insert_dev(target, ol, anchor); + append_dev(ol, li0); + append_dev(ol, t1); + append_dev(ol, li1); + append_dev(ol, t3); + append_dev(ol, li2); + append_dev(ol, t5); + append_dev(ol, li3); + append_dev(ol, t7); + append_dev(ol, li4); + append_dev(ol, t9); + append_dev(ol, li5); + insert_dev(target, t11, anchor); + insert_dev(target, a, anchor); + insert_dev(target, t13, anchor); + insert_dev(target, br, anchor); + insert_dev(target, t14, anchor); + insert_dev(target, button, anchor); + + if (!mounted) { + dispose = listen_dev( + button, + "click", + function () { + if (is_function(/*modal2*/ ctx[1].show)) /*modal2*/ ctx[1].show.apply(this, arguments); + }, + false, + false, + false + ); + + mounted = true; + } + }, + p: function update(new_ctx, dirty) { + ctx = new_ctx; + }, + d: function destroy(detaching) { + if (detaching) detach_dev(ol); + if (detaching) detach_dev(t11); + if (detaching) detach_dev(a); + if (detaching) detach_dev(t13); + if (detaching) detach_dev(br); + if (detaching) detach_dev(t14); + if (detaching) detach_dev(button); + mounted = false; + dispose(); + } + }; + + dispatch_dev("SvelteRegisterBlock", { + block, + id: create_default_slot.name, + type: "slot", + source: "(31:0) ", + ctx + }); + + return block; + } + + function create_fragment$1(ctx) { + let button; + let t1; + let br; + let t2; + let modal0; + let t3; + let modal1_1; + let t4; + let modal2_1; + let current; + let mounted; + let dispose; + + let modal0_props = { + title: "Third modal", + width: "700px", + $$slots: { default: [create_default_slot_2] }, + $$scope: { ctx } + }; + + modal0 = new Modal({ props: modal0_props, $$inline: true }); + /*modal0_binding*/ ctx[3](modal0); + + let modal1_1_props = { + title: "Wat!", + width: "1000px", + $$slots: { default: [create_default_slot_1] }, + $$scope: { ctx } + }; + + modal1_1 = new Modal({ props: modal1_1_props, $$inline: true }); + /*modal1_1_binding*/ ctx[4](modal1_1); + + let modal2_1_props = { + title: "Hello!", + $$slots: { default: [create_default_slot] }, + $$scope: { ctx } + }; + + modal2_1 = new Modal({ props: modal2_1_props, $$inline: true }); + /*modal2_1_binding*/ ctx[5](modal2_1); + + const block = { + c: function create() { + button = element("button"); + button.textContent = "show modal"; + t1 = space(); + br = element("br"); + t2 = space(); + create_component(modal0.$$.fragment); + t3 = space(); + create_component(modal1_1.$$.fragment); + t4 = space(); + create_component(modal2_1.$$.fragment); + add_location(button, file$1, 7, 0, 102); + add_location(br, file$1, 11, 0, 157); + }, + 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, button, anchor); + insert_dev(target, t1, anchor); + insert_dev(target, br, anchor); + insert_dev(target, t2, anchor); + mount_component(modal0, target, anchor); + insert_dev(target, t3, anchor); + mount_component(modal1_1, target, anchor); + insert_dev(target, t4, anchor); + mount_component(modal2_1, target, anchor); + current = true; + + if (!mounted) { + dispose = listen_dev( + button, + "click", + function () { + if (is_function(/*modal1*/ ctx[0].show)) /*modal1*/ ctx[0].show.apply(this, arguments); + }, + false, + false, + false + ); + + mounted = true; + } + }, + p: function update(new_ctx, [dirty]) { + ctx = new_ctx; + const modal0_changes = {}; + + if (dirty & /*$$scope*/ 64) { + modal0_changes.$$scope = { dirty, ctx }; + } + + modal0.$set(modal0_changes); + const modal1_1_changes = {}; + + if (dirty & /*$$scope, modal3*/ 68) { + modal1_1_changes.$$scope = { dirty, ctx }; + } + + modal1_1.$set(modal1_1_changes); + const modal2_1_changes = {}; + + if (dirty & /*$$scope, modal2*/ 66) { + modal2_1_changes.$$scope = { dirty, ctx }; + } + + modal2_1.$set(modal2_1_changes); + }, + i: function intro(local) { + if (current) return; + transition_in(modal0.$$.fragment, local); + transition_in(modal1_1.$$.fragment, local); + transition_in(modal2_1.$$.fragment, local); + current = true; + }, + o: function outro(local) { + transition_out(modal0.$$.fragment, local); + transition_out(modal1_1.$$.fragment, local); + transition_out(modal2_1.$$.fragment, local); + current = false; + }, + d: function destroy(detaching) { + if (detaching) detach_dev(button); + if (detaching) detach_dev(t1); + if (detaching) detach_dev(br); + if (detaching) detach_dev(t2); + /*modal0_binding*/ ctx[3](null); + destroy_component(modal0, detaching); + if (detaching) detach_dev(t3); + /*modal1_1_binding*/ ctx[4](null); + destroy_component(modal1_1, detaching); + if (detaching) detach_dev(t4); + /*modal2_1_binding*/ ctx[5](null); + destroy_component(modal2_1, detaching); + mounted = false; + dispose(); + } + }; + + dispatch_dev("SvelteRegisterBlock", { + block, + id: create_fragment$1.name, + type: "component", + source: "", + ctx + }); + + return block; + } + + function instance$1($$self, $$props, $$invalidate) { + let { $$slots: slots = {}, $$scope } = $$props; + validate_slots("App", slots, []); + let modal1; + let modal2; + let modal3; + const writable_props = []; + + Object.keys($$props).forEach(key => { + if (!~writable_props.indexOf(key) && key.slice(0, 2) !== "$$") console.warn(` was created with unknown prop '${key}'`); + }); + + function modal0_binding($$value) { + binding_callbacks[$$value ? "unshift" : "push"](() => { + modal3 = $$value; + $$invalidate(2, modal3); + }); + } + + function modal1_1_binding($$value) { + binding_callbacks[$$value ? "unshift" : "push"](() => { + modal2 = $$value; + $$invalidate(1, modal2); + }); + } + + function modal2_1_binding($$value) { + binding_callbacks[$$value ? "unshift" : "push"](() => { + modal1 = $$value; + $$invalidate(0, modal1); + }); + } + + $$self.$capture_state = () => ({ Modal, modal1, modal2, modal3 }); + + $$self.$inject_state = $$props => { + if ("modal1" in $$props) $$invalidate(0, modal1 = $$props.modal1); + if ("modal2" in $$props) $$invalidate(1, modal2 = $$props.modal2); + if ("modal3" in $$props) $$invalidate(2, modal3 = $$props.modal3); + }; + + if ($$props && "$$inject" in $$props) { + $$self.$inject_state($$props.$$inject); + } + + return [modal1, modal2, modal3, modal0_binding, modal1_1_binding, modal2_1_binding]; + } + + class App extends SvelteComponentDev { + constructor(options) { + super(options); + init(this, options, instance$1, create_fragment$1, safe_not_equal, {}); + + dispatch_dev("SvelteRegisterComponent", { + component: this, + tagName: "App", + options, + id: create_fragment$1.name + }); + } + } + + const app = new App({ + target: document.body, + props: { + name: 'world' + } + }); + + return app; + +}()); +//# sourceMappingURL=modal.js.map diff --git a/res/template/filesystem.html b/res/template/filesystem.html index c1b324c..c80cafd 100644 --- a/res/template/filesystem.html +++ b/res/template/filesystem.html @@ -19,6 +19,9 @@ {{ range $node := .Other.Path }} / {{ $node.Name }} {{ end }} + {{ if ne .Other.Base.Name "" }} + / {{ .Other.Base.Name }} + {{ end }} {{ range $node := .Other.Children }} diff --git a/res/template/filesystem_svelte.html b/res/template/filesystem_svelte.html new file mode 100644 index 0000000..e7f20a8 --- /dev/null +++ b/res/template/filesystem_svelte.html @@ -0,0 +1,33 @@ +{{define "filesystem_svelte"}} + + + + {{.Title}} + + + {{template "user_style" .}} + + + + + + + + + + + + + + {{.OGData}} + + + + + + + +{{end}} diff --git a/svelte/package-lock.json b/svelte/package-lock.json new file mode 100644 index 0000000..7879de4 --- /dev/null +++ b/svelte/package-lock.json @@ -0,0 +1,769 @@ +{ + "name": "svelte-app", + "version": "1.0.0", + "lockfileVersion": 1, + "requires": true, + "dependencies": { + "@babel/code-frame": { + "version": "7.10.4", + "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.10.4.tgz", + "integrity": "sha512-vG6SvB6oYEhvgisZNFRmRCUkLz11c7rp+tbNTynGqc6mS1d5ATd/sGyV6W0KZZnXRKMTzZDRgQT3Ou9jhpAfUg==", + "dev": true, + "requires": { + "@babel/highlight": "^7.10.4" + } + }, + "@babel/helper-validator-identifier": { + "version": "7.10.4", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.10.4.tgz", + "integrity": "sha512-3U9y+43hz7ZM+rzG24Qe2mufW5KhvFg/NhnNph+i9mgCtdTCtMJuI1TMkrIUiK7Ix4PYlRF9I5dhqaLYA/ADXw==", + "dev": true + }, + "@babel/highlight": { + "version": "7.10.4", + "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.10.4.tgz", + "integrity": "sha512-i6rgnR/YgPEQzZZnbTHHuZdlE8qyoBNalD6F+q4vAFlcMEcqmkoG+mPqJYJCo63qPf74+Y1UZsl3l6f7/RIkmA==", + "dev": true, + "requires": { + "@babel/helper-validator-identifier": "^7.10.4", + "chalk": "^2.0.0", + "js-tokens": "^4.0.0" + } + }, + "@polka/url": { + "version": "1.0.0-next.11", + "resolved": "https://registry.npmjs.org/@polka/url/-/url-1.0.0-next.11.tgz", + "integrity": "sha512-3NsZsJIA/22P3QUyrEDNA2D133H4j224twJrdipXN38dpnIOzAbUDtOwkcJ5pXmn75w7LSQDjA4tO9dm1XlqlA==" + }, + "@rollup/plugin-commonjs": { + "version": "14.0.0", + "resolved": "https://registry.npmjs.org/@rollup/plugin-commonjs/-/plugin-commonjs-14.0.0.tgz", + "integrity": "sha512-+PSmD9ePwTAeU106i9FRdc+Zb3XUWyW26mo5Atr2mk82hor8+nPwkztEjFo8/B1fJKfaQDg9aM2bzQkjhi7zOw==", + "dev": true, + "requires": { + "@rollup/pluginutils": "^3.0.8", + "commondir": "^1.0.1", + "estree-walker": "^1.0.1", + "glob": "^7.1.2", + "is-reference": "^1.1.2", + "magic-string": "^0.25.2", + "resolve": "^1.11.0" + } + }, + "@rollup/plugin-node-resolve": { + "version": "8.4.0", + "resolved": "https://registry.npmjs.org/@rollup/plugin-node-resolve/-/plugin-node-resolve-8.4.0.tgz", + "integrity": "sha512-LFqKdRLn0ShtQyf6SBYO69bGE1upV6wUhBX0vFOUnLAyzx5cwp8svA0eHUnu8+YU57XOkrMtfG63QOpQx25pHQ==", + "dev": true, + "requires": { + "@rollup/pluginutils": "^3.1.0", + "@types/resolve": "1.17.1", + "builtin-modules": "^3.1.0", + "deep-freeze": "^0.0.1", + "deepmerge": "^4.2.2", + "is-module": "^1.0.0", + "resolve": "^1.17.0" + } + }, + "@rollup/pluginutils": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/@rollup/pluginutils/-/pluginutils-3.1.0.tgz", + "integrity": "sha512-GksZ6pr6TpIjHm8h9lSQ8pi8BE9VeubNT0OMJ3B5uZJ8pz73NPiqOtCog/x2/QzM1ENChPKxMDhiQuRHsqc+lg==", + "dev": true, + "requires": { + "@types/estree": "0.0.39", + "estree-walker": "^1.0.1", + "picomatch": "^2.2.2" + } + }, + "@types/estree": { + "version": "0.0.39", + "resolved": "https://registry.npmjs.org/@types/estree/-/estree-0.0.39.tgz", + "integrity": "sha512-EYNwp3bU+98cpU4lAWYYL7Zz+2gryWH1qbdDTidVd6hkiR6weksdbMadyXKXNPEkQFhXM+hVO9ZygomHXp+AIw==", + "dev": true + }, + "@types/node": { + "version": "14.14.7", + "resolved": "https://registry.npmjs.org/@types/node/-/node-14.14.7.tgz", + "integrity": "sha512-Zw1vhUSQZYw+7u5dAwNbIA9TuTotpzY/OF7sJM9FqPOF3SPjKnxrjoTktXDZgUjybf4cWVBP7O8wvKdSaGHweg==", + "dev": true + }, + "@types/resolve": { + "version": "1.17.1", + "resolved": "https://registry.npmjs.org/@types/resolve/-/resolve-1.17.1.tgz", + "integrity": "sha512-yy7HuzQhj0dhGpD8RLXSZWEkLsV9ibvxvi6EiJ3bkqLAO1RGo0WbkWQiwpRlSFymTJRz0d3k5LM3kkx8ArDbLw==", + "dev": true, + "requires": { + "@types/node": "*" + } + }, + "ansi-styles": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "dev": true, + "requires": { + "color-convert": "^1.9.0" + } + }, + "anymatch": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.1.tgz", + "integrity": "sha512-mM8522psRCqzV+6LhomX5wgp25YVibjh8Wj23I5RPkPppSVSjyKD2A2mBJmWGa+KN7f2D6LNh9jkBCeyLktzjg==", + "dev": true, + "requires": { + "normalize-path": "^3.0.0", + "picomatch": "^2.0.4" + } + }, + "async-limiter": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/async-limiter/-/async-limiter-1.0.1.tgz", + "integrity": "sha512-csOlWGAcRFJaI6m+F2WKdnMKr4HhdhFVBk0H/QbJFMCr+uO2kwohwXQPxw/9OCxp05r5ghVBFSyioixx3gfkNQ==", + "dev": true + }, + "balanced-match": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz", + "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=", + "dev": true + }, + "binary-extensions": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.1.0.tgz", + "integrity": "sha512-1Yj8h9Q+QDF5FzhMs/c9+6UntbD5MkRfRwac8DoEm9ZfUBZ7tZ55YcGVAzEe4bXsdQHEk+s9S5wsOKVdZrw0tQ==", + "dev": true + }, + "brace-expansion": { + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "dev": true, + "requires": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "braces": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz", + "integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==", + "dev": true, + "requires": { + "fill-range": "^7.0.1" + } + }, + "buffer-from": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.1.tgz", + "integrity": "sha512-MQcXEUbCKtEo7bhqEs6560Hyd4XaovZlO/k9V3hjVUF/zwW7KBVdSK4gIt/bzwS9MbR5qob+F5jusZsb0YQK2A==", + "dev": true + }, + "builtin-modules": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/builtin-modules/-/builtin-modules-3.1.0.tgz", + "integrity": "sha512-k0KL0aWZuBt2lrxrcASWDfwOLMnodeQjodT/1SxEQAXsHANgo6ZC/VEaSEHCXt7aSTZ4/4H5LKa+tBXmW7Vtvw==", + "dev": true + }, + "chalk": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", + "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", + "dev": true, + "requires": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + } + }, + "chokidar": { + "version": "3.4.3", + "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.4.3.tgz", + "integrity": "sha512-DtM3g7juCXQxFVSNPNByEC2+NImtBuxQQvWlHunpJIS5Ocr0lG306cC7FCi7cEA0fzmybPUIl4txBIobk1gGOQ==", + "dev": true, + "requires": { + "anymatch": "~3.1.1", + "braces": "~3.0.2", + "fsevents": "~2.1.2", + "glob-parent": "~5.1.0", + "is-binary-path": "~2.1.0", + "is-glob": "~4.0.1", + "normalize-path": "~3.0.0", + "readdirp": "~3.5.0" + } + }, + "color-convert": { + "version": "1.9.3", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", + "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", + "dev": true, + "requires": { + "color-name": "1.1.3" + } + }, + "color-name": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", + "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=", + "dev": true + }, + "commander": { + "version": "2.20.3", + "resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz", + "integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==", + "dev": true + }, + "commondir": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/commondir/-/commondir-1.0.1.tgz", + "integrity": "sha1-3dgA2gxmEnOTzKWVDqloo6rxJTs=", + "dev": true + }, + "concat-map": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", + "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=", + "dev": true + }, + "console-clear": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/console-clear/-/console-clear-1.1.1.tgz", + "integrity": "sha512-pMD+MVR538ipqkG5JXeOEbKWS5um1H4LUUccUQG68qpeqBYbzYy79Gh55jkd2TtPdRfUaLWdv6LPP//5Zt0aPQ==" + }, + "deep-freeze": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/deep-freeze/-/deep-freeze-0.0.1.tgz", + "integrity": "sha1-OgsABd4YZygZ39OM0x+RF5yJPoQ=", + "dev": true + }, + "deepmerge": { + "version": "4.2.2", + "resolved": "https://registry.npmjs.org/deepmerge/-/deepmerge-4.2.2.tgz", + "integrity": "sha512-FJ3UgI4gIl+PHZm53knsuSFpE+nESMr7M4v9QcgB7S63Kj/6WqMiFQJpBBYz1Pt+66bZpP3Q7Lye0Oo9MPKEdg==", + "dev": true + }, + "escape-string-regexp": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", + "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=", + "dev": true + }, + "estree-walker": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-1.0.1.tgz", + "integrity": "sha512-1fMXF3YP4pZZVozF8j/ZLfvnR8NSIljt56UhbZ5PeeDmmGHpgpdwQt7ITlGvYaQukCvuBRMLEiKiYC+oeIg4cg==", + "dev": true + }, + "fill-range": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", + "integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==", + "dev": true, + "requires": { + "to-regex-range": "^5.0.1" + } + }, + "fs.realpath": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", + "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=", + "dev": true + }, + "fsevents": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.1.3.tgz", + "integrity": "sha512-Auw9a4AxqWpa9GUfj370BMPzzyncfBABW8Mab7BGWBYDj4Isgq+cDKtx0i6u9jcX9pQDnswsaaOTgTmA5pEjuQ==", + "dev": true, + "optional": true + }, + "function-bind": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", + "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==", + "dev": true + }, + "get-port": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/get-port/-/get-port-3.2.0.tgz", + "integrity": "sha1-3Xzn3hh8Bsi/NTeWrHHgmfCYDrw=" + }, + "glob": { + "version": "7.1.6", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.6.tgz", + "integrity": "sha512-LwaxwyZ72Lk7vZINtNNrywX0ZuLyStrdDtabefZKAY5ZGJhVtgdznluResxNmPitE0SAO+O26sWTHeKSI2wMBA==", + "dev": true, + "requires": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.0.4", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + } + }, + "glob-parent": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.1.tgz", + "integrity": "sha512-FnI+VGOpnlGHWZxthPGR+QhR78fuiK0sNLkHQv+bL9fQi57lNNdquIbna/WrfROrolq8GK5Ek6BiMwqL/voRYQ==", + "dev": true, + "requires": { + "is-glob": "^4.0.1" + } + }, + "has": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", + "integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==", + "dev": true, + "requires": { + "function-bind": "^1.1.1" + } + }, + "has-flag": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=", + "dev": true + }, + "inflight": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", + "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=", + "dev": true, + "requires": { + "once": "^1.3.0", + "wrappy": "1" + } + }, + "inherits": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", + "dev": true + }, + "is-binary-path": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz", + "integrity": "sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==", + "dev": true, + "requires": { + "binary-extensions": "^2.0.0" + } + }, + "is-core-module": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.1.0.tgz", + "integrity": "sha512-YcV7BgVMRFRua2FqQzKtTDMz8iCuLEyGKjr70q8Zm1yy2qKcurbFEd79PAdHV77oL3NrAaOVQIbMmiHQCHB7ZA==", + "dev": true, + "requires": { + "has": "^1.0.3" + } + }, + "is-extglob": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", + "integrity": "sha1-qIwCU1eR8C7TfHahueqXc8gz+MI=", + "dev": true + }, + "is-glob": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.1.tgz", + "integrity": "sha512-5G0tKtBTFImOqDnLB2hG6Bp2qcKEFduo4tZu9MT/H6NQv/ghhy30o55ufafxJ/LdH79LLs2Kfrn85TLKyA7BUg==", + "dev": true, + "requires": { + "is-extglob": "^2.1.1" + } + }, + "is-module": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-module/-/is-module-1.0.0.tgz", + "integrity": "sha1-Mlj7afeMFNW4FdZkM2tM/7ZEFZE=", + "dev": true + }, + "is-number": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", + "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", + "dev": true + }, + "is-reference": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/is-reference/-/is-reference-1.2.1.tgz", + "integrity": "sha512-U82MsXXiFIrjCK4otLT+o2NA2Cd2g5MLoOVXUZjIOhLurrRxpEXzI8O0KZHr3IjLvlAH1kTPYSuqer5T9ZVBKQ==", + "dev": true, + "requires": { + "@types/estree": "*" + } + }, + "jest-worker": { + "version": "26.6.2", + "resolved": "https://registry.npmjs.org/jest-worker/-/jest-worker-26.6.2.tgz", + "integrity": "sha512-KWYVV1c4i+jbMpaBC+U++4Va0cp8OisU185o73T1vo99hqi7w8tSJfUXYswwqqrjzwxa6KpRK54WhPvwf5w6PQ==", + "dev": true, + "requires": { + "@types/node": "*", + "merge-stream": "^2.0.0", + "supports-color": "^7.0.0" + }, + "dependencies": { + "has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "dev": true + }, + "supports-color": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "dev": true, + "requires": { + "has-flag": "^4.0.0" + } + } + } + }, + "js-tokens": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", + "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==", + "dev": true + }, + "kleur": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/kleur/-/kleur-3.0.3.tgz", + "integrity": "sha512-eTIzlVOSUR+JxdDFepEYcBMtZ9Qqdef+rnzWdRZuMbOywu5tO2w2N7rqjoANZ5k9vywhL6Br1VRjUIgTQx4E8w==" + }, + "livereload": { + "version": "0.9.1", + "resolved": "https://registry.npmjs.org/livereload/-/livereload-0.9.1.tgz", + "integrity": "sha512-9g7sua11kkyZNo2hLRCG3LuZZwqexoyEyecSlV8cAsfAVVCZqLzVir6XDqmH0r+Vzgnd5LrdHDMyjtFnJQLAYw==", + "dev": true, + "requires": { + "chokidar": "^3.3.0", + "livereload-js": "^3.1.0", + "opts": ">= 1.2.0", + "ws": "^6.2.1" + } + }, + "livereload-js": { + "version": "3.3.1", + "resolved": "https://registry.npmjs.org/livereload-js/-/livereload-js-3.3.1.tgz", + "integrity": "sha512-CBu1gTEfzVhlOK1WASKAAJ9Qx1fHECTq0SUB67sfxwQssopTyvzqTlgl+c0h9pZ6V+Fzd2rc510ppuNusg9teQ==", + "dev": true + }, + "local-access": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/local-access/-/local-access-1.0.1.tgz", + "integrity": "sha512-ykt2pgN0aqIy6KQC1CqdWTWkmUwNgaOS6dcpHVjyBJONA+Xi7AtSB1vuxC/U/0tjIP3wcRudwQk1YYzUvzk2bA==" + }, + "magic-string": { + "version": "0.25.7", + "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.25.7.tgz", + "integrity": "sha512-4CrMT5DOHTDk4HYDlzmwu4FVCcIYI8gauveasrdCu2IKIFOJ3f0v/8MDGJCDL9oD2ppz/Av1b0Nj345H9M+XIA==", + "dev": true, + "requires": { + "sourcemap-codec": "^1.4.4" + } + }, + "merge-stream": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/merge-stream/-/merge-stream-2.0.0.tgz", + "integrity": "sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w==", + "dev": true + }, + "mime": { + "version": "2.4.6", + "resolved": "https://registry.npmjs.org/mime/-/mime-2.4.6.tgz", + "integrity": "sha512-RZKhC3EmpBchfTGBVb8fb+RL2cWyw/32lshnsETttkBAyAUXSGHxbEJWWRXc751DrIxG1q04b8QwMbAwkRPpUA==" + }, + "minimatch": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", + "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", + "dev": true, + "requires": { + "brace-expansion": "^1.1.7" + } + }, + "mri": { + "version": "1.1.6", + "resolved": "https://registry.npmjs.org/mri/-/mri-1.1.6.tgz", + "integrity": "sha512-oi1b3MfbyGa7FJMP9GmLTttni5JoICpYBRlq+x5V16fZbLsnL9N3wFqqIm/nIG43FjUFkFh9Epzp/kzUGUnJxQ==" + }, + "normalize-path": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", + "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==", + "dev": true + }, + "once": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", + "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", + "dev": true, + "requires": { + "wrappy": "1" + } + }, + "opts": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/opts/-/opts-2.0.2.tgz", + "integrity": "sha512-k41FwbcLnlgnFh69f4qdUfvDQ+5vaSDnVPFI/y5XuhKRq97EnVVneO9F1ESVCdiVu4fCS2L8usX3mU331hB7pg==", + "dev": true + }, + "path-is-absolute": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", + "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=", + "dev": true + }, + "path-parse": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.6.tgz", + "integrity": "sha512-GSmOT2EbHrINBf9SR7CDELwlJ8AENk3Qn7OikK4nFYAu3Ote2+JYNVvkpAEQm3/TLNEJFD/xZJjzyxg3KBWOzw==", + "dev": true + }, + "picomatch": { + "version": "2.2.2", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.2.2.tgz", + "integrity": "sha512-q0M/9eZHzmr0AulXyPwNfZjtwZ/RBZlbN3K3CErVrk50T2ASYI7Bye0EvekFY3IP1Nt2DHu0re+V2ZHIpMkuWg==", + "dev": true + }, + "randombytes": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/randombytes/-/randombytes-2.1.0.tgz", + "integrity": "sha512-vYl3iOX+4CKUWuxGi9Ukhie6fsqXqS9FE2Zaic4tNFD2N2QQaXOMFbuKK4QmDHC0JO6B1Zp41J0LpT0oR68amQ==", + "dev": true, + "requires": { + "safe-buffer": "^5.1.0" + } + }, + "readdirp": { + "version": "3.5.0", + "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.5.0.tgz", + "integrity": "sha512-cMhu7c/8rdhkHXWsY+osBhfSy0JikwpHK/5+imo+LpeasTF8ouErHrlYkwT0++njiyuDvc7OFY5T3ukvZ8qmFQ==", + "dev": true, + "requires": { + "picomatch": "^2.2.1" + } + }, + "require-relative": { + "version": "0.8.7", + "resolved": "https://registry.npmjs.org/require-relative/-/require-relative-0.8.7.tgz", + "integrity": "sha1-eZlTn8ngR6N5KPoZb44VY9q9Nt4=", + "dev": true + }, + "resolve": { + "version": "1.18.1", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.18.1.tgz", + "integrity": "sha512-lDfCPaMKfOJXjy0dPayzPdF1phampNWr3qFCjAu+rw/qbQmr5jWH5xN2hwh9QKfw9E5v4hwV7A+jrCmL8yjjqA==", + "dev": true, + "requires": { + "is-core-module": "^2.0.0", + "path-parse": "^1.0.6" + } + }, + "rollup": { + "version": "2.33.1", + "resolved": "https://registry.npmjs.org/rollup/-/rollup-2.33.1.tgz", + "integrity": "sha512-uY4O/IoL9oNW8MMcbA5hcOaz6tZTMIh7qJHx/tzIJm+n1wLoY38BLn6fuy7DhR57oNFLMbDQtDeJoFURt5933w==", + "dev": true, + "requires": { + "fsevents": "~2.1.2" + } + }, + "rollup-plugin-livereload": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/rollup-plugin-livereload/-/rollup-plugin-livereload-2.0.0.tgz", + "integrity": "sha512-oC/8NqumGYuphkqrfszOHUUIwzKsaHBICw6QRwT5uD07gvePTS+HW+GFwu6f9K8W02CUuTvtIM9AWJrbj4wE1A==", + "dev": true, + "requires": { + "livereload": "^0.9.1" + } + }, + "rollup-plugin-svelte": { + "version": "6.1.1", + "resolved": "https://registry.npmjs.org/rollup-plugin-svelte/-/rollup-plugin-svelte-6.1.1.tgz", + "integrity": "sha512-ijnm0pH1ScrY4uxwaNXBpNVejVzpL2769hIEbAlnqNUWZrffLspu5/k9/l/Wsj3NrEHLQ6wCKGagVJonyfN7ow==", + "dev": true, + "requires": { + "require-relative": "^0.8.7", + "rollup-pluginutils": "^2.8.2", + "sourcemap-codec": "^1.4.8" + } + }, + "rollup-plugin-terser": { + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/rollup-plugin-terser/-/rollup-plugin-terser-7.0.2.tgz", + "integrity": "sha512-w3iIaU4OxcF52UUXiZNsNeuXIMDvFrr+ZXK6bFZ0Q60qyVfq4uLptoS4bbq3paG3x216eQllFZX7zt6TIImguQ==", + "dev": true, + "requires": { + "@babel/code-frame": "^7.10.4", + "jest-worker": "^26.2.1", + "serialize-javascript": "^4.0.0", + "terser": "^5.0.0" + } + }, + "rollup-pluginutils": { + "version": "2.8.2", + "resolved": "https://registry.npmjs.org/rollup-pluginutils/-/rollup-pluginutils-2.8.2.tgz", + "integrity": "sha512-EEp9NhnUkwY8aif6bxgovPHMoMoNr2FulJziTndpt5H9RdwC47GSGuII9XxpSdzVGM0GWrNPHV6ie1LTNJPaLQ==", + "dev": true, + "requires": { + "estree-walker": "^0.6.1" + }, + "dependencies": { + "estree-walker": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-0.6.1.tgz", + "integrity": "sha512-SqmZANLWS0mnatqbSfRP5g8OXZC12Fgg1IwNtLsyHDzJizORW4khDfjPqJZsemPWBB2uqykUah5YpQ6epsqC/w==", + "dev": true + } + } + }, + "sade": { + "version": "1.7.4", + "resolved": "https://registry.npmjs.org/sade/-/sade-1.7.4.tgz", + "integrity": "sha512-y5yauMD93rX840MwUJr7C1ysLFBgMspsdTo4UVrDg3fXDvtwOyIqykhVAAm6fk/3au77773itJStObgK+LKaiA==", + "requires": { + "mri": "^1.1.0" + } + }, + "safe-buffer": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", + "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", + "dev": true + }, + "semiver": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/semiver/-/semiver-1.1.0.tgz", + "integrity": "sha512-QNI2ChmuioGC1/xjyYwyZYADILWyW6AmS1UH6gDj/SFUUUS4MBAWs/7mxnkRPc/F4iHezDP+O8t0dO8WHiEOdg==" + }, + "serialize-javascript": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/serialize-javascript/-/serialize-javascript-4.0.0.tgz", + "integrity": "sha512-GaNA54380uFefWghODBWEGisLZFj00nS5ACs6yHa9nLqlLpVLO8ChDGeKRjZnV4Nh4n0Qi7nhYZD/9fCPzEqkw==", + "dev": true, + "requires": { + "randombytes": "^2.1.0" + } + }, + "sirv": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/sirv/-/sirv-1.0.7.tgz", + "integrity": "sha512-QMT2OTD3CTr8de9VByPmvSEeyt6k8/Cxg0J2kQJ5HNhIWfhFg9ypcIWWzez9rPWnGj+WtJ7AZD/MdT/vdilV/A==", + "requires": { + "@polka/url": "^1.0.0-next.9", + "mime": "^2.3.1", + "totalist": "^1.0.0" + } + }, + "sirv-cli": { + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/sirv-cli/-/sirv-cli-1.0.8.tgz", + "integrity": "sha512-bJI+kkzQvMKfAOfgLzv09kWsdymLm39LgKmGjacB19GHIAQLCvXXg8e8HzcofTjDZlA8zVv4dQjU9SWkNzkJhw==", + "requires": { + "console-clear": "^1.1.0", + "get-port": "^3.2.0", + "kleur": "^3.0.0", + "local-access": "^1.0.1", + "sade": "^1.6.0", + "semiver": "^1.0.0", + "sirv": "^1.0.7", + "tinydate": "^1.0.0" + } + }, + "source-map": { + "version": "0.7.3", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.7.3.tgz", + "integrity": "sha512-CkCj6giN3S+n9qrYiBTX5gystlENnRW5jZeNLHpe6aue+SrHcG5VYwujhW9s4dY31mEGsxBDrHR6oI69fTXsaQ==", + "dev": true + }, + "source-map-support": { + "version": "0.5.19", + "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.19.tgz", + "integrity": "sha512-Wonm7zOCIJzBGQdB+thsPar0kYuCIzYvxZwlBa87yi/Mdjv7Tip2cyVbLj5o0cFPN4EVkuTwb3GDDyUx2DGnGw==", + "dev": true, + "requires": { + "buffer-from": "^1.0.0", + "source-map": "^0.6.0" + }, + "dependencies": { + "source-map": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", + "dev": true + } + } + }, + "sourcemap-codec": { + "version": "1.4.8", + "resolved": "https://registry.npmjs.org/sourcemap-codec/-/sourcemap-codec-1.4.8.tgz", + "integrity": "sha512-9NykojV5Uih4lgo5So5dtw+f0JgJX30KCNI8gwhz2J9A15wD0Ml6tjHKwf6fTSa6fAdVBdZeNOs9eJ71qCk8vA==", + "dev": true + }, + "supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "requires": { + "has-flag": "^3.0.0" + } + }, + "svelte": { + "version": "3.29.6", + "resolved": "https://registry.npmjs.org/svelte/-/svelte-3.29.6.tgz", + "integrity": "sha512-VIQMHPPEg/d4BQTy+WX1hHi/0EzjwjgjBK+DF0kLFy5hBsDKHQemd7xrCO1Spz57sT0xUb/YgRwFoozQrK0cmQ==", + "dev": true + }, + "terser": { + "version": "5.3.8", + "resolved": "https://registry.npmjs.org/terser/-/terser-5.3.8.tgz", + "integrity": "sha512-zVotuHoIfnYjtlurOouTazciEfL7V38QMAOhGqpXDEg6yT13cF4+fEP9b0rrCEQTn+tT46uxgFsTZzhygk+CzQ==", + "dev": true, + "requires": { + "commander": "^2.20.0", + "source-map": "~0.7.2", + "source-map-support": "~0.5.19" + } + }, + "tinydate": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/tinydate/-/tinydate-1.3.0.tgz", + "integrity": "sha512-7cR8rLy2QhYHpsBDBVYnnWXm8uRTr38RoZakFSW7Bs7PzfMPNZthuMLkwqZv7MTu8lhQ91cOFYS5a7iFj2oR3w==" + }, + "to-regex-range": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", + "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", + "dev": true, + "requires": { + "is-number": "^7.0.0" + } + }, + "totalist": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/totalist/-/totalist-1.1.0.tgz", + "integrity": "sha512-gduQwd1rOdDMGxFG1gEvhV88Oirdo2p+KjoYFU7k2g+i7n6AFFbDQ5kMPUsW0pNbfQsB/cwXvT1i4Bue0s9g5g==" + }, + "wrappy": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", + "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=", + "dev": true + }, + "ws": { + "version": "6.2.1", + "resolved": "https://registry.npmjs.org/ws/-/ws-6.2.1.tgz", + "integrity": "sha512-GIyAXC2cB7LjvpgMt9EKS2ldqr0MTrORaleiOno6TweZ6r3TKtoFQWay/2PceJ3RuBasOHzXNn5Lrw1X0bEjqA==", + "dev": true, + "requires": { + "async-limiter": "~1.0.0" + } + } + } +} diff --git a/svelte/package.json b/svelte/package.json new file mode 100644 index 0000000..e9e9def --- /dev/null +++ b/svelte/package.json @@ -0,0 +1,21 @@ +{ + "name": "svelte-app", + "version": "1.0.0", + "scripts": { + "build": "rollup -c", + "dev": "rollup -c -w", + "start": "sirv public" + }, + "devDependencies": { + "@rollup/plugin-commonjs": "^14.0.0", + "@rollup/plugin-node-resolve": "^8.0.0", + "rollup": "^2.3.4", + "rollup-plugin-livereload": "^2.0.0", + "rollup-plugin-svelte": "^6.0.0", + "rollup-plugin-terser": "^7.0.0", + "svelte": "^3.0.0" + }, + "dependencies": { + "sirv-cli": "^1.0.0" + } +} diff --git a/svelte/rollup.config.js b/svelte/rollup.config.js new file mode 100644 index 0000000..a6afe24 --- /dev/null +++ b/svelte/rollup.config.js @@ -0,0 +1,83 @@ +import svelte from 'rollup-plugin-svelte'; +import resolve from '@rollup/plugin-node-resolve'; +import commonjs from '@rollup/plugin-commonjs'; +import livereload from 'rollup-plugin-livereload'; +import { terser } from 'rollup-plugin-terser'; + +const production = !process.env.ROLLUP_WATCH; + +function serve() { + let server; + + function toExit() { + if (server) server.kill(0); + } + + return { + writeBundle() { + if (server) return; + server = require('child_process').spawn('npm', ['run', 'start', '--', '--dev'], { + stdio: ['ignore', 'inherit', 'inherit'], + shell: true + }); + + process.on('SIGTERM', toExit); + process.on('exit', toExit); + } + }; +} + +const builddir = "../res/static/svelte" +export default [ + "filesystem", + "modal", +].map((name, index) => ({ + input: `src/${name}.js`, + output: { + sourcemap: true, + format: 'iife', + name: 'app', + // file: `public/build/${name}.js` + file: `${builddir}/${name}.js` + }, + plugins: [ + svelte({ + // enable run-time checks when not in production + dev: !production, + // we'll extract any component CSS out into + // a separate file - better for performance + css: css => { + css.write(`${name}.css`); + } + }), + + // If you have external dependencies installed from + // npm, you'll most likely need these plugins. In + // some cases you'll need additional configuration - + // consult the documentation for details: + // https://github.com/rollup/plugins/tree/master/packages/commonjs + resolve({ + browser: true, + dedupe: ['svelte'] + }), + commonjs(), + + // In dev mode, call `npm run start` once + // the bundle has been generated + // !production && serve(), + + // Watch the `public` directory and refresh the + // browser on changes when not in production + !production && livereload({ + watch: `${builddir}/${name}.*`, + port: 5000 + index, + }), + + // If we're building for production (npm run build + // instead of npm run dev), minify + production && terser() + ], + watch: { + clearScreen: false + } +})); diff --git a/svelte/src/filesystem.js b/svelte/src/filesystem.js new file mode 100644 index 0000000..ab36c43 --- /dev/null +++ b/svelte/src/filesystem.js @@ -0,0 +1,8 @@ +import App from './filesystem/Filesystem.svelte'; + +const app = new App({ + target: document.body, + props: {} +}); + +export default app; diff --git a/svelte/src/filesystem/Filesystem.svelte b/svelte/src/filesystem/Filesystem.svelte new file mode 100644 index 0000000..7756688 --- /dev/null +++ b/svelte/src/filesystem/Filesystem.svelte @@ -0,0 +1,322 @@ + + + + +
+
+ + home +
+
+ {#if currentNode.parents.length > 0} + {currentNode.parents[currentNode.parents.length-1].path} + {/if} + /{currentNode.base.name} +
+
+
+
+
+
+
Views
+
{formatThousands(file.views)}
+
Downloads
+
{formatThousands(file.downloads)}
+
Size
+
{formatDataVolume(file.size)}
+ + + + + + + +
+ + +
+ {#if loading} +
+ +
+ {:else if viewer_type === "dir"} + {navigate(e.detail)}}> + {/if} +
+
+ + + + + + + + + + + + + {#if currentNode.base.type === "file"} + + + {/if} + + + + + +

Node details

Name{currentNode.base.name}
Path{currentNode.base.path}
Type{currentNode.base.type}
Date created{formatDate(currentNode.base.date_created, true, true, true)}
Date modified{formatDate(currentNode.base.date_modified, true, true, true)}
File type{currentNode.base.file_type}
File size{formatDataVolume(currentNode.base.file_size)}

Bucket details

ID{currentNode.bucket.id}
Name{currentNode.bucket.name}
Date created{formatDate(currentNode.bucket.date_created, true, true, true)}
Date modified{formatDate(currentNode.bucket.date_modified, true, true, true)}
+
+
+ + diff --git a/svelte/src/filesystem/Sharebar.svelte b/svelte/src/filesystem/Sharebar.svelte new file mode 100644 index 0000000..1516a7f --- /dev/null +++ b/svelte/src/filesystem/Sharebar.svelte @@ -0,0 +1,45 @@ + + +
+ Share on:
+ + + + + +
+ + diff --git a/svelte/src/filesystem/Toolbar.svelte b/svelte/src/filesystem/Toolbar.svelte new file mode 100644 index 0000000..9b4508c --- /dev/null +++ b/svelte/src/filesystem/Toolbar.svelte @@ -0,0 +1,112 @@ + + +
+
Views
+
{formatThousands(file.views)}
+
Downloads
+
{formatThousands(file.downloads)}
+
Size
+
{formatDataVolume(file.size)}
+ + + + + + + + +
+ + diff --git a/svelte/src/filesystem/viewers/Directory.svelte b/svelte/src/filesystem/viewers/Directory.svelte new file mode 100644 index 0000000..100280e --- /dev/null +++ b/svelte/src/filesystem/viewers/Directory.svelte @@ -0,0 +1,127 @@ + + +
+
+ +
+
+
+ {#if Array.isArray(node.base.children)} + {#each node.base.children as child} +
+ icon +
{child.name}
+
+ {/each} + {/if} +
+
+ + diff --git a/svelte/src/modal.js b/svelte/src/modal.js new file mode 100644 index 0000000..8df591e --- /dev/null +++ b/svelte/src/modal.js @@ -0,0 +1,10 @@ +import App from './modal/App.svelte'; + +const app = new App({ + target: document.body, + props: { + name: 'world' + } +}); + +export default app; diff --git a/svelte/src/modal/App.svelte b/svelte/src/modal/App.svelte new file mode 100644 index 0000000..2253be3 --- /dev/null +++ b/svelte/src/modal/App.svelte @@ -0,0 +1,45 @@ + + + + +
+ + + logo + + +
    +
  1. of or relating to modality in logic
  2. +
  3. containing provisions as to the mode of procedure or the manner of taking effect —used of a contract or legacy
  4. +
  5. of or relating to a musical mode
  6. +
  7. of or relating to structure as opposed to substance
  8. +
  9. +
  10. of, relating to, or constituting a grammatical form or category characteristically indicating predication
  11. +
  12. of or relating to a statistical mode
  13. +
+ + merriam-webster.com +
+ + +
    +
  1. of or relating to modality in logic
  2. +
  3. containing provisions as to the mode of procedure or the manner of taking effect —used of a contract or legacy
  4. +
  5. of or relating to a musical mode
  6. +
  7. of or relating to structure as opposed to substance
  8. +
  9. of, relating to, or constituting a grammatical form or category characteristically indicating predication
  10. +
  11. of or relating to a statistical mode
  12. +
+ + merriam-webster.com +
+ + +
diff --git a/svelte/src/util/Formatting.svelte b/svelte/src/util/Formatting.svelte new file mode 100644 index 0000000..18552ac --- /dev/null +++ b/svelte/src/util/Formatting.svelte @@ -0,0 +1,61 @@ + diff --git a/svelte/src/util/Modal.svelte b/svelte/src/util/Modal.svelte new file mode 100644 index 0000000..275701a --- /dev/null +++ b/svelte/src/util/Modal.svelte @@ -0,0 +1,117 @@ + + + + + +{#if visible} +
+ +
+{/if} + + diff --git a/svelte/src/util/Spinner.svelte b/svelte/src/util/Spinner.svelte new file mode 100644 index 0000000..055f473 --- /dev/null +++ b/svelte/src/util/Spinner.svelte @@ -0,0 +1,39 @@ + + + + + + + diff --git a/webcontroller/filesystem.go b/webcontroller/filesystem.go index 661a49c..41d3c68 100644 --- a/webcontroller/filesystem.go +++ b/webcontroller/filesystem.go @@ -1,6 +1,7 @@ package webcontroller import ( + "fmt" "net/http" "sort" "strings" @@ -12,6 +13,7 @@ import ( type filesystemPath struct { Path []filesystemNode + Base filesystemNode Children []filesystemNode } @@ -84,15 +86,18 @@ func (wc *WebController) serveFilesystem(w http.ResponseWriter, r *http.Request, return } - if node.Path[node.NodeIndex].Type == "file" { + if node.Base.Type == "file" { http.Redirect(w, r, "/api/filesystem/"+path, http.StatusSeeOther) return } - for _, v := range node.Path { + for _, v := range node.Parents { fsPath.Path = append(fsPath.Path, convFilesystemNode(node.Bucket.ID, v)) } - for _, v := range node.Children { + + fsPath.Base = convFilesystemNode(node.Bucket.ID, node.Base) + + for _, v := range node.Base.Children { fsPath.Children = append(fsPath.Children, convFilesystemNode(node.Bucket.ID, v)) } } @@ -114,3 +119,31 @@ func (wc *WebController) serveFilesystem(w http.ResponseWriter, r *http.Request, log.Error("Error executing template filesystem: %s", err) } } + +func (wc *WebController) serveDirectory(w http.ResponseWriter, r *http.Request, p httprouter.Params) { + var err error + var td = wc.newTemplateData(w, r) + var path = strings.TrimPrefix(p.ByName("path"), "/") + + node, err := td.PixelAPI.GetFilesystemPath(path) + if err != nil { + if err.Error() == "not_found" || err.Error() == "path_not_found" { + wc.templates.Get().ExecuteTemplate(w, "404", td) + } else { + log.Error("Failed to get path: %s", err) + wc.templates.Get().ExecuteTemplate(w, "500", td) + } + return + } + + if node.Base.Type == "bucket" { + td.Title = fmt.Sprintf("%s ~ pixeldrain", node.Base.Name) + } else { + td.Title = fmt.Sprintf("%s in %s ~ pixeldrain", node.Base.Name, node.Bucket.Name) + } + td.Other = node + err = wc.templates.Get().ExecuteTemplate(w, "filesystem_svelte", td) + if err != nil && !strings.Contains(err.Error(), "broken pipe") { + log.Error("Error executing template filesystem: %s", err) + } +} diff --git a/webcontroller/web_controller.go b/webcontroller/web_controller.go index 7776649..31b6272 100644 --- a/webcontroller/web_controller.go +++ b/webcontroller/web_controller.go @@ -141,6 +141,7 @@ func New( // Filesystem {GET, "fs/*path", wc.serveFilesystem}, + {GET, "d/*path", wc.serveDirectory}, {GET, "patreon_activate" /* */, wc.serveForm(wc.patreonLinkForm, true)}, {PST, "patreon_activate" /* */, wc.serveForm(wc.patreonLinkForm, true)},