(function(l, r) { if (l.getElementById('livereloadscript')) return; r = l.createElement('script'); r.async = 1; r.src = '//' + (window.location.host || 'localhost').split(':')[0] + ':35729/livereload.js?snipver=1'; r.id = 'livereloadscript'; l.getElementsByTagName('head')[0].appendChild(r) })(window.document); var app = (function () { 'use strict'; function noop() { } function assign(tar, src) { // @ts-ignore for (const k in src) tar[k] = src[k]; return tar; } function add_location(element, file, line, column, char) { element.__svelte_meta = { loc: { file, line, column, char } }; } function run(fn) { return fn(); } function blank_object() { return Object.create(null); } function run_all(fns) { fns.forEach(run); } function is_function(thing) { return typeof thing === 'function'; } function safe_not_equal(a, b) { return a != a ? b == b : a !== b || ((a && typeof a === 'object') || typeof a === 'function'); } function is_empty(obj) { return Object.keys(obj).length === 0; } function validate_store(store, name) { if (store != null && typeof store.subscribe !== 'function') { throw new Error(`'${name}' is not a store with a 'subscribe' method`); } } function subscribe(store, ...callbacks) { if (store == null) { return noop; } const unsub = store.subscribe(...callbacks); return unsub.unsubscribe ? () => unsub.unsubscribe() : unsub; } function component_subscribe(component, store, callback) { component.$$.on_destroy.push(subscribe(store, callback)); } function create_slot(definition, ctx, $$scope, fn) { if (definition) { const slot_ctx = get_slot_context(definition, ctx, $$scope, fn); return definition[0](slot_ctx); } } function get_slot_context(definition, ctx, $$scope, fn) { return definition[1] && fn ? assign($$scope.ctx.slice(), definition[1](fn(ctx))) : $$scope.ctx; } function get_slot_changes(definition, $$scope, dirty, fn) { if (definition[2] && fn) { const lets = definition[2](fn(dirty)); if ($$scope.dirty === undefined) { return lets; } if (typeof lets === 'object') { const merged = []; const len = Math.max($$scope.dirty.length, lets.length); for (let i = 0; i < len; i += 1) { merged[i] = $$scope.dirty[i] | lets[i]; } return merged; } return $$scope.dirty | lets; } return $$scope.dirty; } function update_slot(slot, slot_definition, ctx, $$scope, dirty, get_slot_changes_fn, get_slot_context_fn) { const slot_changes = get_slot_changes(slot_definition, $$scope, dirty, get_slot_changes_fn); if (slot_changes) { const slot_context = get_slot_context(slot_definition, ctx, $$scope, get_slot_context_fn); slot.p(slot_context, slot_changes); } } function exclude_internal_props(props) { const result = {}; for (const k in props) if (k[0] !== '$') result[k] = props[k]; return result; } function compute_rest_props(props, keys) { const rest = {}; keys = new Set(keys); for (const k in props) if (!keys.has(k) && k[0] !== '$') rest[k] = props[k]; return rest; } function append(target, node) { target.appendChild(node); } function insert(target, node, anchor) { target.insertBefore(node, anchor || null); } function detach(node) { node.parentNode.removeChild(node); } function element(name) { return document.createElement(name); } function text(data) { return document.createTextNode(data); } function space() { return text(' '); } function empty() { return text(''); } function listen(node, event, handler, options) { node.addEventListener(event, handler, options); return () => node.removeEventListener(event, handler, options); } function prevent_default(fn) { return function (event) { event.preventDefault(); // @ts-ignore return fn.call(this, event); }; } function attr(node, attribute, value) { if (value == null) node.removeAttribute(attribute); else if (node.getAttribute(attribute) !== value) node.setAttribute(attribute, value); } function set_attributes(node, attributes) { // @ts-ignore const descriptors = Object.getOwnPropertyDescriptors(node.__proto__); for (const key in attributes) { if (attributes[key] == null) { node.removeAttribute(key); } else if (key === 'style') { node.style.cssText = attributes[key]; } else if (key === '__value') { node.value = node[key] = attributes[key]; } else if (descriptors[key] && descriptors[key].set) { node[key] = attributes[key]; } else { attr(node, key, attributes[key]); } } } function children(element) { return Array.from(element.childNodes); } function set_input_value(input, value) { input.value = value == null ? '' : value; } function custom_event(type, detail) { const e = document.createEvent('CustomEvent'); e.initCustomEvent(type, false, false, detail); return e; } let current_component; function set_current_component(component) { current_component = component; } function get_current_component() { if (!current_component) throw new Error('Function called outside component initialization'); return current_component; } function onMount(fn) { get_current_component().$$.on_mount.push(fn); } function onDestroy(fn) { get_current_component().$$.on_destroy.push(fn); } function createEventDispatcher() { const component = get_current_component(); return (type, detail) => { const callbacks = component.$$.callbacks[type]; if (callbacks) { // TODO are there situations where events could be dispatched // in a server (non-DOM) environment? const event = custom_event(type, detail); callbacks.slice().forEach(fn => { fn.call(component, event); }); } }; } function setContext(key, context) { get_current_component().$$.context.set(key, context); } function getContext(key) { return get_current_component().$$.context.get(key); } const dirty_components = []; const binding_callbacks = []; const render_callbacks = []; const flush_callbacks = []; const resolved_promise = Promise.resolve(); let update_scheduled = false; function schedule_update() { if (!update_scheduled) { update_scheduled = true; resolved_promise.then(flush); } } function add_render_callback(fn) { render_callbacks.push(fn); } let flushing = false; const seen_callbacks = new Set(); function flush() { if (flushing) return; flushing = true; do { // first, call beforeUpdate functions // and update components for (let i = 0; i < dirty_components.length; i += 1) { const component = dirty_components[i]; set_current_component(component); update(component.$$); } set_current_component(null); dirty_components.length = 0; while (binding_callbacks.length) binding_callbacks.pop()(); // then, once components are updated, call // afterUpdate functions. This may cause // subsequent updates... for (let i = 0; i < render_callbacks.length; i += 1) { const callback = render_callbacks[i]; if (!seen_callbacks.has(callback)) { // ...so guard against infinite loops seen_callbacks.add(callback); callback(); } } render_callbacks.length = 0; } while (dirty_components.length); while (flush_callbacks.length) { flush_callbacks.pop()(); } update_scheduled = false; flushing = false; seen_callbacks.clear(); } function update($$) { if ($$.fragment !== null) { $$.update(); run_all($$.before_update); const dirty = $$.dirty; $$.dirty = [-1]; $$.fragment && $$.fragment.p($$.ctx, dirty); $$.after_update.forEach(add_render_callback); } } const outroing = new Set(); let outros; function group_outros() { outros = { r: 0, c: [], p: outros // parent group }; } function check_outros() { if (!outros.r) { run_all(outros.c); } outros = outros.p; } function transition_in(block, local) { if (block && block.i) { outroing.delete(block); block.i(local); } } function transition_out(block, local, detach, callback) { if (block && block.o) { if (outroing.has(block)) return; outroing.add(block); outros.c.push(() => { outroing.delete(block); if (callback) { if (detach) block.d(1); callback(); } }); block.o(local); } } function outro_and_destroy_block(block, lookup) { transition_out(block, 1, 1, () => { lookup.delete(block.key); }); } function update_keyed_each(old_blocks, dirty, 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(child_ctx, dirty); } 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) { transition_in(block, 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 validate_each_keys(ctx, list, get_context, get_key) { const keys = new Set(); for (let i = 0; i < list.length; i++) { const key = get_key(get_context(ctx, list, i)); if (keys.has(key)) { throw new Error('Cannot have duplicate keys in a keyed each'); } keys.add(key); } } 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; } function get_spread_object(spread_props) { return typeof spread_props === 'object' && spread_props !== null ? spread_props : {}; } function create_component(block) { block && block.c(); } function mount_component(component, target, anchor, customElement) { const { fragment, on_mount, on_destroy, after_update } = component.$$; fragment && fragment.m(target, anchor); if (!customElement) { // onMount happens before the initial afterUpdate add_render_callback(() => { const new_on_destroy = on_mount.map(run).filter(is_function); if (on_destroy) { on_destroy.push(...new_on_destroy); } else { // Edge case - component was destroyed immediately, // most likely as a result of a binding initialising run_all(new_on_destroy); } component.$$.on_mount = []; }); } after_update.forEach(add_render_callback); } function destroy_component(component, detaching) { const $$ = component.$$; if ($$.fragment !== null) { run_all($$.on_destroy); $$.fragment && $$.fragment.d(detaching); // TODO null out other refs, including component.$$ (but need to // preserve final state?) $$.on_destroy = $$.fragment = null; $$.ctx = []; } } function make_dirty(component, i) { if (component.$$.dirty[0] === -1) { dirty_components.push(component); schedule_update(); component.$$.dirty.fill(0); } component.$$.dirty[(i / 31) | 0] |= (1 << (i % 31)); } function init(component, options, instance, create_fragment, not_equal, props, dirty = [-1]) { const parent_component = current_component; set_current_component(component); const $$ = component.$$ = { fragment: null, ctx: null, // state props, update: noop, not_equal, bound: blank_object(), // lifecycle on_mount: [], on_destroy: [], on_disconnect: [], before_update: [], after_update: [], context: new Map(parent_component ? parent_component.$$.context : options.context || []), // everything else callbacks: blank_object(), dirty, skip_bound: false }; let ready = false; $$.ctx = instance ? instance(component, options.props || {}, (i, ret, ...rest) => { const value = rest.length ? rest[0] : ret; if ($$.ctx && not_equal($$.ctx[i], $$.ctx[i] = value)) { if (!$$.skip_bound && $$.bound[i]) $$.bound[i](value); if (ready) make_dirty(component, i); } return ret; }) : []; $$.update(); ready = true; run_all($$.before_update); // `false` as a special case of no DOM component $$.fragment = create_fragment ? create_fragment($$.ctx) : false; if (options.target) { if (options.hydrate) { const nodes = children(options.target); // eslint-disable-next-line @typescript-eslint/no-non-null-assertion $$.fragment && $$.fragment.l(nodes); nodes.forEach(detach); } else { // eslint-disable-next-line @typescript-eslint/no-non-null-assertion $$.fragment && $$.fragment.c(); } if (options.intro) transition_in(component.$$.fragment); mount_component(component, options.target, options.anchor, options.customElement); flush(); } set_current_component(parent_component); } /** * Base class for Svelte components. Used when dev=false. */ class SvelteComponent { $destroy() { destroy_component(this, 1); this.$destroy = noop; } $on(type, callback) { const callbacks = (this.$$.callbacks[type] || (this.$$.callbacks[type] = [])); callbacks.push(callback); return () => { const index = callbacks.indexOf(callback); if (index !== -1) callbacks.splice(index, 1); }; } $set($$props) { if (this.$$set && !is_empty($$props)) { this.$$.skip_bound = true; this.$$set($$props); this.$$.skip_bound = false; } } } function dispatch_dev(type, detail) { document.dispatchEvent(custom_event(type, Object.assign({ version: '3.38.2' }, detail))); } function append_dev(target, node) { dispatch_dev('SvelteDOMInsert', { target, node }); append(target, node); } function insert_dev(target, node, anchor) { dispatch_dev('SvelteDOMInsert', { target, node, anchor }); insert(target, node, anchor); } function detach_dev(node) { dispatch_dev('SvelteDOMRemove', { node }); detach(node); } function listen_dev(node, event, handler, options, has_prevent_default, has_stop_propagation) { const modifiers = options === true ? ['capture'] : options ? Array.from(Object.keys(options)) : []; if (has_prevent_default) modifiers.push('preventDefault'); if (has_stop_propagation) modifiers.push('stopPropagation'); dispatch_dev('SvelteDOMAddEventListener', { node, event, handler, modifiers }); const dispose = listen(node, event, handler, options); return () => { dispatch_dev('SvelteDOMRemoveEventListener', { node, event, handler, modifiers }); dispose(); }; } function attr_dev(node, attribute, value) { attr(node, attribute, value); if (value == null) dispatch_dev('SvelteDOMRemoveAttribute', { node, attribute }); else dispatch_dev('SvelteDOMSetAttribute', { node, attribute, value }); } function set_data_dev(text, data) { data = '' + data; if (text.wholeText === data) return; dispatch_dev('SvelteDOMSetData', { node: text, data }); text.data = data; } function validate_each_argument(arg) { if (typeof arg !== 'string' && !(arg && typeof arg === 'object' && 'length' in arg)) { let msg = '{#each} only iterates over array-like objects.'; if (typeof Symbol === 'function' && arg && Symbol.iterator in arg) { msg += ' You can use a spread to convert this iterable into an array.'; } throw new Error(msg); } } function validate_slots(name, slot, keys) { for (const slot_key of Object.keys(slot)) { if (!~keys.indexOf(slot_key)) { console.warn(`<${name}> received an unexpected slot "${slot_key}".`); } } } /** * Base class for Svelte components with some minor dev-enhancements. Used when dev=true. */ class SvelteComponentDev extends SvelteComponent { constructor(options) { if (!options || (!options.target && !options.$$inline)) { throw new Error("'target' is a required option"); } super(); } $destroy() { super.$destroy(); this.$destroy = () => { console.warn('Component was already destroyed'); // eslint-disable-line no-console }; } $capture_state() { } $inject_state() { } } const subscriber_queue = []; /** * Creates a `Readable` store that allows reading by subscription. * @param value initial value * @param {StartStopNotifier}start start and stop notifications for subscriptions */ function readable(value, start) { return { subscribe: writable(value, start).subscribe }; } /** * Create a `Writable` store that allows both updating and reading by subscription. * @param {*=}value initial value * @param {StartStopNotifier=}start start and stop notifications for subscriptions */ function writable(value, start = noop) { let stop; const subscribers = []; function set(new_value) { if (safe_not_equal(value, new_value)) { value = new_value; if (stop) { // store is ready const run_queue = !subscriber_queue.length; for (let i = 0; i < subscribers.length; i += 1) { const s = subscribers[i]; s[1](); subscriber_queue.push(s, value); } if (run_queue) { for (let i = 0; i < subscriber_queue.length; i += 2) { subscriber_queue[i][0](subscriber_queue[i + 1]); } subscriber_queue.length = 0; } } } } function update(fn) { set(fn(value)); } function subscribe(run, invalidate = noop) { const subscriber = [run, invalidate]; subscribers.push(subscriber); if (subscribers.length === 1) { stop = start(set) || noop; } run(value); return () => { const index = subscribers.indexOf(subscriber); if (index !== -1) { subscribers.splice(index, 1); } if (subscribers.length === 0) { stop(); stop = null; } }; } return { set, update, subscribe }; } function derived(stores, fn, initial_value) { const single = !Array.isArray(stores); const stores_array = single ? [stores] : stores; const auto = fn.length < 2; return readable(initial_value, (set) => { let inited = false; const values = []; let pending = 0; let cleanup = noop; const sync = () => { if (pending) { return; } cleanup(); const result = fn(single ? values[0] : values, set); if (auto) { set(result); } else { cleanup = is_function(result) ? result : noop; } }; const unsubscribers = stores_array.map((store, i) => subscribe(store, (value) => { values[i] = value; pending &= ~(1 << i); if (inited) { sync(); } }, () => { pending |= (1 << i); })); inited = true; sync(); return function stop() { run_all(unsubscribers); cleanup(); }; }); } const LOCATION = {}; const ROUTER = {}; /** * Adapted from https://github.com/reach/router/blob/b60e6dd781d5d3a4bdaaf4de665649c0f6a7e78d/src/lib/history.js * * https://github.com/reach/router/blob/master/LICENSE * */ function getLocation(source) { return { ...source.location, state: source.history.state, key: (source.history.state && source.history.state.key) || "initial" }; } function createHistory(source, options) { const listeners = []; let location = getLocation(source); return { get location() { return location; }, listen(listener) { listeners.push(listener); const popstateListener = () => { location = getLocation(source); listener({ location, action: "POP" }); }; source.addEventListener("popstate", popstateListener); return () => { source.removeEventListener("popstate", popstateListener); const index = listeners.indexOf(listener); listeners.splice(index, 1); }; }, navigate(to, { state, replace = false } = {}) { state = { ...state, key: Date.now() + "" }; // try...catch iOS Safari limits to 100 pushState calls try { if (replace) { source.history.replaceState(state, null, to); } else { source.history.pushState(state, null, to); } } catch (e) { source.location[replace ? "replace" : "assign"](to); } location = getLocation(source); listeners.forEach(listener => listener({ location, action: "PUSH" })); } }; } // Stores history entries in memory for testing or other platforms like Native function createMemorySource(initialPathname = "/") { let index = 0; const stack = [{ pathname: initialPathname, search: "" }]; const states = []; return { get location() { return stack[index]; }, addEventListener(name, fn) {}, removeEventListener(name, fn) {}, history: { get entries() { return stack; }, get index() { return index; }, get state() { return states[index]; }, pushState(state, _, uri) { const [pathname, search = ""] = uri.split("?"); index++; stack.push({ pathname, search }); states.push(state); }, replaceState(state, _, uri) { const [pathname, search = ""] = uri.split("?"); stack[index] = { pathname, search }; states[index] = state; } } }; } // Global history uses window.history as the source if available, // otherwise a memory history const canUseDOM = Boolean( typeof window !== "undefined" && window.document && window.document.createElement ); const globalHistory = createHistory(canUseDOM ? window : createMemorySource()); const { navigate } = globalHistory; /** * Adapted from https://github.com/reach/router/blob/b60e6dd781d5d3a4bdaaf4de665649c0f6a7e78d/src/lib/utils.js * * https://github.com/reach/router/blob/master/LICENSE * */ const paramRe = /^:(.+)/; const SEGMENT_POINTS = 4; const STATIC_POINTS = 3; const DYNAMIC_POINTS = 2; const SPLAT_PENALTY = 1; const ROOT_POINTS = 1; /** * Check if `string` starts with `search` * @param {string} string * @param {string} search * @return {boolean} */ function startsWith(string, search) { return string.substr(0, search.length) === search; } /** * Check if `segment` is a root segment * @param {string} segment * @return {boolean} */ function isRootSegment(segment) { return segment === ""; } /** * Check if `segment` is a dynamic segment * @param {string} segment * @return {boolean} */ function isDynamic(segment) { return paramRe.test(segment); } /** * Check if `segment` is a splat * @param {string} segment * @return {boolean} */ function isSplat(segment) { return segment[0] === "*"; } /** * Split up the URI into segments delimited by `/` * @param {string} uri * @return {string[]} */ function segmentize(uri) { return ( uri // Strip starting/ending `/` .replace(/(^\/+|\/+$)/g, "") .split("/") ); } /** * Strip `str` of potential start and end `/` * @param {string} str * @return {string} */ function stripSlashes(str) { return str.replace(/(^\/+|\/+$)/g, ""); } /** * Score a route depending on how its individual segments look * @param {object} route * @param {number} index * @return {object} */ function rankRoute(route, index) { const score = route.default ? 0 : segmentize(route.path).reduce((score, segment) => { score += SEGMENT_POINTS; if (isRootSegment(segment)) { score += ROOT_POINTS; } else if (isDynamic(segment)) { score += DYNAMIC_POINTS; } else if (isSplat(segment)) { score -= SEGMENT_POINTS + SPLAT_PENALTY; } else { score += STATIC_POINTS; } return score; }, 0); return { route, score, index }; } /** * Give a score to all routes and sort them on that * @param {object[]} routes * @return {object[]} */ function rankRoutes(routes) { return ( routes .map(rankRoute) // If two routes have the exact same score, we go by index instead .sort((a, b) => a.score < b.score ? 1 : a.score > b.score ? -1 : a.index - b.index ) ); } /** * Ranks and picks the best route to match. Each segment gets the highest * amount of points, then the type of segment gets an additional amount of * points where * * static > dynamic > splat > root * * This way we don't have to worry about the order of our routes, let the * computers do it. * * A route looks like this * * { path, default, value } * * And a returned match looks like: * * { route, params, uri } * * @param {object[]} routes * @param {string} uri * @return {?object} */ function pick(routes, uri) { let match; let default_; const [uriPathname] = uri.split("?"); const uriSegments = segmentize(uriPathname); const isRootUri = uriSegments[0] === ""; const ranked = rankRoutes(routes); for (let i = 0, l = ranked.length; i < l; i++) { const route = ranked[i].route; let missed = false; if (route.default) { default_ = { route, params: {}, uri }; continue; } const routeSegments = segmentize(route.path); const params = {}; const max = Math.max(uriSegments.length, routeSegments.length); let index = 0; for (; index < max; index++) { const routeSegment = routeSegments[index]; const uriSegment = uriSegments[index]; if (routeSegment !== undefined && isSplat(routeSegment)) { // Hit a splat, just grab the rest, and return a match // uri: /files/documents/work // route: /files/* or /files/*splatname const splatName = routeSegment === "*" ? "*" : routeSegment.slice(1); params[splatName] = uriSegments .slice(index) .map(decodeURIComponent) .join("/"); break; } if (uriSegment === undefined) { // URI is shorter than the route, no match // uri: /users // route: /users/:userId missed = true; break; } let dynamicMatch = paramRe.exec(routeSegment); if (dynamicMatch && !isRootUri) { const value = decodeURIComponent(uriSegment); params[dynamicMatch[1]] = value; } else if (routeSegment !== uriSegment) { // Current segments don't match, not dynamic, not splat, so no match // uri: /users/123/settings // route: /users/:id/profile missed = true; break; } } if (!missed) { match = { route, params, uri: "/" + uriSegments.slice(0, index).join("/") }; break; } } return match || default_ || null; } /** * Check if the `path` matches the `uri`. * @param {string} path * @param {string} uri * @return {?object} */ function match(route, uri) { return pick([route], uri); } /** * Add the query to the pathname if a query is given * @param {string} pathname * @param {string} [query] * @return {string} */ function addQuery(pathname, query) { return pathname + (query ? `?${query}` : ""); } /** * Resolve URIs as though every path is a directory, no files. Relative URIs * in the browser can feel awkward because not only can you be "in a directory", * you can be "at a file", too. For example: * * browserSpecResolve('foo', '/bar/') => /bar/foo * browserSpecResolve('foo', '/bar') => /foo * * But on the command line of a file system, it's not as complicated. You can't * `cd` from a file, only directories. This way, links have to know less about * their current path. To go deeper you can do this: * * * // instead of * * * Just like `cd`, if you want to go deeper from the command line, you do this: * * cd deeper * # not * cd $(pwd)/deeper * * By treating every path as a directory, linking to relative paths should * require less contextual information and (fingers crossed) be more intuitive. * @param {string} to * @param {string} base * @return {string} */ function resolve(to, base) { // /foo/bar, /baz/qux => /foo/bar if (startsWith(to, "/")) { return to; } const [toPathname, toQuery] = to.split("?"); const [basePathname] = base.split("?"); const toSegments = segmentize(toPathname); const baseSegments = segmentize(basePathname); // ?a=b, /users?b=c => /users?a=b if (toSegments[0] === "") { return addQuery(basePathname, toQuery); } // profile, /users/789 => /users/789/profile if (!startsWith(toSegments[0], ".")) { const pathname = baseSegments.concat(toSegments).join("/"); return addQuery((basePathname === "/" ? "" : "/") + pathname, toQuery); } // ./ , /users/123 => /users/123 // ../ , /users/123 => /users // ../.. , /users/123 => / // ../../one, /a/b/c/d => /a/b/one // .././one , /a/b/c/d => /a/b/c/one const allSegments = baseSegments.concat(toSegments); const segments = []; allSegments.forEach(segment => { if (segment === "..") { segments.pop(); } else if (segment !== ".") { segments.push(segment); } }); return addQuery("/" + segments.join("/"), toQuery); } /** * Combines the `basepath` and the `path` into one path. * @param {string} basepath * @param {string} path */ function combinePaths(basepath, path) { return `${stripSlashes( path === "/" ? basepath : `${stripSlashes(basepath)}/${stripSlashes(path)}` )}/`; } /** * Decides whether a given `event` should result in a navigation or not. * @param {object} event */ function shouldNavigate(event) { return ( !event.defaultPrevented && event.button === 0 && !(event.metaKey || event.altKey || event.ctrlKey || event.shiftKey) ); } /* node_modules/svelte-routing/src/Router.svelte generated by Svelte v3.38.2 */ function create_fragment$9(ctx) { let current; const default_slot_template = /*#slots*/ ctx[9].default; const default_slot = create_slot(default_slot_template, ctx, /*$$scope*/ ctx[8], null); const block = { c: function create() { if (default_slot) default_slot.c(); }, 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 (default_slot) { default_slot.m(target, anchor); } current = true; }, p: function update(ctx, [dirty]) { if (default_slot) { if (default_slot.p && (!current || dirty & /*$$scope*/ 256)) { update_slot(default_slot, default_slot_template, ctx, /*$$scope*/ ctx[8], dirty, null, null); } } }, i: function intro(local) { if (current) return; transition_in(default_slot, local); current = true; }, o: function outro(local) { transition_out(default_slot, local); current = false; }, d: function destroy(detaching) { if (default_slot) default_slot.d(detaching); } }; dispatch_dev("SvelteRegisterBlock", { block, id: create_fragment$9.name, type: "component", source: "", ctx }); return block; } function instance$9($$self, $$props, $$invalidate) { let $base; let $location; let $routes; let { $$slots: slots = {}, $$scope } = $$props; validate_slots("Router", slots, ['default']); let { basepath = "/" } = $$props; let { url = null } = $$props; const locationContext = getContext(LOCATION); const routerContext = getContext(ROUTER); const routes = writable([]); validate_store(routes, "routes"); component_subscribe($$self, routes, value => $$invalidate(7, $routes = value)); const activeRoute = writable(null); let hasActiveRoute = false; // Used in SSR to synchronously set that a Route is active. // If locationContext is not set, this is the topmost Router in the tree. // If the `url` prop is given we force the location to it. const location = locationContext || writable(url ? { pathname: url } : globalHistory.location); validate_store(location, "location"); component_subscribe($$self, location, value => $$invalidate(6, $location = value)); // If routerContext is set, the routerBase of the parent Router // will be the base for this Router's descendants. // If routerContext is not set, the path and resolved uri will both // have the value of the basepath prop. const base = routerContext ? routerContext.routerBase : writable({ path: basepath, uri: basepath }); validate_store(base, "base"); component_subscribe($$self, base, value => $$invalidate(5, $base = value)); const routerBase = derived([base, activeRoute], ([base, activeRoute]) => { // If there is no activeRoute, the routerBase will be identical to the base. if (activeRoute === null) { return base; } const { path: basepath } = base; const { route, uri } = activeRoute; // Remove the potential /* or /*splatname from // the end of the child Routes relative paths. const path = route.default ? basepath : route.path.replace(/\*.*$/, ""); return { path, uri }; }); function registerRoute(route) { const { path: basepath } = $base; let { path } = route; // We store the original path in the _path property so we can reuse // it when the basepath changes. The only thing that matters is that // the route reference is intact, so mutation is fine. route._path = path; route.path = combinePaths(basepath, path); if (typeof window === "undefined") { // In SSR we should set the activeRoute immediately if it is a match. // If there are more Routes being registered after a match is found, // we just skip them. if (hasActiveRoute) { return; } const matchingRoute = match(route, $location.pathname); if (matchingRoute) { activeRoute.set(matchingRoute); hasActiveRoute = true; } } else { routes.update(rs => { rs.push(route); return rs; }); } } function unregisterRoute(route) { routes.update(rs => { const index = rs.indexOf(route); rs.splice(index, 1); return rs; }); } if (!locationContext) { // The topmost Router in the tree is responsible for updating // the location store and supplying it through context. onMount(() => { const unlisten = globalHistory.listen(history => { location.set(history.location); }); return unlisten; }); setContext(LOCATION, location); } setContext(ROUTER, { activeRoute, base, routerBase, registerRoute, unregisterRoute }); const writable_props = ["basepath", "url"]; Object.keys($$props).forEach(key => { if (!~writable_props.indexOf(key) && key.slice(0, 2) !== "$$") console.warn(` was created with unknown prop '${key}'`); }); $$self.$$set = $$props => { if ("basepath" in $$props) $$invalidate(3, basepath = $$props.basepath); if ("url" in $$props) $$invalidate(4, url = $$props.url); if ("$$scope" in $$props) $$invalidate(8, $$scope = $$props.$$scope); }; $$self.$capture_state = () => ({ getContext, setContext, onMount, writable, derived, LOCATION, ROUTER, globalHistory, pick, match, stripSlashes, combinePaths, basepath, url, locationContext, routerContext, routes, activeRoute, hasActiveRoute, location, base, routerBase, registerRoute, unregisterRoute, $base, $location, $routes }); $$self.$inject_state = $$props => { if ("basepath" in $$props) $$invalidate(3, basepath = $$props.basepath); if ("url" in $$props) $$invalidate(4, url = $$props.url); if ("hasActiveRoute" in $$props) hasActiveRoute = $$props.hasActiveRoute; }; if ($$props && "$$inject" in $$props) { $$self.$inject_state($$props.$$inject); } $$self.$$.update = () => { if ($$self.$$.dirty & /*$base*/ 32) { // This reactive statement will update all the Routes' path when // the basepath changes. { const { path: basepath } = $base; routes.update(rs => { rs.forEach(r => r.path = combinePaths(basepath, r._path)); return rs; }); } } if ($$self.$$.dirty & /*$routes, $location*/ 192) { // This reactive statement will be run when the Router is created // when there are no Routes and then again the following tick, so it // will not find an active Route in SSR and in the browser it will only // pick an active Route after all Routes have been registered. { const bestMatch = pick($routes, $location.pathname); activeRoute.set(bestMatch); } } }; return [ routes, location, base, basepath, url, $base, $location, $routes, $$scope, slots ]; } class Router extends SvelteComponentDev { constructor(options) { super(options); init(this, options, instance$9, create_fragment$9, safe_not_equal, { basepath: 3, url: 4 }); dispatch_dev("SvelteRegisterComponent", { component: this, tagName: "Router", options, id: create_fragment$9.name }); } get basepath() { throw new Error(": Props cannot be read directly from the component instance unless compiling with 'accessors: true' or ''"); } set basepath(value) { throw new Error(": Props cannot be set directly on the component instance unless compiling with 'accessors: true' or ''"); } get url() { throw new Error(": Props cannot be read directly from the component instance unless compiling with 'accessors: true' or ''"); } set url(value) { throw new Error(": Props cannot be set directly on the component instance unless compiling with 'accessors: true' or ''"); } } /* node_modules/svelte-routing/src/Route.svelte generated by Svelte v3.38.2 */ const get_default_slot_changes = dirty => ({ params: dirty & /*routeParams*/ 4, location: dirty & /*$location*/ 16 }); const get_default_slot_context = ctx => ({ params: /*routeParams*/ ctx[2], location: /*$location*/ ctx[4] }); // (40:0) {#if $activeRoute !== null && $activeRoute.route === route} function create_if_block$2(ctx) { let current_block_type_index; let if_block; let if_block_anchor; let current; const if_block_creators = [create_if_block_1$1, create_else_block$1]; const if_blocks = []; function select_block_type(ctx, dirty) { if (/*component*/ ctx[0] !== null) return 0; return 1; } current_block_type_index = select_block_type(ctx); if_block = if_blocks[current_block_type_index] = if_block_creators[current_block_type_index](ctx); const block = { c: function create() { if_block.c(); if_block_anchor = empty(); }, m: function mount(target, anchor) { if_blocks[current_block_type_index].m(target, anchor); insert_dev(target, if_block_anchor, anchor); current = true; }, p: function update(ctx, dirty) { let previous_block_index = current_block_type_index; current_block_type_index = select_block_type(ctx); if (current_block_type_index === previous_block_index) { if_blocks[current_block_type_index].p(ctx, dirty); } else { group_outros(); transition_out(if_blocks[previous_block_index], 1, 1, () => { if_blocks[previous_block_index] = null; }); check_outros(); 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(); } else { if_block.p(ctx, dirty); } transition_in(if_block, 1); if_block.m(if_block_anchor.parentNode, if_block_anchor); } }, i: function intro(local) { if (current) return; transition_in(if_block); current = true; }, o: function outro(local) { transition_out(if_block); current = false; }, d: function destroy(detaching) { if_blocks[current_block_type_index].d(detaching); if (detaching) detach_dev(if_block_anchor); } }; dispatch_dev("SvelteRegisterBlock", { block, id: create_if_block$2.name, type: "if", source: "(40:0) {#if $activeRoute !== null && $activeRoute.route === route}", ctx }); return block; } // (43:2) {:else} function create_else_block$1(ctx) { let current; const default_slot_template = /*#slots*/ ctx[10].default; const default_slot = create_slot(default_slot_template, ctx, /*$$scope*/ ctx[9], get_default_slot_context); const block = { c: function create() { if (default_slot) default_slot.c(); }, m: function mount(target, anchor) { if (default_slot) { default_slot.m(target, anchor); } current = true; }, p: function update(ctx, dirty) { if (default_slot) { if (default_slot.p && (!current || dirty & /*$$scope, routeParams, $location*/ 532)) { update_slot(default_slot, default_slot_template, ctx, /*$$scope*/ ctx[9], dirty, get_default_slot_changes, get_default_slot_context); } } }, i: function intro(local) { if (current) return; transition_in(default_slot, local); current = true; }, o: function outro(local) { transition_out(default_slot, local); current = false; }, d: function destroy(detaching) { if (default_slot) default_slot.d(detaching); } }; dispatch_dev("SvelteRegisterBlock", { block, id: create_else_block$1.name, type: "else", source: "(43:2) {:else}", ctx }); return block; } // (41:2) {#if component !== null} function create_if_block_1$1(ctx) { let switch_instance; let switch_instance_anchor; let current; const switch_instance_spread_levels = [ { location: /*$location*/ ctx[4] }, /*routeParams*/ ctx[2], /*routeProps*/ ctx[3] ]; var switch_value = /*component*/ ctx[0]; function switch_props(ctx) { let switch_instance_props = {}; for (let i = 0; i < switch_instance_spread_levels.length; i += 1) { switch_instance_props = assign(switch_instance_props, switch_instance_spread_levels[i]); } return { props: switch_instance_props, $$inline: true }; } if (switch_value) { switch_instance = new switch_value(switch_props()); } const block = { c: function create() { if (switch_instance) create_component(switch_instance.$$.fragment); switch_instance_anchor = empty(); }, m: function mount(target, anchor) { if (switch_instance) { mount_component(switch_instance, target, anchor); } insert_dev(target, switch_instance_anchor, anchor); current = true; }, p: function update(ctx, dirty) { const switch_instance_changes = (dirty & /*$location, routeParams, routeProps*/ 28) ? get_spread_update(switch_instance_spread_levels, [ dirty & /*$location*/ 16 && { location: /*$location*/ ctx[4] }, dirty & /*routeParams*/ 4 && get_spread_object(/*routeParams*/ ctx[2]), dirty & /*routeProps*/ 8 && get_spread_object(/*routeProps*/ ctx[3]) ]) : {}; if (switch_value !== (switch_value = /*component*/ ctx[0])) { if (switch_instance) { group_outros(); const old_component = switch_instance; transition_out(old_component.$$.fragment, 1, 0, () => { destroy_component(old_component, 1); }); check_outros(); } if (switch_value) { switch_instance = new switch_value(switch_props()); create_component(switch_instance.$$.fragment); transition_in(switch_instance.$$.fragment, 1); mount_component(switch_instance, switch_instance_anchor.parentNode, switch_instance_anchor); } else { switch_instance = null; } } else if (switch_value) { switch_instance.$set(switch_instance_changes); } }, i: function intro(local) { if (current) return; if (switch_instance) transition_in(switch_instance.$$.fragment, local); current = true; }, o: function outro(local) { if (switch_instance) transition_out(switch_instance.$$.fragment, local); current = false; }, d: function destroy(detaching) { if (detaching) detach_dev(switch_instance_anchor); if (switch_instance) destroy_component(switch_instance, detaching); } }; dispatch_dev("SvelteRegisterBlock", { block, id: create_if_block_1$1.name, type: "if", source: "(41:2) {#if component !== null}", ctx }); return block; } function create_fragment$8(ctx) { let if_block_anchor; let current; let if_block = /*$activeRoute*/ ctx[1] !== null && /*$activeRoute*/ ctx[1].route === /*route*/ ctx[7] && create_if_block$2(ctx); const block = { c: function create() { if (if_block) if_block.c(); if_block_anchor = empty(); }, l: function claim(nodes) { throw new Error("options.hydrate only works if the component was compiled with the `hydratable: true` option"); }, m: function mount(target, anchor) { if (if_block) if_block.m(target, anchor); insert_dev(target, if_block_anchor, anchor); current = true; }, p: function update(ctx, [dirty]) { if (/*$activeRoute*/ ctx[1] !== null && /*$activeRoute*/ ctx[1].route === /*route*/ ctx[7]) { if (if_block) { if_block.p(ctx, dirty); if (dirty & /*$activeRoute*/ 2) { transition_in(if_block, 1); } } else { if_block = create_if_block$2(ctx); if_block.c(); transition_in(if_block, 1); if_block.m(if_block_anchor.parentNode, if_block_anchor); } } else if (if_block) { group_outros(); transition_out(if_block, 1, 1, () => { if_block = null; }); check_outros(); } }, i: function intro(local) { if (current) return; transition_in(if_block); current = true; }, o: function outro(local) { transition_out(if_block); current = false; }, d: function destroy(detaching) { if (if_block) if_block.d(detaching); if (detaching) detach_dev(if_block_anchor); } }; dispatch_dev("SvelteRegisterBlock", { block, id: create_fragment$8.name, type: "component", source: "", ctx }); return block; } function instance$8($$self, $$props, $$invalidate) { let $activeRoute; let $location; let { $$slots: slots = {}, $$scope } = $$props; validate_slots("Route", slots, ['default']); let { path = "" } = $$props; let { component = null } = $$props; const { registerRoute, unregisterRoute, activeRoute } = getContext(ROUTER); validate_store(activeRoute, "activeRoute"); component_subscribe($$self, activeRoute, value => $$invalidate(1, $activeRoute = value)); const location = getContext(LOCATION); validate_store(location, "location"); component_subscribe($$self, location, value => $$invalidate(4, $location = value)); const route = { path, // If no path prop is given, this Route will act as the default Route // that is rendered if no other Route in the Router is a match. default: path === "" }; let routeParams = {}; let routeProps = {}; registerRoute(route); // There is no need to unregister Routes in SSR since it will all be // thrown away anyway. if (typeof window !== "undefined") { onDestroy(() => { unregisterRoute(route); }); } $$self.$$set = $$new_props => { $$invalidate(13, $$props = assign(assign({}, $$props), exclude_internal_props($$new_props))); if ("path" in $$new_props) $$invalidate(8, path = $$new_props.path); if ("component" in $$new_props) $$invalidate(0, component = $$new_props.component); if ("$$scope" in $$new_props) $$invalidate(9, $$scope = $$new_props.$$scope); }; $$self.$capture_state = () => ({ getContext, onDestroy, ROUTER, LOCATION, path, component, registerRoute, unregisterRoute, activeRoute, location, route, routeParams, routeProps, $activeRoute, $location }); $$self.$inject_state = $$new_props => { $$invalidate(13, $$props = assign(assign({}, $$props), $$new_props)); if ("path" in $$props) $$invalidate(8, path = $$new_props.path); if ("component" in $$props) $$invalidate(0, component = $$new_props.component); if ("routeParams" in $$props) $$invalidate(2, routeParams = $$new_props.routeParams); if ("routeProps" in $$props) $$invalidate(3, routeProps = $$new_props.routeProps); }; if ($$props && "$$inject" in $$props) { $$self.$inject_state($$props.$$inject); } $$self.$$.update = () => { if ($$self.$$.dirty & /*$activeRoute*/ 2) { if ($activeRoute && $activeRoute.route === route) { $$invalidate(2, routeParams = $activeRoute.params); } } { const { path, component, ...rest } = $$props; $$invalidate(3, routeProps = rest); } }; $$props = exclude_internal_props($$props); return [ component, $activeRoute, routeParams, routeProps, $location, activeRoute, location, route, path, $$scope, slots ]; } class Route extends SvelteComponentDev { constructor(options) { super(options); init(this, options, instance$8, create_fragment$8, safe_not_equal, { path: 8, component: 0 }); dispatch_dev("SvelteRegisterComponent", { component: this, tagName: "Route", options, id: create_fragment$8.name }); } get path() { throw new Error(": Props cannot be read directly from the component instance unless compiling with 'accessors: true' or ''"); } set path(value) { throw new Error(": Props cannot be set directly on the component instance unless compiling with 'accessors: true' or ''"); } get component() { throw new Error(": Props cannot be read directly from the component instance unless compiling with 'accessors: true' or ''"); } set component(value) { throw new Error(": Props cannot be set directly on the component instance unless compiling with 'accessors: true' or ''"); } } /* node_modules/svelte-routing/src/Link.svelte generated by Svelte v3.38.2 */ const file$6 = "node_modules/svelte-routing/src/Link.svelte"; function create_fragment$7(ctx) { let a; let current; let mounted; let dispose; const default_slot_template = /*#slots*/ ctx[16].default; const default_slot = create_slot(default_slot_template, ctx, /*$$scope*/ ctx[15], null); let a_levels = [ { href: /*href*/ ctx[0] }, { "aria-current": /*ariaCurrent*/ ctx[2] }, /*props*/ ctx[1], /*$$restProps*/ ctx[6] ]; let a_data = {}; for (let i = 0; i < a_levels.length; i += 1) { a_data = assign(a_data, a_levels[i]); } const block = { c: function create() { a = element("a"); if (default_slot) default_slot.c(); set_attributes(a, a_data); add_location(a, file$6, 40, 0, 1249); }, l: function claim(nodes) { throw new Error("options.hydrate only works if the component was compiled with the `hydratable: true` option"); }, m: function mount(target, anchor) { insert_dev(target, a, anchor); if (default_slot) { default_slot.m(a, null); } current = true; if (!mounted) { dispose = listen_dev(a, "click", /*onClick*/ ctx[5], false, false, false); mounted = true; } }, p: function update(ctx, [dirty]) { if (default_slot) { if (default_slot.p && (!current || dirty & /*$$scope*/ 32768)) { update_slot(default_slot, default_slot_template, ctx, /*$$scope*/ ctx[15], dirty, null, null); } } set_attributes(a, a_data = get_spread_update(a_levels, [ (!current || dirty & /*href*/ 1) && { href: /*href*/ ctx[0] }, (!current || dirty & /*ariaCurrent*/ 4) && { "aria-current": /*ariaCurrent*/ ctx[2] }, dirty & /*props*/ 2 && /*props*/ ctx[1], dirty & /*$$restProps*/ 64 && /*$$restProps*/ ctx[6] ])); }, i: function intro(local) { if (current) return; transition_in(default_slot, local); current = true; }, o: function outro(local) { transition_out(default_slot, local); current = false; }, d: function destroy(detaching) { if (detaching) detach_dev(a); if (default_slot) default_slot.d(detaching); mounted = false; dispose(); } }; dispatch_dev("SvelteRegisterBlock", { block, id: create_fragment$7.name, type: "component", source: "", ctx }); return block; } function instance$7($$self, $$props, $$invalidate) { let ariaCurrent; const omit_props_names = ["to","replace","state","getProps"]; let $$restProps = compute_rest_props($$props, omit_props_names); let $base; let $location; let { $$slots: slots = {}, $$scope } = $$props; validate_slots("Link", slots, ['default']); let { to = "#" } = $$props; let { replace = false } = $$props; let { state = {} } = $$props; let { getProps = () => ({}) } = $$props; const { base } = getContext(ROUTER); validate_store(base, "base"); component_subscribe($$self, base, value => $$invalidate(13, $base = value)); const location = getContext(LOCATION); validate_store(location, "location"); component_subscribe($$self, location, value => $$invalidate(14, $location = value)); const dispatch = createEventDispatcher(); let href, isPartiallyCurrent, isCurrent, props; function onClick(event) { dispatch("click", event); if (shouldNavigate(event)) { event.preventDefault(); // Don't push another entry to the history stack when the user // clicks on a Link to the page they are currently on. const shouldReplace = $location.pathname === href || replace; navigate(href, { state, replace: shouldReplace }); } } $$self.$$set = $$new_props => { $$props = assign(assign({}, $$props), exclude_internal_props($$new_props)); $$invalidate(6, $$restProps = compute_rest_props($$props, omit_props_names)); if ("to" in $$new_props) $$invalidate(7, to = $$new_props.to); if ("replace" in $$new_props) $$invalidate(8, replace = $$new_props.replace); if ("state" in $$new_props) $$invalidate(9, state = $$new_props.state); if ("getProps" in $$new_props) $$invalidate(10, getProps = $$new_props.getProps); if ("$$scope" in $$new_props) $$invalidate(15, $$scope = $$new_props.$$scope); }; $$self.$capture_state = () => ({ getContext, createEventDispatcher, ROUTER, LOCATION, navigate, startsWith, resolve, shouldNavigate, to, replace, state, getProps, base, location, dispatch, href, isPartiallyCurrent, isCurrent, props, onClick, $base, $location, ariaCurrent }); $$self.$inject_state = $$new_props => { if ("to" in $$props) $$invalidate(7, to = $$new_props.to); if ("replace" in $$props) $$invalidate(8, replace = $$new_props.replace); if ("state" in $$props) $$invalidate(9, state = $$new_props.state); if ("getProps" in $$props) $$invalidate(10, getProps = $$new_props.getProps); if ("href" in $$props) $$invalidate(0, href = $$new_props.href); if ("isPartiallyCurrent" in $$props) $$invalidate(11, isPartiallyCurrent = $$new_props.isPartiallyCurrent); if ("isCurrent" in $$props) $$invalidate(12, isCurrent = $$new_props.isCurrent); if ("props" in $$props) $$invalidate(1, props = $$new_props.props); if ("ariaCurrent" in $$props) $$invalidate(2, ariaCurrent = $$new_props.ariaCurrent); }; if ($$props && "$$inject" in $$props) { $$self.$inject_state($$props.$$inject); } $$self.$$.update = () => { if ($$self.$$.dirty & /*to, $base*/ 8320) { $$invalidate(0, href = to === "/" ? $base.uri : resolve(to, $base.uri)); } if ($$self.$$.dirty & /*$location, href*/ 16385) { $$invalidate(11, isPartiallyCurrent = startsWith($location.pathname, href)); } if ($$self.$$.dirty & /*href, $location*/ 16385) { $$invalidate(12, isCurrent = href === $location.pathname); } if ($$self.$$.dirty & /*isCurrent*/ 4096) { $$invalidate(2, ariaCurrent = isCurrent ? "page" : undefined); } if ($$self.$$.dirty & /*getProps, $location, href, isPartiallyCurrent, isCurrent*/ 23553) { $$invalidate(1, props = getProps({ location: $location, href, isPartiallyCurrent, isCurrent })); } }; return [ href, props, ariaCurrent, base, location, onClick, $$restProps, to, replace, state, getProps, isPartiallyCurrent, isCurrent, $base, $location, $$scope, slots ]; } class Link extends SvelteComponentDev { constructor(options) { super(options); init(this, options, instance$7, create_fragment$7, safe_not_equal, { to: 7, replace: 8, state: 9, getProps: 10 }); dispatch_dev("SvelteRegisterComponent", { component: this, tagName: "Link", options, id: create_fragment$7.name }); } get to() { throw new Error(": Props cannot be read directly from the component instance unless compiling with 'accessors: true' or ''"); } set to(value) { throw new Error(": Props cannot be set directly on the component instance unless compiling with 'accessors: true' or ''"); } get replace() { throw new Error(": Props cannot be read directly from the component instance unless compiling with 'accessors: true' or ''"); } set replace(value) { throw new Error(": Props cannot be set directly on the component instance unless compiling with 'accessors: true' or ''"); } get state() { throw new Error(": Props cannot be read directly from the component instance unless compiling with 'accessors: true' or ''"); } set state(value) { throw new Error(": Props cannot be set directly on the component instance unless compiling with 'accessors: true' or ''"); } get getProps() { throw new Error(": Props cannot be read directly from the component instance unless compiling with 'accessors: true' or ''"); } set getProps(value) { throw new Error(": Props cannot be set directly on the component instance unless compiling with 'accessors: true' or ''"); } } /* src/routes/Home.svelte generated by Svelte v3.38.2 */ const file$5 = "src/routes/Home.svelte"; function create_fragment$6(ctx) { let section; let div; let p0; let t1; let p1; const block = { c: function create() { section = element("section"); div = element("div"); p0 = element("p"); p0.textContent = "Shioriko"; t1 = space(); p1 = element("p"); p1.textContent = "Booru-style gallery written in Go and Svelte"; attr_dev(p0, "class", "title"); add_location(p0, file$5, 6, 6, 99); attr_dev(p1, "class", "subtitle"); add_location(p1, file$5, 9, 6, 151); attr_dev(div, "class", "hero-body"); add_location(div, file$5, 5, 4, 69); attr_dev(section, "class", "hero is-primary is-medium"); add_location(section, file$5, 4, 0, 21); }, l: function claim(nodes) { throw new Error("options.hydrate only works if the component was compiled with the `hydratable: true` option"); }, m: function mount(target, anchor) { insert_dev(target, section, anchor); append_dev(section, div); append_dev(div, p0); append_dev(div, t1); append_dev(div, p1); }, p: noop, i: noop, o: noop, d: function destroy(detaching) { if (detaching) detach_dev(section); } }; dispatch_dev("SvelteRegisterBlock", { block, id: create_fragment$6.name, type: "component", source: "", ctx }); return block; } function instance$6($$self, $$props) { let { $$slots: slots = {}, $$scope } = $$props; validate_slots("Home", slots, []); const writable_props = []; Object.keys($$props).forEach(key => { if (!~writable_props.indexOf(key) && key.slice(0, 2) !== "$$") console.warn(` was created with unknown prop '${key}'`); }); return []; } class Home extends SvelteComponentDev { constructor(options) { super(options); init(this, options, instance$6, create_fragment$6, safe_not_equal, {}); dispatch_dev("SvelteRegisterComponent", { component: this, tagName: "Home", options, id: create_fragment$6.name }); } } const storedToken = localStorage.getItem("apiToken"); const token = writable(storedToken); token.subscribe(value => { localStorage.setItem("apiToken", value); }); let url = window.BASE_URL; token.subscribe(value => { }); async function login({ username, password }) { const endpoint = url + "/api/auth/login"; const response = await fetch(endpoint, { method: "POST", body: JSON.stringify({ username, password, }), }); const data = await response.json(); token.set(data.token); return data; } async function getPosts({ page }) { const endpoint = url + "/api/post?page=" + page; const response = await fetch(endpoint); const data = await response.json(); return data; } async function getPostsTag({ page, tag }) { const endpoint = url + "/api/post/tag/" + tag + "?page=" + page; const response = await fetch(endpoint); const data = await response.json(); return data; } async function getPost({ id }) { const endpoint = url + "/api/post/" + id; const response = await fetch(endpoint); const data = await response.json(); return data; } /* src/routes/Posts.svelte generated by Svelte v3.38.2 */ const file$4 = "src/routes/Posts.svelte"; function get_each_context$2(ctx, list, i) { const child_ctx = ctx.slice(); child_ctx[4] = list[i]; return child_ctx; } function get_each_context_1$1(ctx, list, i) { const child_ctx = ctx.slice(); child_ctx[7] = list[i]; return child_ctx; } // (32:24) function create_default_slot_1$2(ctx) { let img; let img_src_value; const block = { c: function create() { img = element("img"); if (img.src !== (img_src_value = /*post*/ ctx[4].image_path)) attr_dev(img, "src", img_src_value); add_location(img, file$4, 32, 24, 839); }, m: function mount(target, anchor) { insert_dev(target, img, anchor); }, p: function update(ctx, dirty) { if (dirty & /*posts*/ 1 && img.src !== (img_src_value = /*post*/ ctx[4].image_path)) { attr_dev(img, "src", img_src_value); } }, d: function destroy(detaching) { if (detaching) detach_dev(img); } }; dispatch_dev("SvelteRegisterBlock", { block, id: create_default_slot_1$2.name, type: "slot", source: "(32:24) ", ctx }); return block; } // (40:24) function create_default_slot$3(ctx) { let t_value = /*tag*/ ctx[7] + ""; let t; const block = { c: function create() { t = text(t_value); }, m: function mount(target, anchor) { insert_dev(target, t, anchor); }, p: function update(ctx, dirty) { if (dirty & /*posts*/ 1 && t_value !== (t_value = /*tag*/ ctx[7] + "")) set_data_dev(t, t_value); }, d: function destroy(detaching) { if (detaching) detach_dev(t); } }; dispatch_dev("SvelteRegisterBlock", { block, id: create_default_slot$3.name, type: "slot", source: "(40:24) ", ctx }); return block; } // (39:24) {#each post.tags as tag (tag)} function create_each_block_1$1(key_1, ctx) { let first; let link; let current; link = new Link({ props: { to: "/tag/" + /*tag*/ ctx[7], $$slots: { default: [create_default_slot$3] }, $$scope: { ctx } }, $$inline: true }); const block = { key: key_1, first: null, c: function create() { first = empty(); create_component(link.$$.fragment); this.first = first; }, m: function mount(target, anchor) { insert_dev(target, first, anchor); mount_component(link, target, anchor); current = true; }, p: function update(new_ctx, dirty) { ctx = new_ctx; const link_changes = {}; if (dirty & /*posts*/ 1) link_changes.to = "/tag/" + /*tag*/ ctx[7]; if (dirty & /*$$scope, posts*/ 1025) { link_changes.$$scope = { dirty, ctx }; } link.$set(link_changes); }, i: function intro(local) { if (current) return; transition_in(link.$$.fragment, local); current = true; }, o: function outro(local) { transition_out(link.$$.fragment, local); current = false; }, d: function destroy(detaching) { if (detaching) detach_dev(first); destroy_component(link, detaching); } }; dispatch_dev("SvelteRegisterBlock", { block, id: create_each_block_1$1.name, type: "each", source: "(39:24) {#each post.tags as tag (tag)}", ctx }); return block; } // (28:12) {#each posts as post (post.id)} function create_each_block$2(key_1, ctx) { let div3; let div0; let figure; let link; let t0; let div2; let div1; let each_blocks = []; let each_1_lookup = new Map(); let t1; let current; link = new Link({ props: { to: "/post/" + /*post*/ ctx[4].id, $$slots: { default: [create_default_slot_1$2] }, $$scope: { ctx } }, $$inline: true }); let each_value_1 = /*post*/ ctx[4].tags; validate_each_argument(each_value_1); const get_key = ctx => /*tag*/ ctx[7]; validate_each_keys(ctx, each_value_1, get_each_context_1$1, get_key); for (let i = 0; i < each_value_1.length; i += 1) { let child_ctx = get_each_context_1$1(ctx, each_value_1, i); let key = get_key(child_ctx); each_1_lookup.set(key, each_blocks[i] = create_each_block_1$1(key, child_ctx)); } const block = { key: key_1, first: null, c: function create() { div3 = element("div"); div0 = element("div"); figure = element("figure"); create_component(link.$$.fragment); t0 = space(); div2 = element("div"); div1 = element("div"); for (let i = 0; i < each_blocks.length; i += 1) { each_blocks[i].c(); } t1 = space(); attr_dev(figure, "class", "image"); add_location(figure, file$4, 30, 20, 740); attr_dev(div0, "class", "card-image"); add_location(div0, file$4, 29, 16, 695); attr_dev(div1, "class", "content"); add_location(div1, file$4, 37, 20, 1017); attr_dev(div2, "class", "card-content"); add_location(div2, file$4, 36, 16, 970); attr_dev(div3, "class", "tile is-child is-4 card"); add_location(div3, file$4, 28, 12, 641); this.first = div3; }, m: function mount(target, anchor) { insert_dev(target, div3, anchor); append_dev(div3, div0); append_dev(div0, figure); mount_component(link, figure, null); append_dev(div3, t0); append_dev(div3, div2); append_dev(div2, div1); for (let i = 0; i < each_blocks.length; i += 1) { each_blocks[i].m(div1, null); } append_dev(div3, t1); current = true; }, p: function update(new_ctx, dirty) { ctx = new_ctx; const link_changes = {}; if (dirty & /*posts*/ 1) link_changes.to = "/post/" + /*post*/ ctx[4].id; if (dirty & /*$$scope, posts*/ 1025) { link_changes.$$scope = { dirty, ctx }; } link.$set(link_changes); if (dirty & /*posts*/ 1) { each_value_1 = /*post*/ ctx[4].tags; validate_each_argument(each_value_1); group_outros(); validate_each_keys(ctx, each_value_1, get_each_context_1$1, get_key); each_blocks = update_keyed_each(each_blocks, dirty, get_key, 1, ctx, each_value_1, each_1_lookup, div1, outro_and_destroy_block, create_each_block_1$1, null, get_each_context_1$1); check_outros(); } }, i: function intro(local) { if (current) return; transition_in(link.$$.fragment, local); for (let i = 0; i < each_value_1.length; i += 1) { transition_in(each_blocks[i]); } current = true; }, o: function outro(local) { transition_out(link.$$.fragment, local); for (let i = 0; i < each_blocks.length; i += 1) { transition_out(each_blocks[i]); } current = false; }, d: function destroy(detaching) { if (detaching) detach_dev(div3); destroy_component(link); for (let i = 0; i < each_blocks.length; i += 1) { each_blocks[i].d(); } } }; dispatch_dev("SvelteRegisterBlock", { block, id: create_each_block$2.name, type: "each", source: "(28:12) {#each posts as post (post.id)}", ctx }); return block; } function create_fragment$5(ctx) { let section0; let div0; let p; let t1; let section1; let div2; let div1; let each_blocks = []; let each_1_lookup = new Map(); let current; let each_value = /*posts*/ ctx[0]; validate_each_argument(each_value); const get_key = ctx => /*post*/ ctx[4].id; validate_each_keys(ctx, each_value, get_each_context$2, get_key); for (let i = 0; i < each_value.length; i += 1) { let child_ctx = get_each_context$2(ctx, each_value, i); let key = get_key(child_ctx); each_1_lookup.set(key, each_blocks[i] = create_each_block$2(key, child_ctx)); } const block = { c: function create() { section0 = element("section"); div0 = element("div"); p = element("p"); p.textContent = "Posts"; t1 = space(); section1 = element("section"); div2 = element("div"); div1 = element("div"); for (let i = 0; i < each_blocks.length; i += 1) { each_blocks[i].c(); } attr_dev(p, "class", "title"); add_location(p, file$4, 18, 6, 426); attr_dev(div0, "class", "hero-body"); add_location(div0, file$4, 17, 4, 396); attr_dev(section0, "class", "hero is-primary"); add_location(section0, file$4, 16, 0, 358); attr_dev(div1, "class", "tile is-ancestor"); add_location(div1, file$4, 26, 8, 554); attr_dev(div2, "class", "container"); add_location(div2, file$4, 25, 4, 522); attr_dev(section1, "class", "section"); add_location(section1, file$4, 24, 0, 492); }, l: function claim(nodes) { throw new Error("options.hydrate only works if the component was compiled with the `hydratable: true` option"); }, m: function mount(target, anchor) { insert_dev(target, section0, anchor); append_dev(section0, div0); append_dev(div0, p); insert_dev(target, t1, anchor); insert_dev(target, section1, anchor); append_dev(section1, div2); append_dev(div2, div1); for (let i = 0; i < each_blocks.length; i += 1) { each_blocks[i].m(div1, null); } current = true; }, p: function update(ctx, [dirty]) { if (dirty & /*posts*/ 1) { each_value = /*posts*/ ctx[0]; validate_each_argument(each_value); group_outros(); validate_each_keys(ctx, each_value, get_each_context$2, get_key); each_blocks = update_keyed_each(each_blocks, dirty, get_key, 1, ctx, each_value, each_1_lookup, div1, outro_and_destroy_block, create_each_block$2, null, get_each_context$2); check_outros(); } }, i: function intro(local) { if (current) return; for (let i = 0; i < each_value.length; i += 1) { transition_in(each_blocks[i]); } current = true; }, o: function outro(local) { for (let i = 0; i < each_blocks.length; i += 1) { transition_out(each_blocks[i]); } current = false; }, d: function destroy(detaching) { if (detaching) detach_dev(section0); if (detaching) detach_dev(t1); if (detaching) detach_dev(section1); for (let i = 0; i < each_blocks.length; i += 1) { each_blocks[i].d(); } } }; dispatch_dev("SvelteRegisterBlock", { block, id: create_fragment$5.name, type: "component", source: "", ctx }); return block; } function instance$5($$self, $$props, $$invalidate) { let { $$slots: slots = {}, $$scope } = $$props; validate_slots("Posts", slots, []); let page = 1; let totalPages = 1; let posts = []; const getData = async () => { const data = await getPosts({ page }); $$invalidate(0, posts = data.posts); }; onMount(() => { getData(); }); const writable_props = []; Object.keys($$props).forEach(key => { if (!~writable_props.indexOf(key) && key.slice(0, 2) !== "$$") console.warn(` was created with unknown prop '${key}'`); }); $$self.$capture_state = () => ({ onMount, getPosts, Link, page, totalPages, posts, getData }); $$self.$inject_state = $$props => { if ("page" in $$props) page = $$props.page; if ("totalPages" in $$props) totalPages = $$props.totalPages; if ("posts" in $$props) $$invalidate(0, posts = $$props.posts); }; if ($$props && "$$inject" in $$props) { $$self.$inject_state($$props.$$inject); } return [posts]; } class Posts extends SvelteComponentDev { constructor(options) { super(options); init(this, options, instance$5, create_fragment$5, safe_not_equal, {}); dispatch_dev("SvelteRegisterComponent", { component: this, tagName: "Posts", options, id: create_fragment$5.name }); } } /* src/routes/Post.svelte generated by Svelte v3.38.2 */ const file$3 = "src/routes/Post.svelte"; function get_each_context$1(ctx, list, i) { const child_ctx = ctx.slice(); child_ctx[3] = list[i]; return child_ctx; } // (18:8) {#if post} function create_if_block_1(ctx) { let p; let t0; let t1_value = /*post*/ ctx[0].id + ""; let t1; const block = { c: function create() { p = element("p"); t0 = text("Post ID: "); t1 = text(t1_value); attr_dev(p, "class", "title"); add_location(p, file$3, 18, 6, 397); }, m: function mount(target, anchor) { insert_dev(target, p, anchor); append_dev(p, t0); append_dev(p, t1); }, p: function update(ctx, dirty) { if (dirty & /*post*/ 1 && t1_value !== (t1_value = /*post*/ ctx[0].id + "")) set_data_dev(t1, t1_value); }, d: function destroy(detaching) { if (detaching) detach_dev(p); } }; dispatch_dev("SvelteRegisterBlock", { block, id: create_if_block_1.name, type: "if", source: "(18:8) {#if post}", ctx }); return block; } // (25:0) {#if post} function create_if_block$1(ctx) { let div3; let section; let div2; let div0; let p0; let t0; let a; let t1_value = /*post*/ ctx[0].source_url + ""; let t1; let a_href_value; let t2; let p1; let t3; let each_blocks = []; let each_1_lookup = new Map(); let t4; let div1; let figure; let img; let img_src_value; let current; let each_value = /*post*/ ctx[0].tags; validate_each_argument(each_value); const get_key = ctx => /*tag*/ ctx[3]; validate_each_keys(ctx, each_value, get_each_context$1, get_key); for (let i = 0; i < each_value.length; i += 1) { let child_ctx = get_each_context$1(ctx, each_value, i); let key = get_key(child_ctx); each_1_lookup.set(key, each_blocks[i] = create_each_block$1(key, child_ctx)); } const block = { c: function create() { div3 = element("div"); section = element("section"); div2 = element("div"); div0 = element("div"); p0 = element("p"); t0 = text("Source URL: "); a = element("a"); t1 = text(t1_value); t2 = space(); p1 = element("p"); t3 = text("Tags: \n "); for (let i = 0; i < each_blocks.length; i += 1) { each_blocks[i].c(); } t4 = space(); div1 = element("div"); figure = element("figure"); img = element("img"); attr_dev(a, "href", a_href_value = "//" + /*post*/ ctx[0].source_url); add_location(a, file$3, 30, 36, 700); add_location(p0, file$3, 29, 20, 660); add_location(p1, file$3, 32, 20, 797); attr_dev(div0, "class", "tile is-child is-4 box"); add_location(div0, file$3, 28, 12, 603); if (img.src !== (img_src_value = /*post*/ ctx[0].image_path)) attr_dev(img, "src", img_src_value); add_location(img, file$3, 41, 20, 1121); attr_dev(figure, "class", "image"); add_location(figure, file$3, 40, 16, 1078); attr_dev(div1, "class", "tile is-child"); add_location(div1, file$3, 39, 12, 1034); attr_dev(div2, "class", "tile is-ancestor"); add_location(div2, file$3, 27, 8, 560); attr_dev(section, "class", "section"); add_location(section, file$3, 26, 4, 526); attr_dev(div3, "class", "container"); add_location(div3, file$3, 25, 0, 498); }, m: function mount(target, anchor) { insert_dev(target, div3, anchor); append_dev(div3, section); append_dev(section, div2); append_dev(div2, div0); append_dev(div0, p0); append_dev(p0, t0); append_dev(p0, a); append_dev(a, t1); append_dev(div0, t2); append_dev(div0, p1); append_dev(p1, t3); for (let i = 0; i < each_blocks.length; i += 1) { each_blocks[i].m(p1, null); } append_dev(div2, t4); append_dev(div2, div1); append_dev(div1, figure); append_dev(figure, img); current = true; }, p: function update(ctx, dirty) { if ((!current || dirty & /*post*/ 1) && t1_value !== (t1_value = /*post*/ ctx[0].source_url + "")) set_data_dev(t1, t1_value); if (!current || dirty & /*post*/ 1 && a_href_value !== (a_href_value = "//" + /*post*/ ctx[0].source_url)) { attr_dev(a, "href", a_href_value); } if (dirty & /*post*/ 1) { each_value = /*post*/ ctx[0].tags; validate_each_argument(each_value); group_outros(); validate_each_keys(ctx, each_value, get_each_context$1, get_key); each_blocks = update_keyed_each(each_blocks, dirty, get_key, 1, ctx, each_value, each_1_lookup, p1, outro_and_destroy_block, create_each_block$1, null, get_each_context$1); check_outros(); } if (!current || dirty & /*post*/ 1 && img.src !== (img_src_value = /*post*/ ctx[0].image_path)) { attr_dev(img, "src", img_src_value); } }, i: function intro(local) { if (current) return; for (let i = 0; i < each_value.length; i += 1) { transition_in(each_blocks[i]); } current = true; }, o: function outro(local) { for (let i = 0; i < each_blocks.length; i += 1) { transition_out(each_blocks[i]); } current = false; }, d: function destroy(detaching) { if (detaching) detach_dev(div3); for (let i = 0; i < each_blocks.length; i += 1) { each_blocks[i].d(); } } }; dispatch_dev("SvelteRegisterBlock", { block, id: create_if_block$1.name, type: "if", source: "(25:0) {#if post}", ctx }); return block; } // (36:24) function create_default_slot$2(ctx) { let t_value = /*tag*/ ctx[3] + ""; let t; const block = { c: function create() { t = text(t_value); }, m: function mount(target, anchor) { insert_dev(target, t, anchor); }, p: function update(ctx, dirty) { if (dirty & /*post*/ 1 && t_value !== (t_value = /*tag*/ ctx[3] + "")) set_data_dev(t, t_value); }, d: function destroy(detaching) { if (detaching) detach_dev(t); } }; dispatch_dev("SvelteRegisterBlock", { block, id: create_default_slot$2.name, type: "slot", source: "(36:24) ", ctx }); return block; } // (35:24) {#each post.tags as tag (tag)} function create_each_block$1(key_1, ctx) { let first; let link; let current; link = new Link({ props: { to: "/tag/" + /*tag*/ ctx[3], $$slots: { default: [create_default_slot$2] }, $$scope: { ctx } }, $$inline: true }); const block = { key: key_1, first: null, c: function create() { first = empty(); create_component(link.$$.fragment); this.first = first; }, m: function mount(target, anchor) { insert_dev(target, first, anchor); mount_component(link, target, anchor); current = true; }, p: function update(new_ctx, dirty) { ctx = new_ctx; const link_changes = {}; if (dirty & /*post*/ 1) link_changes.to = "/tag/" + /*tag*/ ctx[3]; if (dirty & /*$$scope, post*/ 65) { link_changes.$$scope = { dirty, ctx }; } link.$set(link_changes); }, i: function intro(local) { if (current) return; transition_in(link.$$.fragment, local); current = true; }, o: function outro(local) { transition_out(link.$$.fragment, local); current = false; }, d: function destroy(detaching) { if (detaching) detach_dev(first); destroy_component(link, detaching); } }; dispatch_dev("SvelteRegisterBlock", { block, id: create_each_block$1.name, type: "each", source: "(35:24) {#each post.tags as tag (tag)}", ctx }); return block; } function create_fragment$4(ctx) { let section; let div; let t; let if_block1_anchor; let current; let if_block0 = /*post*/ ctx[0] && create_if_block_1(ctx); let if_block1 = /*post*/ ctx[0] && create_if_block$1(ctx); const block = { c: function create() { section = element("section"); div = element("div"); if (if_block0) if_block0.c(); t = space(); if (if_block1) if_block1.c(); if_block1_anchor = empty(); attr_dev(div, "class", "hero-body"); add_location(div, file$3, 16, 4, 348); attr_dev(section, "class", "hero is-primary"); add_location(section, file$3, 15, 0, 310); }, l: function claim(nodes) { throw new Error("options.hydrate only works if the component was compiled with the `hydratable: true` option"); }, m: function mount(target, anchor) { insert_dev(target, section, anchor); append_dev(section, div); if (if_block0) if_block0.m(div, null); insert_dev(target, t, anchor); if (if_block1) if_block1.m(target, anchor); insert_dev(target, if_block1_anchor, anchor); current = true; }, p: function update(ctx, [dirty]) { if (/*post*/ ctx[0]) { if (if_block0) { if_block0.p(ctx, dirty); } else { if_block0 = create_if_block_1(ctx); if_block0.c(); if_block0.m(div, null); } } else if (if_block0) { if_block0.d(1); if_block0 = null; } if (/*post*/ ctx[0]) { if (if_block1) { if_block1.p(ctx, dirty); if (dirty & /*post*/ 1) { transition_in(if_block1, 1); } } else { if_block1 = create_if_block$1(ctx); if_block1.c(); transition_in(if_block1, 1); if_block1.m(if_block1_anchor.parentNode, if_block1_anchor); } } else if (if_block1) { group_outros(); transition_out(if_block1, 1, 1, () => { if_block1 = null; }); check_outros(); } }, i: function intro(local) { if (current) return; transition_in(if_block1); current = true; }, o: function outro(local) { transition_out(if_block1); current = false; }, d: function destroy(detaching) { if (detaching) detach_dev(section); if (if_block0) if_block0.d(); if (detaching) detach_dev(t); if (if_block1) if_block1.d(detaching); if (detaching) detach_dev(if_block1_anchor); } }; dispatch_dev("SvelteRegisterBlock", { block, id: create_fragment$4.name, type: "component", source: "", ctx }); return block; } function instance$4($$self, $$props, $$invalidate) { let { $$slots: slots = {}, $$scope } = $$props; validate_slots("Post", slots, []); let { id } = $$props; let post; const getData = async () => { const data = await getPost({ id }); $$invalidate(0, post = data); }; onMount(() => { getData(); }); const writable_props = ["id"]; Object.keys($$props).forEach(key => { if (!~writable_props.indexOf(key) && key.slice(0, 2) !== "$$") console.warn(` was created with unknown prop '${key}'`); }); $$self.$$set = $$props => { if ("id" in $$props) $$invalidate(1, id = $$props.id); }; $$self.$capture_state = () => ({ onMount, Link, getPost, id, post, getData }); $$self.$inject_state = $$props => { if ("id" in $$props) $$invalidate(1, id = $$props.id); if ("post" in $$props) $$invalidate(0, post = $$props.post); }; if ($$props && "$$inject" in $$props) { $$self.$inject_state($$props.$$inject); } return [post, id]; } class Post extends SvelteComponentDev { constructor(options) { super(options); init(this, options, instance$4, create_fragment$4, safe_not_equal, { id: 1 }); dispatch_dev("SvelteRegisterComponent", { component: this, tagName: "Post", options, id: create_fragment$4.name }); const { ctx } = this.$$; const props = options.props || {}; if (/*id*/ ctx[1] === undefined && !("id" in props)) { console.warn(" was created without expected prop 'id'"); } } 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 ''"); } } /* src/routes/Login.svelte generated by Svelte v3.38.2 */ const file$2 = "src/routes/Login.svelte"; function create_fragment$3(ctx) { let div6; let form; let div1; let label0; let t1; let div0; let input0; let t2; let div3; let label1; let t4; let div2; let input1; let t5; let div5; let div4; let button; let mounted; let dispose; const block = { c: function create() { div6 = element("div"); form = element("form"); div1 = element("div"); label0 = element("label"); label0.textContent = "Username"; t1 = space(); div0 = element("div"); input0 = element("input"); t2 = space(); div3 = element("div"); label1 = element("label"); label1.textContent = "Password"; t4 = space(); div2 = element("div"); input1 = element("input"); t5 = space(); div5 = element("div"); div4 = element("div"); button = element("button"); button.textContent = "Login"; attr_dev(label0, "class", "label"); add_location(label0, file$2, 15, 8, 382); attr_dev(input0, "class", "input"); attr_dev(input0, "type", "text"); attr_dev(input0, "placeholder", "Username"); input0.required = true; add_location(input0, file$2, 17, 12, 462); attr_dev(div0, "class", "control"); add_location(div0, file$2, 16, 8, 428); attr_dev(div1, "class", "field"); add_location(div1, file$2, 14, 8, 354); attr_dev(label1, "class", "label"); add_location(label1, file$2, 21, 8, 616); attr_dev(input1, "class", "input"); attr_dev(input1, "type", "password"); attr_dev(input1, "placeholder", "Password"); input1.required = true; add_location(input1, file$2, 23, 12, 696); attr_dev(div2, "class", "control"); add_location(div2, file$2, 22, 8, 662); attr_dev(div3, "class", "field"); add_location(div3, file$2, 20, 8, 588); attr_dev(button, "class", "button is-link"); add_location(button, file$2, 28, 12, 890); attr_dev(div4, "class", "control"); add_location(div4, file$2, 27, 10, 856); attr_dev(div5, "class", "field"); add_location(div5, file$2, 26, 8, 826); add_location(form, file$2, 13, 4, 304); attr_dev(div6, "class", "container"); add_location(div6, file$2, 12, 0, 276); }, l: function claim(nodes) { throw new Error("options.hydrate only works if the component was compiled with the `hydratable: true` option"); }, m: function mount(target, anchor) { insert_dev(target, div6, anchor); append_dev(div6, form); append_dev(form, div1); append_dev(div1, label0); append_dev(div1, t1); append_dev(div1, div0); append_dev(div0, input0); set_input_value(input0, /*username*/ ctx[0]); append_dev(form, t2); append_dev(form, div3); append_dev(div3, label1); append_dev(div3, t4); append_dev(div3, div2); append_dev(div2, input1); set_input_value(input1, /*password*/ ctx[1]); append_dev(form, t5); append_dev(form, div5); append_dev(div5, div4); append_dev(div4, button); if (!mounted) { dispose = [ listen_dev(input0, "input", /*input0_input_handler*/ ctx[3]), listen_dev(input1, "input", /*input1_input_handler*/ ctx[4]), listen_dev(form, "submit", prevent_default(/*doLogin*/ ctx[2]), false, true, false) ]; mounted = true; } }, p: function update(ctx, [dirty]) { if (dirty & /*username*/ 1 && input0.value !== /*username*/ ctx[0]) { set_input_value(input0, /*username*/ ctx[0]); } if (dirty & /*password*/ 2 && input1.value !== /*password*/ ctx[1]) { set_input_value(input1, /*password*/ ctx[1]); } }, i: noop, o: noop, d: function destroy(detaching) { if (detaching) detach_dev(div6); mounted = false; run_all(dispose); } }; dispatch_dev("SvelteRegisterBlock", { block, id: create_fragment$3.name, type: "component", source: "", ctx }); return block; } function instance$3($$self, $$props, $$invalidate) { let { $$slots: slots = {}, $$scope } = $$props; validate_slots("Login", slots, []); let username = ""; let password = ""; const doLogin = async () => { await login({ username, password }); navigate("/"); }; const writable_props = []; Object.keys($$props).forEach(key => { if (!~writable_props.indexOf(key) && key.slice(0, 2) !== "$$") console.warn(` was created with unknown prop '${key}'`); }); function input0_input_handler() { username = this.value; $$invalidate(0, username); } function input1_input_handler() { password = this.value; $$invalidate(1, password); } $$self.$capture_state = () => ({ login, navigate, username, password, doLogin }); $$self.$inject_state = $$props => { if ("username" in $$props) $$invalidate(0, username = $$props.username); if ("password" in $$props) $$invalidate(1, password = $$props.password); }; if ($$props && "$$inject" in $$props) { $$self.$inject_state($$props.$$inject); } return [username, password, doLogin, input0_input_handler, input1_input_handler]; } class Login extends SvelteComponentDev { constructor(options) { super(options); init(this, options, instance$3, create_fragment$3, safe_not_equal, {}); dispatch_dev("SvelteRegisterComponent", { component: this, tagName: "Login", options, id: create_fragment$3.name }); } } /* src/routes/Logout.svelte generated by Svelte v3.38.2 */ function create_fragment$2(ctx) { const block = { c: noop, l: function claim(nodes) { throw new Error("options.hydrate only works if the component was compiled with the `hydratable: true` option"); }, m: noop, p: noop, i: noop, o: noop, d: noop }; dispatch_dev("SvelteRegisterBlock", { block, id: create_fragment$2.name, type: "component", source: "", ctx }); return block; } function instance$2($$self, $$props, $$invalidate) { let { $$slots: slots = {}, $$scope } = $$props; validate_slots("Logout", slots, []); onMount(() => { token.set(""); navigate("/"); }); const writable_props = []; Object.keys($$props).forEach(key => { if (!~writable_props.indexOf(key) && key.slice(0, 2) !== "$$") console.warn(` was created with unknown prop '${key}'`); }); $$self.$capture_state = () => ({ token, navigate, onMount }); return []; } class Logout extends SvelteComponentDev { constructor(options) { super(options); init(this, options, instance$2, create_fragment$2, safe_not_equal, {}); dispatch_dev("SvelteRegisterComponent", { component: this, tagName: "Logout", options, id: create_fragment$2.name }); } } /* src/routes/Tag.svelte generated by Svelte v3.38.2 */ const file$1 = "src/routes/Tag.svelte"; function get_each_context(ctx, list, i) { const child_ctx = ctx.slice(); child_ctx[5] = list[i]; return child_ctx; } function get_each_context_1(ctx, list, i) { const child_ctx = ctx.slice(); child_ctx[8] = list[i]; return child_ctx; } // (37:24) function create_default_slot_1$1(ctx) { let img; let img_src_value; const block = { c: function create() { img = element("img"); if (img.src !== (img_src_value = /*post*/ ctx[5].image_path)) attr_dev(img, "src", img_src_value); add_location(img, file$1, 37, 24, 923); }, m: function mount(target, anchor) { insert_dev(target, img, anchor); }, p: function update(ctx, dirty) { if (dirty & /*posts*/ 2 && img.src !== (img_src_value = /*post*/ ctx[5].image_path)) { attr_dev(img, "src", img_src_value); } }, d: function destroy(detaching) { if (detaching) detach_dev(img); } }; dispatch_dev("SvelteRegisterBlock", { block, id: create_default_slot_1$1.name, type: "slot", source: "(37:24) ", ctx }); return block; } // (45:24) function create_default_slot$1(ctx) { let t_value = /*tag*/ ctx[8] + ""; let t; const block = { c: function create() { t = text(t_value); }, m: function mount(target, anchor) { insert_dev(target, t, anchor); }, p: function update(ctx, dirty) { if (dirty & /*posts*/ 2 && t_value !== (t_value = /*tag*/ ctx[8] + "")) set_data_dev(t, t_value); }, d: function destroy(detaching) { if (detaching) detach_dev(t); } }; dispatch_dev("SvelteRegisterBlock", { block, id: create_default_slot$1.name, type: "slot", source: "(45:24) ", ctx }); return block; } // (44:24) {#each post.tags as tag (tag)} function create_each_block_1(key_1, ctx) { let first; let link; let current; link = new Link({ props: { to: "/tag/" + /*tag*/ ctx[8], $$slots: { default: [create_default_slot$1] }, $$scope: { ctx } }, $$inline: true }); const block = { key: key_1, first: null, c: function create() { first = empty(); create_component(link.$$.fragment); this.first = first; }, m: function mount(target, anchor) { insert_dev(target, first, anchor); mount_component(link, target, anchor); current = true; }, p: function update(new_ctx, dirty) { ctx = new_ctx; const link_changes = {}; if (dirty & /*posts*/ 2) link_changes.to = "/tag/" + /*tag*/ ctx[8]; if (dirty & /*$$scope, posts*/ 2050) { link_changes.$$scope = { dirty, ctx }; } link.$set(link_changes); }, i: function intro(local) { if (current) return; transition_in(link.$$.fragment, local); current = true; }, o: function outro(local) { transition_out(link.$$.fragment, local); current = false; }, d: function destroy(detaching) { if (detaching) detach_dev(first); destroy_component(link, detaching); } }; dispatch_dev("SvelteRegisterBlock", { block, id: create_each_block_1.name, type: "each", source: "(44:24) {#each post.tags as tag (tag)}", ctx }); return block; } // (33:12) {#each posts as post (post.id)} function create_each_block(key_1, ctx) { let div3; let div0; let figure; let link; let t0; let div2; let div1; let each_blocks = []; let each_1_lookup = new Map(); let t1; let current; link = new Link({ props: { to: "/post/" + /*post*/ ctx[5].id, $$slots: { default: [create_default_slot_1$1] }, $$scope: { ctx } }, $$inline: true }); let each_value_1 = /*post*/ ctx[5].tags; validate_each_argument(each_value_1); const get_key = ctx => /*tag*/ ctx[8]; validate_each_keys(ctx, each_value_1, get_each_context_1, get_key); for (let i = 0; i < each_value_1.length; i += 1) { let child_ctx = get_each_context_1(ctx, each_value_1, i); let key = get_key(child_ctx); each_1_lookup.set(key, each_blocks[i] = create_each_block_1(key, child_ctx)); } const block = { key: key_1, first: null, c: function create() { div3 = element("div"); div0 = element("div"); figure = element("figure"); create_component(link.$$.fragment); t0 = space(); div2 = element("div"); div1 = element("div"); for (let i = 0; i < each_blocks.length; i += 1) { each_blocks[i].c(); } t1 = space(); attr_dev(figure, "class", "image"); add_location(figure, file$1, 35, 20, 824); attr_dev(div0, "class", "card-image"); add_location(div0, file$1, 34, 16, 779); attr_dev(div1, "class", "content"); add_location(div1, file$1, 42, 20, 1101); attr_dev(div2, "class", "card-content"); add_location(div2, file$1, 41, 16, 1054); attr_dev(div3, "class", "tile is-child is-4 card"); add_location(div3, file$1, 33, 12, 725); this.first = div3; }, m: function mount(target, anchor) { insert_dev(target, div3, anchor); append_dev(div3, div0); append_dev(div0, figure); mount_component(link, figure, null); append_dev(div3, t0); append_dev(div3, div2); append_dev(div2, div1); for (let i = 0; i < each_blocks.length; i += 1) { each_blocks[i].m(div1, null); } append_dev(div3, t1); current = true; }, p: function update(new_ctx, dirty) { ctx = new_ctx; const link_changes = {}; if (dirty & /*posts*/ 2) link_changes.to = "/post/" + /*post*/ ctx[5].id; if (dirty & /*$$scope, posts*/ 2050) { link_changes.$$scope = { dirty, ctx }; } link.$set(link_changes); if (dirty & /*posts*/ 2) { each_value_1 = /*post*/ ctx[5].tags; validate_each_argument(each_value_1); group_outros(); validate_each_keys(ctx, each_value_1, get_each_context_1, get_key); each_blocks = update_keyed_each(each_blocks, dirty, get_key, 1, ctx, each_value_1, each_1_lookup, div1, outro_and_destroy_block, create_each_block_1, null, get_each_context_1); check_outros(); } }, i: function intro(local) { if (current) return; transition_in(link.$$.fragment, local); for (let i = 0; i < each_value_1.length; i += 1) { transition_in(each_blocks[i]); } current = true; }, o: function outro(local) { transition_out(link.$$.fragment, local); for (let i = 0; i < each_blocks.length; i += 1) { transition_out(each_blocks[i]); } current = false; }, d: function destroy(detaching) { if (detaching) detach_dev(div3); destroy_component(link); for (let i = 0; i < each_blocks.length; i += 1) { each_blocks[i].d(); } } }; dispatch_dev("SvelteRegisterBlock", { block, id: create_each_block.name, type: "each", source: "(33:12) {#each posts as post (post.id)}", ctx }); return block; } function create_fragment$1(ctx) { let section0; let div0; let p0; let t0; let t1; let p1; let t3; let section1; let div2; let div1; let each_blocks = []; let each_1_lookup = new Map(); let current; let each_value = /*posts*/ ctx[1]; validate_each_argument(each_value); const get_key = ctx => /*post*/ ctx[5].id; validate_each_keys(ctx, each_value, get_each_context, get_key); for (let i = 0; i < each_value.length; i += 1) { let child_ctx = get_each_context(ctx, each_value, i); let key = get_key(child_ctx); each_1_lookup.set(key, each_blocks[i] = create_each_block(key, child_ctx)); } const block = { c: function create() { section0 = element("section"); div0 = element("div"); p0 = element("p"); t0 = text(/*id*/ ctx[0]); t1 = space(); p1 = element("p"); p1.textContent = "Tag"; t3 = space(); section1 = element("section"); div2 = element("div"); div1 = element("div"); for (let i = 0; i < each_blocks.length; i += 1) { each_blocks[i].c(); } attr_dev(p0, "class", "title"); add_location(p0, file$1, 20, 6, 461); attr_dev(p1, "class", "subtitle"); add_location(p1, file$1, 23, 6, 509); attr_dev(div0, "class", "hero-body"); add_location(div0, file$1, 19, 4, 431); attr_dev(section0, "class", "hero is-primary"); add_location(section0, file$1, 18, 0, 393); attr_dev(div1, "class", "tile is-ancestor"); add_location(div1, file$1, 31, 8, 638); attr_dev(div2, "class", "container"); add_location(div2, file$1, 30, 4, 606); attr_dev(section1, "class", "section"); add_location(section1, file$1, 29, 0, 576); }, l: function claim(nodes) { throw new Error("options.hydrate only works if the component was compiled with the `hydratable: true` option"); }, m: function mount(target, anchor) { insert_dev(target, section0, anchor); append_dev(section0, div0); append_dev(div0, p0); append_dev(p0, t0); append_dev(div0, t1); append_dev(div0, p1); insert_dev(target, t3, anchor); insert_dev(target, section1, anchor); append_dev(section1, div2); append_dev(div2, div1); for (let i = 0; i < each_blocks.length; i += 1) { each_blocks[i].m(div1, null); } current = true; }, p: function update(ctx, [dirty]) { if (!current || dirty & /*id*/ 1) set_data_dev(t0, /*id*/ ctx[0]); if (dirty & /*posts*/ 2) { each_value = /*posts*/ ctx[1]; validate_each_argument(each_value); group_outros(); validate_each_keys(ctx, each_value, get_each_context, get_key); each_blocks = update_keyed_each(each_blocks, dirty, get_key, 1, ctx, each_value, each_1_lookup, div1, outro_and_destroy_block, create_each_block, null, get_each_context); check_outros(); } }, i: function intro(local) { if (current) return; for (let i = 0; i < each_value.length; i += 1) { transition_in(each_blocks[i]); } current = true; }, o: function outro(local) { for (let i = 0; i < each_blocks.length; i += 1) { transition_out(each_blocks[i]); } current = false; }, d: function destroy(detaching) { if (detaching) detach_dev(section0); if (detaching) detach_dev(t3); if (detaching) detach_dev(section1); for (let i = 0; i < each_blocks.length; i += 1) { each_blocks[i].d(); } } }; dispatch_dev("SvelteRegisterBlock", { block, id: create_fragment$1.name, type: "component", source: "", ctx }); return block; } function instance$1($$self, $$props, $$invalidate) { let { $$slots: slots = {}, $$scope } = $$props; validate_slots("Tag", slots, []); let { id } = $$props; let page = 1; let totalPages = 1; let posts = []; const getData = async () => { const data = await getPostsTag({ page, tag: id }); $$invalidate(1, posts = data.posts); }; onMount(() => { getData(); }); const writable_props = ["id"]; Object.keys($$props).forEach(key => { if (!~writable_props.indexOf(key) && key.slice(0, 2) !== "$$") console.warn(` was created with unknown prop '${key}'`); }); $$self.$$set = $$props => { if ("id" in $$props) $$invalidate(0, id = $$props.id); }; $$self.$capture_state = () => ({ onMount, getPostsTag, Link, id, page, totalPages, posts, getData }); $$self.$inject_state = $$props => { if ("id" in $$props) $$invalidate(0, id = $$props.id); if ("page" in $$props) page = $$props.page; if ("totalPages" in $$props) totalPages = $$props.totalPages; if ("posts" in $$props) $$invalidate(1, posts = $$props.posts); }; if ($$props && "$$inject" in $$props) { $$self.$inject_state($$props.$$inject); } return [id, posts]; } class Tag extends SvelteComponentDev { constructor(options) { super(options); init(this, options, instance$1, create_fragment$1, safe_not_equal, { id: 0 }); dispatch_dev("SvelteRegisterComponent", { component: this, tagName: "Tag", options, id: create_fragment$1.name }); const { ctx } = this.$$; const props = options.props || {}; if (/*id*/ ctx[0] === undefined && !("id" in props)) { console.warn(" was created without expected prop 'id'"); } } 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 ''"); } } /* src/App.svelte generated by Svelte v3.38.2 */ const file = "src/App.svelte"; // (25:4) function create_default_slot_5(ctx) { let t; const block = { c: function create() { t = text("Shioriko"); }, m: function mount(target, anchor) { insert_dev(target, t, anchor); }, d: function destroy(detaching) { if (detaching) detach_dev(t); } }; dispatch_dev("SvelteRegisterBlock", { block, id: create_default_slot_5.name, type: "slot", source: "(25:4) ", ctx }); return block; } // (38:3) function create_default_slot_4(ctx) { let t; const block = { c: function create() { t = text("Posts"); }, m: function mount(target, anchor) { insert_dev(target, t, anchor); }, d: function destroy(detaching) { if (detaching) detach_dev(t); } }; dispatch_dev("SvelteRegisterBlock", { block, id: create_default_slot_4.name, type: "slot", source: "(38:3) ", ctx }); return block; } // (52:5) {:else} function create_else_block(ctx) { let div1; let div0; let link0; let t; let link1; let current; link0 = new Link({ props: { to: "/auth/register", class: "button is-primary", $$slots: { default: [create_default_slot_3] }, $$scope: { ctx } }, $$inline: true }); link1 = new Link({ props: { to: "/auth/login", class: "button is-light", $$slots: { default: [create_default_slot_2] }, $$scope: { ctx } }, $$inline: true }); const block = { c: function create() { div1 = element("div"); div0 = element("div"); create_component(link0.$$.fragment); t = space(); create_component(link1.$$.fragment); attr_dev(div0, "class", "buttons"); add_location(div0, file, 53, 4, 1362); attr_dev(div1, "class", "navbar-item"); add_location(div1, file, 52, 5, 1332); }, m: function mount(target, anchor) { insert_dev(target, div1, anchor); append_dev(div1, div0); mount_component(link0, div0, null); append_dev(div0, t); mount_component(link1, div0, null); current = true; }, i: function intro(local) { if (current) return; transition_in(link0.$$.fragment, local); transition_in(link1.$$.fragment, local); current = true; }, o: function outro(local) { transition_out(link0.$$.fragment, local); transition_out(link1.$$.fragment, local); current = false; }, d: function destroy(detaching) { if (detaching) detach_dev(div1); destroy_component(link0); destroy_component(link1); } }; dispatch_dev("SvelteRegisterBlock", { block, id: create_else_block.name, type: "else", source: "(52:5) {:else}", ctx }); return block; } // (44:5) {#if loggedIn} function create_if_block(ctx) { let div1; let div0; let link; let current; link = new Link({ props: { to: "/auth/logout", class: "button is-light", $$slots: { default: [create_default_slot_1] }, $$scope: { ctx } }, $$inline: true }); const block = { c: function create() { div1 = element("div"); div0 = element("div"); create_component(link.$$.fragment); attr_dev(div0, "class", "buttons"); add_location(div0, file, 45, 4, 1187); attr_dev(div1, "class", "navbar-item"); add_location(div1, file, 44, 5, 1157); }, m: function mount(target, anchor) { insert_dev(target, div1, anchor); append_dev(div1, div0); mount_component(link, div0, null); current = true; }, i: function intro(local) { if (current) return; transition_in(link.$$.fragment, local); current = true; }, o: function outro(local) { transition_out(link.$$.fragment, local); current = false; }, d: function destroy(detaching) { if (detaching) detach_dev(div1); destroy_component(link); } }; dispatch_dev("SvelteRegisterBlock", { block, id: create_if_block.name, type: "if", source: "(44:5) {#if loggedIn}", ctx }); return block; } // (55:6) function create_default_slot_3(ctx) { let strong; const block = { c: function create() { strong = element("strong"); strong.textContent = "Register"; add_location(strong, file, 55, 5, 1448); }, m: function mount(target, anchor) { insert_dev(target, strong, anchor); }, d: function destroy(detaching) { if (detaching) detach_dev(strong); } }; dispatch_dev("SvelteRegisterBlock", { block, id: create_default_slot_3.name, type: "slot", source: "(55:6) ", ctx }); return block; } // (58:6) function create_default_slot_2(ctx) { let t; const block = { c: function create() { t = text("Log in"); }, m: function mount(target, anchor) { insert_dev(target, t, anchor); }, d: function destroy(detaching) { if (detaching) detach_dev(t); } }; dispatch_dev("SvelteRegisterBlock", { block, id: create_default_slot_2.name, type: "slot", source: "(58:6) ", ctx }); return block; } // (47:6) function create_default_slot_1(ctx) { let t; const block = { c: function create() { t = text("Log out"); }, m: function mount(target, anchor) { insert_dev(target, t, anchor); }, d: function destroy(detaching) { if (detaching) detach_dev(t); } }; dispatch_dev("SvelteRegisterBlock", { block, id: create_default_slot_1.name, type: "slot", source: "(47:6) ", ctx }); return block; } // (22:0) function create_default_slot(ctx) { let nav; let div0; let link0; let t0; let a; let span0; let t1; let span1; let t2; let span2; let t3; let div3; let div1; let link1; let t4; let div2; let current_block_type_index; let if_block; let t5; let div4; let route0; let t6; let route1; let t7; let route2; let t8; let route3; let t9; let route4; let t10; let route5; let current; link0 = new Link({ props: { class: "navbar-item", to: "/", $$slots: { default: [create_default_slot_5] }, $$scope: { ctx } }, $$inline: true }); link1 = new Link({ props: { class: "navbar-item", to: "/posts", $$slots: { default: [create_default_slot_4] }, $$scope: { ctx } }, $$inline: true }); const if_block_creators = [create_if_block, create_else_block]; const if_blocks = []; function select_block_type(ctx, dirty) { if (/*loggedIn*/ ctx[1]) return 0; return 1; } current_block_type_index = select_block_type(ctx); if_block = if_blocks[current_block_type_index] = if_block_creators[current_block_type_index](ctx); route0 = new Route({ props: { path: "/", component: Home }, $$inline: true }); route1 = new Route({ props: { path: "/posts", component: Posts }, $$inline: true }); route2 = new Route({ props: { path: "/tag/:id", component: Tag }, $$inline: true }); route3 = new Route({ props: { path: "/post/:id", component: Post }, $$inline: true }); route4 = new Route({ props: { path: "/auth/login", component: Login }, $$inline: true }); route5 = new Route({ props: { path: "/auth/logout", component: Logout }, $$inline: true }); const block = { c: function create() { nav = element("nav"); div0 = element("div"); create_component(link0.$$.fragment); t0 = space(); a = element("a"); span0 = element("span"); t1 = space(); span1 = element("span"); t2 = space(); span2 = element("span"); t3 = space(); div3 = element("div"); div1 = element("div"); create_component(link1.$$.fragment); t4 = space(); div2 = element("div"); if_block.c(); t5 = space(); div4 = element("div"); create_component(route0.$$.fragment); t6 = space(); create_component(route1.$$.fragment); t7 = space(); create_component(route2.$$.fragment); t8 = space(); create_component(route3.$$.fragment); t9 = space(); create_component(route4.$$.fragment); t10 = space(); create_component(route5.$$.fragment); attr_dev(span0, "aria-hidden", "true"); add_location(span0, file, 29, 3, 816); attr_dev(span1, "aria-hidden", "true"); add_location(span1, file, 30, 3, 852); attr_dev(span2, "aria-hidden", "true"); add_location(span2, file, 31, 3, 888); attr_dev(a, "role", "button"); attr_dev(a, "class", "navbar-burger"); attr_dev(a, "aria-label", "menu"); attr_dev(a, "aria-expanded", "false"); attr_dev(a, "data-target", "navbarBasicExample"); add_location(a, file, 28, 4, 700); attr_dev(div0, "class", "navbar-brand"); add_location(div0, file, 23, 2, 603); attr_dev(div1, "class", "navbar-start"); add_location(div1, file, 36, 4, 999); attr_dev(div2, "class", "navbar-end"); add_location(div2, file, 42, 4, 1107); attr_dev(div3, "id", "navbarBasicExample"); attr_dev(div3, "class", "navbar-menu"); add_location(div3, file, 35, 2, 945); attr_dev(nav, "class", "navbar"); attr_dev(nav, "role", "navigation"); attr_dev(nav, "aria-label", "main navigation"); add_location(nav, file, 22, 1, 533); add_location(div4, file, 66, 3, 1635); }, m: function mount(target, anchor) { insert_dev(target, nav, anchor); append_dev(nav, div0); mount_component(link0, div0, null); append_dev(div0, t0); append_dev(div0, a); append_dev(a, span0); append_dev(a, t1); append_dev(a, span1); append_dev(a, t2); append_dev(a, span2); append_dev(nav, t3); append_dev(nav, div3); append_dev(div3, div1); mount_component(link1, div1, null); append_dev(div3, t4); append_dev(div3, div2); if_blocks[current_block_type_index].m(div2, null); insert_dev(target, t5, anchor); insert_dev(target, div4, anchor); mount_component(route0, div4, null); append_dev(div4, t6); mount_component(route1, div4, null); append_dev(div4, t7); mount_component(route2, div4, null); append_dev(div4, t8); mount_component(route3, div4, null); append_dev(div4, t9); mount_component(route4, div4, null); append_dev(div4, t10); mount_component(route5, div4, null); current = true; }, p: function update(ctx, dirty) { const link0_changes = {}; if (dirty & /*$$scope*/ 8) { link0_changes.$$scope = { dirty, ctx }; } link0.$set(link0_changes); const link1_changes = {}; if (dirty & /*$$scope*/ 8) { link1_changes.$$scope = { dirty, ctx }; } link1.$set(link1_changes); let previous_block_index = current_block_type_index; current_block_type_index = select_block_type(ctx); if (current_block_type_index !== previous_block_index) { group_outros(); transition_out(if_blocks[previous_block_index], 1, 1, () => { if_blocks[previous_block_index] = null; }); check_outros(); 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(); } transition_in(if_block, 1); if_block.m(div2, null); } }, i: function intro(local) { if (current) return; transition_in(link0.$$.fragment, local); transition_in(link1.$$.fragment, local); transition_in(if_block); transition_in(route0.$$.fragment, local); transition_in(route1.$$.fragment, local); transition_in(route2.$$.fragment, local); transition_in(route3.$$.fragment, local); transition_in(route4.$$.fragment, local); transition_in(route5.$$.fragment, local); current = true; }, o: function outro(local) { transition_out(link0.$$.fragment, local); transition_out(link1.$$.fragment, local); transition_out(if_block); transition_out(route0.$$.fragment, local); transition_out(route1.$$.fragment, local); transition_out(route2.$$.fragment, local); transition_out(route3.$$.fragment, local); transition_out(route4.$$.fragment, local); transition_out(route5.$$.fragment, local); current = false; }, d: function destroy(detaching) { if (detaching) detach_dev(nav); destroy_component(link0); destroy_component(link1); if_blocks[current_block_type_index].d(); if (detaching) detach_dev(t5); if (detaching) detach_dev(div4); destroy_component(route0); destroy_component(route1); destroy_component(route2); destroy_component(route3); destroy_component(route4); destroy_component(route5); } }; dispatch_dev("SvelteRegisterBlock", { block, id: create_default_slot.name, type: "slot", source: "(22:0) ", ctx }); return block; } function create_fragment(ctx) { let router; let current; router = new Router({ props: { url: /*url*/ ctx[0], $$slots: { default: [create_default_slot] }, $$scope: { ctx } }, $$inline: true }); const block = { c: function create() { create_component(router.$$.fragment); }, 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) { mount_component(router, target, anchor); current = true; }, p: function update(ctx, [dirty]) { const router_changes = {}; if (dirty & /*url*/ 1) router_changes.url = /*url*/ ctx[0]; if (dirty & /*$$scope, loggedIn*/ 10) { router_changes.$$scope = { dirty, ctx }; } router.$set(router_changes); }, i: function intro(local) { if (current) return; transition_in(router.$$.fragment, local); current = true; }, o: function outro(local) { transition_out(router.$$.fragment, local); current = false; }, d: function destroy(detaching) { destroy_component(router, detaching); } }; dispatch_dev("SvelteRegisterBlock", { block, id: create_fragment.name, type: "component", source: "", ctx }); return block; } function instance($$self, $$props, $$invalidate) { let { $$slots: slots = {}, $$scope } = $$props; validate_slots("App", slots, []); let loggedIn = false; token.subscribe(value => { $$invalidate(1, loggedIn = value !== ""); }); let { url = "" } = $$props; let baseURL = window.BASE_URL; const writable_props = ["url"]; Object.keys($$props).forEach(key => { if (!~writable_props.indexOf(key) && key.slice(0, 2) !== "$$") console.warn(` was created with unknown prop '${key}'`); }); $$self.$$set = $$props => { if ("url" in $$props) $$invalidate(0, url = $$props.url); }; $$self.$capture_state = () => ({ Router, Link, Route, Home, Posts, Post, Login, Logout, Tag, token, loggedIn, url, baseURL }); $$self.$inject_state = $$props => { if ("loggedIn" in $$props) $$invalidate(1, loggedIn = $$props.loggedIn); if ("url" in $$props) $$invalidate(0, url = $$props.url); if ("baseURL" in $$props) baseURL = $$props.baseURL; }; if ($$props && "$$inject" in $$props) { $$self.$inject_state($$props.$$inject); } return [url, loggedIn]; } class App extends SvelteComponentDev { constructor(options) { super(options); init(this, options, instance, create_fragment, safe_not_equal, { url: 0 }); dispatch_dev("SvelteRegisterComponent", { component: this, tagName: "App", options, id: create_fragment.name }); } get url() { throw new Error(": Props cannot be read directly from the component instance unless compiling with 'accessors: true' or ''"); } set url(value) { throw new Error(": Props cannot be set directly on the component instance unless compiling with 'accessors: true' or ''"); } } const app = new App({ target: document.body, hydrate: false, }); return app; }()); //# sourceMappingURL=bundle.js.map