var app = (function () { 'use strict'; var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {}; function unwrapExports (x) { return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x; } function createCommonjsModule(fn, module) { return module = { exports: {} }, fn(module, module.exports), module.exports; } var internal = createCommonjsModule(function (module, exports) { Object.defineProperty(exports, '__esModule', { value: true }); function noop() {} const identity = x => x; function assign(tar, src) { for (const k in src) tar[k] = src[k]; return tar; } function is_promise(value) { return value && typeof value.then === 'function'; } 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 not_equal(a, b) { return a != a ? b == b : a !== b; } function validate_store(store, name) { if (!store || typeof store.subscribe !== 'function') { throw new Error(`'${name}' is not a store with a 'subscribe' method`); } } function subscribe(component, store, callback) { const unsub = store.subscribe(callback); component.$$.on_destroy.push(unsub.unsubscribe ? () => unsub.unsubscribe() : unsub); } function create_slot(definition, ctx, fn) { if (definition) { const slot_ctx = get_slot_context(definition, ctx, fn); return definition[0](slot_ctx); } } function get_slot_context(definition, ctx, fn) { return definition[1] ? assign({}, assign(ctx.$$scope.ctx, definition[1](fn ? fn(ctx) : {}))) : ctx.$$scope.ctx; } function get_slot_changes(definition, ctx, changed, fn) { return definition[1] ? assign({}, assign(ctx.$$scope.changed || {}, definition[1](fn ? fn(changed) : {}))) : ctx.$$scope.changed || {}; } function exclude_internal_props(props) { const result = {}; for (const k in props) if (k[0] !== '$') result[k] = props[k]; return result; } const tasks = new Set(); let running = false; function run_tasks() { tasks.forEach(task => { if (!task[0](window.performance.now())) { tasks.delete(task); task[1](); } }); running = tasks.size > 0; if (running) requestAnimationFrame(run_tasks); } function clear_loops() { // for testing... tasks.forEach(task => tasks.delete(task)); running = false; } function loop(fn) { let task; if (!running) { running = true; requestAnimationFrame(run_tasks); } return { promise: new Promise(fulfil => { tasks.add(task = [fn, fulfil]); }), 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 detach_between(before, after) { while (before.nextSibling && before.nextSibling !== after) { before.parentNode.removeChild(before.nextSibling); } } function detach_before(after) { while (after.previousSibling) { after.parentNode.removeChild(after.previousSibling); } } function detach_after(before) { while (before.nextSibling) { before.parentNode.removeChild(before.nextSibling); } } 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 object_without_properties(obj, exclude) { const target = {}; for (const k in obj) { if (Object.prototype.hasOwnProperty.call(obj, k) && exclude.indexOf(k) === -1) { target[k] = obj[k]; } } return target; } 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 prevent_default(fn) { return function(event) { event.preventDefault(); return fn.call(this, event); }; } function stop_propagation(fn) { return function(event) { event.stopPropagation(); return fn.call(this, event); }; } function attr(node, attribute, value) { if (value == null) node.removeAttribute(attribute); else node.setAttribute(attribute, value); } function set_attributes(node, attributes) { for (const key in attributes) { if (key === 'style') { node.style.cssText = attributes[key]; } else if (key in node) { node[key] = attributes[key]; } else { attr(node, key, attributes[key]); } } } function set_custom_element_data(node, prop, value) { if (prop in node) { node[prop] = value; } else { attr(node, prop, value); } } function xlink_attr(node, attribute, value) { node.setAttributeNS('http://www.w3.org/1999/xlink', attribute, value); } function get_binding_group_value(group) { const value = []; for (let i = 0; i < group.length; i += 1) { if (group[i].checked) value.push(group[i].__value); } return value; } function to_number(value) { return value === '' ? undefined : +value; } function time_ranges_to_array(ranges) { const array = []; for (let i = 0; i < ranges.length; i += 1) { array.push({ start: ranges.start(i), end: ranges.end(i) }); } return array; } function children(element) { return Array.from(element.childNodes); } function claim_element(nodes, name, attributes, svg) { for (let i = 0; i < nodes.length; i += 1) { const node = nodes[i]; if (node.nodeName === name) { for (let j = 0; j < node.attributes.length; j += 1) { const attribute = node.attributes[j]; if (!attributes[attribute.name]) node.removeAttribute(attribute.name); } return nodes.splice(i, 1)[0]; // TODO strip unwanted attributes } } return svg ? svg_element(name) : element(name); } function claim_text(nodes, data) { for (let i = 0; i < nodes.length; i += 1) { const node = nodes[i]; if (node.nodeType === 3) { node.data = data; return nodes.splice(i, 1)[0]; } } return text(data); } function set_data(text, data) { data = '' + data; if (text.data !== data) text.data = data; } function set_input_type(input, type) { try { input.type = type; } catch (e) { // do nothing } } function set_style(node, key, value) { node.style.setProperty(key, value); } function select_option(select, value) { for (let i = 0; i < select.options.length; i += 1) { const option = select.options[i]; if (option.__value === value) { option.selected = true; return; } } } function select_options(select, value) { for (let i = 0; i < select.options.length; i += 1) { const option = select.options[i]; option.selected = ~value.indexOf(option.__value); } } function select_value(select) { const selected_option = select.querySelector(':checked') || select.options[0]; return selected_option && selected_option.__value; } function select_multiple_value(select) { return [].map.call(select.querySelectorAll(':checked'), option => option.__value); } function add_resize_listener(element, fn) { if (getComputedStyle(element).position === 'static') { element.style.position = 'relative'; } const object = document.createElement('object'); object.setAttribute('style', 'display: block; position: absolute; top: 0; left: 0; height: 100%; width: 100%; overflow: hidden; pointer-events: none; z-index: -1;'); object.type = 'text/html'; let win; object.onload = () => { win = object.contentDocument.defaultView; win.addEventListener('resize', fn); }; if (/Trident/.test(navigator.userAgent)) { element.appendChild(object); object.data = 'about:blank'; } else { object.data = 'about:blank'; element.appendChild(object); } return { cancel: () => { win && win.removeEventListener && win.removeEventListener('resize', fn); element.removeChild(object); } }; } function toggle_class(element, name, toggle) { element.classList[toggle ? 'add' : 'remove'](name); } function custom_event(type, detail) { const e = document.createEvent('CustomEvent'); e.initCustomEvent(type, false, false, detail); return e; } let stylesheet; let active = 0; let current_rules = {}; // 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}`; if (!current_rules[name]) { if (!stylesheet) { const style = element('style'); document.head.appendChild(style); stylesheet = style.sheet; } 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) { node.style.animation = (node.style.animation || '') .split(', ') .filter(name ? anim => anim.indexOf(name) < 0 // remove specific animation : anim => anim.indexOf('__svelte') === -1 // remove all Svelte animations ) .join(', '); if (name && !--active) clear_rules(); } function clear_rules() { requestAnimationFrame(() => { if (active) return; let i = stylesheet.cssRules.length; while (i--) stylesheet.deleteRule(i); current_rules = {}; }); } function create_animation(node, from, fn, params) { if (!from) return noop; const to = node.getBoundingClientRect(); if (from.left === to.left && from.right === to.right && from.top === to.top && from.bottom === to.bottom) return noop; const { delay = 0, duration = 300, easing = identity, start: start_time = window.performance.now() + delay, end = start_time + duration, tick = noop, css } = fn(node, { from, to }, params); let running = true; let started = false; let name; const css_text = node.style.cssText; function start() { if (css) { if (delay) node.style.cssText = css_text; // TODO create delayed animation instead? name = create_rule(node, 0, 1, duration, 0, easing, css); } started = true; } function stop() { if (css) delete_rule(node, name); running = false; } loop(now => { if (!started && now >= start_time) { start(); } if (started && now >= end) { tick(1, 0); stop(); } if (!running) { return false; } if (started) { const p = now - start_time; const t = 0 + 1 * easing(p / duration); tick(t, 1 - t); } return true; }); if (delay) { if (css) node.style.cssText += css(0, 1); } else { start(); } tick(0, 1); return stop; } function fix_position(node) { const style = getComputedStyle(node); if (style.position !== 'absolute' && style.position !== 'fixed') { const { width, height } = style; const a = node.getBoundingClientRect(); node.style.position = 'absolute'; node.style.width = width; node.style.height = height; const b = node.getBoundingClientRect(); if (a.left !== b.left || a.top !== b.top) { const style = getComputedStyle(node); const transform = style.transform === 'none' ? '' : style.transform; node.style.transform = `${transform} translate(${a.left - b.left}px, ${a.top - b.top}px)`; } } } function set_current_component(component) { exports.current_component = component; } function get_current_component() { if (!exports.current_component) throw new Error(`Function called outside component initialization`); return exports.current_component; } function beforeUpdate(fn) { get_current_component().$$.before_render.push(fn); } function onMount(fn) { get_current_component().$$.on_mount.push(fn); } function afterUpdate(fn) { get_current_component().$$.after_render.push(fn); } function onDestroy(fn) { get_current_component().$$.on_destroy.push(fn); } function createEventDispatcher() { const component = exports.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); }); } }; } function setContext(key, context) { get_current_component().$$.context.set(key, context); } function getContext(key) { return get_current_component().$$.context.get(key); } // 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 intros = { enabled: false }; const resolved_promise = Promise.resolve(); let update_scheduled = false; const binding_callbacks = []; const render_callbacks = []; const flush_callbacks = []; function schedule_update() { if (!update_scheduled) { update_scheduled = true; resolved_promise.then(flush); } } function tick() { schedule_update(); return resolved_promise; } function add_binding_callback(fn) { binding_callbacks.push(fn); } function add_render_callback(fn) { render_callbacks.push(fn); } function add_flush_callback(fn) { flush_callbacks.push(fn); } function flush() { const seen_callbacks = new Set(); do { // first, call beforeUpdate functions // and update components while (dirty_components.length) { const component = dirty_components.shift(); set_current_component(component); update(component.$$); } while (binding_callbacks.length) binding_callbacks.shift()(); // then, once components are updated, call // afterUpdate functions. This may cause // subsequent updates... while (render_callbacks.length) { const callback = render_callbacks.pop(); if (!seen_callbacks.has(callback)) { callback(); // ...so guard against infinite loops seen_callbacks.add(callback); } } } while (dirty_components.length); while (flush_callbacks.length) { flush_callbacks.pop()(); } update_scheduled = false; } function update($$) { if ($$.fragment) { $$.update($$.dirty); run_all($$.before_render); $$.fragment.p($$.dirty, $$.ctx); $$.dirty = null; $$.after_render.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}`)); } let outros; function group_outros() { outros = { remaining: 0, callbacks: [] }; } function check_outros() { if (!outros.remaining) { run_all(outros.callbacks); } } function on_outro(callback) { outros.callbacks.push(callback); } function create_in_transition(node, fn, params) { let config = fn(node, params); let running = false; let animation_name; let task; let uid = 0; function cleanup() { if (animation_name) delete_rule(node, animation_name); } function go() { const { delay = 0, duration = 300, easing = identity, tick: tick$$1 = noop, css } = config; if (css) animation_name = create_rule(node, 0, 1, duration, delay, easing, css, uid++); tick$$1(0, 1); const start_time = window.performance.now() + delay; const end_time = start_time + duration; if (task) task.abort(); running = true; task = loop(now => { if (running) { if (now >= end_time) { tick$$1(1, 0); cleanup(); return running = false; } if (now >= start_time) { const t = easing((now - start_time) / duration); tick$$1(t, 1 - t); } } return running; }); } let started = false; return { start() { if (started) return; delete_rule(node); if (typeof config === 'function') { config = config(); wait().then(go); } else { go(); } }, invalidate() { started = false; }, end() { if (running) { cleanup(); running = false; } } }; } function create_out_transition(node, fn, params) { let config = fn(node, params); let running = true; let animation_name; const group = outros; group.remaining += 1; function go() { const { delay = 0, duration = 300, easing = identity, tick: tick$$1 = noop, css } = config; if (css) animation_name = create_rule(node, 1, 0, duration, delay, easing, css); const start_time = window.performance.now() + delay; const end_time = start_time + duration; loop(now => { if (running) { if (now >= end_time) { tick$$1(0, 1); if (!--group.remaining) { // this will result in `end()` being called, // so we don't need to clean up here run_all(group.callbacks); } return false; } if (now >= start_time) { const t = easing((now - start_time) / duration); tick$$1(1 - t, t); } } return running; }); } if (typeof config === 'function') { wait().then(() => { config = config(); go(); }); } else { go(); } return { end(reset) { if (reset && config.tick) { config.tick(1, 0); } if (running) { if (animation_name) delete_rule(node, animation_name); running = false; } } }; } 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: tick$$1 = noop, css } = config; const program = { start: window.performance.now() + delay, b }; if (!b) { program.group = outros; outros.remaining += 1; } if (running_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$$1(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$$1(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.remaining) run_all(running_program.group.callbacks); } } 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$$1(t, 1 - t); } } return !!(running_program || pending_program); }); } } return { run(b) { if (typeof config === 'function') { wait().then(() => { config = config(); go(b); }); } else { go(b); } }, end() { clear_animation(); running_program = pending_program = null; } }; } function handle_promise(promise, info) { const token = info.token = {}; function update(type, index, key, value) { if (info.token !== token) return; info.resolved = key && { [key]: value }; const child_ctx = assign(assign({}, info.ctx), info.resolved); const block = type && (info.current = type)(child_ctx); if (info.block) { if (info.blocks) { info.blocks.forEach((block, i) => { if (i !== index && block) { group_outros(); on_outro(() => { block.d(1); info.blocks[i] = null; }); block.o(1); check_outros(); } }); } else { info.block.d(1); } block.c(); if (block.i) block.i(1); block.m(info.mount(), info.anchor); flush(); } info.block = block; if (info.blocks) info.blocks[index] = block; } if (is_promise(promise)) { promise.then(value => { update(info.then, 1, info.value, value); }, error => { update(info.catch, 2, info.error, error); }); // if we previously had a then/catch block, destroy it if (info.current !== info.pending) { update(info.pending, 0); return true; } } else { if (info.current !== info.then) { update(info.then, 1, info.value, promise); return true; } info.resolved = { [info.value]: promise }; } } function destroy_block(block, lookup) { block.d(1); lookup.delete(block.key); } function outro_and_destroy_block(block, lookup) { on_outro(() => { destroy_block(block, lookup); }); block.o(1); } function fix_and_outro_and_destroy_block(block, lookup) { block.f(); outro_and_destroy_block(block, lookup); } function update_keyed_each(old_blocks, changed, get_key, dynamic, ctx, list, lookup, node, destroy, create_each_block, next, get_context) { let o = old_blocks.length; let n = list.length; let i = o; const old_indexes = {}; while (i--) old_indexes[old_blocks[i].key] = i; const new_blocks = []; const new_lookup = new Map(); const deltas = new Map(); i = n; while (i--) { const child_ctx = get_context(ctx, list, i); const key = get_key(child_ctx); let block = lookup.get(key); if (!block) { block = create_each_block(key, child_ctx); block.c(); } else if (dynamic) { block.p(changed, child_ctx); } new_lookup.set(key, new_blocks[i] = block); if (key in old_indexes) deltas.set(key, Math.abs(i - old_indexes[key])); } const will_move = new Set(); const did_move = new Set(); function insert(block) { if (block.i) block.i(1); block.m(node, next); lookup.set(block.key, block); next = block.first; n--; } while (o && n) { const new_block = new_blocks[n - 1]; const old_block = old_blocks[o - 1]; const new_key = new_block.key; const old_key = old_block.key; if (new_block === old_block) { // do nothing next = new_block.first; o--; n--; } else if (!new_lookup.has(old_key)) { // remove old block destroy(old_block, lookup); o--; } else if (!lookup.has(new_key) || will_move.has(new_key)) { insert(new_block); } else if (did_move.has(old_key)) { o--; } else if (deltas.get(new_key) > deltas.get(old_key)) { did_move.add(new_key); insert(new_block); } else { will_move.add(old_key); o--; } } while (o--) { const old_block = old_blocks[o]; if (!new_lookup.has(old_block.key)) destroy(old_block, lookup); } while (n) insert(new_blocks[n - 1]); return new_blocks; } function measure(blocks) { const rects = {}; let i = blocks.length; while (i--) rects[blocks[i].key] = blocks[i].node.getBoundingClientRect(); return rects; } function get_spread_update(levels, updates) { const update = {}; const to_null_out = {}; const accounted_for = { $$scope: 1 }; let i = levels.length; while (i--) { const o = levels[i]; const n = updates[i]; if (n) { for (const key in o) { if (!(key in n)) to_null_out[key] = 1; } for (const key in n) { if (!accounted_for[key]) { update[key] = n[key]; accounted_for[key] = 1; } } levels[i] = n; } else { for (const key in o) { accounted_for[key] = 1; } } } for (const key in to_null_out) { if (!(key in update)) update[key] = undefined; } return update; } const invalid_attribute_name_character = /[\s'">/=\u{FDD0}-\u{FDEF}\u{FFFE}\u{FFFF}\u{1FFFE}\u{1FFFF}\u{2FFFE}\u{2FFFF}\u{3FFFE}\u{3FFFF}\u{4FFFE}\u{4FFFF}\u{5FFFE}\u{5FFFF}\u{6FFFE}\u{6FFFF}\u{7FFFE}\u{7FFFF}\u{8FFFE}\u{8FFFF}\u{9FFFE}\u{9FFFF}\u{AFFFE}\u{AFFFF}\u{BFFFE}\u{BFFFF}\u{CFFFE}\u{CFFFF}\u{DFFFE}\u{DFFFF}\u{EFFFE}\u{EFFFF}\u{FFFFE}\u{FFFFF}\u{10FFFE}\u{10FFFF}]/u; // https://html.spec.whatwg.org/multipage/syntax.html#attributes-2 // https://infra.spec.whatwg.org/#noncharacter function spread(args) { const attributes = Object.assign({}, ...args); let str = ''; Object.keys(attributes).forEach(name => { if (invalid_attribute_name_character.test(name)) return; const value = attributes[name]; if (value === undefined) return; if (value === true) str += " " + name; const escaped = String(value) .replace(/"/g, '"') .replace(/'/g, '''); str += " " + name + "=" + JSON.stringify(escaped); }); return str; } const escaped = { '"': '"', "'": ''', '&': '&', '<': '<', '>': '>' }; function escape(html) { return String(html).replace(/["'&<>]/g, match => escaped[match]); } function each(items, fn) { let str = ''; for (let i = 0; i < items.length; i += 1) { str += fn(items[i], i); } return str; } const missing_component = { $$render: () => '' }; function validate_component(component, name) { if (!component || !component.$$render) { if (name === 'svelte:component') name += ' this={...}'; throw new Error(`<${name}> is not a valid SSR component. You may need to review your build config to ensure that dependencies are compiled, rather than imported as pre-compiled modules`); } return component; } function debug(file, line, column, values) { console.log(`{@debug} ${file ? file + ' ' : ''}(${line}:${column})`); // eslint-disable-line no-console console.log(values); // eslint-disable-line no-console return ''; } let on_destroy; function create_ssr_component(fn) { function $$render(result, props, bindings, slots) { const parent_component = exports.current_component; const $$ = { on_destroy, context: new Map(parent_component ? parent_component.$$.context : []), // these will be immediately discarded on_mount: [], before_render: [], after_render: [], callbacks: blank_object() }; set_current_component({ $$ }); const html = fn(result, props, bindings, slots); set_current_component(parent_component); return html; } return { render: (props = {}, options = {}) => { on_destroy = []; const result = { head: '', css: new Set() }; const html = $$render(result, props, {}, options); run_all(on_destroy); return { html, css: { code: Array.from(result.css).map(css => css.code).join('\n'), map: null // TODO }, head: result.head }; }, $$render }; } function get_store_value(store) { let value; store.subscribe(_ => value = _)(); return value; } function bind(component, name, callback) { if (component.$$.props.indexOf(name) === -1) return; component.$$.bound[name] = callback; callback(component.$$.ctx[name]); } function mount_component(component, target, anchor) { const { fragment, on_mount, on_destroy, after_render } = component.$$; fragment.m(target, anchor); // onMount happens after the initial afterUpdate. Because // afterUpdate callbacks happen in reverse order (inner first) // we schedule onMount callbacks before afterUpdate callbacks 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_render.forEach(add_render_callback); } function destroy(component, detaching) { if (component.$$) { run_all(component.$$.on_destroy); component.$$.fragment.d(detaching); // TODO null out other refs, including component.$$ (but need to // preserve final state?) component.$$.on_destroy = component.$$.fragment = null; component.$$.ctx = {}; } } function make_dirty(component, key) { if (!component.$$.dirty) { dirty_components.push(component); schedule_update(); component.$$.dirty = {}; } component.$$.dirty[key] = true; } function init(component, options, instance, create_fragment, not_equal$$1, prop_names) { const parent_component = exports.current_component; set_current_component(component); const props = options.props || {}; const $$ = component.$$ = { fragment: null, ctx: null, // state props: prop_names, update: noop, not_equal: not_equal$$1, bound: blank_object(), // lifecycle on_mount: [], on_destroy: [], before_render: [], after_render: [], context: new Map(parent_component ? parent_component.$$.context : []), // everything else callbacks: blank_object(), dirty: null }; let ready = false; $$.ctx = instance ? instance(component, props, (key, value) => { if ($$.ctx && not_equal$$1($$.ctx[key], $$.ctx[key] = value)) { if ($$.bound[key]) $$.bound[key](value); if (ready) make_dirty(component, key); } }) : props; $$.update(); ready = true; run_all($$.before_render); $$.fragment = create_fragment($$.ctx); if (options.target) { if (options.hydrate) { $$.fragment.l(children(options.target)); } else { $$.fragment.c(); } if (options.intro && component.$$.fragment.i) component.$$.fragment.i(); mount_component(component, options.target, options.anchor); flush(); } set_current_component(parent_component); } if (typeof HTMLElement !== 'undefined') { exports.SvelteElement = class extends HTMLElement { constructor() { super(); this.attachShadow({ mode: 'open' }); } connectedCallback() { for (const key in this.$$.slotted) { this.appendChild(this.$$.slotted[key]); } } attributeChangedCallback(attr$$1, oldValue, newValue) { this[attr$$1] = newValue; } $destroy() { destroy(this, true); this.$destroy = noop; } $on(type, callback) { // TODO should this delegate to addEventListener? 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() { // overridden by instance, if it has props } }; } class SvelteComponent { $destroy() { destroy(this, true); 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() { // overridden by instance, if it has props } } 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 }; } } exports.create_animation = create_animation; exports.fix_position = fix_position; exports.handle_promise = handle_promise; exports.append = append; exports.insert = insert; exports.detach = detach; exports.detach_between = detach_between; exports.detach_before = detach_before; exports.detach_after = detach_after; exports.destroy_each = destroy_each; exports.element = element; exports.object_without_properties = object_without_properties; exports.svg_element = svg_element; exports.text = text; exports.space = space; exports.empty = empty; exports.listen = listen; exports.prevent_default = prevent_default; exports.stop_propagation = stop_propagation; exports.attr = attr; exports.set_attributes = set_attributes; exports.set_custom_element_data = set_custom_element_data; exports.xlink_attr = xlink_attr; exports.get_binding_group_value = get_binding_group_value; exports.to_number = to_number; exports.time_ranges_to_array = time_ranges_to_array; exports.children = children; exports.claim_element = claim_element; exports.claim_text = claim_text; exports.set_data = set_data; exports.set_input_type = set_input_type; exports.set_style = set_style; exports.select_option = select_option; exports.select_options = select_options; exports.select_value = select_value; exports.select_multiple_value = select_multiple_value; exports.add_resize_listener = add_resize_listener; exports.toggle_class = toggle_class; exports.custom_event = custom_event; exports.destroy_block = destroy_block; exports.outro_and_destroy_block = outro_and_destroy_block; exports.fix_and_outro_and_destroy_block = fix_and_outro_and_destroy_block; exports.update_keyed_each = update_keyed_each; exports.measure = measure; exports.set_current_component = set_current_component; exports.beforeUpdate = beforeUpdate; exports.onMount = onMount; exports.afterUpdate = afterUpdate; exports.onDestroy = onDestroy; exports.createEventDispatcher = createEventDispatcher; exports.setContext = setContext; exports.getContext = getContext; exports.bubble = bubble; exports.clear_loops = clear_loops; exports.loop = loop; exports.dirty_components = dirty_components; exports.intros = intros; exports.schedule_update = schedule_update; exports.tick = tick; exports.add_binding_callback = add_binding_callback; exports.add_render_callback = add_render_callback; exports.add_flush_callback = add_flush_callback; exports.flush = flush; exports.get_spread_update = get_spread_update; exports.invalid_attribute_name_character = invalid_attribute_name_character; exports.spread = spread; exports.escaped = escaped; exports.escape = escape; exports.each = each; exports.missing_component = missing_component; exports.validate_component = validate_component; exports.debug = debug; exports.create_ssr_component = create_ssr_component; exports.get_store_value = get_store_value; exports.group_outros = group_outros; exports.check_outros = check_outros; exports.on_outro = on_outro; exports.create_in_transition = create_in_transition; exports.create_out_transition = create_out_transition; exports.create_bidirectional_transition = create_bidirectional_transition; exports.noop = noop; exports.identity = identity; exports.assign = assign; exports.is_promise = is_promise; exports.add_location = add_location; exports.run = run; exports.blank_object = blank_object; exports.run_all = run_all; exports.is_function = is_function; exports.safe_not_equal = safe_not_equal; exports.not_equal = not_equal; exports.validate_store = validate_store; exports.subscribe = subscribe; exports.create_slot = create_slot; exports.get_slot_context = get_slot_context; exports.get_slot_changes = get_slot_changes; exports.exclude_internal_props = exclude_internal_props; exports.bind = bind; exports.mount_component = mount_component; exports.init = init; exports.SvelteComponent = SvelteComponent; exports.SvelteComponentDev = SvelteComponentDev; }); unwrapExports(internal); var internal_1 = internal.current_component; var internal_2 = internal.SvelteElement; var internal_3 = internal.create_animation; var internal_4 = internal.fix_position; var internal_5 = internal.handle_promise; var internal_6 = internal.append; var internal_7 = internal.insert; var internal_8 = internal.detach; var internal_9 = internal.detach_between; var internal_10 = internal.detach_before; var internal_11 = internal.detach_after; var internal_12 = internal.destroy_each; var internal_13 = internal.element; var internal_14 = internal.object_without_properties; var internal_15 = internal.svg_element; var internal_16 = internal.text; var internal_17 = internal.space; var internal_18 = internal.empty; var internal_19 = internal.listen; var internal_20 = internal.prevent_default; var internal_21 = internal.stop_propagation; var internal_22 = internal.attr; var internal_23 = internal.set_attributes; var internal_24 = internal.set_custom_element_data; var internal_25 = internal.xlink_attr; var internal_26 = internal.get_binding_group_value; var internal_27 = internal.to_number; var internal_28 = internal.time_ranges_to_array; var internal_29 = internal.children; var internal_30 = internal.claim_element; var internal_31 = internal.claim_text; var internal_32 = internal.set_data; var internal_33 = internal.set_input_type; var internal_34 = internal.set_style; var internal_35 = internal.select_option; var internal_36 = internal.select_options; var internal_37 = internal.select_value; var internal_38 = internal.select_multiple_value; var internal_39 = internal.add_resize_listener; var internal_40 = internal.toggle_class; var internal_41 = internal.custom_event; var internal_42 = internal.destroy_block; var internal_43 = internal.outro_and_destroy_block; var internal_44 = internal.fix_and_outro_and_destroy_block; var internal_45 = internal.update_keyed_each; var internal_46 = internal.measure; var internal_47 = internal.set_current_component; var internal_48 = internal.beforeUpdate; var internal_49 = internal.onMount; var internal_50 = internal.afterUpdate; var internal_51 = internal.onDestroy; var internal_52 = internal.createEventDispatcher; var internal_53 = internal.setContext; var internal_54 = internal.getContext; var internal_55 = internal.bubble; var internal_56 = internal.clear_loops; var internal_57 = internal.loop; var internal_58 = internal.dirty_components; var internal_59 = internal.intros; var internal_60 = internal.schedule_update; var internal_61 = internal.tick; var internal_62 = internal.add_binding_callback; var internal_63 = internal.add_render_callback; var internal_64 = internal.add_flush_callback; var internal_65 = internal.flush; var internal_66 = internal.get_spread_update; var internal_67 = internal.invalid_attribute_name_character; var internal_68 = internal.spread; var internal_69 = internal.escaped; var internal_70 = internal.escape; var internal_71 = internal.each; var internal_72 = internal.missing_component; var internal_73 = internal.validate_component; var internal_74 = internal.debug; var internal_75 = internal.create_ssr_component; var internal_76 = internal.get_store_value; var internal_77 = internal.group_outros; var internal_78 = internal.check_outros; var internal_79 = internal.on_outro; var internal_80 = internal.create_in_transition; var internal_81 = internal.create_out_transition; var internal_82 = internal.create_bidirectional_transition; var internal_83 = internal.noop; var internal_84 = internal.identity; var internal_85 = internal.assign; var internal_86 = internal.is_promise; var internal_87 = internal.add_location; var internal_88 = internal.run; var internal_89 = internal.blank_object; var internal_90 = internal.run_all; var internal_91 = internal.is_function; var internal_92 = internal.safe_not_equal; var internal_93 = internal.not_equal; var internal_94 = internal.validate_store; var internal_95 = internal.subscribe; var internal_96 = internal.create_slot; var internal_97 = internal.get_slot_context; var internal_98 = internal.get_slot_changes; var internal_99 = internal.exclude_internal_props; var internal_100 = internal.bind; var internal_101 = internal.mount_component; var internal_102 = internal.init; var internal_103 = internal.SvelteComponent; var internal_104 = internal.SvelteComponentDev; /*! ***************************************************************************** Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABLITY OR NON-INFRINGEMENT. See the Apache Version 2.0 License for specific language governing permissions and limitations under the License. ***************************************************************************** */ function __awaiter(thisArg, _arguments, P, generator) { return new (P || (P = Promise))(function (resolve, reject) { function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); } step((generator = generator.apply(thisArg, _arguments || [])).next()); }); } function __generator(thisArg, body) { var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; function verb(n) { return function (v) { return step([n, v]); }; } function step(op) { if (f) throw new TypeError("Generator is already executing."); while (_) try { if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; if (y = 0, t) op = [op[0] & 2, t.value]; switch (op[0]) { case 0: case 1: t = op; break; case 4: _.label++; return { value: op[1], done: false }; case 5: _.label++; y = op[1]; op = [0]; continue; case 7: op = _.ops.pop(); _.trys.pop(); continue; default: if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } if (t[2]) _.ops.pop(); _.trys.pop(); continue; } op = body.call(thisArg, _); } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; } } function setCookie(cname, cvalue, exdate) { var expires = exdate ? ";expires=" + exdate : ""; document.cookie = cname + "=" + cvalue + expires; } function getCookie(cname) { var name = cname + "="; var dc = decodeURIComponent(document.cookie); var ca = dc.split(';'); for (var i = 0; i < ca.length; i++) { var c = ca[i]; while (c.charAt(0) == ' ') { c = c.substring(1); } if (c.indexOf(name) == 0) { return c.substring(name.length, c.length); } } return ""; } // const baseURL = "https://auth.stamm.me"; var baseURL = "http://localhost:3000"; function request(endpoint, parameters, method, body, authInParam) { if (parameters === void 0) { parameters = {}; } if (method === void 0) { method = "GET"; } if (authInParam === void 0) { authInParam = false; } return __awaiter(this, void 0, void 0, function () { var pairs, key, url; return __generator(this, function (_a) { pairs = []; if (authInParam) { parameters.login = getCookie("login"); parameters.special = getCookie("special"); } for (key in parameters) { pairs.push(key + "=" + parameters[key]); } url = endpoint; if (pairs.length > 0) { url += "?" + pairs.join("&"); } return [2 /*return*/, fetch(baseURL + url, { method: method, body: JSON.stringify(body), credentials: "same-origin", headers: { 'content-type': 'application/json' }, }).then(function (e) { if (e.status !== 200) throw new Error(e.statusText); return e.json(); }).then(function (data) { if (data.error) { if (data.additional && data.additional.auth) { var state = btoa(window.location.pathname + window.location.hash); // window.location.href = `/login?state=${state}&base64=true`; } return Promise.reject(new Error(data.error)); } return data; })]; }); }); } var b;if(!(b=t)){var w=Math,y={},B=y.p={},aa=function(){},C=B.A={extend:function(o){aa.prototype=this;var _=new aa;return o&&_.u(o),_.z=this,_},create:function(){var o=this.extend();return o.h.apply(o,arguments),o},h:function(){},u:function(o){for(var _ in o)o.hasOwnProperty(_)&&(this[_]=o[_]);o.hasOwnProperty("toString")&&(this.toString=o.toString);},e:function(){return this.z.extend(this)}},D=B.i=C.extend({h:function(o,_){o=this.d=o||[],this.c=void 0==_?4*o.length:_;},toString:function(o){return (o||ba).stringify(this)},concat:function(o){var _=this.d,Da=o.d,Ea=this.c,o=o.c;if(this.t(),Ea%4)for(var Fa=0;Fa>>2]|=(255&Da[Fa>>>2]>>>24-8*(Fa%4))<<24-8*((Ea+Fa)%4);else if(65535>>2]=Da[Fa>>>2];else _.push.apply(_,Da);return this.c+=o,this},t:function(){var o=this.d,_=this.c;o[_>>>2]&=4294967295<<32-8*(_%4),o.length=w.ceil(_/4);},e:function(){var o=C.e.call(this);return o.d=this.d.slice(0),o},random:function(o){for(var _=[],Da=0;Da>>2]>>>24-8*(Ea%4),Da.push((Fa>>>4).toString(16)),Da.push((15&Fa).toString(16));return Da.join("")},parse:function(o){for(var _=o.length,Da=[],Ea=0;Ea<_;Ea+=2)Da[Ea>>>3]|=parseInt(o.substr(Ea,2),16)<<24-4*(Ea%8);return D.create(Da,_/2)}},da=ca.M={stringify:function(o){for(var _=o.d,o=o.c,Da=[],Ea=0;Ea>>2]>>>24-8*(Ea%4)));return Da.join("")},parse:function(o){for(var _=o.length,Da=[],Ea=0;Ea<_;Ea++)Da[Ea>>>2]|=(255&o.charCodeAt(Ea))<<24-8*(Ea%4);return D.create(Da,_)}},ea=ca.N={stringify:function(o){try{return decodeURIComponent(escape(da.stringify(o)))}catch(_){throw Error("Malformed UTF-8 data")}},parse:function(o){return da.parse(unescape(encodeURIComponent(o)))}},ia=B.I=C.extend({reset:function(){this.g=D.create(),this.j=0;},l:function(o){"string"==typeof o&&(o=ea.parse(o)),this.g.concat(o),this.j+=o.c;},m:function(o){var _=this.g,Da=_.d,Ea=_.c,Fa=this.n,Ga=Ea/(4*Fa),Ga=o?w.ceil(Ga):w.max((0|Ga)-this.r,0),o=Ga*Fa,Ea=w.min(4*o,Ea);if(o){for(var Ha=0;HaAa;Aa++)$[Aa]=L();M=M.k=xa.extend({q:function(){this.f=ya.create([L(1779033703,4089235720),L(3144134277,2227873595),L(1013904242,4271175723),L(2773480762,1595750129),L(1359893119,2917565137),L(2600822924,725511199),L(528734635,4215389547),L(1541459225,327033209)]);},H:function(o,_){for(var qb,Da=this.f.d,Ea=Da[0],Fa=Da[1],Ga=Da[2],Ha=Da[3],Ia=Da[4],Ja=Da[5],Ka=Da[6],Da=Da[7],La=Ea.a,Ma=Ea.b,Na=Fa.a,Oa=Fa.b,Pa=Ga.a,Qa=Ga.b,Ra=Ha.a,Sa=Ha.b,Ta=Ia.a,Ua=Ia.b,Va=Ja.a,Wa=Ja.b,Xa=Ka.a,Ya=Ka.b,Za=Da.a,$a=Da.b,_a=La,ab=Ma,bb=Na,cb=Oa,db=Pa,eb=Qa,fb=Ra,gb=Sa,hb=Ta,ib=Ua,jb=Va,kb=Wa,lb=Xa,mb=Ya,nb=Za,ob=$a,pb=0;80>pb;pb++){if(qb=$[pb],16>pb)var rb=qb.a=0|o[_+2*pb],sb=qb.b=0|o[_+2*pb+1];else{var rb=$[pb-15],sb=rb.a,tb=rb.b,rb=(tb<<31|sb>>>1)^(tb<<24|sb>>>8)^sb>>>7,tb=(sb<<31|tb>>>1)^(sb<<24|tb>>>8)^(sb<<25|tb>>>7),ub=$[pb-2],sb=ub.a,vb=ub.b,ub=(vb<<13|sb>>>19)^(sb<<3|vb>>>29)^sb>>>6,vb=(sb<<13|vb>>>19)^(vb<<3|sb>>>29)^(sb<<26|vb>>>6),sb=$[pb-7],wb=sb.a,xb=$[pb-16],yb=xb.a,xb=xb.b,sb=tb+sb.b,rb=rb+wb+(sb>>>0>>0?1:0),sb=sb+vb,rb=rb+ub+(sb>>>0>>0?1:0),sb=sb+xb,rb=rb+yb+(sb>>>0>>0?1:0);qb.a=rb,qb.b=sb;}var wb=hb&jb^~hb&lb,xb=ib&kb^~ib&mb,qb=_a&bb^_a&db^bb&db,tb=(ab<<4|_a>>>28)^(_a<<30|ab>>>2)^(_a<<25|ab>>>7),ub=(_a<<4|ab>>>28)^(ab<<30|_a>>>2)^(ab<<25|_a>>>7),vb=za[pb],Ab=vb.a,Bb=vb.b,vb=ob+((hb<<18|ib>>>14)^(hb<<14|ib>>>18)^(ib<<23|hb>>>9)),yb=nb+((ib<<18|hb>>>14)^(ib<<14|hb>>>18)^(hb<<23|ib>>>9))+(vb>>>0>>0?1:0),vb=vb+xb,yb=yb+wb+(vb>>>0>>0?1:0),vb=vb+Bb,yb=yb+Ab+(vb>>>0>>0?1:0),vb=vb+sb,yb=yb+rb+(vb>>>0>>0?1:0),sb=ub+(ab&cb^ab&eb^cb&eb),qb=tb+qb+(sb>>>0>>0?1:0),nb=lb,ob=mb,lb=jb,mb=kb,jb=hb,kb=ib,ib=0|gb+vb,hb=0|fb+yb+(ib>>>0>>0?1:0),fb=db,gb=eb,db=bb,eb=cb,bb=_a,cb=ab,ab=0|vb+sb,_a=0|yb+qb+(ab>>>0>>0?1:0);}Ma=Ea.b=0|Ma+ab,Ea.a=0|La+_a+(Ma>>>0>>0?1:0),Oa=Fa.b=0|Oa+cb,Fa.a=0|Na+bb+(Oa>>>0>>0?1:0),Qa=Ga.b=0|Qa+eb,Ga.a=0|Pa+db+(Qa>>>0>>0?1:0),Sa=Ha.b=0|Sa+gb,Ha.a=0|Ra+fb+(Sa>>>0>>0?1:0),Ua=Ia.b=0|Ua+ib,Ia.a=0|Ta+hb+(Ua>>>0>>0?1:0),Wa=Ja.b=0|Wa+kb,Ja.a=0|Va+jb+(Wa>>>0>>0?1:0),Ya=Ka.b=0|Ya+mb,Ka.a=0|Xa+lb+(Ya>>>0>>0?1:0),$a=Da.b=0|$a+ob,Da.a=0|Za+nb+($a>>>0>>0?1:0);},G:function(){var o=this.g,_=o.d,Da=8*this.j,Ea=8*o.c;_[Ea>>>5]|=128<<24-Ea%32,_[(Ea+128>>>10<<5)+31]=Da,o.c=4*_.length,this.m(),this.f=this.f.v();},n:32}),t.k=xa.D(M),t.L=xa.F(M);function sha512 (o){return t.k(o)+""} var TFATypes; (function (TFATypes) { TFATypes[TFATypes["OTC"] = 0] = "OTC"; TFATypes[TFATypes["BACKUP_CODE"] = 1] = "BACKUP_CODE"; TFATypes[TFATypes["U2F"] = 2] = "U2F"; TFATypes[TFATypes["APP_ALLOW"] = 3] = "APP_ALLOW"; })(TFATypes || (TFATypes = {})); var Api = { // twofactor: [{ // id: "1", // name: "Backup Codes", // type: TFATypes.BACKUP_CODE // }, { // id: "2", // name: "YubiKey", // type: TFATypes.U2F // }, { // id: "3", // name: "Authenticator", // type: TFATypes.OTC // }] as TwoFactor[], getUsername: function () { return this.username || getCookie("username"); }, setUsername: function (username) { return __awaiter(this, void 0, void 0, function () { var _this = this; return __generator(this, function (_a) { return [2 /*return*/, request("/api/user/login", { type: "username", username: username }, "POST").then(function (res) { _this.salt = res.salt; _this.username = username; return { error: undefined }; })["catch"](function (err) { var error = err.message; return { error: error }; })]; }); }); }, setPassword: function (password) { return __awaiter(this, void 0, void 0, function () { var pw; var _this = this; return __generator(this, function (_a) { pw = sha512(this.salt + password); return [2 /*return*/, request("/api/user/login", { type: "password" }, "POST", { username: this.username, password: pw }).then(function (_a) { var login = _a.login, special = _a.special, tfa = _a.tfa; _this.login = login; _this.special = special; if (tfa && Array.isArray(tfa) && tfa.length > 0) _this.twofactor = tfa; else _this.twofactor = undefined; return { error: undefined }; })["catch"](function (err) { var error = err.message; return { error: error }; })]; }); }); }, gettok: function () { return { login: this.login.token, special: this.special.token }; }, sendBackup: function (id, code) { return __awaiter(this, void 0, void 0, function () { var _this = this; return __generator(this, function (_a) { return [2 /*return*/, request("/api/user/twofactor/backup", this.gettok(), "PUT", { code: code, id: id }).then(function (_a) { var login_exp = _a.login_exp, special_exp = _a.special_exp; _this.login.expires = login_exp; _this.special.expires = special_exp; return {}; })["catch"](function (err) { return ({ error: err.message }); })]; }); }); }, sendOTC: function (id, code) { return __awaiter(this, void 0, void 0, function () { var _this = this; return __generator(this, function (_a) { return [2 /*return*/, request("/api/user/twofactor/otc", this.gettok(), "PUT", { code: code, id: id }).then(function (_a) { var login_exp = _a.login_exp, special_exp = _a.special_exp; _this.login.expires = login_exp; _this.special.expires = special_exp; return {}; })["catch"](function (error) { return ({ error: error.message }); })]; }); }); }, finish: function () { return __awaiter(this, void 0, void 0, function () { var d, url, state, red, base64; return __generator(this, function (_a) { d = new Date(); d.setTime(d.getTime() + (30 * 24 * 60 * 60 * 1000)); //Keep the username 30 days setCookie("username", this.username, d.toUTCString()); setCookie("login", this.login.token, new Date(this.login.expires).toUTCString()); setCookie("special", this.special.token, new Date(this.special.expires).toUTCString()); url = new URL(window.location.href); state = url.searchParams.get("state"); red = "/"; if (state) { base64 = url.searchParams.get("base64"); if (base64) red = atob(state); else red = state; } window.location.href = red; return [2 /*return*/]; }); }); } }; /* src/Login/Credentials.svelte generated by Svelte v3.2.1 */ const file = "src/Login/Credentials.svelte"; // (66:0) {:else} function create_else_block(ctx) { var h3, t0, t1, t2, div1, input, t3, span0, t4, span1, t5, label, t7, div0, t8, div0_style_value, dispose; return { c: function create() { h3 = internal_13("h3"); t0 = internal_16("Enter password for "); t1 = internal_16(ctx.username); t2 = internal_17(); div1 = internal_13("div"); input = internal_13("input"); t3 = internal_17(); span0 = internal_13("span"); t4 = internal_17(); span1 = internal_13("span"); t5 = internal_17(); label = internal_13("label"); label.textContent = "Password"; t7 = internal_17(); div0 = internal_13("div"); t8 = internal_16(ctx.error); internal_87(h3, file, 66, 0, 1416); internal_22(input, "type", "password"); input.autocomplete = "password"; input.autofocus = true; internal_87(input, file, 68, 3, 1487); span0.className = "highlight"; internal_87(span0, file, 69, 3, 1570); span1.className = "bar"; internal_87(span1, file, 70, 3, 1605); internal_87(label, file, 71, 3, 1634); div0.className = "error svelte-m6rjik"; div0.style.cssText = div0_style_value = !ctx.error ? "display: none;" : ""; internal_87(div0, file, 72, 3, 1661); div1.className = "floating group"; internal_87(div1, file, 67, 0, 1455); dispose = internal_19(input, "input", ctx.input_input_handler_1); }, m: function mount(target, anchor) { internal_7(target, h3, anchor); internal_6(h3, t0); internal_6(h3, t1); internal_7(target, t2, anchor); internal_7(target, div1, anchor); internal_6(div1, input); input.value = ctx.password; internal_6(div1, t3); internal_6(div1, span0); internal_6(div1, t4); internal_6(div1, span1); internal_6(div1, t5); internal_6(div1, label); internal_6(div1, t7); internal_6(div1, div0); internal_6(div0, t8); input.focus(); }, p: function update(changed, ctx) { if (changed.username) { internal_32(t1, ctx.username); } if (changed.password) input.value = ctx.password; if (changed.error) { internal_32(t8, ctx.error); } if ((changed.error) && div0_style_value !== (div0_style_value = !ctx.error ? "display: none;" : "")) { div0.style.cssText = div0_style_value; } }, d: function destroy(detaching) { if (detaching) { internal_8(h3); internal_8(t2); internal_8(div1); } dispose(); } }; } // (57:0) {#if state === states.username} function create_if_block(ctx) { var h3, t1, div1, input, t2, span0, t3, span1, t4, label, t6, div0, t7, div0_style_value, dispose; return { c: function create() { h3 = internal_13("h3"); h3.textContent = "Enter your Username or your E-Mail Address"; t1 = internal_17(); div1 = internal_13("div"); input = internal_13("input"); t2 = internal_17(); span0 = internal_13("span"); t3 = internal_17(); span1 = internal_13("span"); t4 = internal_17(); label = internal_13("label"); label.textContent = "Username or E-Mail"; t6 = internal_17(); div0 = internal_13("div"); t7 = internal_16(ctx.error); internal_87(h3, file, 57, 0, 1064); internal_22(input, "type", "text"); input.autocomplete = "username"; input.autofocus = true; internal_87(input, file, 59, 3, 1148); span0.className = "highlight"; internal_87(span0, file, 60, 3, 1227); span1.className = "bar"; internal_87(span1, file, 61, 3, 1262); internal_87(label, file, 62, 3, 1291); div0.className = "error svelte-m6rjik"; div0.style.cssText = div0_style_value = !ctx.error ? "display: none;" : ""; internal_87(div0, file, 63, 3, 1328); div1.className = "floating group"; internal_87(div1, file, 58, 0, 1116); dispose = internal_19(input, "input", ctx.input_input_handler); }, m: function mount(target, anchor) { internal_7(target, h3, anchor); internal_7(target, t1, anchor); internal_7(target, div1, anchor); internal_6(div1, input); input.value = ctx.username; internal_6(div1, t2); internal_6(div1, span0); internal_6(div1, t3); internal_6(div1, span1); internal_6(div1, t4); internal_6(div1, label); internal_6(div1, t6); internal_6(div1, div0); internal_6(div0, t7); input.focus(); }, p: function update(changed, ctx) { if (changed.username && (input.value !== ctx.username)) input.value = ctx.username; if (changed.error) { internal_32(t7, ctx.error); } if ((changed.error) && div0_style_value !== (div0_style_value = !ctx.error ? "display: none;" : "")) { div0.style.cssText = div0_style_value; } }, d: function destroy(detaching) { if (detaching) { internal_8(h3); internal_8(t1); internal_8(div1); } dispose(); } }; } function create_fragment(ctx) { var t, button, dispose; function select_block_type(ctx) { if (ctx.state === ctx.states.username) return create_if_block; return create_else_block; } var current_block_type = select_block_type(ctx); var if_block = current_block_type(ctx); return { c: function create() { if_block.c(); t = internal_17(); button = internal_13("button"); button.textContent = "Next"; button.className = "btn svelte-m6rjik"; internal_87(button, file, 76, 0, 1748); dispose = internal_19(button, "click", ctx.buttonClick); }, 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_block.m(target, anchor); internal_7(target, t, anchor); internal_7(target, button, anchor); }, p: function update(changed, ctx) { if (current_block_type === (current_block_type = select_block_type(ctx)) && if_block) { if_block.p(changed, ctx); } else { if_block.d(1); if_block = current_block_type(ctx); if (if_block) { if_block.c(); if_block.m(t.parentNode, t); } } }, i: internal_83, o: internal_83, d: function destroy(detaching) { if_block.d(detaching); if (detaching) { internal_8(t); internal_8(button); } dispose(); } }; } function instance($$self, $$props, $$invalidate) { let error; let password = ""; let username = Api.getUsername(); const states = { username: 1, password: 2 }; let state = states.username; let { setLoading, next } = $$props; async function buttonClick() { setLoading(true); if (state === states.username) { let res = await Api.setUsername(username); if (res.error) { $$invalidate('error', error = res.error); } else { $$invalidate('state', state = states.password); $$invalidate('error', error = undefined); } } else if (state === states.password) { let res = await Api.setPassword(password); if (res.error) { $$invalidate('error', error = res.error); } else { $$invalidate('error', error = undefined); next(); } } setLoading(false); } function input_input_handler() { username = this.value; $$invalidate('username', username); } function input_input_handler_1() { password = this.value; $$invalidate('password', password); } $$self.$set = $$props => { if ('setLoading' in $$props) $$invalidate('setLoading', setLoading = $$props.setLoading); if ('next' in $$props) $$invalidate('next', next = $$props.next); }; return { error, password, username, states, state, setLoading, next, buttonClick, input_input_handler, input_input_handler_1 }; } class Credentials extends internal_104 { constructor(options) { super(options); internal_102(this, options, instance, create_fragment, internal_92, ["setLoading", "next"]); const { ctx } = this.$$; const props = options.props || {}; if (ctx.setLoading === undefined && !('setLoading' in props)) { console.warn(" was created without expected prop 'setLoading'"); } if (ctx.next === undefined && !('next' in props)) { console.warn(" was created without expected prop 'next'"); } } get setLoading() { throw new Error(": Props cannot be read directly from the component instance unless compiling with 'accessors: true' or ''"); } set setLoading(value) { throw new Error(": Props cannot be set directly on the component instance unless compiling with 'accessors: true' or ''"); } get next() { throw new Error(": Props cannot be read directly from the component instance unless compiling with 'accessors: true' or ''"); } set next(value) { throw new Error(": Props cannot be set directly on the component instance unless compiling with 'accessors: true' or ''"); } } var svelte = createCommonjsModule(function (module, exports) { Object.defineProperty(exports, '__esModule', { value: true }); exports.onMount = internal.onMount; exports.onDestroy = internal.onDestroy; exports.beforeUpdate = internal.beforeUpdate; exports.afterUpdate = internal.afterUpdate; exports.setContext = internal.setContext; exports.getContext = internal.getContext; exports.tick = internal.tick; exports.createEventDispatcher = internal.createEventDispatcher; }); unwrapExports(svelte); var svelte_1 = svelte.onMount; var svelte_2 = svelte.onDestroy; var svelte_3 = svelte.beforeUpdate; var svelte_4 = svelte.afterUpdate; var svelte_5 = svelte.setContext; var svelte_6 = svelte.getContext; var svelte_7 = svelte.tick; var svelte_8 = svelte.createEventDispatcher; /* src/Login/Redirect.svelte generated by Svelte v3.2.1 */ const file$1 = "src/Login/Redirect.svelte"; function create_fragment$1(ctx) { var div, svg, circle, path, t0, h3, t1; return { c: function create() { div = internal_13("div"); svg = internal_15("svg"); circle = internal_15("circle"); path = internal_15("path"); t0 = internal_17(); h3 = internal_13("h3"); t1 = internal_16(ctx.text); internal_22(circle, "class", "checkmark__circle svelte-zjta2c"); internal_22(circle, "cx", "26"); internal_22(circle, "cy", "26"); internal_22(circle, "r", "25"); internal_22(circle, "fill", "none"); internal_87(circle, file$1, 33, 6, 634); internal_22(path, "class", "checkmark__check svelte-zjta2c"); internal_22(path, "fill", "none"); internal_22(path, "d", "M14.1 27.2l7.1 7.2 16.7-16.8"); internal_87(path, file$1, 34, 6, 712); internal_22(svg, "class", "checkmark svelte-zjta2c"); internal_22(svg, "xmlns", "http://www.w3.org/2000/svg"); internal_22(svg, "viewBox", "0 0 52 52"); internal_87(svg, file$1, 32, 3, 549); div.className = "scale svelte-zjta2c"; internal_87(div, file$1, 31, 0, 526); internal_87(h3, file$1, 38, 0, 851); }, 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) { internal_7(target, div, anchor); internal_6(div, svg); internal_6(svg, circle); internal_6(svg, path); internal_7(target, t0, anchor); internal_7(target, h3, anchor); internal_6(h3, t1); }, p: function update(changed, ctx) { if (changed.text) { internal_32(t1, ctx.text); } }, i: internal_83, o: internal_83, d: function destroy(detaching) { if (detaching) { internal_8(div); internal_8(t0); internal_8(h3); } } }; } const basetext = "Logged in. Redirecting"; function instance$1($$self, $$props, $$invalidate) { let dots = 0; let iv; svelte_1(() => { console.log("Mounted"); $$invalidate('iv', iv = setInterval(() => { dots++; $$invalidate('dots', dots); if (dots > 3) $$invalidate('dots', dots = 0); }, 500)); }); svelte_2(() => { console.log("on Destroy"); clearInterval(iv); }); let text; $$self.$$.update = ($$dirty = { dots: 1 }) => { if ($$dirty.dots) { $$invalidate('text', text = basetext + ".".repeat(dots)); } }; return { text }; } class Redirect extends internal_104 { constructor(options) { super(options); internal_102(this, options, instance$1, create_fragment$1, internal_92, []); } } /* src/Login/icons/Icon.svelte generated by Svelte v3.2.1 */ const file$2 = "src/Login/icons/Icon.svelte"; // (13:0) {:else} function create_else_block$1(ctx) { var t; return { c: function create() { t = internal_16("ERR"); }, m: function mount(target, anchor) { internal_7(target, t, anchor); }, d: function destroy(detaching) { if (detaching) { internal_8(t); } } }; } // (11:34) function create_if_block_3(ctx) { var svg, path0, rect, path1, ellipse; return { c: function create() { svg = internal_15("svg"); path0 = internal_15("path"); rect = internal_15("rect"); path1 = internal_15("path"); ellipse = internal_15("ellipse"); internal_22(path0, "d", "M18.617,1.72c0,-0.949 -0.771,-1.72 -1.721,-1.72l-9.792,0c-0.95,0 -1.721,0.771 -1.721,1.72l0,20.56c0,0.949 0.771,1.72 1.721,1.72l9.792,0c0.95,0 1.721,-0.771 1.721,-1.72l0,-20.56Z"); internal_34(path0, "fill", "#4d4d4d"); internal_87(path0, file$2, 11, 294, 5677); internal_22(rect, "x", "6"); internal_22(rect, "y", "3"); internal_22(rect, "width", "12"); internal_22(rect, "height", "18"); internal_34(rect, "fill", "#b3b3b3"); internal_87(rect, file$2, 11, 505, 5888); internal_22(path1, "d", "M14,1.5c0,-0.129 -0.105,-0.233 -0.233,-0.233l-3.534,0c-0.128,0 -0.233,0.104 -0.233,0.233c0,0.129 0.105,0.233 0.233,0.233l3.534,0c0.128,0 0.233,-0.104 0.233,-0.233Z"); internal_34(path1, "fill", "#b3b3b3"); internal_87(path1, file$2, 11, 569, 5952); internal_22(ellipse, "cx", "12"); internal_22(ellipse, "cy", "22.5"); internal_22(ellipse, "rx", "0.983"); internal_22(ellipse, "ry", "1"); internal_34(ellipse, "fill", "#b3b3b3"); internal_87(ellipse, file$2, 11, 766, 6149); internal_22(svg, "width", "100%"); internal_22(svg, "height", "100%"); internal_22(svg, "viewBox", "0 0 24 24"); internal_22(svg, "version", "1.1"); internal_22(svg, "xmlns", "http://www.w3.org/2000/svg"); internal_22(svg, "xmlns:xlink", "http://www.w3.org/1999/xlink"); internal_22(svg, "xml:space", "preserve"); internal_22(svg, "xmlns:serif", "http://www.serif.com/"); internal_34(svg, "fill-rule", "evenodd"); internal_34(svg, "clip-rule", "evenodd"); internal_34(svg, "stroke-linejoin", "round"); internal_34(svg, "stroke-miterlimit", "1.41421"); internal_87(svg, file$2, 11, 0, 5383); }, m: function mount(target, anchor) { internal_7(target, svg, anchor); internal_6(svg, path0); internal_6(svg, rect); internal_6(svg, path1); internal_6(svg, ellipse); }, d: function destroy(detaching) { if (detaching) { internal_8(svg); } } }; } // (9:37) function create_if_block_2(ctx) { var svg, path0, circle, path1; return { c: function create() { svg = internal_15("svg"); path0 = internal_15("path"); circle = internal_15("circle"); path1 = internal_15("path"); internal_22(path0, "d", "M20.562,9.105c0,-0.853 -0.692,-1.544 -1.544,-1.544l-14.036,0c-0.852,0 -1.544,0.691 -1.544,1.544l0,12.351c0,0.852 0.692,1.544 1.544,1.544l14.036,0c0.852,0 1.544,-0.692 1.544,-1.544l0,-12.351Z"); internal_34(path0, "fill", "none"); internal_34(path0, "stroke", "#000"); internal_34(path0, "stroke-width", "1.5px"); internal_87(path0, file$2, 9, 311, 4883); internal_22(circle, "cx", "12"); internal_22(circle, "cy", "15.3"); internal_22(circle, "r", "1.5"); internal_87(circle, file$2, 9, 563, 5135); internal_22(path1, "d", "M16.646,4.28c0,-1.81 -1.47,-3.28 -3.28,-3.28l-2.732,0c-1.81,0 -3.28,1.47 -3.28,3.28l0,3.281l9.292,0l0,-3.281Z"); internal_34(path1, "fill", "none"); internal_34(path1, "stroke", "#000"); internal_34(path1, "stroke-width", "1.5px"); internal_87(path1, file$2, 9, 598, 5170); internal_22(svg, "width", "100%"); internal_22(svg, "height", "100%"); internal_22(svg, "viewBox", "0 0 24 24"); internal_22(svg, "version", "1.1"); internal_22(svg, "xmlns", "http://www.w3.org/2000/svg"); internal_22(svg, "xmlns:xlink", "http://www.w3.org/1999/xlink"); internal_22(svg, "xml:space", "preserve"); internal_22(svg, "xmlns:serif", "http://www.serif.com/"); internal_34(svg, "fill-rule", "evenodd"); internal_34(svg, "clip-rule", "evenodd"); internal_34(svg, "stroke-linecap", "round"); internal_34(svg, "stroke-linejoin", "round"); internal_34(svg, "stroke-miterlimit", "1.5"); internal_87(svg, file$2, 9, 0, 4572); }, m: function mount(target, anchor) { internal_7(target, svg, anchor); internal_6(svg, path0); internal_6(svg, circle); internal_6(svg, path1); }, d: function destroy(detaching) { if (detaching) { internal_8(svg); } } }; } // (7:40) function create_if_block_1(ctx) { var svg, g, path0, circle0, path1, circle1, circle2, circle3, path2, path3, path4, circle4, circle5, path5, path6, path7, path8, path9, path10, circle6, defs, linearGradient, stop0, stop1; return { c: function create() { svg = internal_15("svg"); g = internal_15("g"); path0 = internal_15("path"); circle0 = internal_15("circle"); path1 = internal_15("path"); circle1 = internal_15("circle"); circle2 = internal_15("circle"); circle3 = internal_15("circle"); path2 = internal_15("path"); path3 = internal_15("path"); path4 = internal_15("path"); circle4 = internal_15("circle"); circle5 = internal_15("circle"); path5 = internal_15("path"); path6 = internal_15("path"); path7 = internal_15("path"); path8 = internal_15("path"); path9 = internal_15("path"); path10 = internal_15("path"); circle6 = internal_15("circle"); defs = internal_15("defs"); linearGradient = internal_15("linearGradient"); stop0 = internal_15("stop"); stop1 = internal_15("stop"); internal_22(path0, "d", "M18.5,12c0,3.59 -2.91,6.5 -6.5,6.5c-3.59,0 -6.5,-2.91 -6.5,-6.5c0,-3.59 2.91,-6.5 6.5,-6.5c1.729,0 3.295,0.679 4.46,1.78l4.169,-3.599c-2.184,-2.265 -5.242,-3.681 -8.629,-3.681c-6.617,0 -12,5.383 -12,12c0,6.617 5.383,12 12,12c6.617,0 12,-5.383 12,-12l-5.5,0Z"); internal_34(path0, "fill", "#999"); internal_34(path0, "fill-rule", "nonzero"); internal_87(path0, file$2, 7, 297, 1300); internal_22(circle0, "id", "XMLID_1331_"); internal_22(circle0, "cx", "12"); internal_22(circle0, "cy", "12"); internal_22(circle0, "r", "12"); internal_34(circle0, "fill", "#808080"); internal_87(circle0, file$2, 7, 603, 1606); internal_22(path1, "d", "M19,12c0,3.866 -3.134,7 -7,7c-3.866,0 -7,-3.134 -7,-7c0,-3.866 3.134,-7 7,-7c1.88,0 3.583,0.745 4.841,1.951l3.788,-3.27c-2.184,-2.265 -5.242,-3.681 -8.629,-3.681c-6.617,0 -12,5.383 -12,12c0,6.617 5.383,12 12,12c6.617,0 12,-5.383 12,-12l-5,0Z"); internal_34(path1, "fill", "#999"); internal_34(path1, "fill-rule", "nonzero"); internal_87(path1, file$2, 7, 674, 1677); internal_22(circle1, "cx", "12"); internal_22(circle1, "cy", "2.5"); internal_22(circle1, "r", "1"); internal_34(circle1, "fill", "#b3b3b3"); internal_87(circle1, file$2, 7, 964, 1967); internal_22(circle2, "cx", "12"); internal_22(circle2, "cy", "21.5"); internal_22(circle2, "r", "1"); internal_34(circle2, "fill", "#b3b3b3"); internal_87(circle2, file$2, 7, 1018, 2021); internal_22(circle3, "cx", "2.5"); internal_22(circle3, "cy", "12"); internal_22(circle3, "r", "1"); internal_34(circle3, "fill", "#b3b3b3"); internal_87(circle3, file$2, 7, 1073, 2076); internal_22(path2, "d", "M4.575,18.01c0.391,-0.39 1.024,-0.39 1.415,0c0.39,0.391 0.39,1.024 0,1.415c-0.391,0.39 -1.024,0.39 -1.415,0c-0.39,-0.391 -0.39,-1.024 0,-1.415Z"); internal_34(path2, "fill", "#b3b3b3"); internal_87(path2, file$2, 7, 1127, 2130); internal_22(path3, "d", "M18.01,18.01c0.391,-0.39 1.024,-0.39 1.415,0c0.39,0.391 0.39,1.024 0,1.415c-0.391,0.39 -1.024,0.39 -1.415,0c-0.39,-0.391 -0.39,-1.024 0,-1.415Z"); internal_34(path3, "fill", "#b3b3b3"); internal_87(path3, file$2, 7, 1304, 2307); internal_22(path4, "d", "M4.575,4.575c0.391,-0.39 1.024,-0.39 1.415,0c0.39,0.391 0.39,1.024 0,1.415c-0.391,0.39 -1.024,0.39 -1.415,0c-0.39,-0.391 -0.39,-1.024 0,-1.415Z"); internal_34(path4, "fill", "#b3b3b3"); internal_87(path4, file$2, 7, 1481, 2484); internal_22(circle4, "id", "XMLID_1329_"); internal_22(circle4, "cx", "12"); internal_22(circle4, "cy", "12"); internal_22(circle4, "r", "6"); internal_34(circle4, "fill", "#808080"); internal_87(circle4, file$2, 7, 1658, 2661); internal_22(circle5, "id", "XMLID_1330_"); internal_22(circle5, "cx", "12"); internal_22(circle5, "cy", "12"); internal_22(circle5, "r", "7"); internal_34(circle5, "fill", "#808080"); internal_87(circle5, file$2, 7, 1728, 2731); internal_22(path5, "d", "M19,12.25c0,-0.042 -0.006,-0.083 -0.006,-0.125c-0.068,3.808 -3.17,6.875 -6.994,6.875c-3.824,0 -6.933,-3.067 -7,-6.875c-0.001,0.042 0,0.083 0,0.125c0,3.866 3.134,7 7,7c3.866,0 7,-3.134 7,-7Z"); internal_34(path5, "fill", "#fff"); internal_34(path5, "fill-opacity", "0.2"); internal_34(path5, "fill-rule", "nonzero"); internal_87(path5, file$2, 7, 1798, 2801); internal_22(path6, "d", "M18.92,13l-3.061,0c0.083,-0.321 0.141,-0.653 0.141,-1c0,-2.209 -1.791,-4 -4,-4c-2.209,0 -4,1.791 -4,4c0,1.105 0.448,2.105 1.172,2.828c1.014,1.015 4.057,4.058 4.057,4.058c2.955,-0.525 5.263,-2.899 5.691,-5.886Z"); internal_34(path6, "fill", "#4d4d4d"); internal_34(path6, "fill-rule", "nonzero"); internal_87(path6, file$2, 7, 2053, 3056); internal_22(path7, "d", "M22,13l-10,0c-0.553,0 -1,-0.448 -1,-1c0,-0.552 0.447,-1 1,-1l10,0c0.553,0 1,0.448 1,1c0,0.552 -0.447,1 -1,1Z"); internal_34(path7, "fill", "#b3b3b3"); internal_34(path7, "fill-rule", "nonzero"); internal_87(path7, file$2, 7, 2314, 3317); internal_22(path8, "d", "M11.948,11.25l10.104,0c0.409,0 0.776,0.247 0.935,0.592c-0.08,-0.471 -0.492,-0.842 -0.987,-0.842l-10,0c-0.495,0 -0.9,0.33 -0.98,0.801c0.159,-0.345 0.519,-0.551 0.928,-0.551Z"); internal_34(path8, "fill", "#fff"); internal_34(path8, "fill-opacity", "0.2"); internal_34(path8, "fill-rule", "nonzero"); internal_87(path8, file$2, 7, 2474, 3477); internal_22(path9, "d", "M23,12c0,0.552 -0.447,1 -1,1l-3.08,0c-0.428,2.988 -2.737,5.362 -5.693,5.886l3.935,3.946c4.04,-1.931 6.838,-6.056 6.838,-10.832l-1,0Z"); internal_34(path9, "fill", "#666"); internal_34(path9, "fill-opacity", "0.5"); internal_34(path9, "fill-rule", "nonzero"); internal_87(path9, file$2, 7, 2712, 3715); internal_22(path10, "d", "M12,5c-3.866,0 -7,3.134 -7,7c0,0.042 -0.001,0.069 0,0.111c0.067,-3.808 3.176,-6.861 7,-6.861c2.828,0 4.841,1.701 4.841,1.701c-1.257,-1.198 -2.968,-1.951 -4.841,-1.951Z"); internal_34(path10, "fill-opacity", "0.1"); internal_34(path10, "fill-rule", "nonzero"); internal_87(path10, file$2, 7, 2910, 3913); internal_22(circle6, "id", "XMLID_4_"); internal_22(circle6, "cx", "12"); internal_22(circle6, "cy", "12"); internal_22(circle6, "r", "12"); internal_34(circle6, "fill", "url(#_Linear1)"); internal_87(circle6, file$2, 7, 3133, 4136); internal_87(g, file$2, 7, 294, 1297); internal_22(stop0, "offset", "0"); internal_34(stop0, "stop-color", "#fff"); internal_34(stop0, "stop-opacity", "0.2"); internal_87(stop0, file$2, 7, 3384, 4387); internal_22(stop1, "offset", "1"); internal_34(stop1, "stop-color", "#fff"); internal_34(stop1, "stop-opacity", "0"); internal_87(stop1, file$2, 7, 3443, 4446); internal_22(linearGradient, "id", "_Linear1"); internal_22(linearGradient, "x1", "0"); internal_22(linearGradient, "y1", "0"); internal_22(linearGradient, "x2", "1"); internal_22(linearGradient, "y2", "0"); internal_22(linearGradient, "gradientUnits", "userSpaceOnUse"); internal_22(linearGradient, "gradientTransform", "matrix(21.7566,10.1453,-10.1453,21.7566,1.12171,6.92737)"); internal_87(linearGradient, file$2, 7, 3218, 4221); internal_87(defs, file$2, 7, 3212, 4215); internal_22(svg, "width", "100%"); internal_22(svg, "height", "100%"); internal_22(svg, "viewBox", "0 0 24 24"); internal_22(svg, "version", "1.1"); internal_22(svg, "xmlns", "http://www.w3.org/2000/svg"); internal_22(svg, "xmlns:xlink", "http://www.w3.org/1999/xlink"); internal_22(svg, "xml:space", "preserve"); internal_22(svg, "xmlns:serif", "http://www.serif.com/"); internal_34(svg, "fill-rule", "evenodd"); internal_34(svg, "clip-rule", "evenodd"); internal_34(svg, "stroke-linejoin", "round"); internal_34(svg, "stroke-miterlimit", "1.41421"); internal_87(svg, file$2, 7, 0, 1003); }, m: function mount(target, anchor) { internal_7(target, svg, anchor); internal_6(svg, g); internal_6(g, path0); internal_6(g, circle0); internal_6(g, path1); internal_6(g, circle1); internal_6(g, circle2); internal_6(g, circle3); internal_6(g, path2); internal_6(g, path3); internal_6(g, path4); internal_6(g, circle4); internal_6(g, circle5); internal_6(g, path5); internal_6(g, path6); internal_6(g, path7); internal_6(g, path8); internal_6(g, path9); internal_6(g, path10); internal_6(g, circle6); internal_6(svg, defs); internal_6(defs, linearGradient); internal_6(linearGradient, stop0); internal_6(linearGradient, stop1); }, d: function destroy(detaching) { if (detaching) { internal_8(svg); } } }; } // (5:0) {#if icon_name === "SecurityKey"} function create_if_block$1(ctx) { var svg, path, rect0, rect1, rect2, rect3, rect4; return { c: function create() { svg = internal_15("svg"); path = internal_15("path"); rect0 = internal_15("rect"); rect1 = internal_15("rect"); rect2 = internal_15("rect"); rect3 = internal_15("rect"); rect4 = internal_15("rect"); internal_22(path, "d", "M18,7.692c0,-0.925 -0.751,-1.675 -1.675,-1.675l-14.65,0c-0.924,0 -1.675,0.75 -1.675,1.675l0,8.616c0,0.925 0.751,1.675 1.675,1.675l14.65,0c0.924,0 1.675,-0.75 1.675,-1.675l0,-8.616Z"); internal_34(path, "fill", "#4d4d4d"); internal_87(path, file$2, 5, 294, 373); internal_22(rect0, "x", "18"); internal_22(rect0, "y", "8.011"); internal_22(rect0, "width", "6"); internal_22(rect0, "height", "7.978"); internal_34(rect0, "fill", "#4d4d4d"); internal_87(rect0, file$2, 5, 508, 587); internal_22(rect1, "x", "18"); internal_22(rect1, "y", "10.644"); internal_22(rect1, "width", "4.8"); internal_22(rect1, "height", "1.231"); internal_34(rect1, "fill", "#b3b3b3"); internal_87(rect1, file$2, 5, 579, 658); internal_22(rect2, "x", "18"); internal_22(rect2, "y", "12.229"); internal_22(rect2, "width", "4.8"); internal_22(rect2, "height", "1.164"); internal_34(rect2, "fill", "#b3b3b3"); internal_87(rect2, file$2, 5, 653, 732); internal_22(rect3, "x", "18"); internal_22(rect3, "y", "9.008"); internal_22(rect3, "width", "5.25"); internal_22(rect3, "height", "1.231"); internal_34(rect3, "fill", "#b3b3b3"); internal_87(rect3, file$2, 5, 727, 806); internal_22(rect4, "x", "18"); internal_22(rect4, "y", "13.794"); internal_22(rect4, "width", "5.25"); internal_22(rect4, "height", "1.197"); internal_34(rect4, "fill", "#b3b3b3"); internal_87(rect4, file$2, 5, 801, 880); internal_22(svg, "width", "100%"); internal_22(svg, "height", "100%"); internal_22(svg, "viewBox", "0 0 24 24"); internal_22(svg, "version", "1.1"); internal_22(svg, "xmlns", "http://www.w3.org/2000/svg"); internal_22(svg, "xmlns:xlink", "http://www.w3.org/1999/xlink"); internal_22(svg, "xml:space", "preserve"); internal_22(svg, "xmlns:serif", "http://www.serif.com/"); internal_34(svg, "fill-rule", "evenodd"); internal_34(svg, "clip-rule", "evenodd"); internal_34(svg, "stroke-linejoin", "round"); internal_34(svg, "stroke-miterlimit", "1.41421"); internal_87(svg, file$2, 5, 0, 79); }, m: function mount(target, anchor) { internal_7(target, svg, anchor); internal_6(svg, path); internal_6(svg, rect0); internal_6(svg, rect1); internal_6(svg, rect2); internal_6(svg, rect3); internal_6(svg, rect4); }, d: function destroy(detaching) { if (detaching) { internal_8(svg); } } }; } function create_fragment$2(ctx) { var if_block_anchor; function select_block_type(ctx) { if (ctx.icon_name === "SecurityKey") return create_if_block$1; if (ctx.icon_name === "Authenticator") return create_if_block_1; if (ctx.icon_name === "BackupCode") return create_if_block_2; if (ctx.icon_name === "AppPush") return create_if_block_3; return create_else_block$1; } var current_block_type = select_block_type(ctx); var if_block = current_block_type(ctx); return { c: function create() { if_block.c(); if_block_anchor = internal_18(); }, 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_block.m(target, anchor); internal_7(target, if_block_anchor, anchor); }, p: function update(changed, ctx) { if (current_block_type !== (current_block_type = select_block_type(ctx))) { if_block.d(1); if_block = current_block_type(ctx); if (if_block) { if_block.c(); if_block.m(if_block_anchor.parentNode, if_block_anchor); } } }, i: internal_83, o: internal_83, d: function destroy(detaching) { if_block.d(detaching); if (detaching) { internal_8(if_block_anchor); } } }; } function instance$2($$self, $$props, $$invalidate) { let { icon_name } = $$props; $$self.$set = $$props => { if ('icon_name' in $$props) $$invalidate('icon_name', icon_name = $$props.icon_name); }; return { icon_name }; } class Icon extends internal_104 { constructor(options) { super(options); internal_102(this, options, instance$2, create_fragment$2, internal_92, ["icon_name"]); const { ctx } = this.$$; const props = options.props || {}; if (ctx.icon_name === undefined && !('icon_name' in props)) { console.warn(" was created without expected prop 'icon_name'"); } } get icon_name() { throw new Error(": Props cannot be read directly from the component instance unless compiling with 'accessors: true' or ''"); } set icon_name(value) { throw new Error(": Props cannot be set directly on the component instance unless compiling with 'accessors: true' or ''"); } } /* src/Login/twofactors/toList.svelte generated by Svelte v3.2.1 */ const file$3 = "src/Login/twofactors/toList.svelte"; function create_fragment$3(ctx) { var p, a, dispose; return { c: function create() { p = internal_13("p"); a = internal_13("a"); a.textContent = "Choose another Method"; a.href = "# "; a.className = "svelte-ieslp9"; internal_87(a, file$3, 11, 3, 147); internal_87(p, file$3, 10, 0, 140); dispose = internal_19(a, "click", ctx.click_handler); }, 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) { internal_7(target, p, anchor); internal_6(p, a); }, p: internal_83, i: internal_83, o: internal_83, d: function destroy(detaching) { if (detaching) { internal_8(p); } dispose(); } }; } function instance$3($$self, $$props, $$invalidate) { let { finish = () => {} } = $$props; function click_handler(evt) { return evt.preventDefault() || finish(false); } $$self.$set = $$props => { if ('finish' in $$props) $$invalidate('finish', finish = $$props.finish); }; return { finish, click_handler }; } class ToList extends internal_104 { constructor(options) { super(options); internal_102(this, options, instance$3, create_fragment$3, internal_92, ["finish"]); } get finish() { throw new Error(": Props cannot be read directly from the component instance unless compiling with 'accessors: true' or ''"); } set finish(value) { throw new Error(": Props cannot be set directly on the component instance unless compiling with 'accessors: true' or ''"); } } var cleave = createCommonjsModule(function (module, exports) { (function webpackUniversalModuleDefinition(root, factory) { module.exports = factory(); })(commonjsGlobal, function () { return /******/ (function (modules) { // webpackBootstrap /******/ // The module cache /******/ var installedModules = {}; /******/ // The require function /******/ function __webpack_require__(moduleId) { /******/ // Check if module is in cache /******/ if (installedModules[moduleId]) /******/ return installedModules[moduleId].exports; /******/ // Create a new module (and put it into the cache) /******/ var module = installedModules[moduleId] = { /******/ exports: {}, /******/ id: moduleId, /******/ loaded: false /******/ }; /******/ // Execute the module function /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); /******/ // Flag the module as loaded /******/ module.loaded = true; /******/ // Return the exports of the module /******/ return module.exports; /******/ } /******/ // expose the modules object (__webpack_modules__) /******/ __webpack_require__.m = modules; /******/ // expose the module cache /******/ __webpack_require__.c = installedModules; /******/ // __webpack_public_path__ /******/ __webpack_require__.p = ""; /******/ // Load entry module and return exports /******/ return __webpack_require__(0); /******/ }) /************************************************************************/ /******/([ /* 0 */ /***/ (function (module, exports, __webpack_require__) { /* WEBPACK VAR INJECTION */(function (global) { /** * Construct a new Cleave instance by passing the configuration object * * @param {String | HTMLElement} element * @param {Object} opts */ var Cleave = function (element, opts) { var owner = this; var hasMultipleElements = false; if (typeof element === 'string') { owner.element = document.querySelector(element); hasMultipleElements = document.querySelectorAll(element).length > 1; } else { if (typeof element.length !== 'undefined' && element.length > 0) { owner.element = element[0]; hasMultipleElements = element.length > 1; } else { owner.element = element; } } if (!owner.element) { throw new Error('[cleave.js] Please check the element'); } if (hasMultipleElements) { try { // eslint-disable-next-line console.warn('[cleave.js] Multiple input fields matched, cleave.js will only take the first one.'); } catch (e) { // Old IE } } opts.initValue = owner.element.value; owner.properties = Cleave.DefaultProperties.assign({}, opts); owner.init(); }; Cleave.prototype = { init: function () { var owner = this, pps = owner.properties; // no need to use this lib if (!pps.numeral && !pps.phone && !pps.creditCard && !pps.time && !pps.date && (pps.blocksLength === 0 && !pps.prefix)) { owner.onInput(pps.initValue); return; } pps.maxLength = Cleave.Util.getMaxLength(pps.blocks); owner.isAndroid = Cleave.Util.isAndroid(); owner.lastInputValue = ''; owner.onChangeListener = owner.onChange.bind(owner); owner.onKeyDownListener = owner.onKeyDown.bind(owner); owner.onFocusListener = owner.onFocus.bind(owner); owner.onCutListener = owner.onCut.bind(owner); owner.onCopyListener = owner.onCopy.bind(owner); owner.element.addEventListener('input', owner.onChangeListener); owner.element.addEventListener('keydown', owner.onKeyDownListener); owner.element.addEventListener('focus', owner.onFocusListener); owner.element.addEventListener('cut', owner.onCutListener); owner.element.addEventListener('copy', owner.onCopyListener); owner.initPhoneFormatter(); owner.initDateFormatter(); owner.initTimeFormatter(); owner.initNumeralFormatter(); // avoid touch input field if value is null // otherwise Firefox will add red box-shadow for if (pps.initValue || (pps.prefix && !pps.noImmediatePrefix)) { owner.onInput(pps.initValue); } }, initNumeralFormatter: function () { var owner = this, pps = owner.properties; if (!pps.numeral) { return; } pps.numeralFormatter = new Cleave.NumeralFormatter( pps.numeralDecimalMark, pps.numeralIntegerScale, pps.numeralDecimalScale, pps.numeralThousandsGroupStyle, pps.numeralPositiveOnly, pps.stripLeadingZeroes, pps.delimiter ); }, initTimeFormatter: function () { var owner = this, pps = owner.properties; if (!pps.time) { return; } pps.timeFormatter = new Cleave.TimeFormatter(pps.timePattern, pps.timeFormat); pps.blocks = pps.timeFormatter.getBlocks(); pps.blocksLength = pps.blocks.length; pps.maxLength = Cleave.Util.getMaxLength(pps.blocks); }, initDateFormatter: function () { var owner = this, pps = owner.properties; if (!pps.date) { return; } pps.dateFormatter = new Cleave.DateFormatter(pps.datePattern); pps.blocks = pps.dateFormatter.getBlocks(); pps.blocksLength = pps.blocks.length; pps.maxLength = Cleave.Util.getMaxLength(pps.blocks); }, initPhoneFormatter: function () { var owner = this, pps = owner.properties; if (!pps.phone) { return; } // Cleave.AsYouTypeFormatter should be provided by // external google closure lib try { pps.phoneFormatter = new Cleave.PhoneFormatter( new pps.root.Cleave.AsYouTypeFormatter(pps.phoneRegionCode), pps.delimiter ); } catch (ex) { throw new Error('[cleave.js] Please include phone-type-formatter.{country}.js lib'); } }, onKeyDown: function (event) { var owner = this, pps = owner.properties, charCode = event.which || event.keyCode, Util = Cleave.Util, currentValue = owner.element.value; // if we got any charCode === 8, this means, that this device correctly // sends backspace keys in event, so we do not need to apply any hacks owner.hasBackspaceSupport = owner.hasBackspaceSupport || charCode === 8; if (!owner.hasBackspaceSupport && Util.isAndroidBackspaceKeydown(owner.lastInputValue, currentValue) ) { charCode = 8; } owner.lastInputValue = currentValue; // hit backspace when last character is delimiter var postDelimiter = Util.getPostDelimiter(currentValue, pps.delimiter, pps.delimiters); if (charCode === 8 && postDelimiter) { pps.postDelimiterBackspace = postDelimiter; } else { pps.postDelimiterBackspace = false; } }, onChange: function () { this.onInput(this.element.value); }, onFocus: function () { var owner = this, pps = owner.properties; Cleave.Util.fixPrefixCursor(owner.element, pps.prefix, pps.delimiter, pps.delimiters); }, onCut: function (e) { this.copyClipboardData(e); this.onInput(''); }, onCopy: function (e) { this.copyClipboardData(e); }, copyClipboardData: function (e) { var owner = this, pps = owner.properties, Util = Cleave.Util, inputValue = owner.element.value, textToCopy = ''; if (!pps.copyDelimiter) { textToCopy = Util.stripDelimiters(inputValue, pps.delimiter, pps.delimiters); } else { textToCopy = inputValue; } try { if (e.clipboardData) { e.clipboardData.setData('Text', textToCopy); } else { window.clipboardData.setData('Text', textToCopy); } e.preventDefault(); } catch (ex) { // empty } }, onInput: function (value) { var owner = this, pps = owner.properties, Util = Cleave.Util; // case 1: delete one more character "4" // 1234*| -> hit backspace -> 123| // case 2: last character is not delimiter which is: // 12|34* -> hit backspace -> 1|34* // note: no need to apply this for numeral mode var postDelimiterAfter = Util.getPostDelimiter(value, pps.delimiter, pps.delimiters); if (!pps.numeral && pps.postDelimiterBackspace && !postDelimiterAfter) { value = Util.headStr(value, value.length - pps.postDelimiterBackspace.length); } // phone formatter if (pps.phone) { if (pps.prefix && (!pps.noImmediatePrefix || value.length)) { pps.result = pps.prefix + pps.phoneFormatter.format(value).slice(pps.prefix.length); } else { pps.result = pps.phoneFormatter.format(value); } owner.updateValueState(); return; } // numeral formatter if (pps.numeral) { if (pps.prefix && (!pps.noImmediatePrefix || value.length)) { pps.result = pps.prefix + pps.numeralFormatter.format(value); } else { pps.result = pps.numeralFormatter.format(value); } owner.updateValueState(); return; } // date if (pps.date) { value = pps.dateFormatter.getValidatedDate(value); } // time if (pps.time) { value = pps.timeFormatter.getValidatedTime(value); } // strip delimiters value = Util.stripDelimiters(value, pps.delimiter, pps.delimiters); // strip prefix // var strippedPreviousResult = Util.stripDelimiters(pps.result, pps.delimiter, pps.delimiters); value = Util.getPrefixStrippedValue(value, pps.prefix, pps.prefixLength, pps.result, pps.delimiter, pps.delimiters); // strip non-numeric characters value = pps.numericOnly ? Util.strip(value, /[^\d]/g) : value; // convert case value = pps.uppercase ? value.toUpperCase() : value; value = pps.lowercase ? value.toLowerCase() : value; // prefix if (pps.prefix && (!pps.noImmediatePrefix || value.length)) { value = pps.prefix + value; // no blocks specified, no need to do formatting if (pps.blocksLength === 0) { pps.result = value; owner.updateValueState(); return; } } // update credit card props if (pps.creditCard) { owner.updateCreditCardPropsByValue(value); } // strip over length characters value = Util.headStr(value, pps.maxLength); // apply blocks pps.result = Util.getFormattedValue( value, pps.blocks, pps.blocksLength, pps.delimiter, pps.delimiters, pps.delimiterLazyShow ); owner.updateValueState(); }, updateCreditCardPropsByValue: function (value) { var owner = this, pps = owner.properties, Util = Cleave.Util, creditCardInfo; // At least one of the first 4 characters has changed if (Util.headStr(pps.result, 4) === Util.headStr(value, 4)) { return; } creditCardInfo = Cleave.CreditCardDetector.getInfo(value, pps.creditCardStrictMode); pps.blocks = creditCardInfo.blocks; pps.blocksLength = pps.blocks.length; pps.maxLength = Util.getMaxLength(pps.blocks); // credit card type changed if (pps.creditCardType !== creditCardInfo.type) { pps.creditCardType = creditCardInfo.type; pps.onCreditCardTypeChanged.call(owner, pps.creditCardType); } }, updateValueState: function () { var owner = this, Util = Cleave.Util, pps = owner.properties; if (!owner.element) { return; } var endPos = owner.element.selectionEnd; var oldValue = owner.element.value; var newValue = pps.result; endPos = Util.getNextCursorPosition(endPos, oldValue, newValue, pps.delimiter, pps.delimiters); // fix Android browser type="text" input field // cursor not jumping issue if (owner.isAndroid) { window.setTimeout(function () { owner.element.value = newValue; Util.setSelection(owner.element, endPos, pps.document, false); owner.callOnValueChanged(); }, 1); return; } owner.element.value = newValue; Util.setSelection(owner.element, endPos, pps.document, false); owner.callOnValueChanged(); }, callOnValueChanged: function () { var owner = this, pps = owner.properties; pps.onValueChanged.call(owner, { target: { value: pps.result, rawValue: owner.getRawValue() } }); }, setPhoneRegionCode: function (phoneRegionCode) { var owner = this, pps = owner.properties; pps.phoneRegionCode = phoneRegionCode; owner.initPhoneFormatter(); owner.onChange(); }, setRawValue: function (value) { var owner = this, pps = owner.properties; value = value !== undefined && value !== null ? value.toString() : ''; if (pps.numeral) { value = value.replace('.', pps.numeralDecimalMark); } pps.postDelimiterBackspace = false; owner.element.value = value; owner.onInput(value); }, getRawValue: function () { var owner = this, pps = owner.properties, Util = Cleave.Util, rawValue = owner.element.value; if (pps.rawValueTrimPrefix) { rawValue = Util.getPrefixStrippedValue(rawValue, pps.prefix, pps.prefixLength, pps.result, pps.delimiter, pps.delimiters); } if (pps.numeral) { rawValue = pps.numeralFormatter.getRawValue(rawValue); } else { rawValue = Util.stripDelimiters(rawValue, pps.delimiter, pps.delimiters); } return rawValue; }, getISOFormatDate: function () { var owner = this, pps = owner.properties; return pps.date ? pps.dateFormatter.getISOFormatDate() : ''; }, getISOFormatTime: function () { var owner = this, pps = owner.properties; return pps.time ? pps.timeFormatter.getISOFormatTime() : ''; }, getFormattedValue: function () { return this.element.value; }, destroy: function () { var owner = this; owner.element.removeEventListener('input', owner.onChangeListener); owner.element.removeEventListener('keydown', owner.onKeyDownListener); owner.element.removeEventListener('focus', owner.onFocusListener); owner.element.removeEventListener('cut', owner.onCutListener); owner.element.removeEventListener('copy', owner.onCopyListener); }, toString: function () { return '[Cleave Object]'; } }; Cleave.NumeralFormatter = __webpack_require__(1); Cleave.DateFormatter = __webpack_require__(2); Cleave.TimeFormatter = __webpack_require__(3); Cleave.PhoneFormatter = __webpack_require__(4); Cleave.CreditCardDetector = __webpack_require__(5); Cleave.Util = __webpack_require__(6); Cleave.DefaultProperties = __webpack_require__(7); // for angular directive ((typeof global === 'object' && global) ? global : window)['Cleave'] = Cleave; // CommonJS module.exports = Cleave; /* WEBPACK VAR INJECTION */ }.call(exports, (function () { return this; }()))); /***/ }), /* 1 */ /***/ (function (module, exports) { var NumeralFormatter = function (numeralDecimalMark, numeralIntegerScale, numeralDecimalScale, numeralThousandsGroupStyle, numeralPositiveOnly, stripLeadingZeroes, delimiter) { var owner = this; owner.numeralDecimalMark = numeralDecimalMark || '.'; owner.numeralIntegerScale = numeralIntegerScale > 0 ? numeralIntegerScale : 0; owner.numeralDecimalScale = numeralDecimalScale >= 0 ? numeralDecimalScale : 2; owner.numeralThousandsGroupStyle = numeralThousandsGroupStyle || NumeralFormatter.groupStyle.thousand; owner.numeralPositiveOnly = !!numeralPositiveOnly; owner.stripLeadingZeroes = stripLeadingZeroes !== false; owner.delimiter = (delimiter || delimiter === '') ? delimiter : ','; owner.delimiterRE = delimiter ? new RegExp('\\' + delimiter, 'g') : ''; }; NumeralFormatter.groupStyle = { thousand: 'thousand', lakh: 'lakh', wan: 'wan', none: 'none' }; NumeralFormatter.prototype = { getRawValue: function (value) { return value.replace(this.delimiterRE, '').replace(this.numeralDecimalMark, '.'); }, format: function (value) { var owner = this, parts, partInteger, partDecimal = ''; // strip alphabet letters value = value.replace(/[A-Za-z]/g, '') // replace the first decimal mark with reserved placeholder .replace(owner.numeralDecimalMark, 'M') // strip non numeric letters except minus and "M" // this is to ensure prefix has been stripped .replace(/[^\dM-]/g, '') // replace the leading minus with reserved placeholder .replace(/^\-/, 'N') // strip the other minus sign (if present) .replace(/\-/g, '') // replace the minus sign (if present) .replace('N', owner.numeralPositiveOnly ? '' : '-') // replace decimal mark .replace('M', owner.numeralDecimalMark); // strip any leading zeros if (owner.stripLeadingZeroes) { value = value.replace(/^(-)?0+(?=\d)/, '$1'); } partInteger = value; if (value.indexOf(owner.numeralDecimalMark) >= 0) { parts = value.split(owner.numeralDecimalMark); partInteger = parts[0]; partDecimal = owner.numeralDecimalMark + parts[1].slice(0, owner.numeralDecimalScale); } if (owner.numeralIntegerScale > 0) { partInteger = partInteger.slice(0, owner.numeralIntegerScale + (value.slice(0, 1) === '-' ? 1 : 0)); } switch (owner.numeralThousandsGroupStyle) { case NumeralFormatter.groupStyle.lakh: partInteger = partInteger.replace(/(\d)(?=(\d\d)+\d$)/g, '$1' + owner.delimiter); break; case NumeralFormatter.groupStyle.wan: partInteger = partInteger.replace(/(\d)(?=(\d{4})+$)/g, '$1' + owner.delimiter); break; case NumeralFormatter.groupStyle.thousand: partInteger = partInteger.replace(/(\d)(?=(\d{3})+$)/g, '$1' + owner.delimiter); break; } return partInteger.toString() + (owner.numeralDecimalScale > 0 ? partDecimal.toString() : ''); } }; module.exports = NumeralFormatter; /***/ }), /* 2 */ /***/ (function (module, exports) { var DateFormatter = function (datePattern) { var owner = this; owner.date = []; owner.blocks = []; owner.datePattern = datePattern; owner.initBlocks(); }; DateFormatter.prototype = { initBlocks: function () { var owner = this; owner.datePattern.forEach(function (value) { if (value === 'Y') { owner.blocks.push(4); } else { owner.blocks.push(2); } }); }, getISOFormatDate: function () { var owner = this, date = owner.date; return date[2] ? ( date[2] + '-' + owner.addLeadingZero(date[1]) + '-' + owner.addLeadingZero(date[0]) ) : ''; }, getBlocks: function () { return this.blocks; }, getValidatedDate: function (value) { var owner = this, result = ''; value = value.replace(/[^\d]/g, ''); owner.blocks.forEach(function (length, index) { if (value.length > 0) { var sub = value.slice(0, length), sub0 = sub.slice(0, 1), rest = value.slice(length); switch (owner.datePattern[index]) { case 'd': if (sub === '00') { sub = '01'; } else if (parseInt(sub0, 10) > 3) { sub = '0' + sub0; } else if (parseInt(sub, 10) > 31) { sub = '31'; } break; case 'm': if (sub === '00') { sub = '01'; } else if (parseInt(sub0, 10) > 1) { sub = '0' + sub0; } else if (parseInt(sub, 10) > 12) { sub = '12'; } break; } result += sub; // update remaining string value = rest; } }); return this.getFixedDateString(result); }, getFixedDateString: function (value) { var owner = this, datePattern = owner.datePattern, date = [], dayIndex = 0, monthIndex = 0, yearIndex = 0, dayStartIndex = 0, monthStartIndex = 0, yearStartIndex = 0, day, month, year, fullYearDone = false; // mm-dd || dd-mm if (value.length === 4 && datePattern[0].toLowerCase() !== 'y' && datePattern[1].toLowerCase() !== 'y') { dayStartIndex = datePattern[0] === 'd' ? 0 : 2; monthStartIndex = 2 - dayStartIndex; day = parseInt(value.slice(dayStartIndex, dayStartIndex + 2), 10); month = parseInt(value.slice(monthStartIndex, monthStartIndex + 2), 10); date = this.getFixedDate(day, month, 0); } // yyyy-mm-dd || yyyy-dd-mm || mm-dd-yyyy || dd-mm-yyyy || dd-yyyy-mm || mm-yyyy-dd if (value.length === 8) { datePattern.forEach(function (type, index) { switch (type) { case 'd': dayIndex = index; break; case 'm': monthIndex = index; break; default: yearIndex = index; break; } }); yearStartIndex = yearIndex * 2; dayStartIndex = (dayIndex <= yearIndex) ? dayIndex * 2 : (dayIndex * 2 + 2); monthStartIndex = (monthIndex <= yearIndex) ? monthIndex * 2 : (monthIndex * 2 + 2); day = parseInt(value.slice(dayStartIndex, dayStartIndex + 2), 10); month = parseInt(value.slice(monthStartIndex, monthStartIndex + 2), 10); year = parseInt(value.slice(yearStartIndex, yearStartIndex + 4), 10); fullYearDone = value.slice(yearStartIndex, yearStartIndex + 4).length === 4; date = this.getFixedDate(day, month, year); } owner.date = date; return date.length === 0 ? value : datePattern.reduce(function (previous, current) { switch (current) { case 'd': return previous + owner.addLeadingZero(date[0]); case 'm': return previous + owner.addLeadingZero(date[1]); default: return previous + (fullYearDone ? owner.addLeadingZeroForYear(date[2]) : ''); } }, ''); }, getFixedDate: function (day, month, year) { day = Math.min(day, 31); month = Math.min(month, 12); year = parseInt((year || 0), 10); if ((month < 7 && month % 2 === 0) || (month > 8 && month % 2 === 1)) { day = Math.min(day, month === 2 ? (this.isLeapYear(year) ? 29 : 28) : 30); } return [day, month, year]; }, isLeapYear: function (year) { return ((year % 4 === 0) && (year % 100 !== 0)) || (year % 400 === 0); }, addLeadingZero: function (number) { return (number < 10 ? '0' : '') + number; }, addLeadingZeroForYear: function (number) { return (number < 10 ? '000' : (number < 100 ? '00' : (number < 1000 ? '0' : ''))) + number; } }; module.exports = DateFormatter; /***/ }), /* 3 */ /***/ (function (module, exports) { var TimeFormatter = function (timePattern, timeFormat) { var owner = this; owner.time = []; owner.blocks = []; owner.timePattern = timePattern; owner.timeFormat = timeFormat; owner.initBlocks(); }; TimeFormatter.prototype = { initBlocks: function () { var owner = this; owner.timePattern.forEach(function () { owner.blocks.push(2); }); }, getISOFormatTime: function () { var owner = this, time = owner.time; return time[2] ? ( owner.addLeadingZero(time[0]) + ':' + owner.addLeadingZero(time[1]) + ':' + owner.addLeadingZero(time[2]) ) : ''; }, getBlocks: function () { return this.blocks; }, getTimeFormatOptions: function () { var owner = this; if (String(owner.timeFormat) === '12') { return { maxHourFirstDigit: 1, maxHours: 12, maxMinutesFirstDigit: 5, maxMinutes: 60 }; } return { maxHourFirstDigit: 2, maxHours: 23, maxMinutesFirstDigit: 5, maxMinutes: 60 }; }, getValidatedTime: function (value) { var owner = this, result = ''; value = value.replace(/[^\d]/g, ''); var timeFormatOptions = owner.getTimeFormatOptions(); owner.blocks.forEach(function (length, index) { if (value.length > 0) { var sub = value.slice(0, length), sub0 = sub.slice(0, 1), rest = value.slice(length); switch (owner.timePattern[index]) { case 'h': if (parseInt(sub0, 10) > timeFormatOptions.maxHourFirstDigit) { sub = '0' + sub0; } else if (parseInt(sub, 10) > timeFormatOptions.maxHours) { sub = timeFormatOptions.maxHours + ''; } break; case 'm': case 's': if (parseInt(sub0, 10) > timeFormatOptions.maxMinutesFirstDigit) { sub = '0' + sub0; } else if (parseInt(sub, 10) > timeFormatOptions.maxMinutes) { sub = timeFormatOptions.maxMinutes + ''; } break; } result += sub; // update remaining string value = rest; } }); return this.getFixedTimeString(result); }, getFixedTimeString: function (value) { var owner = this, timePattern = owner.timePattern, time = [], secondIndex = 0, minuteIndex = 0, hourIndex = 0, secondStartIndex = 0, minuteStartIndex = 0, hourStartIndex = 0, second, minute, hour; if (value.length === 6) { timePattern.forEach(function (type, index) { switch (type) { case 's': secondIndex = index * 2; break; case 'm': minuteIndex = index * 2; break; case 'h': hourIndex = index * 2; break; } }); hourStartIndex = hourIndex; minuteStartIndex = minuteIndex; secondStartIndex = secondIndex; second = parseInt(value.slice(secondStartIndex, secondStartIndex + 2), 10); minute = parseInt(value.slice(minuteStartIndex, minuteStartIndex + 2), 10); hour = parseInt(value.slice(hourStartIndex, hourStartIndex + 2), 10); time = this.getFixedTime(hour, minute, second); } if (value.length === 4 && owner.timePattern.indexOf('s') < 0) { timePattern.forEach(function (type, index) { switch (type) { case 'm': minuteIndex = index * 2; break; case 'h': hourIndex = index * 2; break; } }); hourStartIndex = hourIndex; minuteStartIndex = minuteIndex; second = 0; minute = parseInt(value.slice(minuteStartIndex, minuteStartIndex + 2), 10); hour = parseInt(value.slice(hourStartIndex, hourStartIndex + 2), 10); time = this.getFixedTime(hour, minute, second); } owner.time = time; return time.length === 0 ? value : timePattern.reduce(function (previous, current) { switch (current) { case 's': return previous + owner.addLeadingZero(time[2]); case 'm': return previous + owner.addLeadingZero(time[1]); case 'h': return previous + owner.addLeadingZero(time[0]); } }, ''); }, getFixedTime: function (hour, minute, second) { second = Math.min(parseInt(second || 0, 10), 60); minute = Math.min(minute, 60); hour = Math.min(hour, 60); return [hour, minute, second]; }, addLeadingZero: function (number) { return (number < 10 ? '0' : '') + number; } }; module.exports = TimeFormatter; /***/ }), /* 4 */ /***/ (function (module, exports) { var PhoneFormatter = function (formatter, delimiter) { var owner = this; owner.delimiter = (delimiter || delimiter === '') ? delimiter : ' '; owner.delimiterRE = delimiter ? new RegExp('\\' + delimiter, 'g') : ''; owner.formatter = formatter; }; PhoneFormatter.prototype = { setFormatter: function (formatter) { this.formatter = formatter; }, format: function (phoneNumber) { var owner = this; owner.formatter.clear(); // only keep number and + phoneNumber = phoneNumber.replace(/[^\d+]/g, ''); // strip non-leading + phoneNumber = phoneNumber.replace(/^\+/, 'B').replace(/\+/g, '').replace('B', '+'); // strip delimiter phoneNumber = phoneNumber.replace(owner.delimiterRE, ''); var result = '', current, validated = false; for (var i = 0, iMax = phoneNumber.length; i < iMax; i++) { current = owner.formatter.inputDigit(phoneNumber.charAt(i)); // has ()- or space inside if (/[\s()-]/g.test(current)) { result = current; validated = true; } else { if (!validated) { result = current; } // else: over length input // it turns to invalid number again } } // strip () // e.g. US: 7161234567 returns (716) 123-4567 result = result.replace(/[()]/g, ''); // replace library delimiter with user customized delimiter result = result.replace(/[\s-]/g, owner.delimiter); return result; } }; module.exports = PhoneFormatter; /***/ }), /* 5 */ /***/ (function (module, exports) { var CreditCardDetector = { blocks: { uatp: [4, 5, 6], amex: [4, 6, 5], diners: [4, 6, 4], discover: [4, 4, 4, 4], mastercard: [4, 4, 4, 4], dankort: [4, 4, 4, 4], instapayment: [4, 4, 4, 4], jcb15: [4, 6, 5], jcb: [4, 4, 4, 4], maestro: [4, 4, 4, 4], visa: [4, 4, 4, 4], mir: [4, 4, 4, 4], unionPay: [4, 4, 4, 4], general: [4, 4, 4, 4], generalStrict: [4, 4, 4, 7] }, re: { // starts with 1; 15 digits, not starts with 1800 (jcb card) uatp: /^(?!1800)1\d{0,14}/, // starts with 34/37; 15 digits amex: /^3[47]\d{0,13}/, // starts with 6011/65/644-649; 16 digits discover: /^(?:6011|65\d{0,2}|64[4-9]\d?)\d{0,12}/, // starts with 300-305/309 or 36/38/39; 14 digits diners: /^3(?:0([0-5]|9)|[689]\d?)\d{0,11}/, // starts with 51-55/2221–2720; 16 digits mastercard: /^(5[1-5]\d{0,2}|22[2-9]\d{0,1}|2[3-7]\d{0,2})\d{0,12}/, // starts with 5019/4175/4571; 16 digits dankort: /^(5019|4175|4571)\d{0,12}/, // starts with 637-639; 16 digits instapayment: /^63[7-9]\d{0,13}/, // starts with 2131/1800; 15 digits jcb15: /^(?:2131|1800)\d{0,11}/, // starts with 2131/1800/35; 16 digits jcb: /^(?:35\d{0,2})\d{0,12}/, // starts with 50/56-58/6304/67; 16 digits maestro: /^(?:5[0678]\d{0,2}|6304|67\d{0,2})\d{0,12}/, // starts with 22; 16 digits mir: /^220[0-4]\d{0,12}/, // starts with 4; 16 digits visa: /^4\d{0,15}/, // starts with 62; 16 digits unionPay: /^62\d{0,14}/ }, getInfo: function (value, strictMode) { var blocks = CreditCardDetector.blocks, re = CreditCardDetector.re; // Some credit card can have up to 19 digits number. // Set strictMode to true will remove the 16 max-length restrain, // however, I never found any website validate card number like // this, hence probably you don't want to enable this option. strictMode = !!strictMode; for (var key in re) { if (re[key].test(value)) { var block; if (strictMode) { block = blocks.generalStrict; } else { block = blocks[key]; } return { type: key, blocks: block }; } } return { type: 'unknown', blocks: strictMode ? blocks.generalStrict : blocks.general }; } }; module.exports = CreditCardDetector; /***/ }), /* 6 */ /***/ (function (module, exports) { var Util = { noop: function () { }, strip: function (value, re) { return value.replace(re, ''); }, getPostDelimiter: function (value, delimiter, delimiters) { // single delimiter if (delimiters.length === 0) { return value.slice(-delimiter.length) === delimiter ? delimiter : ''; } // multiple delimiters var matchedDelimiter = ''; delimiters.forEach(function (current) { if (value.slice(-current.length) === current) { matchedDelimiter = current; } }); return matchedDelimiter; }, getDelimiterREByDelimiter: function (delimiter) { return new RegExp(delimiter.replace(/([.?*+^$[\]\\(){}|-])/g, '\\$1'), 'g'); }, getNextCursorPosition: function (prevPos, oldValue, newValue, delimiter, delimiters) { // If cursor was at the end of value, just place it back. // Because new value could contain additional chars. if (oldValue.length === prevPos) { return newValue.length; } return prevPos + this.getPositionOffset(prevPos, oldValue, newValue, delimiter, delimiters); }, getPositionOffset: function (prevPos, oldValue, newValue, delimiter, delimiters) { var oldRawValue, newRawValue, lengthOffset; oldRawValue = this.stripDelimiters(oldValue.slice(0, prevPos), delimiter, delimiters); newRawValue = this.stripDelimiters(newValue.slice(0, prevPos), delimiter, delimiters); lengthOffset = oldRawValue.length - newRawValue.length; return (lengthOffset !== 0) ? (lengthOffset / Math.abs(lengthOffset)) : 0; }, stripDelimiters: function (value, delimiter, delimiters) { var owner = this; // single delimiter if (delimiters.length === 0) { var delimiterRE = delimiter ? owner.getDelimiterREByDelimiter(delimiter) : ''; return value.replace(delimiterRE, ''); } // multiple delimiters delimiters.forEach(function (current) { current.split('').forEach(function (letter) { value = value.replace(owner.getDelimiterREByDelimiter(letter), ''); }); }); return value; }, headStr: function (str, length) { return str.slice(0, length); }, getMaxLength: function (blocks) { return blocks.reduce(function (previous, current) { return previous + current; }, 0); }, // strip prefix // Before type | After type | Return value // PEFIX-... | PEFIX-... | '' // PREFIX-123 | PEFIX-123 | 123 // PREFIX-123 | PREFIX-23 | 23 // PREFIX-123 | PREFIX-1234 | 1234 getPrefixStrippedValue: function (value, prefix, prefixLength, prevResult, delimiter, delimiters) { // No prefix if (prefixLength === 0) { return value; } // Pre result has issue // Revert to raw prefix if (prevResult.slice(0, prefixLength) !== prefix) { return ''; } var prevValue = this.stripDelimiters(prevResult, delimiter, delimiters); // New value has issue, someone typed in between prefix letters // Revert to pre value if (value.slice(0, prefixLength) !== prefix) { return prevValue.slice(prefixLength); } // No issue, strip prefix for new value return value.slice(prefixLength); }, getFirstDiffIndex: function (prev, current) { var index = 0; while (prev.charAt(index) === current.charAt(index)) { if (prev.charAt(index++) === '') { return -1; } } return index; }, getFormattedValue: function (value, blocks, blocksLength, delimiter, delimiters, delimiterLazyShow) { var result = '', multipleDelimiters = delimiters.length > 0, currentDelimiter; // no options, normal input if (blocksLength === 0) { return value; } blocks.forEach(function (length, index) { if (value.length > 0) { var sub = value.slice(0, length), rest = value.slice(length); if (multipleDelimiters) { currentDelimiter = delimiters[delimiterLazyShow ? (index - 1) : index] || currentDelimiter; } else { currentDelimiter = delimiter; } if (delimiterLazyShow) { if (index > 0) { result += currentDelimiter; } result += sub; } else { result += sub; if (sub.length === length && index < blocksLength - 1) { result += currentDelimiter; } } // update remaining string value = rest; } }); return result; }, // move cursor to the end // the first time user focuses on an input with prefix fixPrefixCursor: function (el, prefix, delimiter, delimiters) { if (!el) { return; } var val = el.value, appendix = delimiter || (delimiters[0] || ' '); if (!el.setSelectionRange || !prefix || (prefix.length + appendix.length) < val.length) { return; } var len = val.length * 2; // set timeout to avoid blink setTimeout(function () { el.setSelectionRange(len, len); }, 1); }, setSelection: function (element, position, doc) { if (element !== this.getActiveElement(doc)) { return; } // cursor is already in the end if (element && element.value.length <= position) { return; } if (element.createTextRange) { var range = element.createTextRange(); range.move('character', position); range.select(); } else { try { element.setSelectionRange(position, position); } catch (e) { // eslint-disable-next-line console.warn('The input element type does not support selection'); } } }, getActiveElement: function (parent) { var activeElement = parent.activeElement; if (activeElement && activeElement.shadowRoot) { return this.getActiveElement(activeElement.shadowRoot); } return activeElement; }, isAndroid: function () { return navigator && /android/i.test(navigator.userAgent); }, // On Android chrome, the keyup and keydown events // always return key code 229 as a composition that // buffers the user’s keystrokes // see https://github.com/nosir/cleave.js/issues/147 isAndroidBackspaceKeydown: function (lastInputValue, currentInputValue) { if (!this.isAndroid() || !lastInputValue || !currentInputValue) { return false; } return currentInputValue === lastInputValue.slice(0, -1); } }; module.exports = Util; /***/ }), /* 7 */ /***/ (function (module, exports) { /* WEBPACK VAR INJECTION */(function (global) { /** * Props Assignment * * Separate this, so react module can share the usage */ var DefaultProperties = { // Maybe change to object-assign // for now just keep it as simple assign: function (target, opts) { target = target || {}; opts = opts || {}; // credit card target.creditCard = !!opts.creditCard; target.creditCardStrictMode = !!opts.creditCardStrictMode; target.creditCardType = ''; target.onCreditCardTypeChanged = opts.onCreditCardTypeChanged || (function () { }); // phone target.phone = !!opts.phone; target.phoneRegionCode = opts.phoneRegionCode || 'AU'; target.phoneFormatter = {}; // time target.time = !!opts.time; target.timePattern = opts.timePattern || ['h', 'm', 's']; target.timeFormat = opts.timeFormat || '24'; target.timeFormatter = {}; // date target.date = !!opts.date; target.datePattern = opts.datePattern || ['d', 'm', 'Y']; target.dateFormatter = {}; // numeral target.numeral = !!opts.numeral; target.numeralIntegerScale = opts.numeralIntegerScale > 0 ? opts.numeralIntegerScale : 0; target.numeralDecimalScale = opts.numeralDecimalScale >= 0 ? opts.numeralDecimalScale : 2; target.numeralDecimalMark = opts.numeralDecimalMark || '.'; target.numeralThousandsGroupStyle = opts.numeralThousandsGroupStyle || 'thousand'; target.numeralPositiveOnly = !!opts.numeralPositiveOnly; target.stripLeadingZeroes = opts.stripLeadingZeroes !== false; // others target.numericOnly = target.creditCard || target.date || !!opts.numericOnly; target.uppercase = !!opts.uppercase; target.lowercase = !!opts.lowercase; target.prefix = (target.creditCard || target.date) ? '' : (opts.prefix || ''); target.noImmediatePrefix = !!opts.noImmediatePrefix; target.prefixLength = target.prefix.length; target.rawValueTrimPrefix = !!opts.rawValueTrimPrefix; target.copyDelimiter = !!opts.copyDelimiter; target.initValue = (opts.initValue !== undefined && opts.initValue !== null) ? opts.initValue.toString() : ''; target.delimiter = (opts.delimiter || opts.delimiter === '') ? opts.delimiter : (opts.date ? '/' : (opts.time ? ':' : (opts.numeral ? ',' : (opts.phone ? ' ' : ' ')))); target.delimiterLength = target.delimiter.length; target.delimiterLazyShow = !!opts.delimiterLazyShow; target.delimiters = opts.delimiters || []; target.blocks = opts.blocks || []; target.blocksLength = target.blocks.length; target.root = (typeof global === 'object' && global) ? global : window; target.document = opts.document || target.root.document; target.maxLength = 0; target.backspace = false; target.result = ''; target.onValueChanged = opts.onValueChanged || (function () { }); return target; } }; module.exports = DefaultProperties; /* WEBPACK VAR INJECTION */ }.call(exports, (function () { return this; }()))); /***/ }) /******/]) }); }); /* src/Login/twofactors/codeInput.svelte generated by Svelte v3.2.1 */ const file$4 = "src/Login/twofactors/codeInput.svelte"; function create_fragment$4(ctx) { var div1, input_1, t0, span0, t1, span1, t2, label_1, t4, div0, t5, div0_style_value, dispose; return { c: function create() { div1 = internal_13("div"); input_1 = internal_13("input"); t0 = internal_17(); span0 = internal_13("span"); t1 = internal_17(); span1 = internal_13("span"); t2 = internal_17(); label_1 = internal_13("label"); label_1.textContent = "Code"; t4 = internal_17(); div0 = internal_13("div"); t5 = internal_16(ctx.error); input_1.autofocus = true; internal_87(input_1, file$4, 29, 3, 502); span0.className = "highlight"; internal_87(span0, file$4, 30, 3, 560); span1.className = "bar"; internal_87(span1, file$4, 31, 3, 595); internal_87(label_1, file$4, 32, 3, 624); div0.className = "error svelte-1dvmdfa"; div0.style.cssText = div0_style_value = !ctx.error ? "display: none;" : ""; internal_87(div0, file$4, 33, 3, 647); div1.className = "floating group"; internal_87(div1, file$4, 28, 0, 470); dispose = internal_19(input_1, "input", ctx.input_1_input_handler); }, 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) { internal_7(target, div1, anchor); internal_6(div1, input_1); input_1.value = ctx.value; internal_62(() => ctx.input_1_binding(input_1, null)); internal_6(div1, t0); internal_6(div1, span0); internal_6(div1, t1); internal_6(div1, span1); internal_6(div1, t2); internal_6(div1, label_1); internal_6(div1, t4); internal_6(div1, div0); internal_6(div0, t5); input_1.focus(); }, p: function update(changed, ctx) { if (changed.value && (input_1.value !== ctx.value)) input_1.value = ctx.value; if (changed.items) { ctx.input_1_binding(null, input_1); ctx.input_1_binding(input_1, null); } if (changed.error) { internal_32(t5, ctx.error); } if ((changed.error) && div0_style_value !== (div0_style_value = !ctx.error ? "display: none;" : "")) { div0.style.cssText = div0_style_value; } }, i: internal_83, o: internal_83, d: function destroy(detaching) { if (detaching) { internal_8(div1); } ctx.input_1_binding(null, input_1); dispose(); } }; } function instance$4($$self, $$props, $$invalidate) { let { error, label, value, length = 6 } = $$props; let input; svelte_1(() => { const cleaveCustom = new cleave(input, { blocks: [length / 2, length / 2], delimiter: ' ', numericOnly: true }); }); function input_1_input_handler() { value = this.value; $$invalidate('value', value); } function input_1_binding($$node, check) { input = $$node; $$invalidate('input', input); } $$self.$set = $$props => { if ('error' in $$props) $$invalidate('error', error = $$props.error); if ('label' in $$props) $$invalidate('label', label = $$props.label); if ('value' in $$props) $$invalidate('value', value = $$props.value); if ('length' in $$props) $$invalidate('length', length = $$props.length); }; return { error, label, value, length, input, input_1_input_handler, input_1_binding }; } class CodeInput extends internal_104 { constructor(options) { super(options); internal_102(this, options, instance$4, create_fragment$4, internal_92, ["error", "label", "value", "length"]); const { ctx } = this.$$; const props = options.props || {}; if (ctx.error === undefined && !('error' in props)) { console.warn(" was created without expected prop 'error'"); } if (ctx.label === undefined && !('label' in props)) { console.warn(" was created without expected prop 'label'"); } if (ctx.value === undefined && !('value' in props)) { console.warn(" was created without expected prop 'value'"); } } get error() { throw new Error(": Props cannot be read directly from the component instance unless compiling with 'accessors: true' or ''"); } set error(value) { throw new Error(": Props cannot be set directly on the component instance unless compiling with 'accessors: true' or ''"); } get label() { throw new Error(": Props cannot be read directly from the component instance unless compiling with 'accessors: true' or ''"); } set label(value) { throw new Error(": Props cannot be set directly on the component instance unless compiling with 'accessors: true' or ''"); } get value() { throw new Error(": Props cannot be read directly from the component instance unless compiling with 'accessors: true' or ''"); } set value(value) { throw new Error(": Props cannot be set directly on the component instance unless compiling with 'accessors: true' or ''"); } get length() { throw new Error(": Props cannot be read directly from the component instance unless compiling with 'accessors: true' or ''"); } set length(value) { throw new Error(": Props cannot be set directly on the component instance unless compiling with 'accessors: true' or ''"); } } /* src/Login/twofactors/otc.svelte generated by Svelte v3.2.1 */ const file$5 = "src/Login/twofactors/otc.svelte"; function create_fragment$5(ctx) { var h3, t0, t1, updating_value, t2, div, t3, button, current, dispose; function codeinput_value_binding(value) { ctx.codeinput_value_binding.call(null, value); updating_value = true; internal_64(() => updating_value = false); } let codeinput_props = { label: "Code", error: ctx.error, length: ctx.length }; if (ctx.code !== void 0) { codeinput_props.value = ctx.code; } var codeinput = new CodeInput({ props: codeinput_props, $$inline: true }); internal_62(() => internal_100(codeinput, 'value', codeinput_value_binding)); var tolist = new ToList({ props: { finish: ctx.finish }, $$inline: true }); return { c: function create() { h3 = internal_13("h3"); t0 = internal_16(ctx.title); t1 = internal_17(); codeinput.$$.fragment.c(); t2 = internal_17(); div = internal_13("div"); tolist.$$.fragment.c(); t3 = internal_17(); button = internal_13("button"); button.textContent = "Send"; internal_87(h3, file$5, 48, 0, 980); button.className = "btn svelte-1l4mr9e"; internal_34(button, "margin-left", "auto"); internal_87(button, file$5, 54, 3, 1122); div.className = "actions svelte-1l4mr9e"; internal_87(div, file$5, 52, 0, 1074); dispose = internal_19(button, "click", ctx.sendCode); }, 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) { internal_7(target, h3, anchor); internal_6(h3, t0); internal_7(target, t1, anchor); internal_101(codeinput, target, anchor); internal_7(target, t2, anchor); internal_7(target, div, anchor); internal_101(tolist, div, null); internal_6(div, t3); internal_6(div, button); current = true; }, p: function update(changed, ctx) { var codeinput_changes = {}; if (changed.error) codeinput_changes.error = ctx.error; if (changed.length) codeinput_changes.length = ctx.length; if (!updating_value && changed.code) { codeinput_changes.value = ctx.code; } codeinput.$set(codeinput_changes); var tolist_changes = {}; if (changed.finish) tolist_changes.finish = ctx.finish; tolist.$set(tolist_changes); }, i: function intro(local) { if (current) return; codeinput.$$.fragment.i(local); tolist.$$.fragment.i(local); current = true; }, o: function outro(local) { codeinput.$$.fragment.o(local); tolist.$$.fragment.o(local); current = false; }, d: function destroy(detaching) { if (detaching) { internal_8(h3); internal_8(t1); } codeinput.$destroy(detaching); if (detaching) { internal_8(t2); internal_8(div); } tolist.$destroy(); dispose(); } }; } function instance$5($$self, $$props, $$invalidate) { let error = ""; let code = ""; let { finish, id, otc = false } = $$props; let title = otc ? "One Time Code (OTC)" : "Backup Code"; let length = otc ? 6 : 8; async function sendCode() { let c = code.replace(/\s+/g, ""); if (c.length < length) { $$invalidate('error', error = `Code must be ${length} digits long!`); } else { $$invalidate('error', error = ""); let res; if (otc) res = await Api.sendOTC(id, c); else res = await Api.sendBackup(id, c); if (res.error) $$invalidate('error', error = res.error); else finish(true); } } function codeinput_value_binding(value) { code = value; $$invalidate('code', code); } $$self.$set = $$props => { if ('finish' in $$props) $$invalidate('finish', finish = $$props.finish); if ('id' in $$props) $$invalidate('id', id = $$props.id); if ('otc' in $$props) $$invalidate('otc', otc = $$props.otc); }; return { error, code, finish, id, otc, title, length, sendCode, codeinput_value_binding }; } class Otc extends internal_104 { constructor(options) { super(options); internal_102(this, options, instance$5, create_fragment$5, internal_92, ["finish", "id", "otc"]); const { ctx } = this.$$; const props = options.props || {}; if (ctx.finish === undefined && !('finish' in props)) { console.warn(" was created without expected prop 'finish'"); } if (ctx.id === undefined && !('id' in props)) { console.warn(" was created without expected prop 'id'"); } } get finish() { throw new Error(": Props cannot be read directly from the component instance unless compiling with 'accessors: true' or ''"); } set finish(value) { throw new Error(": Props cannot be set directly on the component instance unless compiling with 'accessors: true' or ''"); } get id() { throw new Error(": Props cannot be read directly from the component instance unless compiling with 'accessors: true' or ''"); } set id(value) { throw new Error(": Props cannot be set directly on the component instance unless compiling with 'accessors: true' or ''"); } get otc() { throw new Error(": Props cannot be read directly from the component instance unless compiling with 'accessors: true' or ''"); } set otc(value) { throw new Error(": Props cannot be set directly on the component instance unless compiling with 'accessors: true' or ''"); } } /* src/Login/twofactors/push.svelte generated by Svelte v3.2.1 */ const file$6 = "src/Login/twofactors/push.svelte"; function create_fragment$6(ctx) { var h3, t1, p, t2, b, t3, t4, div10, div1, div0, t5, div3, div2, t6, div5, div4, t7, div7, div6, t8, div9, div8, t9, div11, t10, t11, current; var tolist = new ToList({ props: { finish: ctx.finish }, $$inline: true }); return { c: function create() { h3 = internal_13("h3"); h3.textContent = "SMS"; t1 = internal_17(); p = internal_13("p"); t2 = internal_16("A code was sent to your Device "); b = internal_13("b"); t3 = internal_16(ctx.device); t4 = internal_17(); div10 = internal_13("div"); div1 = internal_13("div"); div0 = internal_13("div"); t5 = internal_17(); div3 = internal_13("div"); div2 = internal_13("div"); t6 = internal_17(); div5 = internal_13("div"); div4 = internal_13("div"); t7 = internal_17(); div7 = internal_13("div"); div6 = internal_13("div"); t8 = internal_17(); div9 = internal_13("div"); div8 = internal_13("div"); t9 = internal_17(); div11 = internal_13("div"); t10 = internal_16(error); t11 = internal_17(); tolist.$$.fragment.c(); internal_87(h3, file$6, 369, 0, 7853); internal_87(b, file$6, 371, 34, 7901); internal_87(p, file$6, 371, 0, 7867); div0.className = "wInnerBall svelte-1xgtl8s"; internal_87(div0, file$6, 375, 6, 7987); div1.className = "wBall svelte-1xgtl8s"; div1.id = "wBall_1"; internal_87(div1, file$6, 374, 3, 7948); div2.className = "wInnerBall svelte-1xgtl8s"; internal_87(div2, file$6, 378, 6, 8070); div3.className = "wBall svelte-1xgtl8s"; div3.id = "wBall_2"; internal_87(div3, file$6, 377, 3, 8031); div4.className = "wInnerBall svelte-1xgtl8s"; internal_87(div4, file$6, 381, 6, 8153); div5.className = "wBall svelte-1xgtl8s"; div5.id = "wBall_3"; internal_87(div5, file$6, 380, 3, 8114); div6.className = "wInnerBall svelte-1xgtl8s"; internal_87(div6, file$6, 384, 6, 8236); div7.className = "wBall svelte-1xgtl8s"; div7.id = "wBall_4"; internal_87(div7, file$6, 383, 3, 8197); div8.className = "wInnerBall svelte-1xgtl8s"; internal_87(div8, file$6, 387, 6, 8319); div9.className = "wBall svelte-1xgtl8s"; div9.id = "wBall_5"; internal_87(div9, file$6, 386, 3, 8280); div10.className = "windows8 svelte-1xgtl8s"; internal_87(div10, file$6, 373, 0, 7922); div11.className = "error svelte-1xgtl8s"; internal_87(div11, file$6, 391, 0, 8368); }, 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) { internal_7(target, h3, anchor); internal_7(target, t1, anchor); internal_7(target, p, anchor); internal_6(p, t2); internal_6(p, b); internal_6(b, t3); internal_7(target, t4, anchor); internal_7(target, div10, anchor); internal_6(div10, div1); internal_6(div1, div0); internal_6(div10, t5); internal_6(div10, div3); internal_6(div3, div2); internal_6(div10, t6); internal_6(div10, div5); internal_6(div5, div4); internal_6(div10, t7); internal_6(div10, div7); internal_6(div7, div6); internal_6(div10, t8); internal_6(div10, div9); internal_6(div9, div8); internal_7(target, t9, anchor); internal_7(target, div11, anchor); internal_6(div11, t10); internal_7(target, t11, anchor); internal_101(tolist, target, anchor); current = true; }, p: function update(changed, ctx) { if (!current || changed.device) { internal_32(t3, ctx.device); } var tolist_changes = {}; if (changed.finish) tolist_changes.finish = ctx.finish; tolist.$set(tolist_changes); }, i: function intro(local) { if (current) return; tolist.$$.fragment.i(local); current = true; }, o: function outro(local) { tolist.$$.fragment.o(local); current = false; }, d: function destroy(detaching) { if (detaching) { internal_8(h3); internal_8(t1); internal_8(p); internal_8(t4); internal_8(div10); internal_8(t9); internal_8(div11); internal_8(t11); } tolist.$destroy(detaching); } }; } let error = ""; function instance$6($$self, $$props, $$invalidate) { let { device = "Handy01", deviceId = "", finish } = $$props; $$self.$set = $$props => { if ('device' in $$props) $$invalidate('device', device = $$props.device); if ('deviceId' in $$props) $$invalidate('deviceId', deviceId = $$props.deviceId); if ('finish' in $$props) $$invalidate('finish', finish = $$props.finish); }; return { device, deviceId, finish }; } class Push extends internal_104 { constructor(options) { super(options); internal_102(this, options, instance$6, create_fragment$6, internal_92, ["device", "deviceId", "finish"]); const { ctx } = this.$$; const props = options.props || {}; if (ctx.finish === undefined && !('finish' in props)) { console.warn(" was created without expected prop 'finish'"); } } get device() { throw new Error(": Props cannot be read directly from the component instance unless compiling with 'accessors: true' or ''"); } set device(value) { throw new Error(": Props cannot be set directly on the component instance unless compiling with 'accessors: true' or ''"); } get deviceId() { throw new Error(": Props cannot be read directly from the component instance unless compiling with 'accessors: true' or ''"); } set deviceId(value) { throw new Error(": Props cannot be set directly on the component instance unless compiling with 'accessors: true' or ''"); } get finish() { throw new Error(": Props cannot be read directly from the component instance unless compiling with 'accessors: true' or ''"); } set finish(value) { throw new Error(": Props cannot be set directly on the component instance unless compiling with 'accessors: true' or ''"); } } /* src/Login/twofactors/u2f.svelte generated by Svelte v3.2.1 */ const file$7 = "src/Login/twofactors/u2f.svelte"; function create_fragment$7(ctx) { var h3, t1, h4, t3, current; var tolist = new ToList({ props: { finish: ctx.finish }, $$inline: true }); return { c: function create() { h3 = internal_13("h3"); h3.textContent = "U2F Security Key"; t1 = internal_17(); h4 = internal_13("h4"); h4.textContent = "This Method is currently not supported. Please choose another one!"; t3 = internal_17(); tolist.$$.fragment.c(); h3.className = "svelte-1b22rk9"; internal_87(h3, file$7, 69, 0, 1410); h4.className = "svelte-1b22rk9"; internal_87(h4, file$7, 70, 0, 1436); }, 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) { internal_7(target, h3, anchor); internal_7(target, t1, anchor); internal_7(target, h4, anchor); internal_7(target, t3, anchor); internal_101(tolist, target, anchor); current = true; }, p: function update(changed, ctx) { var tolist_changes = {}; if (changed.finish) tolist_changes.finish = ctx.finish; tolist.$set(tolist_changes); }, i: function intro(local) { if (current) return; tolist.$$.fragment.i(local); current = true; }, o: function outro(local) { tolist.$$.fragment.o(local); current = false; }, d: function destroy(detaching) { if (detaching) { internal_8(h3); internal_8(t1); internal_8(h4); internal_8(t3); } tolist.$destroy(detaching); } }; } function instance$7($$self, $$props, $$invalidate) { let { finish } = $$props; const states = { getChallenge: 0, requestUser: 1, sendChallenge: 2, error: 3 }; let state = states.getChallenge; let error = ""; const onError = err => { $$invalidate('state', state = states.error); $$invalidate('error', error = err.message); }; let challenge; async function requestUser() { $$invalidate('state', state = states.requestUser); let res = await window.navigator.credentials.get({ publicKey: challenge }); $$invalidate('state', state = states.sendChallenge()); let r = res.response; let data = encode({ authenticatorData: r.authenticatorData, clientDataJSON: r.clientDataJSON, signature: r.signature, userHandle: r.userHandle }); let { success } = fetch("https://localhost:8444/auth", { body: data, method: "POST" }).then(res => res.json()); if (success) { finish(true); } } async function getChallenge() { $$invalidate('state', state = states.getChallenge); $$invalidate('challenge', challenge = await fetch("https://localhost:8444/auth") .then(res => res.arrayBuffer()) .then(data => decode(MessagePack.Buffer.from(data)))); requestUser().catch(onError); } getChallenge().catch(onError); $$self.$set = $$props => { if ('finish' in $$props) $$invalidate('finish', finish = $$props.finish); }; return { finish }; } class U2f extends internal_104 { constructor(options) { super(options); internal_102(this, options, instance$7, create_fragment$7, internal_92, ["finish"]); const { ctx } = this.$$; const props = options.props || {}; if (ctx.finish === undefined && !('finish' in props)) { console.warn(" was created without expected prop 'finish'"); } } get finish() { throw new Error(": Props cannot be read directly from the component instance unless compiling with 'accessors: true' or ''"); } set finish(value) { throw new Error(": Props cannot be set directly on the component instance unless compiling with 'accessors: true' or ''"); } } /* src/Login/Twofactor.svelte generated by Svelte v3.2.1 */ const file$8 = "src/Login/Twofactor.svelte"; function get_each_context(ctx, list, i) { const child_ctx = Object.create(ctx); child_ctx.tf = list[i]; return child_ctx; } // (107:6) {:else} function create_else_block$2(ctx) { var div; return { c: function create() { div = internal_13("div"); div.textContent = "Invalid TwoFactor Method!"; internal_87(div, file$8, 107, 9, 2311); }, m: function mount(target, anchor) { internal_7(target, div, anchor); }, p: internal_83, i: internal_83, o: internal_83, d: function destroy(detaching) { if (detaching) { internal_8(div); } } }; } // (105:54) function create_if_block_4(ctx) { var current; var pushtwofactor = new Push({ props: { id: ctx.twofactor.id, finish: ctx.onFinish }, $$inline: true }); return { c: function create() { pushtwofactor.$$.fragment.c(); }, m: function mount(target, anchor) { internal_101(pushtwofactor, target, anchor); current = true; }, p: function update(changed, ctx) { var pushtwofactor_changes = {}; if (changed.twofactor) pushtwofactor_changes.id = ctx.twofactor.id; if (changed.onFinish) pushtwofactor_changes.finish = ctx.onFinish; pushtwofactor.$set(pushtwofactor_changes); }, i: function intro(local) { if (current) return; pushtwofactor.$$.fragment.i(local); current = true; }, o: function outro(local) { pushtwofactor.$$.fragment.o(local); current = false; }, d: function destroy(detaching) { pushtwofactor.$destroy(detaching); } }; } // (103:48) function create_if_block_3$1(ctx) { var current; var u2ftwofactor = new U2f({ props: { id: ctx.twofactor.id, finish: ctx.onFinish }, $$inline: true }); return { c: function create() { u2ftwofactor.$$.fragment.c(); }, m: function mount(target, anchor) { internal_101(u2ftwofactor, target, anchor); current = true; }, p: function update(changed, ctx) { var u2ftwofactor_changes = {}; if (changed.twofactor) u2ftwofactor_changes.id = ctx.twofactor.id; if (changed.onFinish) u2ftwofactor_changes.finish = ctx.onFinish; u2ftwofactor.$set(u2ftwofactor_changes); }, i: function intro(local) { if (current) return; u2ftwofactor.$$.fragment.i(local); current = true; }, o: function outro(local) { u2ftwofactor.$$.fragment.o(local); current = false; }, d: function destroy(detaching) { u2ftwofactor.$destroy(detaching); } }; } // (101:56) function create_if_block_2$1(ctx) { var current; var otctwofactor = new Otc({ props: { id: ctx.twofactor.id, finish: ctx.onFinish, otc: false }, $$inline: true }); return { c: function create() { otctwofactor.$$.fragment.c(); }, m: function mount(target, anchor) { internal_101(otctwofactor, target, anchor); current = true; }, p: function update(changed, ctx) { var otctwofactor_changes = {}; if (changed.twofactor) otctwofactor_changes.id = ctx.twofactor.id; if (changed.onFinish) otctwofactor_changes.finish = ctx.onFinish; otctwofactor.$set(otctwofactor_changes); }, i: function intro(local) { if (current) return; otctwofactor.$$.fragment.i(local); current = true; }, o: function outro(local) { otctwofactor.$$.fragment.o(local); current = false; }, d: function destroy(detaching) { otctwofactor.$destroy(detaching); } }; } // (99:6) {#if twofactor.type === TFATypes.OTC} function create_if_block_1$1(ctx) { var current; var otctwofactor = new Otc({ props: { id: ctx.twofactor.id, finish: ctx.onFinish, otc: true }, $$inline: true }); return { c: function create() { otctwofactor.$$.fragment.c(); }, m: function mount(target, anchor) { internal_101(otctwofactor, target, anchor); current = true; }, p: function update(changed, ctx) { var otctwofactor_changes = {}; if (changed.twofactor) otctwofactor_changes.id = ctx.twofactor.id; if (changed.onFinish) otctwofactor_changes.finish = ctx.onFinish; otctwofactor.$set(otctwofactor_changes); }, i: function intro(local) { if (current) return; otctwofactor.$$.fragment.i(local); current = true; }, o: function outro(local) { otctwofactor.$$.fragment.o(local); current = false; }, d: function destroy(detaching) { otctwofactor.$destroy(detaching); } }; } // (83:3) {#if !twofactor} function create_if_block$2(ctx) { var h3, t_1, ul, current; var each_value = ctx.twofactors; var each_blocks = []; for (var i = 0; i < each_value.length; i += 1) { each_blocks[i] = create_each_block(get_each_context(ctx, each_value, i)); } function outro_block(i, detaching, local) { if (each_blocks[i]) { if (detaching) { internal_79(() => { each_blocks[i].d(detaching); each_blocks[i] = null; }); } each_blocks[i].o(local); } } return { c: function create() { h3 = internal_13("h3"); h3.textContent = "Select your Authentication method:"; t_1 = internal_17(); ul = internal_13("ul"); for (var i = 0; i < each_blocks.length; i += 1) { each_blocks[i].c(); } internal_87(h3, file$8, 83, 3, 1491); ul.className = "svelte-w0gm0o"; internal_87(ul, file$8, 84, 3, 1538); }, m: function mount(target, anchor) { internal_7(target, h3, anchor); internal_7(target, t_1, anchor); internal_7(target, ul, anchor); for (var i = 0; i < each_blocks.length; i += 1) { each_blocks[i].m(ul, null); } current = true; }, p: function update(changed, ctx) { if (changed.twofactors) { each_value = ctx.twofactors; for (var 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(changed, child_ctx); each_blocks[i].i(1); } else { each_blocks[i] = create_each_block(child_ctx); each_blocks[i].c(); each_blocks[i].i(1); each_blocks[i].m(ul, null); } } internal_77(); for (; i < each_blocks.length; i += 1) outro_block(i, 1, 1); internal_78(); } }, i: function intro(local) { if (current) return; for (var i = 0; i < each_value.length; i += 1) each_blocks[i].i(); current = true; }, o: function outro(local) { each_blocks = each_blocks.filter(Boolean); for (let i = 0; i < each_blocks.length; i += 1) outro_block(i, 0); current = false; }, d: function destroy(detaching) { if (detaching) { internal_8(h3); internal_8(t_1); internal_8(ul); } internal_12(each_blocks, detaching); } }; } // (86:6) {#each twofactors as tf} function create_each_block(ctx) { var li, div0, t0, div1, t1_value = ctx.tf.name, t1, t2, current, dispose; var icon = new Icon({ props: { icon_name: ctx.tf.icon }, $$inline: true }); function click_handler() { return ctx.click_handler(ctx); } return { c: function create() { li = internal_13("li"); div0 = internal_13("div"); icon.$$.fragment.c(); t0 = internal_17(); div1 = internal_13("div"); t1 = internal_16(t1_value); t2 = internal_17(); div0.className = "icon svelte-w0gm0o"; internal_87(div0, file$8, 87, 9, 1624); div1.className = "name svelte-w0gm0o"; internal_87(div1, file$8, 91, 9, 1709); li.className = "svelte-w0gm0o"; internal_87(li, file$8, 86, 6, 1580); dispose = internal_19(li, "click", click_handler); }, m: function mount(target, anchor) { internal_7(target, li, anchor); internal_6(li, div0); internal_101(icon, div0, null); internal_6(li, t0); internal_6(li, div1); internal_6(div1, t1); internal_6(li, t2); current = true; }, p: function update(changed, new_ctx) { ctx = new_ctx; var icon_changes = {}; if (changed.twofactors) icon_changes.icon_name = ctx.tf.icon; icon.$set(icon_changes); }, i: function intro(local) { if (current) return; icon.$$.fragment.i(local); current = true; }, o: function outro(local) { icon.$$.fragment.o(local); current = false; }, d: function destroy(detaching) { if (detaching) { internal_8(li); } icon.$destroy(); dispose(); } }; } function create_fragment$8(ctx) { var div, current_block_type_index, if_block, current; var if_block_creators = [ create_if_block$2, create_if_block_1$1, create_if_block_2$1, create_if_block_3$1, create_if_block_4, create_else_block$2 ]; var if_blocks = []; function select_block_type(ctx) { if (!ctx.twofactor) return 0; if (ctx.twofactor.type === TFATypes.OTC) return 1; if (ctx.twofactor.type === TFATypes.BACKUP_CODE) return 2; if (ctx.twofactor.type === TFATypes.U2F) return 3; if (ctx.twofactor.type === TFATypes.APP_ALLOW) return 4; return 5; } current_block_type_index = select_block_type(ctx); if_block = if_blocks[current_block_type_index] = if_block_creators[current_block_type_index](ctx); return { c: function create() { div = internal_13("div"); if_block.c(); internal_87(div, file$8, 81, 0, 1461); }, 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) { internal_7(target, div, anchor); if_blocks[current_block_type_index].m(div, null); current = true; }, p: function update(changed, ctx) { var previous_block_index = current_block_type_index; current_block_type_index = select_block_type(ctx); if (current_block_type_index === previous_block_index) { if_blocks[current_block_type_index].p(changed, ctx); } else { internal_77(); internal_79(() => { if_blocks[previous_block_index].d(1); if_blocks[previous_block_index] = null; }); if_block.o(1); internal_78(); if_block = if_blocks[current_block_type_index]; if (!if_block) { if_block = if_blocks[current_block_type_index] = if_block_creators[current_block_type_index](ctx); if_block.c(); } if_block.i(1); if_block.m(div, null); } }, i: function intro(local) { if (current) return; if (if_block) if_block.i(); current = true; }, o: function outro(local) { if (if_block) if_block.o(); current = false; }, d: function destroy(detaching) { if (detaching) { internal_8(div); } if_blocks[current_block_type_index].d(); } }; } function getIcon(tf) { switch (tf.type) { case TFATypes.OTC: return "Authenticator" case TFATypes.BACKUP_CODE: return "BackupCode" case TFATypes.U2F: return "SecurityKey" case TFATypes.APP_ALLOW: return "AppPush" } } function instance$8($$self, $$props, $$invalidate) { let twofactors = Api.twofactor.map(tf => { return { ...tf, icon: getIcon(tf) } }); let twofactor = undefined; $$invalidate('twofactor', twofactor = twofactors[0]); function onFinish(res) { if (res) finish(); else $$invalidate('twofactor', twofactor = undefined); } let { finish } = $$props; function click_handler({ tf }) { const $$result = twofactor = tf; $$invalidate('twofactor', twofactor); return $$result; } $$self.$set = $$props => { if ('finish' in $$props) $$invalidate('finish', finish = $$props.finish); }; $$self.$$.update = ($$dirty = { twofactor: 1 }) => { if ($$dirty.twofactor) { console.log(twofactor); } }; return { twofactors, twofactor, onFinish, finish, click_handler }; } class Twofactor extends internal_104 { constructor(options) { super(options); internal_102(this, options, instance$8, create_fragment$8, internal_92, ["finish"]); const { ctx } = this.$$; const props = options.props || {}; if (ctx.finish === undefined && !('finish' in props)) { console.warn(" was created without expected prop 'finish'"); } } get finish() { throw new Error(": Props cannot be read directly from the component instance unless compiling with 'accessors: true' or ''"); } set finish(value) { throw new Error(": Props cannot be set directly on the component instance unless compiling with 'accessors: true' or ''"); } } /* src/Login/App.svelte generated by Svelte v3.2.1 */ const file$9 = "src/Login/App.svelte"; // (105:6) {#if loading} function create_if_block_3$2(ctx) { var div2, div1, div0; return { c: function create() { div2 = internal_13("div"); div1 = internal_13("div"); div0 = internal_13("div"); div0.className = "loader"; internal_87(div0, file$9, 107, 12, 2332); div1.className = "loader_box"; internal_87(div1, file$9, 106, 9, 2295); div2.className = "loader_container svelte-1ckcw4k"; internal_87(div2, file$9, 105, 6, 2255); }, m: function mount(target, anchor) { internal_7(target, div2, anchor); internal_6(div2, div1); internal_6(div1, div0); }, d: function destroy(detaching) { if (detaching) { internal_8(div2); } } }; } // (117:46) function create_if_block_2$2(ctx) { var current; var twofactor = new Twofactor({ props: { finish: ctx.afterTwoFactor, setLoading: ctx.func_1 }, $$inline: true }); return { c: function create() { twofactor.$$.fragment.c(); }, m: function mount(target, anchor) { internal_101(twofactor, target, anchor); current = true; }, p: function update(changed, ctx) { var twofactor_changes = {}; if (changed.afterTwoFactor) twofactor_changes.finish = ctx.afterTwoFactor; twofactor.$set(twofactor_changes); }, i: function intro(local) { if (current) return; twofactor.$$.fragment.i(local); current = true; }, o: function outro(local) { twofactor.$$.fragment.o(local); current = false; }, d: function destroy(detaching) { twofactor.$destroy(detaching); } }; } // (115:48) function create_if_block_1$2(ctx) { var current; var credentials = new Credentials({ props: { next: ctx.afterCredentials, setLoading: ctx.func }, $$inline: true }); return { c: function create() { credentials.$$.fragment.c(); }, m: function mount(target, anchor) { internal_101(credentials, target, anchor); current = true; }, p: function update(changed, ctx) { var credentials_changes = {}; if (changed.afterCredentials) credentials_changes.next = ctx.afterCredentials; credentials.$set(credentials_changes); }, i: function intro(local) { if (current) return; credentials.$$.fragment.i(local); current = true; }, o: function outro(local) { credentials.$$.fragment.o(local); current = false; }, d: function destroy(detaching) { credentials.$destroy(detaching); } }; } // (113:9) {#if state === states.redirect} function create_if_block$3(ctx) { var current; var redirect = new Redirect({ $$inline: true }); return { c: function create() { redirect.$$.fragment.c(); }, m: function mount(target, anchor) { internal_101(redirect, target, anchor); current = true; }, p: internal_83, i: function intro(local) { if (current) return; redirect.$$.fragment.i(local); current = true; }, o: function outro(local) { redirect.$$.fragment.o(local); current = false; }, d: function destroy(detaching) { redirect.$destroy(detaching); } }; } function create_fragment$9(ctx) { var div2, form, div0, h1, t1, t2, div1, current_block_type_index, if_block1, t3, footer, p, t4, t5, current; var if_block0 = (ctx.loading) && create_if_block_3$2(ctx); var if_block_creators = [ create_if_block$3, create_if_block_1$2, create_if_block_2$2 ]; var if_blocks = []; function select_block_type(ctx) { if (ctx.state === ctx.states.redirect) return 0; if (ctx.state === ctx.states.credentials) return 1; if (ctx.state === ctx.states.twofactor) return 2; 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); } return { c: function create() { div2 = internal_13("div"); form = internal_13("form"); div0 = internal_13("div"); h1 = internal_13("h1"); h1.textContent = "Login"; t1 = internal_17(); if (if_block0) if_block0.c(); t2 = internal_17(); div1 = internal_13("div"); if (if_block1) if_block1.c(); t3 = internal_17(); footer = internal_13("footer"); p = internal_13("p"); t4 = internal_16("Powered by "); t5 = internal_16(appname); internal_87(h1, file$9, 102, 9, 2201); div0.className = "card title-container svelte-1ckcw4k"; internal_87(div0, file$9, 101, 6, 2157); div1.className = "container svelte-1ckcw4k"; internal_40(div1, "loading_container", ctx.loading); internal_87(div1, file$9, 111, 6, 2406); form.action = "JavaScript:void(0)"; form.className = "card svelte-1ckcw4k"; internal_87(form, file$9, 100, 3, 2103); div2.className = "form-container svelte-1ckcw4k"; internal_87(div2, file$9, 99, 0, 2071); internal_87(p, file$9, 123, 1, 2843); footer.className = "svelte-1ckcw4k"; internal_87(footer, file$9, 122, 0, 2833); }, 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) { internal_7(target, div2, anchor); internal_6(div2, form); internal_6(form, div0); internal_6(div0, h1); internal_6(form, t1); if (if_block0) if_block0.m(form, null); internal_6(form, t2); internal_6(form, div1); if (~current_block_type_index) if_blocks[current_block_type_index].m(div1, null); internal_7(target, t3, anchor); internal_7(target, footer, anchor); internal_6(footer, p); internal_6(p, t4); internal_6(p, t5); current = true; }, p: function update(changed, ctx) { if (ctx.loading) { if (!if_block0) { if_block0 = create_if_block_3$2(ctx); if_block0.c(); if_block0.m(form, t2); } } else if (if_block0) { if_block0.d(1); if_block0 = null; } var 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(changed, ctx); } else { if (if_block1) { internal_77(); internal_79(() => { if_blocks[previous_block_index].d(1); if_blocks[previous_block_index] = null; }); if_block1.o(1); internal_78(); } 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(); } if_block1.i(1); if_block1.m(div1, null); } else { if_block1 = null; } } if (changed.loading) { internal_40(div1, "loading_container", ctx.loading); } }, i: function intro(local) { if (current) return; if (if_block1) if_block1.i(); current = true; }, o: function outro(local) { if (if_block1) if_block1.o(); current = false; }, d: function destroy(detaching) { if (detaching) { internal_8(div2); } if (if_block0) if_block0.d(); if (~current_block_type_index) if_blocks[current_block_type_index].d(); if (detaching) { internal_8(t3); internal_8(footer); } } }; } const appname = "OpenAuth"; function instance$9($$self, $$props, $$invalidate) { const states = { credentials: 1, twofactor: 3, redirect: 4 }; let username = Api.getUsername(); let loading = false; let state = states.credentials; function getButtonText(state) { switch (state) { case states.username: return "Next"; case states.password: return "Login"; default: return ""; } } function startRedirect() { $$invalidate('state', state = states.redirect); // Show message to User and then redirect setTimeout(() => Api.finish(), 2000); } function afterCredentials() { if (Api.twofactor) { $$invalidate('state', state = states.twofactor); } else { startRedirect(); } } function afterTwoFactor() { startRedirect(); } function func(s) { const $$result = loading = s; $$invalidate('loading', loading); return $$result; } function func_1(s) { const $$result = loading = s; $$invalidate('loading', loading); return $$result; } let btnText; $$self.$$.update = ($$dirty = { state: 1 }) => { if ($$dirty.state) { $$invalidate('btnText', btnText = getButtonText(state)); } }; return { states, loading, state, afterCredentials, afterTwoFactor, func, func_1 }; } class App extends internal_104 { constructor(options) { super(options); internal_102(this, options, instance$9, create_fragment$9, internal_92, []); } } var app = new App({ target: document.getElementById("content") }); return app; }()); //# sourceMappingURL=bundle.js.map