[
  {
    "path": ".gitattributes",
    "content": "package-lock.json -diff\nbuild/* -diff\n"
  },
  {
    "path": ".gitignore",
    "content": ".DS_Store\nnode_modules\nyarn.lock\nchromedriver.log\n*.xml\ndist\ntests_output\ntest/public/test.js\ntest/public/test.js.map\n"
  },
  {
    "path": ".travis.yml",
    "content": "sudo: required\naddons:\n chrome: stable\nlanguage: node_js\nnode_js:\n  - \"lts/*\"\ndeploy:\n  provider: npm\n  email: $NPM_EMAIL\n  api_key: $NPM_TOKEN\n  on:\n    tags: true\nnotifications:\nemail: false"
  },
  {
    "path": "LICENSE",
    "content": "MIT License\n\nCopyright (c) 2019 Claudio Holanda\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n"
  },
  {
    "path": "README.md",
    "content": "⚠️⚠️ THIS LIBRARY IS DEPRECATED AND SHOULD NOT BE USED IN NEW PROJECTS ⚠️⚠️\n\n⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️\n<br>⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️\n\n⚠️⚠️ MORE DETAILS [HERE](https://github.com/kazzkiq/svero/issues/68). ⚠️⚠️\n\n⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️\n<br>⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️\n\n\n\n[![npm version](https://badge.fury.io/js/svero.svg)](https://www.npmjs.com/package/svero)\n[![Build Status](https://travis-ci.org/kazzkiq/svero.svg?branch=master)](https://travis-ci.org/kazzkiq/svero)\n\n<p align=\"center\">\n  svero (<b>Sve</b>lte <b>Ro</b>uter): A simple router for Svelte 3.\n</p>\n\n## First things first\n\nsvero is intented to be used in SPA (Single Page Applications) making usage of `pushState` and History API. We're assuming that you already know how to configure your front-end server (being it dev or production) to serve all path requests to `index.html`.\n\nIf you're not familiar with the terms SPA, `pushState` or History API, you should probably be reading these first:\n\n<small>http://krasimirtsonev.com/blog/article/deep-dive-into-client-side-routing-navigo-pushstate-hash</small><br>\n<small>https://css-tricks.com/using-the-html5-history-api/</small><br>\n<small>https://diveinto.html5doctor.com/history.html</small><br>\n<small>https://developer.mozilla.org/pt-BR/docs/Web/API/History</small><br>\n\n## Installation\n\nSince it's exported in CommonJS format, you should be using it with a module bundler such as [Rollup](https://github.com/sveltejs/template/tree/v3) or Webpack.\n\nYou can install svero via npm:\n\n```\nnpm install --save svero\n```\n\n## Usage\n\nThe usage is super simple:\n\n```html\n<!-- ./App.svelte -->\n<script>\n  import { Router, Route } from 'svero';\n\n  import Index from './pages/Index.svelte';\n  import About from './pages/About.svelte';\n  import Employees from './pages/Employees.svelte';\n\n  let employees = [{ id: 1, name: 'Bill'}, { id:2, name: 'Sven' }];\n</script>\n\n<Router>\n  <Route path=\"*\" component={Index} />\n  <Route path=\"/about\" component={About} />\n  <Route path=\"/about/:who/123/:where\" component={About} />\n  <Route path=\"/employees\">\n    <Employees {employees}/>\n  </Route>\n</Router>\n```\n\nThe `*` wildcard simply works as a fallback. If a route fails to meet any other path, it then loads the path with the `*`. If there is no wildcard route and the route did not meet any other path, nothing is loaded.\n\nYour custom props can be passed by putting your component in the Route `slot` (Employees example above).\n\nPaths with parameters (`:param`) are passed to components via props: `router.params`.\n\n> Parameters like `*param` will capture the rest of segments. You can access them as `router.params._` like other params.\n\nA component loaded by `<Route>` receives a property with route details:\n\n```html\n<!-- ./pages/About.svelte -->\n<script>\n  export let router = {};\n\n  // Those contains useful information about current route status\n  router.path; // /test\n  router.route; // Route Object\n  router.params; // /about/bill/123/kansas { who: 'bill', where: 'kansas' }\n</script>\n```\n\nAdditional properties are passed to the mounted component, e.g.\n\n```html\n<Route component={Test} title=\"Some description\" />\n```\n\nAlso, you can pass an object:\n\n```html\n<Route component={Test} props={myProps} />\n```\n\n> `Route` props are omitted, but all remaining ones are passed to `Test`.\n\nRoutes can also render any given markup when they're active, e.g.\n\n```html\n<Route path=\"/static-path\">\n  <h1>It works!</h1>\n</Route>\n```\n\n> You can access `router` within `<slot />` renders by declaring `let:router` on `<Router />` or `<Route />` components (see below).\n\nIf you're building an SPA or simply want to leverage on hash-based routing for certain components try the following:\n\n```html\n<Route path=\"#g/:gistId/*filePath\" let:router>\n  <p>Info: {JSON.stringify(router.params)}</p>\n</Route>\n```\n\nStandard anchors and `<Link />` components will work as usual:\n\n```html\n<a href=\"#g/1acf21/path/to/README.md\">View README.md</a>\n```\n\nDeclaring a component `<Route path=\"#\" />` will serve as fallback when `location.hash` is empty.\n\n### Nesting\n\nYou can render `svero` components inside anything, e.g.\n\n```html\n<Router nofallback path=\"/sub\">\n  <Route>\n    <fieldset>\n      <legend>Routing:</legend>\n      <Router nofallback path=\"/sub/:bar\">\n        <Route let:router>{router.params.bar}!</Route>\n      </Router>\n      <Route path=\"/foo\">Foo</Route>\n      <Route fallback path=\"*\" let:router>\n        <summary>\n          <p>Not found: {router.params._}</p>\n          <details>{router.failure}</details>\n        </summary>\n      </Route>\n      <Router nofallback path=\"/sub/nested\">\n        <Route>\n          [...]\n          <Route fallback path=\"*\">not found?</Route>\n          <Route path=\"/a\">A</Route>\n          <Route path=\"/b/:c\">C</Route>\n          <Route path=\"/:value\" let:router>{JSON.stringify(router.params)}</Route>\n        </Route>\n      </Router>\n    </fieldset>\n  </Route>\n</Router>\n```\n\nProperties determine how routing will match and render routes:\n\n- Use the `nofallback` prop for telling `<Router />` to disable the _fallback_ mechanism by default\n- Any route using the `fallback` prop will catch unmatched routes or potential look-up errors\n- Use the `exact` prop to skip this route from render just in case it does not matches\n- A `<Route />` without `path` will render only if `<Router path=\"...\" />` is active!\n\n> Note that all `<Router />` paths MUST begin from the root as `/sub` and `/sub/nested` in the example.\n\n### Redirects\n\nSometimes you just want a route to send user to another place. You can use the `redirect` attribute for that.\n\nA redirect should always be a string with a path. It uses the same pattern as `path` attribute. For a redirect to run, there must be a Route with the equivalent path.\n\n```html\n<Router>\n  <Route path=\"/company\" redirect=\"/about-us\">\n  <Route path=\"/about-us\" component={AboutUs}>\n</Router>\n```\n\n### Conditions\n\nIf you need to meet a condition in order to run a route, you can use the `condition` attribute. Conditions can also be used with `redirect` for graceful route fallback.\n\nA condition should be either `boolean` or a function returning `boolean`. There is no support for asynchronous conditions at the moment (so keep it simple).\n\n```html\n<Router>\n  <Route path=\"/admin/settings\" condition={isAdminLogged} redirect=\"/admin/login\">\n</Router>\n```\n\nThink of it as a simpler middleware. A condition will run *before* the route loads your component, so there is no wasteful component mounting, and no screen blinking the unwanted view.\n\n### Link Component\n\nThere is also an useful `<Link>` component that overrides `<a>` elements:\n\n```html\n<Link href=\"path/here\" className=\"btn\">Hello!</Link>\n```\n\nThe difference between `<Link>` and `<a>` is that it uses `pushState` whenever possible, with fallback to `<a>` behavior. This means that when you use `<Link>`, svero can update the view based on your URL trigger, without reloading the entire page.\n\n> Given `href` values will be normalized (on-click) if they don't start with a slash, e.g. when `location.pathname === '/foo'` then `#bar` would become `/foo#bar` as result.\n\n### navigateTo()\n\nIn some cases you want to navigate to routes programatically instead of letting user click on links. For this scenario we have `navigateto()` which takes a route as parameter and navigates imediatelly to said route.\n\n`navigateTo()` receives the same treatment as `<Link>`: It will always try to use `pushState` for better performance, fallbacking to a full page redirect if it isn't supported.\n\nUsage:\n\n```html\n<script>\n  import { onMount } from 'svelte';\n  import { navigateTo } from 'svero';\n\n  onMount(() => {\n    if (localStorage.getItem('logged')) {\n      navigateTo('/admin');\n    }\n  });\n</script>\n```\n\n### Webpack issues\n\nIf you're having trouble with Webpack failing to load svero, please replace the following rule (in Svelte rule):\n\n```js\nexclude: /node_modules/,\n```\n\nwith:\n\n```js\nexclude: /node_modules\\/(?!(svero)\\/).*/,\n```\n\nMore information [here](https://github.com/kazzkiq/svero/issues/23).\n"
  },
  {
    "path": "nightwatch.json",
    "content": "{\n  \"src_folders\" : [\"test/e2e\"],\n\n  \"webdriver\" : {\n    \"start_process\": true,\n    \"server_path\": \"node_modules/.bin/chromedriver\",\n    \"port\": 9515\n  },\n\n  \"test_settings\" : {\n    \"default\" : {\n      \"desiredCapabilities\": {\n        \"browserName\": \"chrome\",\n        \"chromeOptions\": {\n          \"args\": [\n            \"--headless\"\n          ]\n        }\n      }\n    }\n  }\n}"
  },
  {
    "path": "package.json",
    "content": "{\n  \"name\": \"svero\",\n  \"version\": \"1.0.0\",\n  \"description\": \"Simple Router for Svelte 3\",\n  \"main\": \"dist/svero.js\",\n  \"svelte\": \"src/main.js\",\n  \"module\": \"dist/svero.es.js\",\n  \"browser\": \"dist/svero.min.js\",\n  \"files\": [\n    \"src/**\",\n    \"dist/*\"\n  ],\n  \"peerDependencies\": {\n    \"svelte\": \"3.x\"\n  },\n  \"devDependencies\": {\n    \"chromedriver\": \"^78.0.1\",\n    \"http-server\": \"^0.11.1\",\n    \"kill-port\": \"^1.3.2\",\n    \"nightwatch\": \"^1.0.19\",\n    \"rollup\": \"^1.14.4\",\n    \"rollup-plugin-commonjs\": \"^10.0.0\",\n    \"rollup-plugin-node-resolve\": \"^5.0.1\",\n    \"rollup-plugin-svelte\": \"^5.0.3\",\n    \"rollup-plugin-terser\": \"^5.0.0\",\n    \"svelte\": \"^3.4.4\"\n  },\n  \"dependencies\": {\n    \"abstract-nested-router\": \"^0.1.3\"\n  },\n  \"scripts\": {\n    \"test\": \"kill-port 5001 && npm run test:server & npm run test:build && npm run test:run\",\n    \"debug\": \"kill-port 5001 && npm run test:build && npm run test:server\",\n    \"test:server\": \"http-server test/public -s -p 5001\",\n    \"test:build\": \"NODE_ENV=test rollup -c\",\n    \"test:run\": \"nightwatch\",\n    \"build\": \"NODE_ENV=production rollup -c\",\n    \"prepublishOnly\": \"npm run test && npm run build\"\n  },\n  \"repository\": {\n    \"type\": \"git\",\n    \"url\": \"git+https://github.com/kazzkiq/svero.git\"\n  },\n  \"keywords\": [\n    \"router\",\n    \"svelte\",\n    \"svelte3\"\n  ],\n  \"author\": \"Claudio Holanda\",\n  \"license\": \"MIT\",\n  \"bugs\": {\n    \"url\": \"https://github.com/kazzkiq/svero/issues\"\n  },\n  \"homepage\": \"https://github.com/kazzkiq/svero\"\n}\n"
  },
  {
    "path": "rollup.config.js",
    "content": "import svelte from 'rollup-plugin-svelte';\nimport resolve from 'rollup-plugin-node-resolve';\nimport commonjs from 'rollup-plugin-commonjs';\nimport { terser } from 'rollup-plugin-terser';\n\nconst isDev = process.env.ROLLUP_WATCH;\nconst isProd = process.env.NODE_ENV === 'production';\n\nfunction bundle(file, format) {\n  return {\n    sourcemap: false,\n    name: 'svero',\n    format,\n    file,\n  };\n}\n\nexport default {\n  input: isProd ? 'src/main.js' : 'test/main.js',\n  output: isProd ? [\n    bundle('dist/svero.js', 'cjs'),\n    bundle('dist/svero.es.js', 'es'),\n    bundle('dist/svero.min.js', 'umd'),\n  ] : bundle('test/public/test.js', 'iife'),\n  external: isProd ? ['svelte', 'svelte/store', 'svelte/internal'] : [],\n  plugins: [\n    svelte({\n      dev: isDev,\n    }),\n    resolve(),\n    commonjs(),\n    isProd && terser(),\n  ],\n};\n"
  },
  {
    "path": "src/Link.svelte",
    "content": "<script>\n  import { onMount, createEventDispatcher } from 'svelte';\n  import { navigateTo } from './utils';\n\n  let cssClass = '';\n\n  export let href = '/';\n  export let className = '';\n  export let title = '';\n  export { cssClass as class };\n\n  onMount(() => {\n    className = className || cssClass;\n  });\n\n  const dispatch = createEventDispatcher();\n\n  // this will enable `<Link on:click={...} />` calls\n  function onClick(e) {\n    let fixedHref = href;\n\n    // this will rebase anchors to avoid location changes\n    if (fixedHref.charAt() !== '/') {\n      fixedHref = window.location.pathname + fixedHref;\n    }\n\n    navigateTo(fixedHref);\n    dispatch('click', e);\n  }\n</script>\n\n<a {href} class={className} title={title} on:click|preventDefault={onClick}><slot></slot></a>\n"
  },
  {
    "path": "src/Route.svelte",
    "content": "<script>\n  import { onDestroy, getContext } from 'svelte';\n  import { CTX_ROUTER } from './utils';\n\n  export let key = null;\n  export let path = '';\n  export let props = null;\n  export let exact = undefined;\n  export let fallback = undefined;\n  export let component = undefined;\n  export let condition = undefined;\n  export let redirect = undefined;\n\n  const { assignRoute, unassignRoute, routeInfo } = getContext(CTX_ROUTER);\n\n  let activeRouter = null;\n  let activeProps = {};\n  let fullpath;\n\n  function getProps(given, required) {\n    const { props, ...others } = given;\n\n    // prune all declared props from this component\n    required.forEach(k => {\n      delete others[k];\n    });\n\n    return {\n      ...props,\n      ...others,\n    };\n  }\n\n  [key, fullpath] = assignRoute(key, path, { condition, redirect, fallback, exact });\n\n  $: {\n    activeRouter = $routeInfo[key];\n    activeProps = getProps($$props, arguments[0]['$$'].props);\n  }\n\n  onDestroy(() => {\n    unassignRoute(fullpath);\n  });\n</script>\n\n{#if activeRouter}\n  {#if component}\n    <svelte:component this={component} router={activeRouter} {...activeProps} />\n  {:else}\n    <slot router={activeRouter} props={activeProps} />\n  {/if}\n{/if}\n"
  },
  {
    "path": "src/Router.svelte",
    "content": "<script context=\"module\">\n  import Router from 'abstract-nested-router';\n  import { CTX_ROUTER, navigateTo } from './utils';\n\n  const router = new Router();\n</script>\n\n<script>\n  import { writable } from 'svelte/store';\n  import { onMount, getContext, setContext } from 'svelte';\n\n  let t;\n  let failure;\n  let fallback;\n\n  export let path = '/';\n  export let nofallback = null;\n\n  const routeInfo = writable({});\n  const routerContext = getContext(CTX_ROUTER);\n  const basePath = routerContext ? routerContext.basePath : writable(path);\n\n  function cleanPath(route) {\n    return route.replace(/\\?[^#]*/, '').replace(/(?!^)\\/#/, '#').replace('/#', '#').replace(/\\/$/, '');\n  }\n\n  function fixPath(route) {\n    if (route === '/#*' || route === '#*') return '#*_';\n    if (route === '/*' || route === '*') return '/*_';\n    return route;\n  }\n\n  function handleRoutes(map) {\n    const params = map.reduce((prev, cur) => {\n      prev[cur.key] = Object.assign(prev[cur.key] || {}, cur.params);\n      return prev;\n    }, {});\n\n    let skip;\n    let routes = {};\n\n    map.some(x => {\n      if (typeof x.condition === 'boolean' || typeof x.condition === 'function') {\n        const ok = typeof x.condition === 'function' ? x.condition() : x.condition;\n\n        if (ok === false && x.redirect) {\n          navigateTo(x.redirect);\n          skip = true;\n          return true;\n        }\n      }\n\n      if (x.key && !routes[x.key]) {\n        if (x.exact && !x.matches) return false;\n        routes[x.key] = { ...x, params: params[x.key] };\n      }\n\n      return false;\n    });\n\n    if (!skip) {\n      $routeInfo = routes;\n    }\n  }\n\n  function doFallback(e, path) {\n    $routeInfo[fallback] = { failure: e, params: { _: path.substr(1) || undefined } };\n  }\n\n  function resolveRoutes(path) {\n    const segments = path.split('#')[0].split('/');\n    const prefix = [];\n    const map = [];\n\n    segments.forEach(key => {\n      const sub = prefix.concat(`/${key}`).join('');\n\n      if (key) prefix.push(`/${key}`);\n\n      try {\n        const next = router.find(sub);\n\n        handleRoutes(next);\n        map.push(...next);\n      } catch (e_) {\n        doFallback(e_, path);\n      }\n    });\n\n    return map;\n  }\n\n  function handlePopState() {\n    const fullpath = cleanPath(`/${location.href.split('/').slice(3).join('/')}`);\n\n    try {\n      const found = resolveRoutes(fullpath);\n\n      if (fullpath.includes('#')) {\n        const next = router.find(fullpath);\n        const keys = {};\n\n        // override previous routes to avoid non-exact matches\n        handleRoutes(found.concat(next).reduce((prev, cur) => {\n          if (typeof keys[cur.key] === 'undefined') {\n            keys[cur.key] = prev.length;\n          }\n\n          prev[keys[cur.key]] = cur;\n\n          return prev;\n        }, []));\n      }\n    } catch (e) {\n      if (!fallback) {\n        failure = e;\n        return;\n      }\n\n      doFallback(e, fullpath);\n    }\n  }\n\n  function _handlePopState() {\n    clearTimeout(t);\n    t = setTimeout(handlePopState, 100);\n  }\n\n  function assignRoute(key, route, detail) {\n    key = key || Math.random().toString(36).substr(2);\n\n    const fixedRoot = $basePath !== path && $basePath !== '/'\n      ? `${$basePath}${path}`\n      : path;\n\n    const handler = { key, ...detail };\n\n    let fullpath;\n\n    router.mount(fixedRoot, () => {\n      fullpath = router.add(fixPath(route), handler);\n      fallback = (handler.fallback && key) || fallback;\n    });\n\n    _handlePopState();\n\n    return [key, fullpath];\n  }\n\n  function unassignRoute(route) {\n    router.rm(fixPath(route));\n    _handlePopState();\n  }\n\n  setContext(CTX_ROUTER, {\n    basePath,\n    routeInfo,\n    assignRoute,\n    unassignRoute,\n  });\n</script>\n\n<svelte:window on:popstate={handlePopState}></svelte:window>\n\n{#if failure && !nofallback}\n  <fieldset>\n    <legend>Router failure: {path}</legend>\n    <pre>{failure}</pre>\n  </fieldset>\n{/if}\n\n<slot />\n"
  },
  {
    "path": "src/main.js",
    "content": "import Router from './Router.svelte';\nimport Route from './Route.svelte';\nimport Link from './Link.svelte';\nimport { navigateTo } from './utils';\n\nexport {\n  Router,\n  Route,\n  Link,\n  navigateTo\n};\n"
  },
  {
    "path": "src/utils.js",
    "content": "export const CTX_ROUTER = {};\n\nexport function navigateTo(path) {\n  // If path empty or no string, throws error\n  if (!path || typeof path !== 'string') {\n    throw Error(`svero expects navigateTo() to have a string parameter. The parameter provided was: ${path} of type ${typeof path} instead.`);\n  }\n\n  if (path[0] !== '/' && path[0] !== '#') {\n    throw Error(`svero expects navigateTo() param to start with slash or hash, e.g. \"/${path}\" or \"#${path}\" instead of \"${path}\".`);\n  }\n\n  // If no History API support, fallbacks to URL redirect\n  if (!history.pushState || !window.dispatchEvent) {\n    window.location.href = path;\n    return;\n  }\n\n  // If has History API support, uses it\n  history.pushState({}, '', path);\n  window.dispatchEvent(new Event('popstate'));\n}\n"
  },
  {
    "path": "test/About.svelte",
    "content": "<script>\n  export let description = '';\n  export let router = null;\n</script>\n\n<h1>Hello from About!</h1>\n\n{#if description}\n  <p>{description}</p>\n{/if}\n"
  },
  {
    "path": "test/App.svelte",
    "content": "<script>\n  import { Router, Route, Link } from '../src/main';\n  import Index from './Index.svelte';\n  import About from './About.svelte';\n  import User from './User.svelte';\n</script>\n\n<main>\n  <Router>\n    <Route fallback path=\"*\"><h1>Not found</h1></Route>\n    <Route exact path=\"/\" component={Index} />\n    <Route path=\"/company\" redirect=\"/about\" />\n    <Route path=\"/about\" description=\"Company and such.\" component={About} />\n    <Route path=\"/user/:name/:age\" component={User} />\n    <Route path=\"/admin-false\" condition={false} component={User} redirect=\"/\" />\n    <Route path=\"/admin-true\" condition={true} component={User} redirect=\"/\" />\n    <Route path=\"/slot\"><h3>It works!</h3></Route>\n    <Router nofallback path=\"/nested\">\n      <Route>\n        <a href=\"#abc/def/ghi\">Show params</a> | <Link href=\"#test\">Static test</Link> | <Link href=\"#\">Reset hash</Link>\n        <p>\n          <Route path=\"#:any/*path\" let:router>Params: {JSON.stringify(router.params)}</Route>\n          <Route path=\"#test\">Static placeholder is shown</Route>\n          <Route path=\"#\">No hash is present</Route>\n        </p>\n      </Route>\n    </Router>\n    <Route path=\"#*\" let:router>\n      <p><b>Anchored</b>. {router.params._}</p>\n    </Route>\n  </Router>\n</main>\n\n<Router nofallback path=\"/sub\">\n  <Route>\n    <fieldset>\n      <legend>Routing:</legend>\n      <Router nofallback path=\"/:bar\">\n        <Route let:router>{router.params.bar}!</Route>\n      </Router>\n      <Route path=\"/foo\">Foo</Route>\n      <Route fallback path=\"*\" let:router>\n        <summary>\n          <p>Not found: {router.params._}</p>\n          <details>{router.failure}</details>\n        </summary>\n      </Route>\n      <Router nofallback path=\"/nested\">\n        <Route>\n          [...]\n          <Route fallback path=\"*\">not found?</Route>\n          <Route path=\"/a\">A</Route>\n          <Route path=\"/b/:c\">C</Route>\n          <Route path=\"/:value\" let:router>{JSON.stringify(router.params)}</Route>\n        </Route>\n      </Router>\n    </fieldset>\n  </Route>\n</Router>\n"
  },
  {
    "path": "test/Index.svelte",
    "content": "<h1>Hello from Index!</h1>"
  },
  {
    "path": "test/User.svelte",
    "content": "<script>\n  import { Link, navigateTo } from '../src/main';\n\n  export let router = {};\n</script>\n\n{#if router.params.age}\n  <h1>Hello {router.params.name}, {router.params.age}yo!</h1>\n{:else}\n  <h1>Hello {router.params.name}!</h1>\n{/if}\n\n{#if window.location.pathname === '/admin-true'}\n  <h2>Admin Panel</h2>\n{/if}\n\n{#if router.params.name === 'Classious'}\n  <Link class=\"purple\" href=\"/about\">Go to About</Link>\n{:else}\n  <Link className=\"red\" href=\"/about\">Go to About</Link>\n{/if}\n<br>\n<button on:click={() => { navigateTo('/about') }}>Goto /about</button>\n<br>\n<em on:click={() => { navigateTo('') }}>Does nothing</em>\n<br>\n<strong on:click={() => { navigateTo('about') }}>Does nothing</strong>\n<br>\n<Link href=\"/test-no-class\">No Class Link</Link>\n"
  },
  {
    "path": "test/e2e/link.js",
    "content": "module.exports = {\n  '<Link> Href Attribute Tests': (browser) => {\n    browser\n      .url('http://localhost:5001/user/Amanda')\n      .waitForElementVisible('a')\n      .click('a')\n      .pause(100)\n      .assert.containsText('h1', 'Hello from About!')\n      .assert.urlContains('/about')\n      .end();\n  },\n  '<Link> ClassName Attribute Tests': (browser) => {\n    browser\n      .url('http://localhost:5001/user/Amanda')\n      .waitForElementVisible('a.red')\n      .end();\n  },\n  '<Link> Class Attribute Tests': (browser) => {\n    browser\n      .url('http://localhost:5001/user/Classious')\n      .waitForElementVisible('a.purple')\n      .end();\n  },\n  '<Link> Empty Class Attribute Shouldn\\'t be \"undefined\"': (browser) => {\n    browser\n      .url('http://localhost:5001/user/Josh')\n      .waitForElementVisible('a[href=\"/test-no-class\"]:not(.undefined)')\n      .end();\n  },\n  '<Link> <slot> Text Tests': (browser) => {\n    browser\n      .url('http://localhost:5001/user/Amanda')\n      .waitForElementVisible('a.red')\n      .assert.containsText('a.red', 'Go to About')\n      .end();\n  },\n};"
  },
  {
    "path": "test/e2e/navigateTo.js",
    "content": "module.exports = {\n  'navigateTo(path) navigate to new path': (browser) => {\n    browser\n      .url('http://localhost:5001/user/Jon')\n      .waitForElementVisible('button')\n      .click('button')\n      .pause(100)\n      .assert.containsText('h1', 'Hello from About!')\n      .assert.urlContains('/about')\n      .end();\n  },\n  'navigateTo(path) empty parameter does nothing': (browser) => {\n    browser\n      .url('http://localhost:5001/user/Jon')\n      .waitForElementVisible('em')\n      .click('em')\n      .pause(100)\n      .assert.containsText('h1', 'Hello Jon!')\n      .assert.urlContains('/user/Jon')\n      .end();\n  },\n  'navigateTo(path) parameter not starting with slash (/) does nothing': (browser) => {\n    browser\n      .url('http://localhost:5001/user/Jon')\n      .waitForElementVisible('strong')\n      .click('strong')\n      .pause(100)\n      .assert.containsText('h1', 'Hello Jon!')\n      .assert.urlContains('/user/Jon')\n      .end();\n  }\n};"
  },
  {
    "path": "test/e2e/route.js",
    "content": "module.exports = {\n  '<Route> Wildcard (*) Tests': (browser) => {\n    browser\n      // Checking if \"/\" Route loads Index Component\n      .url('http://localhost:5001')\n      .waitForElementVisible('h1')\n      .assert.containsText('h1', 'Hello from Index!')\n\n      // Checking if non-existent route redirects to About Page\n      .url('http://localhost:5001/does-not-exists')\n      .waitForElementVisible('h1')\n      .assert.containsText('h1', 'Not found')\n      .end();\n  },\n  '<Route> Slot rendering (/slot) Tests': (browser) => {\n    browser\n      .url('http://localhost:5001/slot')\n      .waitForElementVisible('h3')\n      .assert.containsText('h3', 'It works!')\n      .end();\n  },\n  '<Route> Basic path (/{name}) Tests': (browser) => {\n    browser\n      .url('http://localhost:5001/about')\n      .waitForElementVisible('h1')\n      .assert.containsText('h1', 'Hello from About!')\n      .end();\n  },\n  '<Route> Single param (/:name) Tests': (browser) => {\n    browser\n      .url('http://localhost:5001/user/Amanda')\n      .waitForElementVisible('h1')\n      .assert.containsText('h1', 'Hello Amanda!')\n      .end();\n  },\n  '<Route> Multiple params (/:name/:age) Tests': (browser) => {\n    browser\n      .url('http://localhost:5001/user/Amanda/30')\n      .waitForElementVisible('h1')\n      .assert.containsText('h1', 'Hello Amanda, 30yo!')\n      .end();\n  },\n  '<Route> Redirect Attribute Tests': (browser) => {\n    browser\n      .url('http://localhost:5001/company')\n      .waitForElementVisible('h1')\n      .assert.containsText('h1', 'Hello from About!')\n      .assert.urlContains('/about')\n      .end();\n  },\n  '<Route> Redirect Attribute Tests': (browser) => {\n    browser\n      // Check if /admin-false redirects to index\n      .url('http://localhost:5001/admin-false')\n      .pause(100)\n      .waitForElementVisible('h1')\n      .assert.containsText('h1', 'Hello from Index!')\n      .assert.urlContains('/')\n\n      // Check if /admin-true redirects to the right page\n      .url('http://localhost:5001/admin-true')\n      .waitForElementVisible('h2')\n      .assert.containsText('h2', 'Admin Panel')\n      .assert.urlContains('/admin-true')\n      .end();\n  },\n  '<Route> should work with hash-based routes': (browser) => {\n    browser\n      .url('http://localhost:5001/nested#')\n      .waitForElementVisible('p')\n      .assert.containsText('p', 'No hash is present')\n      .click('a[href=\"#abc/def/ghi\"]')\n      .assert.containsText('p', 'Params: {\"any\":\"abc\",\"path\":\"def/ghi\"}')\n      .click('a[href=\"#test\"]')\n      .assert.containsText('p', 'Static placeholder is shown')\n      .end();\n  },\n  '<Route> use fallback for unreachable nested-routes': (browser) => {\n    browser\n      .url('http://localhost:5001/nested/im_not_exists')\n      .waitForElementVisible('h1')\n      .assert.containsText('h1', 'Not found')\n      .end();\n  },\n  '<Route> hash-based paths can all catch-all': (browser) => {\n    browser\n      .url('http://localhost:5001/#whatever')\n      .waitForElementVisible('h1')\n      .assert.containsText('h1', 'Hello from Index!')\n      .waitForElementVisible('p')\n      .assert.containsText('p', 'Anchored. whatever')\n      .end();\n  },\n  '<Route> can receive additional props': (browser) => {\n    browser\n      .url('http://localhost:5001/about')\n      .waitForElementVisible('p')\n      .assert.containsText('p', 'Company and such.')\n      .end();\n  },\n};\n"
  },
  {
    "path": "test/e2e/router.js",
    "content": "module.exports = {\n  '<Router> Render inside elements': (browser) => {\n    browser\n      .url('http://localhost:5001')\n      .waitForElementVisible('main h1')\n      .assert.containsText('main h1', 'Hello from Index!')\n\n      .url('http://localhost:5001/does-not-exists')\n      .waitForElementVisible('main h1')\n      .assert.containsText('main h1', 'Not found')\n      .end();\n  },\n  '<Router> can be nested indefinitely': (browser) => {\n    browser\n      .url('http://localhost:5001/sub')\n      .waitForElementVisible('fieldset')\n      .url('http://localhost:5001/sub/val')\n      .waitForElementVisible('fieldset')\n      .assert.containsText('fieldset', 'val!')\n      .url('http://localhost:5001/sub/foo')\n      .waitForElementVisible('fieldset')\n      .assert.containsText('fieldset', 'Foo')\n      .url('http://localhost:5001/sub/im/not/exists')\n      .waitForElementVisible('fieldset')\n      .assert.containsText('fieldset', 'im!')\n      .assert.containsText('fieldset', 'Not found: sub/im/not/exists')\n      .url('http://localhost:5001/sub/nested')\n      .waitForElementVisible('fieldset')\n      .assert.containsText('fieldset', '[...]')\n      .url('http://localhost:5001/sub/nested/a')\n      .waitForElementVisible('fieldset')\n      .assert.containsText('fieldset', '[...] A')\n      .url('http://localhost:5001/sub/nested/b')\n      .waitForElementVisible('fieldset')\n      .assert.containsText('fieldset', '[...] C')\n      .url('http://localhost:5001/sub/nested/b/d')\n      .waitForElementVisible('fieldset')\n      .assert.containsText('fieldset', '[...] C')\n      .url('http://localhost:5001/sub/nested/b/c/d')\n      .waitForElementVisible('fieldset')\n      .assert.containsText('fieldset', '[...] not found? C')\n      .assert.containsText('fieldset', 'Not found: sub/nested/b/c/d')\n      .url('http://localhost:5001/sub/nested/something')\n      .waitForElementVisible('fieldset')\n      .assert.containsText('fieldset', '[...] {\"value\":\"something\"}')\n      .end();\n  },\n};\n"
  },
  {
    "path": "test/main.js",
    "content": "import App from './App.svelte';\n\ndocument.addEventListener('DOMContentLoaded', () => {\n  new App({\n    target: document.body\n  });\n});\n"
  },
  {
    "path": "test/public/404.html",
    "content": "<!DOCTYPE html>\n<html lang=\"en\">\n<head>\n  <meta charset=\"UTF-8\">\n  <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">\n  <meta http-equiv=\"X-UA-Compatible\" content=\"ie=edge\">\n  <title>Svero Testing Page</title>\n  <script src=\"/test.js\"></script>\n</head>\n<body>\n  \n</body>\n</html>"
  },
  {
    "path": "test/public/index.html",
    "content": "<!DOCTYPE html>\n<html lang=\"en\">\n<head>\n  <meta charset=\"UTF-8\">\n  <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">\n  <meta http-equiv=\"X-UA-Compatible\" content=\"ie=edge\">\n  <title>Svero Testing Page</title>\n  <script src=\"/test.js\"></script>\n</head>\n<body>\n  \n</body>\n</html>"
  }
]