2021-05-10 22:47:35 +07:00
( 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 destroy _each ( iterations , detaching ) {
for ( let i = 0 ; i < iterations . length ; i += 1 ) {
if ( iterations [ i ] )
iterations [ i ] . d ( detaching ) ;
}
}
function element ( name ) {
return document . createElement ( name ) ;
}
function 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 toggle _class ( element , name , toggle ) {
element . classList [ toggle ? 'add' : 'remove' ] ( name ) ;
}
function custom _event ( type , detail ) {
const e = document . createEvent ( 'CustomEvent' ) ;
e . initCustomEvent ( type , false , false , detail ) ;
return e ;
}
let current _component ;
function set _current _component ( component ) {
current _component = component ;
}
function get _current _component ( ) {
if ( ! current _component )
throw new Error ( 'Function called outside component initialization' ) ;
return current _component ;
}
function 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 :
*
* < Link to = "deeper" / >
* // instead of
* < Link to = ` { ${ props . uri } /deeper} ` / >
*
* 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$a ( 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$a . name ,
type : "component" ,
source : "" ,
ctx
} ) ;
return block ;
}
function instance$a ( $$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 ( ` <Router> 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$a , create _fragment$a , safe _not _equal , { basepath : 3 , url : 4 } ) ;
dispatch _dev ( "SvelteRegisterComponent" , {
component : this ,
tagName : "Router" ,
options ,
id : create _fragment$a . name
} ) ;
}
get basepath ( ) {
throw new Error ( "<Router>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'" ) ;
}
set basepath ( value ) {
throw new Error ( "<Router>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'" ) ;
}
get url ( ) {
throw new Error ( "<Router>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'" ) ;
}
set url ( value ) {
throw new Error ( "<Router>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'" ) ;
}
}
/* 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$4 ( ctx ) {
let current _block _type _index ;
let if _block ;
let if _block _anchor ;
let current ;
const if _block _creators = [ create _if _block _1$4 , create _else _block$3 ] ;
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$4 . name ,
type : "if" ,
source : "(40:0) {#if $activeRoute !== null && $activeRoute.route === route}" ,
ctx
} ) ;
return block ;
}
// (43:2) {:else}
function create _else _block$3 ( 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$3 . name ,
type : "else" ,
source : "(43:2) {:else}" ,
ctx
} ) ;
return block ;
}
// (41:2) {#if component !== null}
function create _if _block _1$4 ( 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$4 . name ,
type : "if" ,
source : "(41:2) {#if component !== null}" ,
ctx
} ) ;
return block ;
}
function create _fragment$9 ( ctx ) {
let if _block _anchor ;
let current ;
let if _block = /*$activeRoute*/ ctx [ 1 ] !== null && /*$activeRoute*/ ctx [ 1 ] . route === /*route*/ ctx [ 7 ] && create _if _block$4 ( 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$4 ( 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$9 . name ,
type : "component" ,
source : "" ,
ctx
} ) ;
return block ;
}
function instance$9 ( $$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$9 , create _fragment$9 , safe _not _equal , { path : 8 , component : 0 } ) ;
dispatch _dev ( "SvelteRegisterComponent" , {
component : this ,
tagName : "Route" ,
options ,
id : create _fragment$9 . name
} ) ;
}
get path ( ) {
throw new Error ( "<Route>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'" ) ;
}
set path ( value ) {
throw new Error ( "<Route>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'" ) ;
}
get component ( ) {
throw new Error ( "<Route>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'" ) ;
}
set component ( value ) {
throw new Error ( "<Route>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'" ) ;
}
}
/* node_modules/svelte-routing/src/Link.svelte generated by Svelte v3.38.2 */
const file$7 = "node_modules/svelte-routing/src/Link.svelte" ;
function create _fragment$8 ( 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$7 , 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$8 . name ,
type : "component" ,
source : "" ,
ctx
} ) ;
return block ;
}
function instance$8 ( $$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$8 , create _fragment$8 , safe _not _equal , {
to : 7 ,
replace : 8 ,
state : 9 ,
getProps : 10
} ) ;
dispatch _dev ( "SvelteRegisterComponent" , {
component : this ,
tagName : "Link" ,
options ,
id : create _fragment$8 . name
} ) ;
}
get to ( ) {
throw new Error ( "<Link>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'" ) ;
}
set to ( value ) {
throw new Error ( "<Link>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'" ) ;
}
get replace ( ) {
throw new Error ( "<Link>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'" ) ;
}
set replace ( value ) {
throw new Error ( "<Link>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'" ) ;
}
get state ( ) {
throw new Error ( "<Link>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'" ) ;
}
set state ( value ) {
throw new Error ( "<Link>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'" ) ;
}
get getProps ( ) {
throw new Error ( "<Link>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'" ) ;
}
set getProps ( value ) {
throw new Error ( "<Link>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'" ) ;
}
}
const storedToken = localStorage . getItem ( "apiToken" ) ;
const token$1 = writable ( storedToken ) ;
token$1 . subscribe ( value => {
localStorage . setItem ( "apiToken" , value ) ;
} ) ;
/* src/Navbar.svelte generated by Svelte v3.38.2 */
const file$6 = "src/Navbar.svelte" ;
// (19:8) <Link class="navbar-item" to="/">
function create _default _slot _5$2 ( 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$2 . name ,
type : "slot" ,
source : "(19:8) <Link class=\\\"navbar-item\\\" to=\\\"/\\\">" ,
ctx
} ) ;
return block ;
}
// (37:12) <Link class="navbar-item" to="/posts">
function create _default _slot _4$2 ( 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$2 . name ,
type : "slot" ,
source : "(37:12) <Link class=\\\"navbar-item\\\" to=\\\"/posts\\\">" ,
ctx
} ) ;
return block ;
}
// (38:12) {#if loggedIn}
function create _if _block _1$3 ( ctx ) {
let link ;
let current ;
link = new Link ( {
props : {
class : "navbar-item" ,
to : "/upload" ,
$$slots : { default : [ create _default _slot _3$2 ] } ,
$$scope : { ctx }
} ,
$$inline : true
} ) ;
const block = {
c : function create ( ) {
create _component ( link . $$ . fragment ) ;
} ,
m : function mount ( target , anchor ) {
mount _component ( link , target , anchor ) ;
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 ) {
destroy _component ( link , detaching ) ;
}
} ;
dispatch _dev ( "SvelteRegisterBlock" , {
block ,
id : create _if _block _1$3 . name ,
type : "if" ,
source : "(38:12) {#if loggedIn}" ,
ctx
} ) ;
return block ;
}
// (39:16) <Link class="navbar-item" to="/upload">
function create _default _slot _3$2 ( ctx ) {
let t ;
const block = {
c : function create ( ) {
t = text ( "Upload" ) ;
} ,
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 _3$2 . name ,
type : "slot" ,
source : "(39:16) <Link class=\\\"navbar-item\\\" to=\\\"/upload\\\">" ,
ctx
} ) ;
return block ;
}
// (52:12) {:else}
function create _else _block$2 ( 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 _2$2 ] } ,
$$scope : { ctx }
} ,
$$inline : true
} ) ;
link1 = new Link ( {
props : {
to : "/auth/login" ,
class : "button is-light" ,
$$slots : { default : [ create _default _slot _1$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$6 , 53 , 20 , 1515 ) ;
attr _dev ( div1 , "class" , "navbar-item" ) ;
add _location ( div1 , file$6 , 52 , 16 , 1469 ) ;
} ,
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$2 . name ,
type : "else" ,
source : "(52:12) {:else}" ,
ctx
} ) ;
return block ;
}
// (44:12) {#if loggedIn}
function create _if _block$3 ( 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$4 ] } ,
$$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$6 , 45 , 20 , 1220 ) ;
attr _dev ( div1 , "class" , "navbar-item" ) ;
add _location ( div1 , file$6 , 44 , 16 , 1174 ) ;
} ,
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$3 . name ,
type : "if" ,
source : "(44:12) {#if loggedIn}" ,
ctx
} ) ;
return block ;
}
// (55:24) <Link to="/auth/register" class="button is-primary">
function create _default _slot _2$2 ( ctx ) {
let strong ;
const block = {
c : function create ( ) {
strong = element ( "strong" ) ;
strong . textContent = "Register" ;
add _location ( strong , file$6 , 55 , 28 , 1642 ) ;
} ,
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 _2$2 . name ,
type : "slot" ,
source : "(55:24) <Link to=\\\"/auth/register\\\" class=\\\"button is-primary\\\">" ,
ctx
} ) ;
return block ;
}
// (58:24) <Link to="/auth/login" class="button is-light">
function create _default _slot _1$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 _1$2 . name ,
type : "slot" ,
source : "(58:24) <Link to=\\\"/auth/login\\\" class=\\\"button is-light\\\">" ,
ctx
} ) ;
return block ;
}
// (47:24) <Link to="/auth/logout" class="button is-light">
function create _default _slot$4 ( 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$4 . name ,
type : "slot" ,
source : "(47:24) <Link to=\\\"/auth/logout\\\" class=\\\"button is-light\\\">" ,
ctx
} ) ;
return block ;
}
function create _fragment$7 ( 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 t5 ;
let div2 ;
let current _block _type _index ;
let if _block1 ;
let current ;
let mounted ;
let dispose ;
link0 = new Link ( {
props : {
class : "navbar-item" ,
to : "/" ,
$$slots : { default : [ create _default _slot _5$2 ] } ,
$$scope : { ctx }
} ,
$$inline : true
} ) ;
link1 = new Link ( {
props : {
class : "navbar-item" ,
to : "/posts" ,
$$slots : { default : [ create _default _slot _4$2 ] } ,
$$scope : { ctx }
} ,
$$inline : true
} ) ;
let if _block0 = /*loggedIn*/ ctx [ 1 ] && create _if _block _1$3 ( ctx ) ;
const if _block _creators = [ create _if _block$3 , create _else _block$2 ] ;
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 _block1 = if _blocks [ current _block _type _index ] = if _block _creators [ current _block _type _index ] ( ctx ) ;
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 ( ) ;
if ( if _block0 ) if _block0 . c ( ) ;
t5 = space ( ) ;
div2 = element ( "div" ) ;
if _block1 . c ( ) ;
attr _dev ( span0 , "aria-hidden" , "true" ) ;
add _location ( span0 , file$6 , 28 , 12 , 678 ) ;
attr _dev ( span1 , "aria-hidden" , "true" ) ;
add _location ( span1 , file$6 , 29 , 12 , 718 ) ;
attr _dev ( span2 , "aria-hidden" , "true" ) ;
add _location ( span2 , file$6 , 30 , 12 , 758 ) ;
attr _dev ( a , "href" , "#" ) ;
attr _dev ( a , "role" , "button" ) ;
attr _dev ( a , "class" , "navbar-burger" ) ;
attr _dev ( a , "aria-label" , "menu" ) ;
attr _dev ( a , "aria-expanded" , "false" ) ;
add _location ( a , file$6 , 20 , 8 , 472 ) ;
attr _dev ( div0 , "class" , "navbar-brand" ) ;
add _location ( div0 , file$6 , 17 , 4 , 379 ) ;
attr _dev ( div1 , "class" , "navbar-start" ) ;
add _location ( div1 , file$6 , 35 , 8 , 878 ) ;
attr _dev ( div2 , "class" , "navbar-end" ) ;
add _location ( div2 , file$6 , 42 , 8 , 1106 ) ;
attr _dev ( div3 , "class" , "navbar-menu" ) ;
toggle _class ( div3 , "is-active" , /*menu_shown*/ ctx [ 0 ] ) ;
add _location ( div3 , file$6 , 34 , 4 , 815 ) ;
attr _dev ( nav , "class" , "navbar" ) ;
attr _dev ( nav , "role" , "navigation" ) ;
attr _dev ( nav , "aria-label" , "main navigation" ) ;
add _location ( nav , file$6 , 16 , 0 , 307 ) ;
} ,
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 , 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 ( div1 , t4 ) ;
if ( if _block0 ) if _block0 . m ( div1 , null ) ;
append _dev ( div3 , t5 ) ;
append _dev ( div3 , div2 ) ;
if _blocks [ current _block _type _index ] . m ( div2 , null ) ;
current = true ;
if ( ! mounted ) {
dispose = listen _dev ( a , "click" , /*toggleMenu*/ ctx [ 2 ] , false , false , false ) ;
mounted = 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 ) ;
if ( /*loggedIn*/ ctx [ 1 ] ) {
if ( if _block0 ) {
if ( dirty & /*loggedIn*/ 2 ) {
transition _in ( if _block0 , 1 ) ;
}
} else {
if _block0 = create _if _block _1$3 ( ctx ) ;
if _block0 . c ( ) ;
transition _in ( if _block0 , 1 ) ;
if _block0 . m ( div1 , null ) ;
}
} else if ( if _block0 ) {
group _outros ( ) ;
transition _out ( if _block0 , 1 , 1 , ( ) => {
if _block0 = null ;
} ) ;
check _outros ( ) ;
}
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 _block1 = if _blocks [ current _block _type _index ] ;
if ( ! if _block1 ) {
if _block1 = if _blocks [ current _block _type _index ] = if _block _creators [ current _block _type _index ] ( ctx ) ;
if _block1 . c ( ) ;
}
transition _in ( if _block1 , 1 ) ;
if _block1 . m ( div2 , null ) ;
}
if ( dirty & /*menu_shown*/ 1 ) {
toggle _class ( div3 , "is-active" , /*menu_shown*/ ctx [ 0 ] ) ;
}
} ,
i : function intro ( local ) {
if ( current ) return ;
transition _in ( link0 . $$ . fragment , local ) ;
transition _in ( link1 . $$ . fragment , local ) ;
transition _in ( if _block0 ) ;
transition _in ( if _block1 ) ;
current = true ;
} ,
o : function outro ( local ) {
transition _out ( link0 . $$ . fragment , local ) ;
transition _out ( link1 . $$ . fragment , local ) ;
transition _out ( if _block0 ) ;
transition _out ( if _block1 ) ;
current = false ;
} ,
d : function destroy ( detaching ) {
if ( detaching ) detach _dev ( nav ) ;
destroy _component ( link0 ) ;
destroy _component ( link1 ) ;
if ( if _block0 ) if _block0 . d ( ) ;
if _blocks [ current _block _type _index ] . d ( ) ;
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 { $$slots : slots = { } , $$scope } = $$props ;
validate _slots ( "Navbar" , slots , [ ] ) ;
let menu _shown = false ;
let loggedIn = false ;
token$1 . subscribe ( value => {
$$invalidate ( 1 , loggedIn = value !== "" ) ;
} ) ;
const toggleMenu = ( ) => {
$$invalidate ( 0 , menu _shown = ! menu _shown ) ;
} ;
const writable _props = [ ] ;
Object . keys ( $$props ) . forEach ( key => {
if ( ! ~ writable _props . indexOf ( key ) && key . slice ( 0 , 2 ) !== "$$" ) console . warn ( ` <Navbar> was created with unknown prop ' ${ key } ' ` ) ;
} ) ;
$$self . $capture _state = ( ) => ( {
Link ,
token : token$1 ,
menu _shown ,
loggedIn ,
toggleMenu
} ) ;
$$self . $inject _state = $$props => {
if ( "menu_shown" in $$props ) $$invalidate ( 0 , menu _shown = $$props . menu _shown ) ;
if ( "loggedIn" in $$props ) $$invalidate ( 1 , loggedIn = $$props . loggedIn ) ;
} ;
if ( $$props && "$$inject" in $$props ) {
$$self . $inject _state ( $$props . $$inject ) ;
}
return [ menu _shown , loggedIn , toggleMenu ] ;
}
class Navbar extends SvelteComponentDev {
constructor ( options ) {
super ( options ) ;
init ( this , options , instance$7 , create _fragment$7 , safe _not _equal , { } ) ;
dispatch _dev ( "SvelteRegisterComponent" , {
component : this ,
tagName : "Navbar" ,
options ,
id : create _fragment$7 . name
} ) ;
}
}
/* 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 , 5 , 4 , 94 ) ;
attr _dev ( p1 , "class" , "subtitle" ) ;
add _location ( p1 , file$5 , 6 , 4 , 128 ) ;
attr _dev ( div , "class" , "hero-body" ) ;
add _location ( div , file$5 , 4 , 2 , 66 ) ;
attr _dev ( section , "class" , "hero is-primary is-medium" ) ;
add _location ( section , file$5 , 3 , 0 , 20 ) ;
} ,
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 ( ` <Home> 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
} ) ;
}
}
let url = window . BASE _URL ;
token$1 . 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$1 . 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 ;
}
function createCommonjsModule ( fn ) {
var module = { exports : { } } ;
return fn ( module , module . exports ) , module . exports ;
}
var strictUriEncode = str => encodeURIComponent ( str ) . replace ( /[!'()*]/g , x => ` % ${ x . charCodeAt ( 0 ) . toString ( 16 ) . toUpperCase ( ) } ` ) ;
var token = '%[a-f0-9]{2}' ;
var singleMatcher = new RegExp ( token , 'gi' ) ;
var multiMatcher = new RegExp ( '(' + token + ')+' , 'gi' ) ;
function decodeComponents ( components , split ) {
try {
// Try to decode the entire string first
return decodeURIComponent ( components . join ( '' ) ) ;
} catch ( err ) {
// Do nothing
}
if ( components . length === 1 ) {
return components ;
}
split = split || 1 ;
// Split the array in 2 parts
var left = components . slice ( 0 , split ) ;
var right = components . slice ( split ) ;
return Array . prototype . concat . call ( [ ] , decodeComponents ( left ) , decodeComponents ( right ) ) ;
}
function decode ( input ) {
try {
return decodeURIComponent ( input ) ;
} catch ( err ) {
var tokens = input . match ( singleMatcher ) ;
for ( var i = 1 ; i < tokens . length ; i ++ ) {
input = decodeComponents ( tokens , i ) . join ( '' ) ;
tokens = input . match ( singleMatcher ) ;
}
return input ;
}
}
function customDecodeURIComponent ( input ) {
// Keep track of all the replacements and prefill the map with the `BOM`
var replaceMap = {
'%FE%FF' : '\uFFFD\uFFFD' ,
'%FF%FE' : '\uFFFD\uFFFD'
} ;
var match = multiMatcher . exec ( input ) ;
while ( match ) {
try {
// Decode as big chunks as possible
replaceMap [ match [ 0 ] ] = decodeURIComponent ( match [ 0 ] ) ;
} catch ( err ) {
var result = decode ( match [ 0 ] ) ;
if ( result !== match [ 0 ] ) {
replaceMap [ match [ 0 ] ] = result ;
}
}
match = multiMatcher . exec ( input ) ;
}
// Add `%C2` at the end of the map to make sure it does not replace the combinator before everything else
replaceMap [ '%C2' ] = '\uFFFD' ;
var entries = Object . keys ( replaceMap ) ;
for ( var i = 0 ; i < entries . length ; i ++ ) {
// Replace all decoded components
var key = entries [ i ] ;
input = input . replace ( new RegExp ( key , 'g' ) , replaceMap [ key ] ) ;
}
return input ;
}
var decodeUriComponent = function ( encodedURI ) {
if ( typeof encodedURI !== 'string' ) {
throw new TypeError ( 'Expected `encodedURI` to be of type `string`, got `' + typeof encodedURI + '`' ) ;
}
try {
encodedURI = encodedURI . replace ( /\+/g , ' ' ) ;
// Try the built in decoder first
return decodeURIComponent ( encodedURI ) ;
} catch ( err ) {
// Fallback to a more advanced decoder
return customDecodeURIComponent ( encodedURI ) ;
}
} ;
var splitOnFirst = ( string , separator ) => {
if ( ! ( typeof string === 'string' && typeof separator === 'string' ) ) {
throw new TypeError ( 'Expected the arguments to be of type `string`' ) ;
}
if ( separator === '' ) {
return [ string ] ;
}
const separatorIndex = string . indexOf ( separator ) ;
if ( separatorIndex === - 1 ) {
return [ string ] ;
}
return [
string . slice ( 0 , separatorIndex ) ,
string . slice ( separatorIndex + separator . length )
] ;
} ;
var filterObj = function ( obj , predicate ) {
var ret = { } ;
var keys = Object . keys ( obj ) ;
var isArr = Array . isArray ( predicate ) ;
for ( var i = 0 ; i < keys . length ; i ++ ) {
var key = keys [ i ] ;
var val = obj [ key ] ;
if ( isArr ? predicate . indexOf ( key ) !== - 1 : predicate ( key , val , obj ) ) {
ret [ key ] = val ;
}
}
return ret ;
} ;
var queryString = createCommonjsModule ( function ( module , exports ) {
const isNullOrUndefined = value => value === null || value === undefined ;
function encoderForArrayFormat ( options ) {
switch ( options . arrayFormat ) {
case 'index' :
return key => ( result , value ) => {
const index = result . length ;
if (
value === undefined ||
( options . skipNull && value === null ) ||
( options . skipEmptyString && value === '' )
) {
return result ;
}
if ( value === null ) {
return [ ... result , [ encode ( key , options ) , '[' , index , ']' ] . join ( '' ) ] ;
}
return [
... result ,
[ encode ( key , options ) , '[' , encode ( index , options ) , ']=' , encode ( value , options ) ] . join ( '' )
] ;
} ;
case 'bracket' :
return key => ( result , value ) => {
if (
value === undefined ||
( options . skipNull && value === null ) ||
( options . skipEmptyString && value === '' )
) {
return result ;
}
if ( value === null ) {
return [ ... result , [ encode ( key , options ) , '[]' ] . join ( '' ) ] ;
}
return [ ... result , [ encode ( key , options ) , '[]=' , encode ( value , options ) ] . join ( '' ) ] ;
} ;
case 'comma' :
case 'separator' :
case 'bracket-separator' : {
const keyValueSep = options . arrayFormat === 'bracket-separator' ?
'[]=' :
'=' ;
return key => ( result , value ) => {
if (
value === undefined ||
( options . skipNull && value === null ) ||
( options . skipEmptyString && value === '' )
) {
return result ;
}
// Translate null to an empty string so that it doesn't serialize as 'null'
value = value === null ? '' : value ;
if ( result . length === 0 ) {
return [ [ encode ( key , options ) , keyValueSep , encode ( value , options ) ] . join ( '' ) ] ;
}
return [ [ result , encode ( value , options ) ] . join ( options . arrayFormatSeparator ) ] ;
} ;
}
default :
return key => ( result , value ) => {
if (
value === undefined ||
( options . skipNull && value === null ) ||
( options . skipEmptyString && value === '' )
) {
return result ;
}
if ( value === null ) {
return [ ... result , encode ( key , options ) ] ;
}
return [ ... result , [ encode ( key , options ) , '=' , encode ( value , options ) ] . join ( '' ) ] ;
} ;
}
}
function parserForArrayFormat ( options ) {
let result ;
switch ( options . arrayFormat ) {
case 'index' :
return ( key , value , accumulator ) => {
result = /\[(\d*)\]$/ . exec ( key ) ;
key = key . replace ( /\[\d*\]$/ , '' ) ;
if ( ! result ) {
accumulator [ key ] = value ;
return ;
}
if ( accumulator [ key ] === undefined ) {
accumulator [ key ] = { } ;
}
accumulator [ key ] [ result [ 1 ] ] = value ;
} ;
case 'bracket' :
return ( key , value , accumulator ) => {
result = /(\[\])$/ . exec ( key ) ;
key = key . replace ( /\[\]$/ , '' ) ;
if ( ! result ) {
accumulator [ key ] = value ;
return ;
}
if ( accumulator [ key ] === undefined ) {
accumulator [ key ] = [ value ] ;
return ;
}
accumulator [ key ] = [ ] . concat ( accumulator [ key ] , value ) ;
} ;
case 'comma' :
case 'separator' :
return ( key , value , accumulator ) => {
const isArray = typeof value === 'string' && value . includes ( options . arrayFormatSeparator ) ;
const isEncodedArray = ( typeof value === 'string' && ! isArray && decode ( value , options ) . includes ( options . arrayFormatSeparator ) ) ;
value = isEncodedArray ? decode ( value , options ) : value ;
const newValue = isArray || isEncodedArray ? value . split ( options . arrayFormatSeparator ) . map ( item => decode ( item , options ) ) : value === null ? value : decode ( value , options ) ;
accumulator [ key ] = newValue ;
} ;
case 'bracket-separator' :
return ( key , value , accumulator ) => {
const isArray = /(\[\])$/ . test ( key ) ;
key = key . replace ( /\[\]$/ , '' ) ;
if ( ! isArray ) {
accumulator [ key ] = value ? decode ( value , options ) : value ;
return ;
}
const arrayValue = value === null ?
[ ] :
value . split ( options . arrayFormatSeparator ) . map ( item => decode ( item , options ) ) ;
if ( accumulator [ key ] === undefined ) {
accumulator [ key ] = arrayValue ;
return ;
}
accumulator [ key ] = [ ] . concat ( accumulator [ key ] , arrayValue ) ;
} ;
default :
return ( key , value , accumulator ) => {
if ( accumulator [ key ] === undefined ) {
accumulator [ key ] = value ;
return ;
}
accumulator [ key ] = [ ] . concat ( accumulator [ key ] , value ) ;
} ;
}
}
function validateArrayFormatSeparator ( value ) {
if ( typeof value !== 'string' || value . length !== 1 ) {
throw new TypeError ( 'arrayFormatSeparator must be single character string' ) ;
}
}
function encode ( value , options ) {
if ( options . encode ) {
return options . strict ? strictUriEncode ( value ) : encodeURIComponent ( value ) ;
}
return value ;
}
function decode ( value , options ) {
if ( options . decode ) {
return decodeUriComponent ( value ) ;
}
return value ;
}
function keysSorter ( input ) {
if ( Array . isArray ( input ) ) {
return input . sort ( ) ;
}
if ( typeof input === 'object' ) {
return keysSorter ( Object . keys ( input ) )
. sort ( ( a , b ) => Number ( a ) - Number ( b ) )
. map ( key => input [ key ] ) ;
}
return input ;
}
function removeHash ( input ) {
const hashStart = input . indexOf ( '#' ) ;
if ( hashStart !== - 1 ) {
input = input . slice ( 0 , hashStart ) ;
}
return input ;
}
function getHash ( url ) {
let hash = '' ;
const hashStart = url . indexOf ( '#' ) ;
if ( hashStart !== - 1 ) {
hash = url . slice ( hashStart ) ;
}
return hash ;
}
function extract ( input ) {
input = removeHash ( input ) ;
const queryStart = input . indexOf ( '?' ) ;
if ( queryStart === - 1 ) {
return '' ;
}
return input . slice ( queryStart + 1 ) ;
}
function parseValue ( value , options ) {
if ( options . parseNumbers && ! Number . isNaN ( Number ( value ) ) && ( typeof value === 'string' && value . trim ( ) !== '' ) ) {
value = Number ( value ) ;
} else if ( options . parseBooleans && value !== null && ( value . toLowerCase ( ) === 'true' || value . toLowerCase ( ) === 'false' ) ) {
value = value . toLowerCase ( ) === 'true' ;
}
return value ;
}
function parse ( query , options ) {
options = Object . assign ( {
decode : true ,
sort : true ,
arrayFormat : 'none' ,
arrayFormatSeparator : ',' ,
parseNumbers : false ,
parseBooleans : false
} , options ) ;
validateArrayFormatSeparator ( options . arrayFormatSeparator ) ;
const formatter = parserForArrayFormat ( options ) ;
// Create an object with no prototype
const ret = Object . create ( null ) ;
if ( typeof query !== 'string' ) {
return ret ;
}
query = query . trim ( ) . replace ( /^[?#&]/ , '' ) ;
if ( ! query ) {
return ret ;
}
for ( const param of query . split ( '&' ) ) {
if ( param === '' ) {
continue ;
}
let [ key , value ] = splitOnFirst ( options . decode ? param . replace ( /\+/g , ' ' ) : param , '=' ) ;
// Missing `=` should be `null`:
// http://w3.org/TR/2012/WD-url-20120524/#collect-url-parameters
value = value === undefined ? null : [ 'comma' , 'separator' , 'bracket-separator' ] . includes ( options . arrayFormat ) ? value : decode ( value , options ) ;
formatter ( decode ( key , options ) , value , ret ) ;
}
for ( const key of Object . keys ( ret ) ) {
const value = ret [ key ] ;
if ( typeof value === 'object' && value !== null ) {
for ( const k of Object . keys ( value ) ) {
value [ k ] = parseValue ( value [ k ] , options ) ;
}
} else {
ret [ key ] = parseValue ( value , options ) ;
}
}
if ( options . sort === false ) {
return ret ;
}
return ( options . sort === true ? Object . keys ( ret ) . sort ( ) : Object . keys ( ret ) . sort ( options . sort ) ) . reduce ( ( result , key ) => {
const value = ret [ key ] ;
if ( Boolean ( value ) && typeof value === 'object' && ! Array . isArray ( value ) ) {
// Sort object keys, not values
result [ key ] = keysSorter ( value ) ;
} else {
result [ key ] = value ;
}
return result ;
} , Object . create ( null ) ) ;
}
exports . extract = extract ;
exports . parse = parse ;
exports . stringify = ( object , options ) => {
if ( ! object ) {
return '' ;
}
options = Object . assign ( {
encode : true ,
strict : true ,
arrayFormat : 'none' ,
arrayFormatSeparator : ','
} , options ) ;
validateArrayFormatSeparator ( options . arrayFormatSeparator ) ;
const shouldFilter = key => (
( options . skipNull && isNullOrUndefined ( object [ key ] ) ) ||
( options . skipEmptyString && object [ key ] === '' )
) ;
const formatter = encoderForArrayFormat ( options ) ;
const objectCopy = { } ;
for ( const key of Object . keys ( object ) ) {
if ( ! shouldFilter ( key ) ) {
objectCopy [ key ] = object [ key ] ;
}
}
const keys = Object . keys ( objectCopy ) ;
if ( options . sort !== false ) {
keys . sort ( options . sort ) ;
}
return keys . map ( key => {
const value = object [ key ] ;
if ( value === undefined ) {
return '' ;
}
if ( value === null ) {
return encode ( key , options ) ;
}
if ( Array . isArray ( value ) ) {
if ( value . length === 0 && options . arrayFormat === 'bracket-separator' ) {
return encode ( key , options ) + '[]' ;
}
return value
. reduce ( formatter ( key ) , [ ] )
. join ( '&' ) ;
}
return encode ( key , options ) + '=' + encode ( value , options ) ;
} ) . filter ( x => x . length > 0 ) . join ( '&' ) ;
} ;
exports . parseUrl = ( url , options ) => {
options = Object . assign ( {
decode : true
} , options ) ;
const [ url _ , hash ] = splitOnFirst ( url , '#' ) ;
return Object . assign (
{
url : url _ . split ( '?' ) [ 0 ] || '' ,
query : parse ( extract ( url ) , options )
} ,
options && options . parseFragmentIdentifier && hash ? { fragmentIdentifier : decode ( hash , options ) } : { }
) ;
} ;
exports . stringifyUrl = ( object , options ) => {
options = Object . assign ( {
encode : true ,
strict : true
} , options ) ;
const url = removeHash ( object . url ) . split ( '?' ) [ 0 ] || '' ;
const queryFromUrl = exports . extract ( object . url ) ;
const parsedQueryFromUrl = exports . parse ( queryFromUrl , { sort : false } ) ;
const query = Object . assign ( parsedQueryFromUrl , object . query ) ;
let queryString = exports . stringify ( query , options ) ;
if ( queryString ) {
queryString = ` ? ${ queryString } ` ;
}
let hash = getHash ( object . url ) ;
if ( object . fragmentIdentifier ) {
hash = ` # ${ encode ( object . fragmentIdentifier , options ) } ` ;
}
return ` ${ url } ${ queryString } ${ hash } ` ;
} ;
exports . pick = ( input , filter , options ) => {
options = Object . assign ( {
parseFragmentIdentifier : true
} , options ) ;
const { url , query , fragmentIdentifier } = exports . parseUrl ( input , options ) ;
return exports . stringifyUrl ( {
url ,
query : filterObj ( query , filter ) ,
fragmentIdentifier
} , options ) ;
} ;
exports . exclude = ( input , filter , options ) => {
const exclusionFilter = Array . isArray ( filter ) ? key => ! filter . includes ( key ) : ( key , value ) => ! filter ( key , value ) ;
return exports . pick ( input , exclusionFilter , options ) ;
} ;
} ) ;
/* 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 [ 7 ] = list [ i ] ;
return child _ctx ;
}
function get _each _context _1$1 ( ctx , list , i ) {
const child _ctx = ctx . slice ( ) ;
child _ctx [ 10 ] = list [ i ] ;
return child _ctx ;
}
function get _each _context _2$1 ( ctx , list , i ) {
const child _ctx = ctx . slice ( ) ;
child _ctx [ 13 ] = list [ i ] ;
return child _ctx ;
}
// (45:12) {#if page > 1}
function create _if _block _5$1 ( ctx ) {
let link ;
let current ;
link = new Link ( {
props : {
to : "/posts?page=" + ( /*page*/ ctx [ 0 ] - 1 ) ,
class : "pagination-previous" ,
"aria-label" : "Previous" ,
$$slots : { default : [ create _default _slot _7$1 ] } ,
$$scope : { ctx }
} ,
$$inline : true
} ) ;
link . $on ( "click" , function ( ) {
if ( is _function ( /*handlePage*/ ctx [ 3 ] ( /*page*/ ctx [ 0 ] - 1 ) ) ) /*handlePage*/ ctx [ 3 ] ( /*page*/ ctx [ 0 ] - 1 ) . apply ( this , arguments ) ;
} ) ;
const block = {
c : function create ( ) {
create _component ( link . $$ . fragment ) ;
} ,
m : function mount ( target , anchor ) {
mount _component ( link , target , anchor ) ;
current = true ;
} ,
p : function update ( new _ctx , dirty ) {
ctx = new _ctx ;
const link _changes = { } ;
if ( dirty & /*page*/ 1 ) link _changes . to = "/posts?page=" + ( /*page*/ ctx [ 0 ] - 1 ) ;
if ( dirty & /*$$scope*/ 65536 ) {
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 ) {
destroy _component ( link , detaching ) ;
}
} ;
dispatch _dev ( "SvelteRegisterBlock" , {
block ,
id : create _if _block _5$1 . name ,
type : "if" ,
source : "(45:12) {#if page > 1}" ,
ctx
} ) ;
return block ;
}
// (46:16) <Link on:click={handlePage(page - 1)} to="/posts?page={page - 1}" class="pagination-previous" aria-label="Previous">
function create _default _slot _7$1 ( ctx ) {
let t ;
const block = {
c : function create ( ) {
t = text ( "Previous" ) ;
} ,
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 _7$1 . name ,
type : "slot" ,
source : "(46:16) <Link on:click={handlePage(page - 1)} to=\\\"/posts?page={page - 1}\\\" class=\\\"pagination-previous\\\" aria-label=\\\"Previous\\\">" ,
ctx
} ) ;
return block ;
}
// (53:12) {#if page < totalPages}
function create _if _block _4$1 ( ctx ) {
let link ;
let current ;
link = new Link ( {
props : {
to : "/posts?page=" + ( /*page*/ ctx [ 0 ] + 1 ) ,
class : "pagination-next" ,
"aria-label" : "Next" ,
$$slots : { default : [ create _default _slot _6$1 ] } ,
$$scope : { ctx }
} ,
$$inline : true
} ) ;
link . $on ( "click" , function ( ) {
if ( is _function ( /*handlePage*/ ctx [ 3 ] ( /*page*/ ctx [ 0 ] + 1 ) ) ) /*handlePage*/ ctx [ 3 ] ( /*page*/ ctx [ 0 ] + 1 ) . apply ( this , arguments ) ;
} ) ;
const block = {
c : function create ( ) {
create _component ( link . $$ . fragment ) ;
} ,
m : function mount ( target , anchor ) {
mount _component ( link , target , anchor ) ;
current = true ;
} ,
p : function update ( new _ctx , dirty ) {
ctx = new _ctx ;
const link _changes = { } ;
if ( dirty & /*page*/ 1 ) link _changes . to = "/posts?page=" + ( /*page*/ ctx [ 0 ] + 1 ) ;
if ( dirty & /*$$scope*/ 65536 ) {
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 ) {
destroy _component ( link , detaching ) ;
}
} ;
dispatch _dev ( "SvelteRegisterBlock" , {
block ,
id : create _if _block _4$1 . name ,
type : "if" ,
source : "(53:12) {#if page < totalPages}" ,
ctx
} ) ;
return block ;
}
// (54:16) <Link on:click={handlePage(page + 1)} to="/posts?page={page + 1}" class="pagination-next" aria-label="Next">
function create _default _slot _6$1 ( ctx ) {
let t ;
const block = {
c : function create ( ) {
t = text ( "Next" ) ;
} ,
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 _6$1 . name ,
type : "slot" ,
source : "(54:16) <Link on:click={handlePage(page + 1)} to=\\\"/posts?page={page + 1}\\\" class=\\\"pagination-next\\\" aria-label=\\\"Next\\\">" ,
ctx
} ) ;
return block ;
}
// (62:16) {#if page > 3}
function create _if _block _3$1 ( ctx ) {
let li0 ;
let link ;
let t0 ;
let li1 ;
let span ;
let current ;
link = new Link ( {
props : {
to : "/posts?page=" + 1 ,
class : "pagination-link" ,
"aria-label" : "Goto page 1" ,
$$slots : { default : [ create _default _slot _5$1 ] } ,
$$scope : { ctx }
} ,
$$inline : true
} ) ;
link . $on ( "click" , /*handlePage*/ ctx [ 3 ] ( 1 ) ) ;
const block = {
c : function create ( ) {
li0 = element ( "li" ) ;
create _component ( link . $$ . fragment ) ;
t0 = space ( ) ;
li1 = element ( "li" ) ;
span = element ( "span" ) ;
span . textContent = "…" ;
add _location ( li0 , file$4 , 62 , 20 , 1744 ) ;
attr _dev ( span , "class" , "pagination-ellipsis" ) ;
add _location ( span , file$4 , 71 , 24 , 2095 ) ;
add _location ( li1 , file$4 , 70 , 20 , 2066 ) ;
} ,
m : function mount ( target , anchor ) {
insert _dev ( target , li0 , anchor ) ;
mount _component ( link , li0 , null ) ;
insert _dev ( target , t0 , anchor ) ;
insert _dev ( target , li1 , anchor ) ;
append _dev ( li1 , span ) ;
current = true ;
} ,
p : function update ( ctx , dirty ) {
const link _changes = { } ;
if ( dirty & /*$$scope*/ 65536 ) {
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 ( li0 ) ;
destroy _component ( link ) ;
if ( detaching ) detach _dev ( t0 ) ;
if ( detaching ) detach _dev ( li1 ) ;
}
} ;
dispatch _dev ( "SvelteRegisterBlock" , {
block ,
id : create _if _block _3$1 . name ,
type : "if" ,
source : "(62:16) {#if page > 3}" ,
ctx
} ) ;
return block ;
}
// (64:24) <Link on:click={handlePage(1)} to="/posts?page={1}" class="pagination-link" aria-label="Goto page 1">
function create _default _slot _5$1 ( ctx ) {
let t ;
const block = {
c : function create ( ) {
t = text ( "1" ) ;
} ,
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$1 . name ,
type : "slot" ,
source : "(64:24) <Link on:click={handlePage(1)} to=\\\"/posts?page={1}\\\" class=\\\"pagination-link\\\" aria-label=\\\"Goto page 1\\\">" ,
ctx
} ) ;
return block ;
}
// (76:20) {#if i >= 1 && i <= totalPages}
function create _if _block _1$2 ( ctx ) {
let current _block _type _index ;
let if _block ;
let if _block _anchor ;
let current ;
const if _block _creators = [ create _if _block _2$1 , create _else _block$1 ] ;
const if _blocks = [ ] ;
function select _block _type ( ctx , dirty ) {
if ( /*i*/ ctx [ 13 ] == /*page*/ ctx [ 0 ] ) 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 _1$2 . name ,
type : "if" ,
source : "(76:20) {#if i >= 1 && i <= totalPages}" ,
ctx
} ) ;
return block ;
}
// (86:24) {:else}
function create _else _block$1 ( ctx ) {
let li ;
let link ;
let current ;
link = new Link ( {
props : {
to : "/posts?page=" + /*i*/ ctx [ 13 ] ,
class : "pagination-link" ,
"aria-label" : "Goto page " + /*i*/ ctx [ 13 ] ,
$$slots : { default : [ create _default _slot _4$1 ] } ,
$$scope : { ctx }
} ,
$$inline : true
} ) ;
link . $on ( "click" , function ( ) {
if ( is _function ( /*handlePage*/ ctx [ 3 ] ( /*i*/ ctx [ 13 ] ) ) ) /*handlePage*/ ctx [ 3 ] ( /*i*/ ctx [ 13 ] ) . apply ( this , arguments ) ;
} ) ;
const block = {
c : function create ( ) {
li = element ( "li" ) ;
create _component ( link . $$ . fragment ) ;
add _location ( li , file$4 , 86 , 28 , 2821 ) ;
} ,
m : function mount ( target , anchor ) {
insert _dev ( target , li , anchor ) ;
mount _component ( link , li , null ) ;
current = true ;
} ,
p : function update ( new _ctx , dirty ) {
ctx = new _ctx ;
const link _changes = { } ;
if ( dirty & /*page*/ 1 ) link _changes . to = "/posts?page=" + /*i*/ ctx [ 13 ] ;
if ( dirty & /*page*/ 1 ) link _changes [ "aria-label" ] = "Goto page " + /*i*/ ctx [ 13 ] ;
if ( dirty & /*$$scope, page*/ 65537 ) {
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 ( li ) ;
destroy _component ( link ) ;
}
} ;
dispatch _dev ( "SvelteRegisterBlock" , {
block ,
id : create _else _block$1 . name ,
type : "else" ,
source : "(86:24) {:else}" ,
ctx
} ) ;
return block ;
}
// (77:24) {#if i == page}
function create _if _block _2$1 ( ctx ) {
let li ;
let link ;
let current ;
link = new Link ( {
props : {
to : "/posts?page=" + /*i*/ ctx [ 13 ] ,
class : "pagination-link is-current" ,
"aria-label" : "Goto page " + /*i*/ ctx [ 13 ] ,
$$slots : { default : [ create _default _slot _3$1 ] } ,
$$scope : { ctx }
} ,
$$inline : true
} ) ;
link . $on ( "click" , function ( ) {
if ( is _function ( /*handlePage*/ ctx [ 3 ] ( /*i*/ ctx [ 13 ] ) ) ) /*handlePage*/ ctx [ 3 ] ( /*i*/ ctx [ 13 ] ) . apply ( this , arguments ) ;
} ) ;
const block = {
c : function create ( ) {
li = element ( "li" ) ;
create _component ( link . $$ . fragment ) ;
add _location ( li , file$4 , 77 , 28 , 2388 ) ;
} ,
m : function mount ( target , anchor ) {
insert _dev ( target , li , anchor ) ;
mount _component ( link , li , null ) ;
current = true ;
} ,
p : function update ( new _ctx , dirty ) {
ctx = new _ctx ;
const link _changes = { } ;
if ( dirty & /*page*/ 1 ) link _changes . to = "/posts?page=" + /*i*/ ctx [ 13 ] ;
if ( dirty & /*page*/ 1 ) link _changes [ "aria-label" ] = "Goto page " + /*i*/ ctx [ 13 ] ;
if ( dirty & /*$$scope, page*/ 65537 ) {
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 ( li ) ;
destroy _component ( link ) ;
}
} ;
dispatch _dev ( "SvelteRegisterBlock" , {
block ,
id : create _if _block _2$1 . name ,
type : "if" ,
source : "(77:24) {#if i == page}" ,
ctx
} ) ;
return block ;
}
// (88:32) <Link on:click={handlePage(i)} to="/posts?page={i}" class="pagination-link" aria-label="Goto page {i}">
function create _default _slot _4$1 ( ctx ) {
let t _value = /*i*/ ctx [ 13 ] + "" ;
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 & /*page*/ 1 && t _value !== ( t _value = /*i*/ ctx [ 13 ] + "" ) ) set _data _dev ( t , t _value ) ;
} ,
d : function destroy ( detaching ) {
if ( detaching ) detach _dev ( t ) ;
}
} ;
dispatch _dev ( "SvelteRegisterBlock" , {
block ,
id : create _default _slot _4$1 . name ,
type : "slot" ,
source : "(88:32) <Link on:click={handlePage(i)} to=\\\"/posts?page={i}\\\" class=\\\"pagination-link\\\" aria-label=\\\"Goto page {i}\\\">" ,
ctx
} ) ;
return block ;
}
// (79:32) <Link on:click={handlePage(i)} to="/posts?page={i}" class="pagination-link is-current" aria-label="Goto page {i}">
function create _default _slot _3$1 ( ctx ) {
let t _value = /*i*/ ctx [ 13 ] + "" ;
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 & /*page*/ 1 && t _value !== ( t _value = /*i*/ ctx [ 13 ] + "" ) ) set _data _dev ( t , t _value ) ;
} ,
d : function destroy ( detaching ) {
if ( detaching ) detach _dev ( t ) ;
}
} ;
dispatch _dev ( "SvelteRegisterBlock" , {
block ,
id : create _default _slot _3$1 . name ,
type : "slot" ,
source : "(79:32) <Link on:click={handlePage(i)} to=\\\"/posts?page={i}\\\" class=\\\"pagination-link is-current\\\" aria-label=\\\"Goto page {i}\\\">" ,
ctx
} ) ;
return block ;
}
// (75:16) {#each [...Array(5).keys()].map((x) => x + page - 2) as i}
function create _each _block _2$1 ( ctx ) {
let if _block _anchor ;
let current ;
let if _block = /*i*/ ctx [ 13 ] >= 1 && /*i*/ ctx [ 13 ] <= /*totalPages*/ ctx [ 1 ] && create _if _block _1$2 ( ctx ) ;
const block = {
c : function create ( ) {
if ( if _block ) if _block . c ( ) ;
if _block _anchor = empty ( ) ;
} ,
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 ( /*i*/ ctx [ 13 ] >= 1 && /*i*/ ctx [ 13 ] <= /*totalPages*/ ctx [ 1 ] ) {
if ( if _block ) {
if _block . p ( ctx , dirty ) ;
if ( dirty & /*page, totalPages*/ 3 ) {
transition _in ( if _block , 1 ) ;
}
} else {
if _block = create _if _block _1$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 _each _block _2$1 . name ,
type : "each" ,
source : "(75:16) {#each [...Array(5).keys()].map((x) => x + page - 2) as i}" ,
ctx
} ) ;
return block ;
}
// (98:16) {#if totalPages - page > 2}
function create _if _block$2 ( ctx ) {
let li0 ;
let span ;
let t1 ;
let li1 ;
let link ;
let current ;
link = new Link ( {
props : {
to : "/posts?page=" + /*totalPages*/ ctx [ 1 ] ,
class : "pagination-link" ,
"aria-label" : "Goto page " + /*totalPages*/ ctx [ 1 ] ,
$$slots : { default : [ create _default _slot _2$1 ] } ,
$$scope : { ctx }
} ,
$$inline : true
} ) ;
link . $on ( "click" , function ( ) {
if ( is _function ( /*handlePage*/ ctx [ 3 ] ( /*totalPages*/ ctx [ 1 ] ) ) ) /*handlePage*/ ctx [ 3 ] ( /*totalPages*/ ctx [ 1 ] ) . apply ( this , arguments ) ;
} ) ;
const block = {
c : function create ( ) {
li0 = element ( "li" ) ;
span = element ( "span" ) ;
span . textContent = "…" ;
t1 = space ( ) ;
li1 = element ( "li" ) ;
create _component ( link . $$ . fragment ) ;
attr _dev ( span , "class" , "pagination-ellipsis" ) ;
add _location ( span , file$4 , 99 , 24 , 3356 ) ;
add _location ( li0 , file$4 , 98 , 20 , 3327 ) ;
add _location ( li1 , file$4 , 101 , 20 , 3452 ) ;
} ,
m : function mount ( target , anchor ) {
insert _dev ( target , li0 , anchor ) ;
append _dev ( li0 , span ) ;
insert _dev ( target , t1 , anchor ) ;
insert _dev ( target , li1 , anchor ) ;
mount _component ( link , li1 , null ) ;
current = true ;
} ,
p : function update ( new _ctx , dirty ) {
ctx = new _ctx ;
const link _changes = { } ;
if ( dirty & /*totalPages*/ 2 ) link _changes . to = "/posts?page=" + /*totalPages*/ ctx [ 1 ] ;
if ( dirty & /*totalPages*/ 2 ) link _changes [ "aria-label" ] = "Goto page " + /*totalPages*/ ctx [ 1 ] ;
if ( dirty & /*$$scope, totalPages*/ 65538 ) {
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 ( li0 ) ;
if ( detaching ) detach _dev ( t1 ) ;
if ( detaching ) detach _dev ( li1 ) ;
destroy _component ( link ) ;
}
} ;
dispatch _dev ( "SvelteRegisterBlock" , {
block ,
id : create _if _block$2 . name ,
type : "if" ,
source : "(98:16) {#if totalPages - page > 2}" ,
ctx
} ) ;
return block ;
}
// (103:24) <Link on:click={handlePage(totalPages)} to="/posts?page={totalPages}" class="pagination-link" aria-label="Goto page {totalPages}" >
function create _default _slot _2$1 ( ctx ) {
let t ;
const block = {
c : function create ( ) {
t = text ( /*totalPages*/ ctx [ 1 ] ) ;
} ,
m : function mount ( target , anchor ) {
insert _dev ( target , t , anchor ) ;
} ,
p : function update ( ctx , dirty ) {
if ( dirty & /*totalPages*/ 2 ) set _data _dev ( t , /*totalPages*/ ctx [ 1 ] ) ;
} ,
d : function destroy ( detaching ) {
if ( detaching ) detach _dev ( t ) ;
}
} ;
dispatch _dev ( "SvelteRegisterBlock" , {
block ,
id : create _default _slot _2$1 . name ,
type : "slot" ,
source : "(103:24) <Link on:click={handlePage(totalPages)} to=\\\"/posts?page={totalPages}\\\" class=\\\"pagination-link\\\" aria-label=\\\"Goto page {totalPages}\\\" >" ,
ctx
} ) ;
return block ;
}
// (119:28) <Link to="/post/{post.id}">
function create _default _slot _1$1 ( ctx ) {
let img ;
let img _alt _value ;
let img _src _value ;
const block = {
c : function create ( ) {
img = element ( "img" ) ;
attr _dev ( img , "alt" , img _alt _value = /*post*/ ctx [ 7 ] . id ) ;
if ( img . src !== ( img _src _value = /*post*/ ctx [ 7 ] . image _path ) ) attr _dev ( img , "src" , img _src _value ) ;
add _location ( img , file$4 , 119 , 32 , 4202 ) ;
} ,
m : function mount ( target , anchor ) {
insert _dev ( target , img , anchor ) ;
} ,
p : function update ( ctx , dirty ) {
if ( dirty & /*posts*/ 4 && img _alt _value !== ( img _alt _value = /*post*/ ctx [ 7 ] . id ) ) {
attr _dev ( img , "alt" , img _alt _value ) ;
}
if ( dirty & /*posts*/ 4 && img . src !== ( img _src _value = /*post*/ ctx [ 7 ] . 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 : "(119:28) <Link to=\\\"/post/{post.id}\\\">" ,
ctx
} ) ;
return block ;
}
// (128:36) <Link to="/tag/{tag}">
function create _default _slot$3 ( ctx ) {
let t _value = /*tag*/ ctx [ 10 ] + "" ;
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*/ 4 && t _value !== ( t _value = /*tag*/ ctx [ 10 ] + "" ) ) 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 : "(128:36) <Link to=\\\"/tag/{tag}\\\">" ,
ctx
} ) ;
return block ;
}
// (126:28) {#each post.tags as tag (tag)}
function create _each _block _1$1 ( key _1 , ctx ) {
let p ;
let link ;
let t ;
let current ;
link = new Link ( {
props : {
to : "/tag/" + /*tag*/ ctx [ 10 ] ,
$$slots : { default : [ create _default _slot$3 ] } ,
$$scope : { ctx }
} ,
$$inline : true
} ) ;
const block = {
key : key _1 ,
first : null ,
c : function create ( ) {
p = element ( "p" ) ;
create _component ( link . $$ . fragment ) ;
t = space ( ) ;
add _location ( p , file$4 , 126 , 32 , 4527 ) ;
this . first = p ;
} ,
m : function mount ( target , anchor ) {
insert _dev ( target , p , anchor ) ;
mount _component ( link , p , null ) ;
append _dev ( p , t ) ;
current = true ;
} ,
p : function update ( new _ctx , dirty ) {
ctx = new _ctx ;
const link _changes = { } ;
if ( dirty & /*posts*/ 4 ) link _changes . to = "/tag/" + /*tag*/ ctx [ 10 ] ;
if ( dirty & /*$$scope, posts*/ 65540 ) {
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 ( p ) ;
destroy _component ( link ) ;
}
} ;
dispatch _dev ( "SvelteRegisterBlock" , {
block ,
id : create _each _block _1$1 . name ,
type : "each" ,
source : "(126:28) {#each post.tags as tag (tag)}" ,
ctx
} ) ;
return block ;
}
// (115: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 [ 7 ] . id ,
$$slots : { default : [ create _default _slot _1$1 ] } ,
$$scope : { ctx }
} ,
$$inline : true
} ) ;
let each _value _1 = /*post*/ ctx [ 7 ] . tags ;
validate _each _argument ( each _value _1 ) ;
const get _key = ctx => /*tag*/ ctx [ 10 ] ;
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 , 117 , 24 , 4091 ) ;
attr _dev ( div0 , "class" , "card-image" ) ;
add _location ( div0 , file$4 , 116 , 20 , 4042 ) ;
attr _dev ( div1 , "class" , "content" ) ;
add _location ( div1 , file$4 , 124 , 24 , 4414 ) ;
attr _dev ( div2 , "class" , "card-content" ) ;
add _location ( div2 , file$4 , 123 , 20 , 4363 ) ;
attr _dev ( div3 , "class" , "column is-one-quarter card" ) ;
add _location ( div3 , file$4 , 115 , 16 , 3981 ) ;
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*/ 4 ) link _changes . to = "/post/" + /*post*/ ctx [ 7 ] . id ;
if ( dirty & /*$$scope, posts*/ 65540 ) {
link _changes . $$scope = { dirty , ctx } ;
}
link . $set ( link _changes ) ;
if ( dirty & /*posts*/ 4 ) {
each _value _1 = /*post*/ ctx [ 7 ] . 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 : "(115: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 nav ;
let t2 ;
let t3 ;
let ul ;
let t4 ;
let t5 ;
let t6 ;
let div1 ;
let each _blocks = [ ] ;
let each1 _lookup = new Map ( ) ;
let current ;
let if _block0 = /*page*/ ctx [ 0 ] > 1 && create _if _block _5$1 ( ctx ) ;
let if _block1 = /*page*/ ctx [ 0 ] < /*totalPages*/ ctx [ 1 ] && create _if _block _4$1 ( ctx ) ;
let if _block2 = /*page*/ ctx [ 0 ] > 3 && create _if _block _3$1 ( ctx ) ;
let each _value _2 = [ ... Array ( 5 ) . keys ( ) ] . map ( /*func*/ ctx [ 5 ] ) ;
validate _each _argument ( each _value _2 ) ;
let each _blocks _1 = [ ] ;
for ( let i = 0 ; i < each _value _2 . length ; i += 1 ) {
each _blocks _1 [ i ] = create _each _block _2$1 ( get _each _context _2$1 ( ctx , each _value _2 , i ) ) ;
}
const out = i => transition _out ( each _blocks _1 [ i ] , 1 , 1 , ( ) => {
each _blocks _1 [ i ] = null ;
} ) ;
let if _block3 = /*totalPages*/ ctx [ 1 ] - /*page*/ ctx [ 0 ] > 2 && create _if _block$2 ( ctx ) ;
let each _value = /*posts*/ ctx [ 2 ] ;
validate _each _argument ( each _value ) ;
const get _key = ctx => /*post*/ ctx [ 7 ] . 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 ) ;
each1 _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" ) ;
nav = element ( "nav" ) ;
if ( if _block0 ) if _block0 . c ( ) ;
t2 = space ( ) ;
if ( if _block1 ) if _block1 . c ( ) ;
t3 = space ( ) ;
ul = element ( "ul" ) ;
if ( if _block2 ) if _block2 . c ( ) ;
t4 = space ( ) ;
for ( let i = 0 ; i < each _blocks _1 . length ; i += 1 ) {
each _blocks _1 [ i ] . c ( ) ;
}
t5 = space ( ) ;
if ( if _block3 ) if _block3 . c ( ) ;
t6 = space ( ) ;
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 , 37 , 8 , 896 ) ;
attr _dev ( div0 , "class" , "hero-body" ) ;
add _location ( div0 , file$4 , 36 , 4 , 864 ) ;
attr _dev ( section0 , "class" , "hero is-primary" ) ;
add _location ( section0 , file$4 , 35 , 0 , 826 ) ;
attr _dev ( ul , "class" , "pagination-list" ) ;
add _location ( ul , file$4 , 60 , 12 , 1664 ) ;
attr _dev ( nav , "class" , "pagination" ) ;
attr _dev ( nav , "role" , "navigation" ) ;
attr _dev ( nav , "aria-label" , "pagination" ) ;
add _location ( nav , file$4 , 43 , 8 , 1008 ) ;
attr _dev ( div1 , "class" , "columns is-multiline" ) ;
add _location ( div1 , file$4 , 113 , 8 , 3886 ) ;
attr _dev ( div2 , "class" , "container" ) ;
add _location ( div2 , file$4 , 42 , 4 , 976 ) ;
attr _dev ( section1 , "class" , "section" ) ;
add _location ( section1 , file$4 , 41 , 0 , 946 ) ;
} ,
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 , nav ) ;
if ( if _block0 ) if _block0 . m ( nav , null ) ;
append _dev ( nav , t2 ) ;
if ( if _block1 ) if _block1 . m ( nav , null ) ;
append _dev ( nav , t3 ) ;
append _dev ( nav , ul ) ;
if ( if _block2 ) if _block2 . m ( ul , null ) ;
append _dev ( ul , t4 ) ;
for ( let i = 0 ; i < each _blocks _1 . length ; i += 1 ) {
each _blocks _1 [ i ] . m ( ul , null ) ;
}
append _dev ( ul , t5 ) ;
if ( if _block3 ) if _block3 . m ( ul , null ) ;
append _dev ( div2 , t6 ) ;
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 ( /*page*/ ctx [ 0 ] > 1 ) {
if ( if _block0 ) {
if _block0 . p ( ctx , dirty ) ;
if ( dirty & /*page*/ 1 ) {
transition _in ( if _block0 , 1 ) ;
}
} else {
if _block0 = create _if _block _5$1 ( ctx ) ;
if _block0 . c ( ) ;
transition _in ( if _block0 , 1 ) ;
if _block0 . m ( nav , t2 ) ;
}
} else if ( if _block0 ) {
group _outros ( ) ;
transition _out ( if _block0 , 1 , 1 , ( ) => {
if _block0 = null ;
} ) ;
check _outros ( ) ;
}
if ( /*page*/ ctx [ 0 ] < /*totalPages*/ ctx [ 1 ] ) {
if ( if _block1 ) {
if _block1 . p ( ctx , dirty ) ;
if ( dirty & /*page, totalPages*/ 3 ) {
transition _in ( if _block1 , 1 ) ;
}
} else {
if _block1 = create _if _block _4$1 ( ctx ) ;
if _block1 . c ( ) ;
transition _in ( if _block1 , 1 ) ;
if _block1 . m ( nav , t3 ) ;
}
} else if ( if _block1 ) {
group _outros ( ) ;
transition _out ( if _block1 , 1 , 1 , ( ) => {
if _block1 = null ;
} ) ;
check _outros ( ) ;
}
if ( /*page*/ ctx [ 0 ] > 3 ) {
if ( if _block2 ) {
if _block2 . p ( ctx , dirty ) ;
if ( dirty & /*page*/ 1 ) {
transition _in ( if _block2 , 1 ) ;
}
} else {
if _block2 = create _if _block _3$1 ( ctx ) ;
if _block2 . c ( ) ;
transition _in ( if _block2 , 1 ) ;
if _block2 . m ( ul , t4 ) ;
}
} else if ( if _block2 ) {
group _outros ( ) ;
transition _out ( if _block2 , 1 , 1 , ( ) => {
if _block2 = null ;
} ) ;
check _outros ( ) ;
}
if ( dirty & /*Array, page, handlePage, totalPages*/ 11 ) {
each _value _2 = [ ... Array ( 5 ) . keys ( ) ] . map ( /*func*/ ctx [ 5 ] ) ;
validate _each _argument ( each _value _2 ) ;
let i ;
for ( i = 0 ; i < each _value _2 . length ; i += 1 ) {
const child _ctx = get _each _context _2$1 ( ctx , each _value _2 , i ) ;
if ( each _blocks _1 [ i ] ) {
each _blocks _1 [ i ] . p ( child _ctx , dirty ) ;
transition _in ( each _blocks _1 [ i ] , 1 ) ;
} else {
each _blocks _1 [ i ] = create _each _block _2$1 ( child _ctx ) ;
each _blocks _1 [ i ] . c ( ) ;
transition _in ( each _blocks _1 [ i ] , 1 ) ;
each _blocks _1 [ i ] . m ( ul , t5 ) ;
}
}
group _outros ( ) ;
for ( i = each _value _2 . length ; i < each _blocks _1 . length ; i += 1 ) {
out ( i ) ;
}
check _outros ( ) ;
}
if ( /*totalPages*/ ctx [ 1 ] - /*page*/ ctx [ 0 ] > 2 ) {
if ( if _block3 ) {
if _block3 . p ( ctx , dirty ) ;
if ( dirty & /*totalPages, page*/ 3 ) {
transition _in ( if _block3 , 1 ) ;
}
} else {
if _block3 = create _if _block$2 ( ctx ) ;
if _block3 . c ( ) ;
transition _in ( if _block3 , 1 ) ;
if _block3 . m ( ul , null ) ;
}
} else if ( if _block3 ) {
group _outros ( ) ;
transition _out ( if _block3 , 1 , 1 , ( ) => {
if _block3 = null ;
} ) ;
check _outros ( ) ;
}
if ( dirty & /*posts*/ 4 ) {
each _value = /*posts*/ ctx [ 2 ] ;
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 , each1 _lookup , div1 , outro _and _destroy _block , create _each _block$2 , null , get _each _context$2 ) ;
check _outros ( ) ;
}
} ,
i : function intro ( local ) {
if ( current ) return ;
transition _in ( if _block0 ) ;
transition _in ( if _block1 ) ;
transition _in ( if _block2 ) ;
for ( let i = 0 ; i < each _value _2 . length ; i += 1 ) {
transition _in ( each _blocks _1 [ i ] ) ;
}
transition _in ( if _block3 ) ;
for ( let i = 0 ; i < each _value . length ; i += 1 ) {
transition _in ( each _blocks [ i ] ) ;
}
current = true ;
} ,
o : function outro ( local ) {
transition _out ( if _block0 ) ;
transition _out ( if _block1 ) ;
transition _out ( if _block2 ) ;
each _blocks _1 = each _blocks _1 . filter ( Boolean ) ;
for ( let i = 0 ; i < each _blocks _1 . length ; i += 1 ) {
transition _out ( each _blocks _1 [ i ] ) ;
}
transition _out ( if _block3 ) ;
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 ) ;
if ( if _block0 ) if _block0 . d ( ) ;
if ( if _block1 ) if _block1 . d ( ) ;
if ( if _block2 ) if _block2 . d ( ) ;
destroy _each ( each _blocks _1 , detaching ) ;
if ( if _block3 ) if _block3 . d ( ) ;
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 { location } = $$props ;
let page = 1 ;
let totalPages = 1 ;
let posts = [ ] ;
const getData = async ( ) => {
const data = await getPosts ( { page } ) ;
if ( Array . isArray ( data . posts ) ) {
$$invalidate ( 2 , posts = data . posts ) ;
$$invalidate ( 1 , totalPages = data . totalPage ) ;
}
} ;
onMount ( ( ) => {
let queryParams ;
queryParams = queryString . parse ( location . search ) ;
if ( queryParams . page ) {
$$invalidate ( 0 , page = parseInt ( queryParams . page ) ) ;
}
getData ( ) ;
} ) ;
const handlePage = i => {
return ( ) => {
$$invalidate ( 0 , page = i ) ;
getData ( ) ;
} ;
} ;
const writable _props = [ "location" ] ;
Object . keys ( $$props ) . forEach ( key => {
if ( ! ~ writable _props . indexOf ( key ) && key . slice ( 0 , 2 ) !== "$$" ) console . warn ( ` <Posts> was created with unknown prop ' ${ key } ' ` ) ;
} ) ;
const func = x => x + page - 2 ;
$$self . $$set = $$props => {
if ( "location" in $$props ) $$invalidate ( 4 , location = $$props . location ) ;
} ;
$$self . $capture _state = ( ) => ( {
onMount ,
getPosts ,
Link ,
queryString ,
location ,
page ,
totalPages ,
posts ,
getData ,
handlePage
} ) ;
$$self . $inject _state = $$props => {
if ( "location" in $$props ) $$invalidate ( 4 , location = $$props . location ) ;
if ( "page" in $$props ) $$invalidate ( 0 , page = $$props . page ) ;
if ( "totalPages" in $$props ) $$invalidate ( 1 , totalPages = $$props . totalPages ) ;
if ( "posts" in $$props ) $$invalidate ( 2 , posts = $$props . posts ) ;
} ;
if ( $$props && "$$inject" in $$props ) {
$$self . $inject _state ( $$props . $$inject ) ;
}
return [ page , totalPages , posts , handlePage , location , func ] ;
}
class Posts extends SvelteComponentDev {
constructor ( options ) {
super ( options ) ;
init ( this , options , instance$5 , create _fragment$5 , safe _not _equal , { location : 4 } ) ;
dispatch _dev ( "SvelteRegisterComponent" , {
component : this ,
tagName : "Posts" ,
options ,
id : create _fragment$5 . name
} ) ;
const { ctx } = this . $$ ;
const props = options . props || { } ;
if ( /*location*/ ctx [ 4 ] === undefined && ! ( "location" in props ) ) {
console . warn ( "<Posts> was created without expected prop 'location'" ) ;
}
}
get location ( ) {
throw new Error ( "<Posts>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'" ) ;
}
set location ( value ) {
throw new Error ( "<Posts>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'" ) ;
}
}
/* 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 [ 4 ] = list [ i ] ;
return child _ctx ;
}
// (25:8) {#if post}
function create _if _block _1$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 , 25 , 6 , 545 ) ;
} ,
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$1 . name ,
type : "if" ,
source : "(25:8) {#if post}" ,
ctx
} ) ;
return block ;
}
// (32: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 = /*trimUrl*/ ctx [ 1 ] ( /*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 _alt _value ;
let img _src _value ;
let current ;
let each _value = /*post*/ ctx [ 0 ] . tags ;
validate _each _argument ( each _value ) ;
const get _key = ctx => /*tag*/ ctx [ 4 ] ;
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 , 37 , 36 , 840 ) ;
add _location ( p0 , file$3 , 36 , 20 , 800 ) ;
add _location ( p1 , file$3 , 39 , 20 , 944 ) ;
attr _dev ( div0 , "class" , "column is-one-third box" ) ;
add _location ( div0 , file$3 , 35 , 12 , 742 ) ;
attr _dev ( img , "alt" , img _alt _value = /*post*/ ctx [ 0 ] . id ) ;
if ( img . src !== ( img _src _value = /*post*/ ctx [ 0 ] . image _path ) ) attr _dev ( img , "src" , img _src _value ) ;
add _location ( img , file$3 , 52 , 20 , 1395 ) ;
attr _dev ( figure , "class" , "image" ) ;
add _location ( figure , file$3 , 51 , 16 , 1352 ) ;
attr _dev ( div1 , "class" , "column" ) ;
add _location ( div1 , file$3 , 50 , 12 , 1315 ) ;
attr _dev ( div2 , "class" , "columns" ) ;
add _location ( div2 , file$3 , 34 , 8 , 708 ) ;
attr _dev ( section , "class" , "section" ) ;
add _location ( section , file$3 , 33 , 4 , 674 ) ;
attr _dev ( div3 , "class" , "container" ) ;
add _location ( div3 , file$3 , 32 , 0 , 646 ) ;
} ,
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 = /*trimUrl*/ ctx [ 1 ] ( /*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 _alt _value !== ( img _alt _value = /*post*/ ctx [ 0 ] . id ) ) {
attr _dev ( img , "alt" , img _alt _value ) ;
}
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 : "(32:0) {#if post}" ,
ctx
} ) ;
return block ;
}
// (45:32) <Link to="/tag/{tag}">
function create _default _slot$2 ( ctx ) {
let t _value = /*tag*/ ctx [ 4 ] + "" ;
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 [ 4 ] + "" ) ) 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 : "(45:32) <Link to=\\\"/tag/{tag}\\\">" ,
ctx
} ) ;
return block ;
}
// (42:24) {#each post.tags as tag (tag)}
function create _each _block$1 ( key _1 , ctx ) {
let ul ;
let li ;
let link ;
let t ;
let current ;
link = new Link ( {
props : {
to : "/tag/" + /*tag*/ ctx [ 4 ] ,
$$slots : { default : [ create _default _slot$2 ] } ,
$$scope : { ctx }
} ,
$$inline : true
} ) ;
const block = {
key : key _1 ,
first : null ,
c : function create ( ) {
ul = element ( "ul" ) ;
li = element ( "li" ) ;
create _component ( link . $$ . fragment ) ;
t = space ( ) ;
add _location ( li , file$3 , 43 , 28 , 1091 ) ;
add _location ( ul , file$3 , 42 , 24 , 1058 ) ;
this . first = ul ;
} ,
m : function mount ( target , anchor ) {
insert _dev ( target , ul , anchor ) ;
append _dev ( ul , li ) ;
mount _component ( link , li , null ) ;
append _dev ( ul , t ) ;
current = true ;
} ,
p : function update ( new _ctx , dirty ) {
ctx = new _ctx ;
const link _changes = { } ;
if ( dirty & /*post*/ 1 ) link _changes . to = "/tag/" + /*tag*/ ctx [ 4 ] ;
if ( dirty & /*$$scope, post*/ 129 ) {
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 ( ul ) ;
destroy _component ( link ) ;
}
} ;
dispatch _dev ( "SvelteRegisterBlock" , {
block ,
id : create _each _block$1 . name ,
type : "each" ,
source : "(42: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$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 , 23 , 4 , 496 ) ;
attr _dev ( section , "class" , "hero is-primary" ) ;
add _location ( section , file$3 , 22 , 0 , 458 ) ;
} ,
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$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 ) ;
} ;
const trimUrl = str => {
if ( str . length > 30 ) {
return str . substring ( 0 , 30 ) + "..." ;
}
return str ;
} ;
onMount ( ( ) => {
getData ( ) ;
} ) ;
const writable _props = [ "id" ] ;
Object . keys ( $$props ) . forEach ( key => {
if ( ! ~ writable _props . indexOf ( key ) && key . slice ( 0 , 2 ) !== "$$" ) console . warn ( ` <Post> was created with unknown prop ' ${ key } ' ` ) ;
} ) ;
$$self . $$set = $$props => {
if ( "id" in $$props ) $$invalidate ( 2 , id = $$props . id ) ;
} ;
$$self . $capture _state = ( ) => ( {
onMount ,
Link ,
getPost ,
id ,
post ,
getData ,
trimUrl
} ) ;
$$self . $inject _state = $$props => {
if ( "id" in $$props ) $$invalidate ( 2 , id = $$props . id ) ;
if ( "post" in $$props ) $$invalidate ( 0 , post = $$props . post ) ;
} ;
if ( $$props && "$$inject" in $$props ) {
$$self . $inject _state ( $$props . $$inject ) ;
}
return [ post , trimUrl , id ] ;
}
class Post extends SvelteComponentDev {
constructor ( options ) {
super ( options ) ;
init ( this , options , instance$4 , create _fragment$4 , safe _not _equal , { id : 2 } ) ;
dispatch _dev ( "SvelteRegisterComponent" , {
component : this ,
tagName : "Post" ,
options ,
id : create _fragment$4 . name
} ) ;
const { ctx } = this . $$ ;
const props = options . props || { } ;
if ( /*id*/ ctx [ 2 ] === undefined && ! ( "id" in props ) ) {
console . warn ( "<Post> was created without expected prop 'id'" ) ;
}
}
get id ( ) {
throw new Error ( "<Post>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'" ) ;
}
set id ( value ) {
throw new Error ( "<Post>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'" ) ;
}
}
/* 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 , "for" , "username" ) ;
attr _dev ( label0 , "class" , "label" ) ;
add _location ( label0 , file$2 , 16 , 12 , 391 ) ;
attr _dev ( input0 , "id" , "username" ) ;
attr _dev ( input0 , "class" , "input" ) ;
attr _dev ( input0 , "type" , "text" ) ;
attr _dev ( input0 , "placeholder" , "Username" ) ;
input0 . required = true ;
add _location ( input0 , file$2 , 18 , 16 , 494 ) ;
attr _dev ( div0 , "class" , "control" ) ;
add _location ( div0 , file$2 , 17 , 12 , 456 ) ;
attr _dev ( div1 , "class" , "field" ) ;
add _location ( div1 , file$2 , 15 , 8 , 359 ) ;
attr _dev ( label1 , "for" , "password" ) ;
attr _dev ( label1 , "class" , "label" ) ;
add _location ( label1 , file$2 , 29 , 12 , 808 ) ;
attr _dev ( input1 , "id" , "password" ) ;
attr _dev ( input1 , "class" , "input" ) ;
attr _dev ( input1 , "type" , "password" ) ;
attr _dev ( input1 , "placeholder" , "Password" ) ;
input1 . required = true ;
add _location ( input1 , file$2 , 31 , 16 , 911 ) ;
attr _dev ( div2 , "class" , "control" ) ;
add _location ( div2 , file$2 , 30 , 12 , 873 ) ;
attr _dev ( div3 , "class" , "field" ) ;
add _location ( div3 , file$2 , 28 , 8 , 776 ) ;
attr _dev ( button , "class" , "button is-link" ) ;
add _location ( button , file$2 , 43 , 16 , 1267 ) ;
attr _dev ( div4 , "class" , "control" ) ;
add _location ( div4 , file$2 , 42 , 12 , 1229 ) ;
attr _dev ( div5 , "class" , "field" ) ;
add _location ( div5 , file$2 , 41 , 8 , 1197 ) ;
add _location ( form , file$2 , 14 , 4 , 309 ) ;
attr _dev ( div6 , "class" , "container" ) ;
add _location ( div6 , file$2 , 13 , 0 , 281 ) ;
} ,
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 ( ` <Login> 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$1 . set ( "" ) ;
navigate ( "/" ) ;
} ) ;
const writable _props = [ ] ;
Object . keys ( $$props ) . forEach ( key => {
if ( ! ~ writable _props . indexOf ( key ) && key . slice ( 0 , 2 ) !== "$$" ) console . warn ( ` <Logout> was created with unknown prop ' ${ key } ' ` ) ;
} ) ;
$$self . $capture _state = ( ) => ( { token : token$1 , 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 [ 8 ] = list [ i ] ;
return child _ctx ;
}
function get _each _context _1 ( ctx , list , i ) {
const child _ctx = ctx . slice ( ) ;
child _ctx [ 11 ] = list [ i ] ;
return child _ctx ;
}
function get _each _context _2 ( ctx , list , i ) {
const child _ctx = ctx . slice ( ) ;
child _ctx [ 14 ] = list [ i ] ;
return child _ctx ;
}
// (50:12) {#if page > 1}
function create _if _block _5 ( ctx ) {
let link ;
let current ;
link = new Link ( {
props : {
to : "/tag/" + /*id*/ ctx [ 0 ] + "?page=" + ( /*page*/ ctx [ 1 ] - 1 ) ,
class : "pagination-previous" ,
"aria-label" : "Previous" ,
$$slots : { default : [ create _default _slot _7 ] } ,
$$scope : { ctx }
} ,
$$inline : true
} ) ;
link . $on ( "click" , function ( ) {
if ( is _function ( /*handlePage*/ ctx [ 4 ] ( /*page*/ ctx [ 1 ] - 1 ) ) ) /*handlePage*/ ctx [ 4 ] ( /*page*/ ctx [ 1 ] - 1 ) . apply ( this , arguments ) ;
} ) ;
const block = {
c : function create ( ) {
create _component ( link . $$ . fragment ) ;
} ,
m : function mount ( target , anchor ) {
mount _component ( link , target , anchor ) ;
current = true ;
} ,
p : function update ( new _ctx , dirty ) {
ctx = new _ctx ;
const link _changes = { } ;
if ( dirty & /*id, page*/ 3 ) link _changes . to = "/tag/" + /*id*/ ctx [ 0 ] + "?page=" + ( /*page*/ ctx [ 1 ] - 1 ) ;
if ( dirty & /*$$scope*/ 131072 ) {
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 ) {
destroy _component ( link , detaching ) ;
}
} ;
dispatch _dev ( "SvelteRegisterBlock" , {
block ,
id : create _if _block _5 . name ,
type : "if" ,
source : "(50:12) {#if page > 1}" ,
ctx
} ) ;
return block ;
}
// (51:16) <Link on:click={handlePage(page - 1)} to="/tag/{id}?page={page - 1}" class="pagination-previous" aria-label="Previous">
function create _default _slot _7 ( ctx ) {
let t ;
const block = {
c : function create ( ) {
t = text ( "Previous" ) ;
} ,
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 _7 . name ,
type : "slot" ,
source : "(51:16) <Link on:click={handlePage(page - 1)} to=\\\"/tag/{id}?page={page - 1}\\\" class=\\\"pagination-previous\\\" aria-label=\\\"Previous\\\">" ,
ctx
} ) ;
return block ;
}
// (58:12) {#if page < totalPages}
function create _if _block _4 ( ctx ) {
let link ;
let current ;
link = new Link ( {
props : {
to : "/tag/" + /*id*/ ctx [ 0 ] + "?page=" + ( /*page*/ ctx [ 1 ] + 1 ) ,
class : "pagination-next" ,
"aria-label" : "Next" ,
$$slots : { default : [ create _default _slot _6 ] } ,
$$scope : { ctx }
} ,
$$inline : true
} ) ;
link . $on ( "click" , function ( ) {
if ( is _function ( /*handlePage*/ ctx [ 4 ] ( /*page*/ ctx [ 1 ] + 1 ) ) ) /*handlePage*/ ctx [ 4 ] ( /*page*/ ctx [ 1 ] + 1 ) . apply ( this , arguments ) ;
} ) ;
const block = {
c : function create ( ) {
create _component ( link . $$ . fragment ) ;
} ,
m : function mount ( target , anchor ) {
mount _component ( link , target , anchor ) ;
current = true ;
} ,
p : function update ( new _ctx , dirty ) {
ctx = new _ctx ;
const link _changes = { } ;
if ( dirty & /*id, page*/ 3 ) link _changes . to = "/tag/" + /*id*/ ctx [ 0 ] + "?page=" + ( /*page*/ ctx [ 1 ] + 1 ) ;
if ( dirty & /*$$scope*/ 131072 ) {
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 ) {
destroy _component ( link , detaching ) ;
}
} ;
dispatch _dev ( "SvelteRegisterBlock" , {
block ,
id : create _if _block _4 . name ,
type : "if" ,
source : "(58:12) {#if page < totalPages}" ,
ctx
} ) ;
return block ;
}
// (59:16) <Link on:click={handlePage(page + 1)} to="/tag/{id}?page={page + 1}" class="pagination-next" aria-label="Next">
function create _default _slot _6 ( ctx ) {
let t ;
const block = {
c : function create ( ) {
t = text ( "Next" ) ;
} ,
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 _6 . name ,
type : "slot" ,
source : "(59:16) <Link on:click={handlePage(page + 1)} to=\\\"/tag/{id}?page={page + 1}\\\" class=\\\"pagination-next\\\" aria-label=\\\"Next\\\">" ,
ctx
} ) ;
return block ;
}
// (67:16) {#if page > 3}
function create _if _block _3 ( ctx ) {
let li0 ;
let link ;
let t0 ;
let li1 ;
let span ;
let current ;
link = new Link ( {
props : {
to : "/tag/" + /*id*/ ctx [ 0 ] + "?page=" + 1 ,
class : "pagination-link" ,
"aria-label" : "Goto page 1" ,
$$slots : { default : [ create _default _slot _5 ] } ,
$$scope : { ctx }
} ,
$$inline : true
} ) ;
link . $on ( "click" , /*handlePage*/ ctx [ 4 ] ( 1 ) ) ;
const block = {
c : function create ( ) {
li0 = element ( "li" ) ;
create _component ( link . $$ . fragment ) ;
t0 = space ( ) ;
li1 = element ( "li" ) ;
span = element ( "span" ) ;
span . textContent = "…" ;
add _location ( li0 , file$1 , 67 , 20 , 1842 ) ;
attr _dev ( span , "class" , "pagination-ellipsis" ) ;
add _location ( span , file$1 , 76 , 24 , 2196 ) ;
add _location ( li1 , file$1 , 75 , 20 , 2167 ) ;
} ,
m : function mount ( target , anchor ) {
insert _dev ( target , li0 , anchor ) ;
mount _component ( link , li0 , null ) ;
insert _dev ( target , t0 , anchor ) ;
insert _dev ( target , li1 , anchor ) ;
append _dev ( li1 , span ) ;
current = true ;
} ,
p : function update ( ctx , dirty ) {
const link _changes = { } ;
if ( dirty & /*id*/ 1 ) link _changes . to = "/tag/" + /*id*/ ctx [ 0 ] + "?page=" + 1 ;
if ( dirty & /*$$scope*/ 131072 ) {
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 ( li0 ) ;
destroy _component ( link ) ;
if ( detaching ) detach _dev ( t0 ) ;
if ( detaching ) detach _dev ( li1 ) ;
}
} ;
dispatch _dev ( "SvelteRegisterBlock" , {
block ,
id : create _if _block _3 . name ,
type : "if" ,
source : "(67:16) {#if page > 3}" ,
ctx
} ) ;
return block ;
}
// (69:24) <Link on:click={handlePage(1)} to="/tag/{id}?page={1}" class="pagination-link" aria-label="Goto page 1">
function create _default _slot _5 ( ctx ) {
let t ;
const block = {
c : function create ( ) {
t = text ( "1" ) ;
} ,
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 : "(69:24) <Link on:click={handlePage(1)} to=\\\"/tag/{id}?page={1}\\\" class=\\\"pagination-link\\\" aria-label=\\\"Goto page 1\\\">" ,
ctx
} ) ;
return block ;
}
// (81:20) {#if i >= 1 && i <= totalPages}
function create _if _block _1 ( ctx ) {
let current _block _type _index ;
let if _block ;
let if _block _anchor ;
let current ;
const if _block _creators = [ create _if _block _2 , create _else _block ] ;
const if _blocks = [ ] ;
function select _block _type ( ctx , dirty ) {
if ( /*i*/ ctx [ 14 ] == /*page*/ 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 ) ;
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 _1 . name ,
type : "if" ,
source : "(81:20) {#if i >= 1 && i <= totalPages}" ,
ctx
} ) ;
return block ;
}
// (91:24) {:else}
function create _else _block ( ctx ) {
let li ;
let link ;
let current ;
link = new Link ( {
props : {
to : "/tag/" + /*id*/ ctx [ 0 ] + "?page=" + /*i*/ ctx [ 14 ] ,
class : "pagination-link" ,
"aria-label" : "Goto page " + /*i*/ ctx [ 14 ] ,
$$slots : { default : [ create _default _slot _4 ] } ,
$$scope : { ctx }
} ,
$$inline : true
} ) ;
link . $on ( "click" , function ( ) {
if ( is _function ( /*handlePage*/ ctx [ 4 ] ( /*i*/ ctx [ 14 ] ) ) ) /*handlePage*/ ctx [ 4 ] ( /*i*/ ctx [ 14 ] ) . apply ( this , arguments ) ;
} ) ;
const block = {
c : function create ( ) {
li = element ( "li" ) ;
create _component ( link . $$ . fragment ) ;
add _location ( li , file$1 , 91 , 28 , 2925 ) ;
} ,
m : function mount ( target , anchor ) {
insert _dev ( target , li , anchor ) ;
mount _component ( link , li , null ) ;
current = true ;
} ,
p : function update ( new _ctx , dirty ) {
ctx = new _ctx ;
const link _changes = { } ;
if ( dirty & /*id, page*/ 3 ) link _changes . to = "/tag/" + /*id*/ ctx [ 0 ] + "?page=" + /*i*/ ctx [ 14 ] ;
if ( dirty & /*page*/ 2 ) link _changes [ "aria-label" ] = "Goto page " + /*i*/ ctx [ 14 ] ;
if ( dirty & /*$$scope, page*/ 131074 ) {
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 ( li ) ;
destroy _component ( link ) ;
}
} ;
dispatch _dev ( "SvelteRegisterBlock" , {
block ,
id : create _else _block . name ,
type : "else" ,
source : "(91:24) {:else}" ,
ctx
} ) ;
return block ;
}
// (82:24) {#if i == page}
function create _if _block _2 ( ctx ) {
let li ;
let link ;
let current ;
link = new Link ( {
props : {
to : "/tag/" + /*id*/ ctx [ 0 ] + "?page=" + /*i*/ ctx [ 14 ] ,
class : "pagination-link is-current" ,
"aria-label" : "Goto page " + /*i*/ ctx [ 14 ] ,
$$slots : { default : [ create _default _slot _3 ] } ,
$$scope : { ctx }
} ,
$$inline : true
} ) ;
link . $on ( "click" , function ( ) {
if ( is _function ( /*handlePage*/ ctx [ 4 ] ( /*i*/ ctx [ 14 ] ) ) ) /*handlePage*/ ctx [ 4 ] ( /*i*/ ctx [ 14 ] ) . apply ( this , arguments ) ;
} ) ;
const block = {
c : function create ( ) {
li = element ( "li" ) ;
create _component ( link . $$ . fragment ) ;
add _location ( li , file$1 , 82 , 28 , 2489 ) ;
} ,
m : function mount ( target , anchor ) {
insert _dev ( target , li , anchor ) ;
mount _component ( link , li , null ) ;
current = true ;
} ,
p : function update ( new _ctx , dirty ) {
ctx = new _ctx ;
const link _changes = { } ;
if ( dirty & /*id, page*/ 3 ) link _changes . to = "/tag/" + /*id*/ ctx [ 0 ] + "?page=" + /*i*/ ctx [ 14 ] ;
if ( dirty & /*page*/ 2 ) link _changes [ "aria-label" ] = "Goto page " + /*i*/ ctx [ 14 ] ;
if ( dirty & /*$$scope, page*/ 131074 ) {
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 ( li ) ;
destroy _component ( link ) ;
}
} ;
dispatch _dev ( "SvelteRegisterBlock" , {
block ,
id : create _if _block _2 . name ,
type : "if" ,
source : "(82:24) {#if i == page}" ,
ctx
} ) ;
return block ;
}
// (93:32) <Link on:click={handlePage(i)} to="/tag/{id}?page={i}" class="pagination-link" aria-label="Goto page {i}">
function create _default _slot _4 ( ctx ) {
let t _value = /*i*/ ctx [ 14 ] + "" ;
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 & /*page*/ 2 && t _value !== ( t _value = /*i*/ ctx [ 14 ] + "" ) ) set _data _dev ( t , t _value ) ;
} ,
d : function destroy ( detaching ) {
if ( detaching ) detach _dev ( t ) ;
}
} ;
dispatch _dev ( "SvelteRegisterBlock" , {
block ,
id : create _default _slot _4 . name ,
type : "slot" ,
source : "(93:32) <Link on:click={handlePage(i)} to=\\\"/tag/{id}?page={i}\\\" class=\\\"pagination-link\\\" aria-label=\\\"Goto page {i}\\\">" ,
ctx
} ) ;
return block ;
}
// (84:32) <Link on:click={handlePage(i)} to="/tag/{id}?page={i}" class="pagination-link is-current" aria-label="Goto page {i}">
function create _default _slot _3 ( ctx ) {
let t _value = /*i*/ ctx [ 14 ] + "" ;
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 & /*page*/ 2 && t _value !== ( t _value = /*i*/ ctx [ 14 ] + "" ) ) 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 : "(84:32) <Link on:click={handlePage(i)} to=\\\"/tag/{id}?page={i}\\\" class=\\\"pagination-link is-current\\\" aria-label=\\\"Goto page {i}\\\">" ,
ctx
} ) ;
return block ;
}
// (80:16) {#each [...Array(5).keys()].map((x) => x + page - 2) as i}
function create _each _block _2 ( ctx ) {
let if _block _anchor ;
let current ;
let if _block = /*i*/ ctx [ 14 ] >= 1 && /*i*/ ctx [ 14 ] <= /*totalPages*/ ctx [ 2 ] && create _if _block _1 ( ctx ) ;
const block = {
c : function create ( ) {
if ( if _block ) if _block . c ( ) ;
if _block _anchor = empty ( ) ;
} ,
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 ( /*i*/ ctx [ 14 ] >= 1 && /*i*/ ctx [ 14 ] <= /*totalPages*/ ctx [ 2 ] ) {
if ( if _block ) {
if _block . p ( ctx , dirty ) ;
if ( dirty & /*page, totalPages*/ 6 ) {
transition _in ( if _block , 1 ) ;
}
} else {
if _block = create _if _block _1 ( 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 _each _block _2 . name ,
type : "each" ,
source : "(80:16) {#each [...Array(5).keys()].map((x) => x + page - 2) as i}" ,
ctx
} ) ;
return block ;
}
// (103:16) {#if totalPages - page > 2}
function create _if _block ( ctx ) {
let li0 ;
let span ;
let t1 ;
let li1 ;
let link ;
let current ;
link = new Link ( {
props : {
to : "/tag/" + /*id*/ ctx [ 0 ] + "?page=" + /*totalPages*/ ctx [ 2 ] ,
class : "pagination-link" ,
"aria-label" : "Goto page " + /*totalPages*/ ctx [ 2 ] ,
$$slots : { default : [ create _default _slot _2 ] } ,
$$scope : { ctx }
} ,
$$inline : true
} ) ;
link . $on ( "click" , function ( ) {
if ( is _function ( /*handlePage*/ ctx [ 4 ] ( /*totalPages*/ ctx [ 2 ] ) ) ) /*handlePage*/ ctx [ 4 ] ( /*totalPages*/ ctx [ 2 ] ) . apply ( this , arguments ) ;
} ) ;
const block = {
c : function create ( ) {
li0 = element ( "li" ) ;
span = element ( "span" ) ;
span . textContent = "…" ;
t1 = space ( ) ;
li1 = element ( "li" ) ;
create _component ( link . $$ . fragment ) ;
attr _dev ( span , "class" , "pagination-ellipsis" ) ;
add _location ( span , file$1 , 104 , 24 , 3463 ) ;
add _location ( li0 , file$1 , 103 , 20 , 3434 ) ;
add _location ( li1 , file$1 , 106 , 20 , 3559 ) ;
} ,
m : function mount ( target , anchor ) {
insert _dev ( target , li0 , anchor ) ;
append _dev ( li0 , span ) ;
insert _dev ( target , t1 , anchor ) ;
insert _dev ( target , li1 , anchor ) ;
mount _component ( link , li1 , null ) ;
current = true ;
} ,
p : function update ( new _ctx , dirty ) {
ctx = new _ctx ;
const link _changes = { } ;
if ( dirty & /*id, totalPages*/ 5 ) link _changes . to = "/tag/" + /*id*/ ctx [ 0 ] + "?page=" + /*totalPages*/ ctx [ 2 ] ;
if ( dirty & /*totalPages*/ 4 ) link _changes [ "aria-label" ] = "Goto page " + /*totalPages*/ ctx [ 2 ] ;
if ( dirty & /*$$scope, totalPages*/ 131076 ) {
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 ( li0 ) ;
if ( detaching ) detach _dev ( t1 ) ;
if ( detaching ) detach _dev ( li1 ) ;
destroy _component ( link ) ;
}
} ;
dispatch _dev ( "SvelteRegisterBlock" , {
block ,
id : create _if _block . name ,
type : "if" ,
source : "(103:16) {#if totalPages - page > 2}" ,
ctx
} ) ;
return block ;
}
// (108:24) <Link on:click={handlePage(totalPages)} to="/tag/{id}?page={totalPages}" class="pagination-link" aria-label="Goto page {totalPages}" >
function create _default _slot _2 ( ctx ) {
let t ;
const block = {
c : function create ( ) {
t = text ( /*totalPages*/ ctx [ 2 ] ) ;
} ,
m : function mount ( target , anchor ) {
insert _dev ( target , t , anchor ) ;
} ,
p : function update ( ctx , dirty ) {
if ( dirty & /*totalPages*/ 4 ) set _data _dev ( t , /*totalPages*/ ctx [ 2 ] ) ;
} ,
d : function destroy ( detaching ) {
if ( detaching ) detach _dev ( t ) ;
}
} ;
dispatch _dev ( "SvelteRegisterBlock" , {
block ,
id : create _default _slot _2 . name ,
type : "slot" ,
source : "(108:24) <Link on:click={handlePage(totalPages)} to=\\\"/tag/{id}?page={totalPages}\\\" class=\\\"pagination-link\\\" aria-label=\\\"Goto page {totalPages}\\\" >" ,
ctx
} ) ;
return block ;
}
// (124:28) <Link to="/post/{post.id}">
function create _default _slot _1 ( ctx ) {
let img ;
let img _alt _value ;
let img _src _value ;
const block = {
c : function create ( ) {
img = element ( "img" ) ;
attr _dev ( img , "alt" , img _alt _value = /*post*/ ctx [ 8 ] . id ) ;
if ( img . src !== ( img _src _value = /*post*/ ctx [ 8 ] . image _path ) ) attr _dev ( img , "src" , img _src _value ) ;
add _location ( img , file$1 , 124 , 32 , 4312 ) ;
} ,
m : function mount ( target , anchor ) {
insert _dev ( target , img , anchor ) ;
} ,
p : function update ( ctx , dirty ) {
if ( dirty & /*posts*/ 8 && img _alt _value !== ( img _alt _value = /*post*/ ctx [ 8 ] . id ) ) {
attr _dev ( img , "alt" , img _alt _value ) ;
}
if ( dirty & /*posts*/ 8 && img . src !== ( img _src _value = /*post*/ ctx [ 8 ] . 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 . name ,
type : "slot" ,
source : "(124:28) <Link to=\\\"/post/{post.id}\\\">" ,
ctx
} ) ;
return block ;
}
// (133:36) <Link to="/tag/{tag}">
function create _default _slot$1 ( ctx ) {
let t _value = /*tag*/ ctx [ 11 ] + "" ;
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*/ 8 && t _value !== ( t _value = /*tag*/ ctx [ 11 ] + "" ) ) 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 : "(133:36) <Link to=\\\"/tag/{tag}\\\">" ,
ctx
} ) ;
return block ;
}
// (131:28) {#each post.tags as tag (tag)}
function create _each _block _1 ( key _1 , ctx ) {
let p ;
let link ;
let t ;
let current ;
link = new Link ( {
props : {
to : "/tag/" + /*tag*/ ctx [ 11 ] ,
$$slots : { default : [ create _default _slot$1 ] } ,
$$scope : { ctx }
} ,
$$inline : true
} ) ;
const block = {
key : key _1 ,
first : null ,
c : function create ( ) {
p = element ( "p" ) ;
create _component ( link . $$ . fragment ) ;
t = space ( ) ;
add _location ( p , file$1 , 131 , 32 , 4637 ) ;
this . first = p ;
} ,
m : function mount ( target , anchor ) {
insert _dev ( target , p , anchor ) ;
mount _component ( link , p , null ) ;
append _dev ( p , t ) ;
current = true ;
} ,
p : function update ( new _ctx , dirty ) {
ctx = new _ctx ;
const link _changes = { } ;
if ( dirty & /*posts*/ 8 ) link _changes . to = "/tag/" + /*tag*/ ctx [ 11 ] ;
if ( dirty & /*$$scope, posts*/ 131080 ) {
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 ( p ) ;
destroy _component ( link ) ;
}
} ;
dispatch _dev ( "SvelteRegisterBlock" , {
block ,
id : create _each _block _1 . name ,
type : "each" ,
source : "(131:28) {#each post.tags as tag (tag)}" ,
ctx
} ) ;
return block ;
}
// (120: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 [ 8 ] . id ,
$$slots : { default : [ create _default _slot _1 ] } ,
$$scope : { ctx }
} ,
$$inline : true
} ) ;
let each _value _1 = /*post*/ ctx [ 8 ] . tags ;
validate _each _argument ( each _value _1 ) ;
const get _key = ctx => /*tag*/ ctx [ 11 ] ;
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 , 122 , 24 , 4201 ) ;
attr _dev ( div0 , "class" , "card-image" ) ;
add _location ( div0 , file$1 , 121 , 20 , 4152 ) ;
attr _dev ( div1 , "class" , "content" ) ;
add _location ( div1 , file$1 , 129 , 24 , 4524 ) ;
attr _dev ( div2 , "class" , "card-content" ) ;
add _location ( div2 , file$1 , 128 , 20 , 4473 ) ;
attr _dev ( div3 , "class" , "column is-one-quarter card" ) ;
add _location ( div3 , file$1 , 120 , 16 , 4091 ) ;
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*/ 8 ) link _changes . to = "/post/" + /*post*/ ctx [ 8 ] . id ;
if ( dirty & /*$$scope, posts*/ 131080 ) {
link _changes . $$scope = { dirty , ctx } ;
}
link . $set ( link _changes ) ;
if ( dirty & /*posts*/ 8 ) {
each _value _1 = /*post*/ ctx [ 8 ] . 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 : "(120: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 nav ;
let t4 ;
let t5 ;
let ul ;
let t6 ;
let t7 ;
let t8 ;
let div1 ;
let each _blocks = [ ] ;
let each1 _lookup = new Map ( ) ;
let current ;
let if _block0 = /*page*/ ctx [ 1 ] > 1 && create _if _block _5 ( ctx ) ;
let if _block1 = /*page*/ ctx [ 1 ] < /*totalPages*/ ctx [ 2 ] && create _if _block _4 ( ctx ) ;
let if _block2 = /*page*/ ctx [ 1 ] > 3 && create _if _block _3 ( ctx ) ;
let each _value _2 = [ ... Array ( 5 ) . keys ( ) ] . map ( /*func*/ ctx [ 6 ] ) ;
validate _each _argument ( each _value _2 ) ;
let each _blocks _1 = [ ] ;
for ( let i = 0 ; i < each _value _2 . length ; i += 1 ) {
each _blocks _1 [ i ] = create _each _block _2 ( get _each _context _2 ( ctx , each _value _2 , i ) ) ;
}
const out = i => transition _out ( each _blocks _1 [ i ] , 1 , 1 , ( ) => {
each _blocks _1 [ i ] = null ;
} ) ;
let if _block3 = /*totalPages*/ ctx [ 2 ] - /*page*/ ctx [ 1 ] > 2 && create _if _block ( ctx ) ;
let each _value = /*posts*/ ctx [ 3 ] ;
validate _each _argument ( each _value ) ;
const get _key = ctx => /*post*/ ctx [ 8 ] . 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 ) ;
each1 _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" ) ;
nav = element ( "nav" ) ;
if ( if _block0 ) if _block0 . c ( ) ;
t4 = space ( ) ;
if ( if _block1 ) if _block1 . c ( ) ;
t5 = space ( ) ;
ul = element ( "ul" ) ;
if ( if _block2 ) if _block2 . c ( ) ;
t6 = space ( ) ;
for ( let i = 0 ; i < each _blocks _1 . length ; i += 1 ) {
each _blocks _1 [ i ] . c ( ) ;
}
t7 = space ( ) ;
if ( if _block3 ) if _block3 . c ( ) ;
t8 = space ( ) ;
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 , 39 , 8 , 931 ) ;
attr _dev ( p1 , "class" , "subtitle" ) ;
add _location ( p1 , file$1 , 42 , 8 , 987 ) ;
attr _dev ( div0 , "class" , "hero-body" ) ;
add _location ( div0 , file$1 , 38 , 4 , 899 ) ;
attr _dev ( section0 , "class" , "hero is-primary" ) ;
add _location ( section0 , file$1 , 37 , 0 , 861 ) ;
attr _dev ( ul , "class" , "pagination-list" ) ;
add _location ( ul , file$1 , 65 , 12 , 1762 ) ;
attr _dev ( nav , "class" , "pagination" ) ;
attr _dev ( nav , "role" , "navigation" ) ;
attr _dev ( nav , "aria-label" , "pagination" ) ;
add _location ( nav , file$1 , 48 , 8 , 1100 ) ;
attr _dev ( div1 , "class" , "columns is-multiline" ) ;
add _location ( div1 , file$1 , 118 , 8 , 3996 ) ;
attr _dev ( div2 , "class" , "container" ) ;
add _location ( div2 , file$1 , 47 , 4 , 1068 ) ;
attr _dev ( section1 , "class" , "section" ) ;
add _location ( section1 , file$1 , 46 , 0 , 1038 ) ;
} ,
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 , nav ) ;
if ( if _block0 ) if _block0 . m ( nav , null ) ;
append _dev ( nav , t4 ) ;
if ( if _block1 ) if _block1 . m ( nav , null ) ;
append _dev ( nav , t5 ) ;
append _dev ( nav , ul ) ;
if ( if _block2 ) if _block2 . m ( ul , null ) ;
append _dev ( ul , t6 ) ;
for ( let i = 0 ; i < each _blocks _1 . length ; i += 1 ) {
each _blocks _1 [ i ] . m ( ul , null ) ;
}
append _dev ( ul , t7 ) ;
if ( if _block3 ) if _block3 . m ( ul , null ) ;
append _dev ( div2 , t8 ) ;
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 ( /*page*/ ctx [ 1 ] > 1 ) {
if ( if _block0 ) {
if _block0 . p ( ctx , dirty ) ;
if ( dirty & /*page*/ 2 ) {
transition _in ( if _block0 , 1 ) ;
}
} else {
if _block0 = create _if _block _5 ( ctx ) ;
if _block0 . c ( ) ;
transition _in ( if _block0 , 1 ) ;
if _block0 . m ( nav , t4 ) ;
}
} else if ( if _block0 ) {
group _outros ( ) ;
transition _out ( if _block0 , 1 , 1 , ( ) => {
if _block0 = null ;
} ) ;
check _outros ( ) ;
}
if ( /*page*/ ctx [ 1 ] < /*totalPages*/ ctx [ 2 ] ) {
if ( if _block1 ) {
if _block1 . p ( ctx , dirty ) ;
if ( dirty & /*page, totalPages*/ 6 ) {
transition _in ( if _block1 , 1 ) ;
}
} else {
if _block1 = create _if _block _4 ( ctx ) ;
if _block1 . c ( ) ;
transition _in ( if _block1 , 1 ) ;
if _block1 . m ( nav , t5 ) ;
}
} else if ( if _block1 ) {
group _outros ( ) ;
transition _out ( if _block1 , 1 , 1 , ( ) => {
if _block1 = null ;
} ) ;
check _outros ( ) ;
}
if ( /*page*/ ctx [ 1 ] > 3 ) {
if ( if _block2 ) {
if _block2 . p ( ctx , dirty ) ;
if ( dirty & /*page*/ 2 ) {
transition _in ( if _block2 , 1 ) ;
}
} else {
if _block2 = create _if _block _3 ( ctx ) ;
if _block2 . c ( ) ;
transition _in ( if _block2 , 1 ) ;
if _block2 . m ( ul , t6 ) ;
}
} else if ( if _block2 ) {
group _outros ( ) ;
transition _out ( if _block2 , 1 , 1 , ( ) => {
if _block2 = null ;
} ) ;
check _outros ( ) ;
}
if ( dirty & /*id, Array, page, handlePage, totalPages*/ 23 ) {
each _value _2 = [ ... Array ( 5 ) . keys ( ) ] . map ( /*func*/ ctx [ 6 ] ) ;
validate _each _argument ( each _value _2 ) ;
let i ;
for ( i = 0 ; i < each _value _2 . length ; i += 1 ) {
const child _ctx = get _each _context _2 ( ctx , each _value _2 , i ) ;
if ( each _blocks _1 [ i ] ) {
each _blocks _1 [ i ] . p ( child _ctx , dirty ) ;
transition _in ( each _blocks _1 [ i ] , 1 ) ;
} else {
each _blocks _1 [ i ] = create _each _block _2 ( child _ctx ) ;
each _blocks _1 [ i ] . c ( ) ;
transition _in ( each _blocks _1 [ i ] , 1 ) ;
each _blocks _1 [ i ] . m ( ul , t7 ) ;
}
}
group _outros ( ) ;
for ( i = each _value _2 . length ; i < each _blocks _1 . length ; i += 1 ) {
out ( i ) ;
}
check _outros ( ) ;
}
if ( /*totalPages*/ ctx [ 2 ] - /*page*/ ctx [ 1 ] > 2 ) {
if ( if _block3 ) {
if _block3 . p ( ctx , dirty ) ;
if ( dirty & /*totalPages, page*/ 6 ) {
transition _in ( if _block3 , 1 ) ;
}
} else {
if _block3 = create _if _block ( ctx ) ;
if _block3 . c ( ) ;
transition _in ( if _block3 , 1 ) ;
if _block3 . m ( ul , null ) ;
}
} else if ( if _block3 ) {
group _outros ( ) ;
transition _out ( if _block3 , 1 , 1 , ( ) => {
if _block3 = null ;
} ) ;
check _outros ( ) ;
}
if ( dirty & /*posts*/ 8 ) {
each _value = /*posts*/ ctx [ 3 ] ;
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 , each1 _lookup , div1 , outro _and _destroy _block , create _each _block , null , get _each _context ) ;
check _outros ( ) ;
}
} ,
i : function intro ( local ) {
if ( current ) return ;
transition _in ( if _block0 ) ;
transition _in ( if _block1 ) ;
transition _in ( if _block2 ) ;
for ( let i = 0 ; i < each _value _2 . length ; i += 1 ) {
transition _in ( each _blocks _1 [ i ] ) ;
}
transition _in ( if _block3 ) ;
for ( let i = 0 ; i < each _value . length ; i += 1 ) {
transition _in ( each _blocks [ i ] ) ;
}
current = true ;
} ,
o : function outro ( local ) {
transition _out ( if _block0 ) ;
transition _out ( if _block1 ) ;
transition _out ( if _block2 ) ;
each _blocks _1 = each _blocks _1 . filter ( Boolean ) ;
for ( let i = 0 ; i < each _blocks _1 . length ; i += 1 ) {
transition _out ( each _blocks _1 [ i ] ) ;
}
transition _out ( if _block3 ) ;
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 ) ;
if ( if _block0 ) if _block0 . d ( ) ;
if ( if _block1 ) if _block1 . d ( ) ;
if ( if _block2 ) if _block2 . d ( ) ;
destroy _each ( each _blocks _1 , detaching ) ;
if ( if _block3 ) if _block3 . d ( ) ;
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 { location } = $$props ;
let { id } = $$props ;
let page = 1 ;
let totalPages = 1 ;
let posts = [ ] ;
const getData = async ( ) => {
const data = await getPostsTag ( { page , tag : id } ) ;
if ( Array . isArray ( data . posts ) ) {
$$invalidate ( 3 , posts = data . posts ) ;
$$invalidate ( 2 , totalPages = data . totalPage ) ;
}
} ;
onMount ( ( ) => {
let queryParams ;
queryParams = queryString . parse ( location . search ) ;
if ( queryParams . page ) {
$$invalidate ( 1 , page = parseInt ( queryParams . page ) ) ;
}
getData ( ) ;
} ) ;
const handlePage = i => {
return ( ) => {
$$invalidate ( 1 , page = i ) ;
getData ( ) ;
} ;
} ;
const writable _props = [ "location" , "id" ] ;
Object . keys ( $$props ) . forEach ( key => {
if ( ! ~ writable _props . indexOf ( key ) && key . slice ( 0 , 2 ) !== "$$" ) console . warn ( ` <Tag> was created with unknown prop ' ${ key } ' ` ) ;
} ) ;
const func = x => x + page - 2 ;
$$self . $$set = $$props => {
if ( "location" in $$props ) $$invalidate ( 5 , location = $$props . location ) ;
if ( "id" in $$props ) $$invalidate ( 0 , id = $$props . id ) ;
} ;
$$self . $capture _state = ( ) => ( {
onMount ,
getPostsTag ,
Link ,
queryString ,
location ,
id ,
page ,
totalPages ,
posts ,
getData ,
handlePage
} ) ;
$$self . $inject _state = $$props => {
if ( "location" in $$props ) $$invalidate ( 5 , location = $$props . location ) ;
if ( "id" in $$props ) $$invalidate ( 0 , id = $$props . id ) ;
if ( "page" in $$props ) $$invalidate ( 1 , page = $$props . page ) ;
if ( "totalPages" in $$props ) $$invalidate ( 2 , totalPages = $$props . totalPages ) ;
if ( "posts" in $$props ) $$invalidate ( 3 , posts = $$props . posts ) ;
} ;
if ( $$props && "$$inject" in $$props ) {
$$self . $inject _state ( $$props . $$inject ) ;
}
return [ id , page , totalPages , posts , handlePage , location , func ] ;
}
class Tag extends SvelteComponentDev {
constructor ( options ) {
super ( options ) ;
init ( this , options , instance$1 , create _fragment$1 , safe _not _equal , { location : 5 , id : 0 } ) ;
dispatch _dev ( "SvelteRegisterComponent" , {
component : this ,
tagName : "Tag" ,
options ,
id : create _fragment$1 . name
} ) ;
const { ctx } = this . $$ ;
const props = options . props || { } ;
if ( /*location*/ ctx [ 5 ] === undefined && ! ( "location" in props ) ) {
console . warn ( "<Tag> was created without expected prop 'location'" ) ;
}
if ( /*id*/ ctx [ 0 ] === undefined && ! ( "id" in props ) ) {
console . warn ( "<Tag> was created without expected prop 'id'" ) ;
}
}
get location ( ) {
throw new Error ( "<Tag>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'" ) ;
}
set location ( value ) {
throw new Error ( "<Tag>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'" ) ;
}
get id ( ) {
throw new Error ( "<Tag>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'" ) ;
}
set id ( value ) {
throw new Error ( "<Tag>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'" ) ;
}
}
/* src/App.svelte generated by Svelte v3.38.2 */
const file = "src/App.svelte" ;
// (20:0) <Router {url}>
function create _default _slot ( ctx ) {
let navbar ;
let t0 ;
let div ;
let route0 ;
let t1 ;
let route1 ;
let t2 ;
let route2 ;
let t3 ;
let route3 ;
let t4 ;
let route4 ;
let t5 ;
let route5 ;
let current ;
navbar = new Navbar ( { $$inline : true } ) ;
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 ( ) {
create _component ( navbar . $$ . fragment ) ;
t0 = space ( ) ;
div = element ( "div" ) ;
create _component ( route0 . $$ . fragment ) ;
t1 = space ( ) ;
create _component ( route1 . $$ . fragment ) ;
t2 = space ( ) ;
create _component ( route2 . $$ . fragment ) ;
t3 = space ( ) ;
create _component ( route3 . $$ . fragment ) ;
t4 = space ( ) ;
create _component ( route4 . $$ . fragment ) ;
t5 = space ( ) ;
create _component ( route5 . $$ . fragment ) ;
add _location ( div , file , 21 , 1 , 461 ) ;
} ,
m : function mount ( target , anchor ) {
mount _component ( navbar , target , anchor ) ;
insert _dev ( target , t0 , anchor ) ;
insert _dev ( target , div , anchor ) ;
mount _component ( route0 , div , null ) ;
append _dev ( div , t1 ) ;
mount _component ( route1 , div , null ) ;
append _dev ( div , t2 ) ;
mount _component ( route2 , div , null ) ;
append _dev ( div , t3 ) ;
mount _component ( route3 , div , null ) ;
append _dev ( div , t4 ) ;
mount _component ( route4 , div , null ) ;
append _dev ( div , t5 ) ;
mount _component ( route5 , div , null ) ;
current = true ;
} ,
p : noop ,
i : function intro ( local ) {
if ( current ) return ;
transition _in ( navbar . $$ . fragment , local ) ;
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 ( navbar . $$ . fragment , local ) ;
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 ) {
destroy _component ( navbar , detaching ) ;
if ( detaching ) detach _dev ( t0 ) ;
if ( detaching ) detach _dev ( div ) ;
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 : "(20:0) <Router {url}>" ,
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*/ 4 ) {
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 { 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 ( ` <App> was created with unknown prop ' ${ key } ' ` ) ;
} ) ;
$$self . $$set = $$props => {
if ( "url" in $$props ) $$invalidate ( 0 , url = $$props . url ) ;
} ;
$$self . $capture _state = ( ) => ( {
Router ,
Link ,
Route ,
Navbar ,
Home ,
Posts ,
Post ,
Login ,
Logout ,
Tag ,
url ,
baseURL
} ) ;
$$self . $inject _state = $$props => {
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 ] ;
}
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 ( "<App>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'" ) ;
}
set url ( value ) {
throw new Error ( "<App>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'" ) ;
}
}
const app = new App ( {
target : document . body ,
hydrate : false ,
} ) ;
return app ;
} ( ) ) ;
2021-05-09 22:07:23 +07:00
//# sourceMappingURL=bundle.js.map