diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000..5008ddf Binary files /dev/null and b/.DS_Store differ diff --git a/Main.elm b/Main.elm deleted file mode 100644 index 45c9d88..0000000 --- a/Main.elm +++ /dev/null @@ -1,7 +0,0 @@ -module Main exposing (..) - -import Html - - -main = - Html.text "Hello World" diff --git a/README.md b/README.md index 0a2cb70..db65216 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,748 @@ -# prefer -An app to facilitate and compare preferences +This project is bootstrapped with [Create Elm App](https://github.com/halfzebra/create-elm-app). +Below you will find some information on how to perform basic tasks. +You can find the most recent version of this guide [here](https://github.com/halfzebra/create-elm-app/blob/master/template/README.md). -## Litterature -https://en.wikipedia.org/wiki/Preference_learning -https://en.wikipedia.org/wiki/Learning_to_rank +## Table of Contents +- [Sending feedback](#sending-feedback) +- [Folder structure](#folder-structure) +- [Installing Elm packages](#installing-elm-packages) +- [Installing JavaScript packages](#installing-javascript-packages) +- [Available scripts](#available-scripts) + - [elm-app build](#elm-app-build) + - [elm-app start](#elm-app-start) + - [elm-app install](#elm-app-install) + - [elm-app test](#elm-app-test) + - [elm-app eject](#elm-app-eject) + - [elm-app ](#elm-app-elm-platform-comand) + - [package](#package) + - [repl](#repl) + - [make](#make) + - [reactor](#reactor) +- [Turning on/off Elm Debugger](#turning-onoff-elm-debugger) +- [Dead code elimination](#dead-code-elimination) +- [Changing the Page ``](#changing-the-page-title) +- [Adding a Stylesheet](#adding-a-stylesheet) +- [Post-Processing CSS](#post-processing-css) +- [Using elm-css](#using-elm-css) +- [Adding Images and Fonts](#adding-images-and-fonts) +- [Using the `public` Folder](#using-the-public-folder) + - [Changing the HTML](#changing-the-html) + - [Adding Assets Outside of the Module System](#adding-assets-outside-of-the-module-system) + - [When to Use the `public` Folder](#when-to-use-the-public-folder) +- [Using custom environment variables](#using-custom-environment-variables) +- [Setting up API Proxy](#setting-up-api-proxy) +- [Running tests](#running-tests) + - [Dependencies in Tests](#dependencies-in-tests) + - [Continuous Integration](#continuous-integration) +- [Making a Progressive Web App](#making-a-progressive-web-app) + - [Opting Out of Caching](#opting-out-of-caching) + - [Offline-First Considerations](#offline-first-considerations) + - [Progressive Web App Metadata](#progressive-web-app-metadata) +- [Deployment](#deployment) + - [Static Server](#static-server) + - [GitHub Pages](#github-pages) +- [IDE setup for Hot Module Replacement](#ide-setup-for-hot-module-replacement) + +## Sending feedback + +You are very welcome with any [feedback](https://github.com/halfzebra/create-elm-app/issues) + +## Installing Elm packages + +```sh +elm-app install <package-name> +``` + +Other `elm-package` commands are also [available.](#package) + +## Installing JavaScript packages + +To use JavaScript packages from npm, you'll need to add a `package.json`, install the dependencies, and you're ready to go. + +```sh +npm init -y # Add package.json +npm install --save-dev pouchdb-browser # Install library from npm +``` + +```js +// Use in your JS code +import PouchDB from 'pouchdb-browser'; +const db = new PouchDB('mydb'); +``` + +## Folder structure + +``` +my-app/ +├── .gitignore +├── README.md +├── elm-package.json +├── elm-stuff +├── public +│ ├── favicon.ico +│ ├── index.html +│ ├── logo.svg +│ └── manifest.json +├── src +│ ├── Main.elm +│ ├── index.js +│ ├── main.css +│ └── registerServiceWorker.js +└── tests + ├── Tests.elm + └── elm-package.json +``` + +For the project to build, these files must exist with exact filenames: + +- `public/index.html` is the page template; +- `public/favicon.ico` is the icon you see in the browser tab; +- `src/index.js` is the JavaScript entry point. + +You can delete or rename the other files. + +You may create subdirectories inside src. + +## Available scripts +In the project directory you can run: +### `elm-app build` +Builds the app for production to the `build` folder. + +The build is minified, and the filenames include the hashes. +Your app is ready to be deployed! + +### `elm-app start` +Runs the app in the development mode. +Open [http://localhost:3000](http://localhost:3000) to view it in the browser. + +The page will reload if you make edits. +You will also see any lint errors in the console. + +### `elm-app install` + +An alias for [`elm-app package install`](#package) + +### `elm-app test` +Run tests with [node-test-runner](https://github.com/rtfeldman/node-test-runner/tree/master) + +You can make test runner watch project files by running: +```sh +elm-app test --watch +``` + +### `elm-app eject` + +**Note: this is a one-way operation. Once you `eject`, you can’t go back!** + +If you aren’t satisfied with the build tool and configuration choices, you can `eject` at any time. + +Instead, it will copy all the configuration files and the transitive dependencies (Webpack, Elm Platform, etc.) right into your project, so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point, you’re on your own. + +You don’t have to use 'eject' The curated feature set is suitable for small and middle deployments, and you shouldn’t feel obligated to use this feature. However, we understand that this tool wouldn’t be useful if you couldn’t customize it when you are ready for it. + +### `elm-app <elm-platform-comand>` + +Create Elm App does not rely on the global installation of Elm Platform, but you still can use its local Elm Platform to access default command line tools: + +#### `package` + +Alias for [elm-package](http://guide.elm-lang.org/get_started.html#elm-package) + +Use it for installing Elm packages from [package.elm-lang.org](http://package.elm-lang.org/) + +#### `repl` + +Alias for [elm-repl](http://guide.elm-lang.org/get_started.html#elm-repl) + +#### `make` + +Alias for [elm-make](http://guide.elm-lang.org/get_started.html#elm-make) + +#### `reactor` + +Alias for [elm-reactor](http://guide.elm-lang.org/get_started.html#elm-reactor) + + +## Turning on/off Elm Debugger + +By default, in production (`elm-app build`) the Debugger is turned off and in development mode (`elm-app start`) it's turned on. + +To turn on/off Elm Debugger explicitly, set `ELM_DEBUGGER` environment variable to `true` or `false` respectively. + +## Dead code elimination + +Create Elm App comes with an opinionated setup for dead code elimination which is disabled by default, because it may break your code. + +You can enable it by setting `DEAD_CODE_ELIMINATION` environment variable to `true` + +## Changing the base path of the assets in the HTML + +By default, assets will be linked from the HTML to the root url. For example `/css/style.css`. + +If you deploy to a path that is not the root, you can change the `PUBLIC_URL` environment variable to properly reference your assets in the compiled assets. For example: `PUBLIC_URL=./ elm-app build`. + +## Changing the Page `<title>` + +You can find the source HTML file in the `public` folder of the generated project. You may edit the `<title>` tag in it to change the title from “Elm App” to anything else. + +Note that normally you wouldn’t edit files in the `public` folder very often. For example, [adding a stylesheet](#adding-a-stylesheet) is done without touching the HTML. + +If you need to dynamically update the page title based on the content, you can use the browser [`document.title`](https://developer.mozilla.org/en-US/docs/Web/API/Document/title) API and [ports.](https://guide.elm-lang.org/interop/javascript.html#ports) + +## Adding a Stylesheet + +This project setup uses [Webpack](https://webpack.js.org/) for handling all assets. Webpack offers a custom way of “extending” the concept of `import` beyond JavaScript. To express that a JavaScript file depends on a CSS file, you need to **import the CSS from the JavaScript file**: + +### `main.css` + +```css +body { + padding: 20px; +} +``` + +### `index.js` + +```js +import './main.css'; // Tell Webpack to pick-up the styles from main.css +``` + +## Post-Processing CSS + +This project setup minifies your CSS and adds vendor prefixes to it automatically through [Autoprefixer](https://github.com/postcss/autoprefixer) so you don’t need to worry about it. + +For example, this: + +```css +.container { + display: flex; + flex-direction: row; + align-items: center; +} +``` + +becomes this: + +```css +.container { + display: -webkit-box; + display: -ms-flexbox; + display: flex; +} +``` + +In development, expressing dependencies this way allows your styles to be reloaded on the fly as you edit them. In production, all CSS files will be concatenated into a single minified `.css` file in the build output. + +You can put all your CSS right into `src/main.css`. It would still be imported from `src/index.js`, but you could always remove that import if you later migrate to a different build tool. + +## Using elm-css + +### Step 1: Install [elm-css](https://github.com/rtfeldman/elm-css) npm package + +```sh +npm install elm-css -g +``` + +### Step 2: Install Elm dependencies + +```sh +elm-app install rtfeldman/elm-css +elm-app install rtfeldman/elm-css-helpers +``` + +### Step 3: Create the stylesheet file + +Create an Elm file at `src/Stylesheets.elm` (The name of this file cannot be changed). + +```elm +port module Stylesheets exposing (main, CssClasses(..), CssIds(..), helpers) + +import Css exposing (..) +import Css.Elements exposing (body, li) +import Css.Namespace exposing (namespace) +import Css.File exposing (..) +import Html.CssHelpers exposing (withNamespace) + + +port files : CssFileStructure -> Cmd msg + + +cssFiles : CssFileStructure +cssFiles = + toFileStructure [ ( "src/style.css", Css.File.compile [ css ] ) ] + + +main : CssCompilerProgram +main = + Css.File.compiler files cssFiles + + +type CssClasses + = NavBar + + +type CssIds + = Page + + +appNamespace = + "App" + + +helpers = + withNamespace appNamespace + + +css = + (stylesheet << namespace appNamespace) + [ body + [ overflowX auto + , minWidth (px 1280) + ] + , id Page + [ backgroundColor (rgb 200 128 64) + , color (hex "CCFFFF") + , width (pct 100) + , height (pct 100) + , boxSizing borderBox + , padding (px 8) + , margin zero + ] + , class NavBar + [ margin zero + , padding zero + , children + [ li + [ (display inlineBlock) |> important + , color primaryAccentColor + ] + ] + ] + ] + + +primaryAccentColor = + hex "ccffaa" +``` + +### Steap 4: Compiling the stylesheet + +To compile the CSS file, just run + +```sh +elm-css src/Stylesheets.elm +``` + +This will generate a file called `style.css` + +### Step 5: Import the compiled CSS file + +Add the following line to your `src/index.js`: + +```js +import './style.css'; +``` + +### Step 6: Using the stylesheet in your Elm code + +```elm +import Stylesheets exposing (helpers, CssIds(..), CssClasses(..)) + + +view model = + div [ helpers.id Page ] + [ div [ helpers.class [ NavBar ] ] + [ text "Your Elm App is working!" ] + ] +``` + +Please note that `Stylesheets.elm` exposes `helpers` record, which contains functions for creating id and class attributes. + +You can also destructure `helpers` to make your view more readable: + +```elm +{ id, class } = + helpers +``` + +## Adding Images and Fonts + +With Webpack, using static assets like images and fonts works similarly to CSS. + +By requiring an image in JavaScript code, you tell Webpack to add a file to the build of your application. The variable will contain a unique path to the said file. + +Here is an example: + +```js +import logoPath from './logo.svg'; // Tell Webpack this JS file uses this image +import { Main } from './Main.elm'; + +Main.embed( + document.getElementById('root'), + logoPath // Pass image path as a flag for Html.programWithFlags + ); +``` + +Later on, you can use the image path in your view for displaying it in the DOM. + +```elm +view : Model -> Html Msg +view model = + div [] + [ img [ src model.logo ] [] + , div [] [ text model.message ] + ] +``` + +## Using the `public` Folder + +### Changing the HTML + +The `public` folder contains the HTML file so you can tweak it, for example, to [set the page title](#changing-the-page-title). +The `<script>` tag with the compiled code will be added to it automatically during the build process. + +### Adding Assets Outside of the Module System + +You can also add other assets to the `public` folder. + +Note that we normally encourage you to `import` assets in JavaScript files instead. +For example, see the sections on [adding a stylesheet](#adding-a-stylesheet) and [adding images and fonts](#adding-images-fonts-and-files). +This mechanism provides a few benefits: + +* Scripts and stylesheets get minified and bundled together to avoid extra network requests. +* Missing files cause compilation errors instead of 404 errors for your users. +* Result filenames include content hashes, so you don’t need to worry about browsers caching their old versions. + +However, there is a **escape hatch** that you can use to add an asset outside of the module system. + +If you put a file into the `public` folder, it will **not** be processed by Webpack. Instead, it will be copied into the build folder untouched. To reference assets in the `public` folder, you need to use a special variable called `PUBLIC_URL`. + +Inside `index.html`, you can use it like this: + +```html +<link rel="shortcut icon" href="%PUBLIC_URL%/favicon.ico"> +``` + +Only files inside the `public` folder will be accessible by `%PUBLIC_URL%` prefix. If you need to use a file from `src` or `node_modules`, you’ll have to copy it there to explicitly specify your intention to make this file a part of the build. + +When you run `elm-app build`, Create Elm App will substitute `%PUBLIC_URL%` with a correct absolute path, so your project works even if you use client-side routing or host it at a non-root URL. + +In Elm code, you can use `%PUBLIC_URL%` for similar purposes: + +```elm +// Note: this is an escape hatch and should be used sparingly! +// Normally we recommend using `import` and `Html.programWithFlags` for getting +// asset URLs as described in “Adding Images and Fonts” above this section. +img [ src "%PUBLIC_URL%/logo.svg" ] [] +``` + +In JavaScript code, you can use `process.env.PUBLIC_URL` for similar purposes: + +```js +const logo = `<img src=${process.env.PUBLIC_URL + '/img/logo.svg'} />`; +``` + +Keep in mind the downsides of this approach: + +* None of the files in `public` folder get post-processed or minified. +* Missing files will not be called at compilation time, and will cause 404 errors for your users. +* Result filenames won’t include content hashes so you’ll need to add query arguments or rename them every time they change. + +### When to Use the `public` Folder + +Normally we recommend importing [stylesheets](#adding-a-stylesheet), [images, and fonts](#adding-images-fonts-and-files) from JavaScript. +The `public` folder is used as a workaround for some less common cases: + +* You need a file with a specific name in the build output, such as [`manifest.webmanifest`](https://developer.mozilla.org/en-US/docs/Web/Manifest). +* You have thousands of images and need to dynamically reference their paths. +* You want to include a small script like [`pace.js`](http://github.hubspot.com/pace/docs/welcome/) outside of the bundled code. +* Some library may be incompatible with Webpack and you have no other option but to include it as a `<script>` tag. + +Note that if you add a `<script>` that declares global variables, you also need to read the next section on using them. + + +## Using custom environment variables + +In your JavaScript code you have access to variables declared in your +environment, like an API key set in an `.env`-file or via your shell. They are +available on the `process.env`-object and will be injected during build time. + +Besides the `NODE_ENV` variable you can access all variables prefixed with +`ELM_APP_`: + +```bash +# .env +ELM_APP_API_KEY="secret-key" +``` + +Alternatively, you can set them on your shell before calling the start- or +build-script, e.g.: + +```bash +ELM_APP_API_KEY="secret-key" elm-app start +``` + +Both ways can be mixed, but variables set on your shell prior to calling one of +the scripts will take precedence over those declared in an `.env`-file. + +Passing the variables to your Elm-code can be done via `flags`: + +```javascript +// index.js +import { Main } from './Main.elm'; + +Main.fullscreen({ + environment: process.env.NODE_ENV, + apiKey: process.env.ELM_APP_API_KEY, +}); +``` + +```elm +-- Main.elm +type alias Flags = { apiKey : String, environment : String } + +init : Flags -> ( Model, Cmd Msg ) +init flags = + ... + +main = + programWithFlags { init = init, ... } +``` + +Be aware that you cannot override `NODE_ENV` manually. See +[this list from the `dotenv`-library](https://github.com/bkeepers/dotenv#what-other-env-files-can-i-use) +for a list of files you can use to declare environment variables. + + +## Setting up API Proxy +To forward the API ( REST ) calls to backend server, add a proxy to the `elm-package.json` in the top level json object. + +```json +{ + ... + "proxy" : "http://localhost:1313", + ... +} +``` + +Make sure the XHR requests set the `Content-type: application/json` and `Accept: application/json`. +The development server has heuristics, to handle its own flow, which may interfere with proxying of +other html and javascript content types. + +```sh + curl -X GET -H "Content-type: application/json" -H "Accept: application/json" http://localhost:3000/api/list +``` + +## Running Tests + +Create Elm App uses [elm-test](https://github.com/rtfeldman/node-test-runner) as its test runner. + +### Dependencies in Tests + +To use packages in tests, you also need to install them in `tests` directory. + +```bash +elm-app test --add-dependencies elm-package.json +``` + +### Continuous Integration + +#### Travis CI + +1. Following the [Travis Getting started](https://docs.travis-ci.com/user/getting-started/) guide for syncing your GitHub repository with Travis. You may need to initialize some settings manually in your [profile](https://travis-ci.org/profile) page. +1. Add a `.travis.yml` file to your git repository. + +```yaml +language: node_js + +sudo: required + +node_js: + - '7' + +install: + - npm i create-elm-app -g + +script: elm-app test +``` + +1. Trigger your first build with a git push. +1. [Customize your Travis CI Build](https://docs.travis-ci.com/user/customizing-the-build/) if needed. + +## Making a Progressive Web App + +By default, the production build is a fully functional, offline-first +[Progressive Web App](https://developers.google.com/web/progressive-web-apps/). + +Progressive Web Apps are faster and more reliable than traditional web pages, and provide an engaging mobile experience: + + * All static site assets are cached so that your page loads fast on subsequent visits, regardless of network connectivity (such as 2G or 3G). Updates are downloaded in the background. + * Your app will work regardless of network state, even if offline. This means your users will be able to use your app at 10,000 feet and on the Subway. + * On mobile devices, your app can be added directly to the user's home screen, app icon and all. You can also re-engage users using web **push notifications**. This eliminates the need for the app store. + +The [`sw-precache-webpack-plugin`](https://github.com/goldhand/sw-precache-webpack-plugin) +is integrated into production configuration, +and it will take care of generating a service worker file that will automatically +precache all of your local assets and keep them up to date as you deploy updates. +The service worker will use a [cache-first strategy](https://developers.google.com/web/fundamentals/instant-and-offline/offline-cookbook/#cache-falling-back-to-network) +for handling all requests for local assets, including the initial HTML, ensuring +that your web app is reliably fast, even on a slow or unreliable network. + +### Opting Out of Caching + +If you would prefer not to enable service workers prior to your initial +production deployment, then remove the call to `serviceWorkerRegistration.register()` +from [`src/index.js`](src/index.js). + +If you had previously enabled service workers in your production deployment and +have decided that you would like to disable them for all your existing users, +you can swap out the call to `serviceWorkerRegistration.register()` in +[`src/index.js`](src/index.js) with a call to `serviceWorkerRegistration.unregister()`. +After the user visits a page that has `serviceWorkerRegistration.unregister()`, +the service worker will be uninstalled. Note that depending on how `/service-worker.js` is served, +it may take up to 24 hours for the cache to be invalidated. + +### Offline-First Considerations + +1. Service workers [require HTTPS](https://developers.google.com/web/fundamentals/getting-started/primers/service-workers#you_need_https), +although to facilitate local testing, that policy +[does not apply to `localhost`](http://stackoverflow.com/questions/34160509/options-for-testing-service-workers-via-http/34161385#34161385). +If your production web server does not support HTTPS, then the service worker +registration will fail, but the rest of your web app will remain functional. + +1. Service workers are [not currently supported](https://jakearchibald.github.io/isserviceworkerready/) +in all web browsers. Service worker registration [won't be attempted](src/registerServiceWorker.js) +on browsers that lack support. + +1. The service worker is only enabled in the [production environment](#deployment), +e.g. the output of `npm run build`. It's recommended that you do not enable an +offline-first service worker in a development environment, as it can lead to +frustration when previously cached assets are used and do not include the latest +changes you've made locally. + +1. If you *need* to test your offline-first service worker locally, build +the application (using `npm run build`) and run a simple http server from your +build directory. After running the build script, `create-react-app` will give +instructions for one way to test your production build locally and the [deployment instructions](#deployment) have +instructions for using other methods. *Be sure to always use an +incognito window to avoid complications with your browser cache.* + +1. If possible, configure your production environment to serve the generated +`service-worker.js` [with HTTP caching disabled](http://stackoverflow.com/questions/38843970/service-worker-javascript-update-frequency-every-24-hours). +If that's not possible—[GitHub Pages](#github-pages), for instance, does not +allow you to change the default 10 minute HTTP cache lifetime—then be aware +that if you visit your production site, and then revisit again before +`service-worker.js` has expired from your HTTP cache, you'll continue to get +the previously cached assets from the service worker. If you have an immediate +need to view your updated production deployment, performing a shift-refresh +will temporarily disable the service worker and retrieve all assets from the +network. + +1. Users aren't always familiar with offline-first web apps. It can be useful to +[let the user know](https://developers.google.com/web/fundamentals/instant-and-offline/offline-ux#inform_the_user_when_the_app_is_ready_for_offline_consumption) +when the service worker has finished populating your caches (showing a "This web +app works offline!" message) and also let them know when the service worker has +fetched the latest updates that will be available the next time they load the +page (showing a "New content is available; please refresh." message). Showing +this messages is currently left as an exercise to the developer, but as a +starting point, you can make use of the logic included in [`src/registerServiceWorker.js`](src/registerServiceWorker.js), which +demonstrates which service worker lifecycle events to listen for to detect each +scenario, and which as a default, just logs appropriate messages to the +JavaScript console. + +1. By default, the generated service worker file will not intercept or cache any +cross-origin traffic, like HTTP [API requests](#integrating-with-an-api-backend), +images, or embeds loaded from a different domain. If you would like to use a +runtime caching strategy for those requests, you can [`eject`](#npm-run-eject) +and then configure the +[`runtimeCaching`](https://github.com/GoogleChrome/sw-precache#runtimecaching-arrayobject) +option in the `SWPrecacheWebpackPlugin` section of +[`webpack.config.prod.js`](../config/webpack.config.prod.js). + +### Progressive Web App Metadata + +The default configuration includes a web app manifest located at +[`public/manifest.json`](public/manifest.json), that you can customize with +details specific to your web application. + +When a user adds a web app to their homescreen using Chrome or Firefox on +Android, the metadata in [`manifest.json`](public/manifest.json) determines what +icons, names, and branding colors to use when the web app is displayed. +[The Web App Manifest guide](https://developers.google.com/web/fundamentals/engage-and-retain/web-app-manifest/) +provides more context about what each field means, and how your customizations +will affect your users' experience. + +## Deployment + + +`elm-app build` creates a `build` directory with a production build of your app. Set up your favourite HTTP server so that a visitor to your site is served `index.html`, and requests to static paths like `/static/js/main.<hash>.js` are served with the contents of the `/static/js/main.<hash>.js` file. + +### Static Server + +For environments using [Node](https://nodejs.org/), the easiest way to handle this would be to install [serve](https://github.com/zeit/serve) and let it handle the rest: + +```sh +npm install -g serve +serve -s build +``` + +The last command shown above will serve your static site on the port **5000**. Like many of [serve](https://github.com/zeit/serve)’s internal settings, the port can be adjusted using the `-p` or `--port` flags. + +Run this command to get a full list of the options available: + +```sh +serve -h +``` + +### GitHub Pages + +#### Step 1: Add `homepage` to `elm-package.json` + +**The step below is important!**<br> +**If you skip it, your app will not deploy correctly.** + +Open your `elm-package.json` and add a `homepage` field: + +```js + "homepage": "https://myusername.github.io/my-app", +``` + +Create Elm App uses the `homepage` field to determine the root URL in the built HTML file. + +#### Step 2: Build the static site + +```sh +elm-app build +``` + +#### Step 3: Deploy the site by running `gh-pages -d build` + +We will use [gh-pages](https://www.npmjs.com/package/gh-pages) to upload the files from the `build` directory to GitHub. If you haven't already installed it, do so now (`npm install -g gh-pages`) + +Now run: + +```sh +gh-pages -d build +``` + +#### Step 4: Ensure your project’s settings use `gh-pages` + +Finally, make sure **GitHub Pages** option in your GitHub project settings is set to use the `gh-pages` branch: + +<img src="http://i.imgur.com/HUjEr9l.png" width="500" alt="gh-pages branch setting"> + +#### Step 5: Optionally, configure the domain + +You can configure a custom domain with GitHub Pages by adding a `CNAME` file to the `public/` folder. + +#### Notes on client-side routing + +GitHub Pages doesn’t support routers that use the HTML5 `pushState` history API under the hood (for example, React Router using `browserHistory`). This is because when there is a fresh page load for a url like `http://user.github.io/todomvc/todos/42`, where `/todos/42` is a frontend route, the GitHub Pages server returns 404 because it knows nothing of `/todos/42`. If you want to add a router to a project hosted on GitHub Pages, here are a couple of solutions: + +* You could switch from using HTML5 history API to routing with hashes. +* Alternatively, you can use a trick to teach GitHub Pages to handle 404 by redirecting to your `index.html` page with a special redirect parameter. You would need to add a `404.html` file with the redirection code to the `build` folder before deploying your project, and you’ll need to add code handling the redirect parameter to `index.html`. You can find a detailed explanation of this technique [in this guide](https://github.com/rafrex/spa-github-pages). + +## IDE setup for Hot Module Replacement + +Remember to disable [safe write](https://webpack.github.io/docs/webpack-dev-server.html#working-with-editors-ides-supporting-safe-write) if you are using VIM or IntelliJ IDE, such as WebStorm. diff --git a/build/favicon.ico b/build/favicon.ico new file mode 100644 index 0000000..d7057bd Binary files /dev/null and b/build/favicon.ico differ diff --git a/build/index.html b/build/index.html new file mode 100644 index 0000000..bf1bb2c --- /dev/null +++ b/build/index.html @@ -0,0 +1 @@ +<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta http-equiv="x-ua-compatible" content="ie=edge"><meta name="viewport" content="width=device-width,initial-scale=1,shrink-to-fit=no"><meta name="theme-color" content="#000000"><link rel="manifest" href="/manifest.json"><link rel="shortcut icon" href="/favicon.ico"><title>Elm App
\ No newline at end of file diff --git a/build/logo.svg b/build/logo.svg new file mode 100644 index 0000000..4321d4d --- /dev/null +++ b/build/logo.svg @@ -0,0 +1,39 @@ + + + + + + + + + + + + + + + + + + + + diff --git a/build/manifest.json b/build/manifest.json new file mode 100644 index 0000000..9b7dc41 --- /dev/null +++ b/build/manifest.json @@ -0,0 +1,15 @@ +{ + "short_name": "Elm App", + "name": "Create Elm App Sample", + "icons": [ + { + "src": "favicon.ico", + "sizes": "192x192", + "type": "image/png" + } + ], + "start_url": "./index.html", + "display": "standalone", + "theme_color": "#000000", + "background_color": "#ffffff" +} diff --git a/build/service-worker.js b/build/service-worker.js new file mode 100644 index 0000000..39df65f --- /dev/null +++ b/build/service-worker.js @@ -0,0 +1 @@ +"use strict";var precacheConfig=[["/index.html","39878f4477cea7222161bf10b3fe2b2d"],["/static/css/main.f5c22ef7.css","f5c22ef792b6b7188747120e8b53f6f3"],["/static/js/main.85c4ab04.js","0f10e047abd8e60e63a0e57d325a79bf"]],cacheName="sw-precache-v3-sw-precache-webpack-plugin-"+(self.registration?self.registration.scope:""),ignoreUrlParametersMatching=[/^utm_/],addDirectoryIndex=function(e,t){var n=new URL(e);return"/"===n.pathname.slice(-1)&&(n.pathname+=t),n.toString()},cleanResponse=function(e){return e.redirected?("body"in e?Promise.resolve(e.body):e.blob()).then(function(t){return new Response(t,{headers:e.headers,status:e.status,statusText:e.statusText})}):Promise.resolve(e)},createCacheKey=function(e,t,n,r){var a=new URL(e);return r&&a.pathname.match(r)||(a.search+=(a.search?"&":"")+encodeURIComponent(t)+"="+encodeURIComponent(n)),a.toString()},isPathWhitelisted=function(e,t){if(0===e.length)return!0;var n=new URL(t).pathname;return e.some(function(e){return n.match(e)})},stripIgnoredUrlParameters=function(e,t){var n=new URL(e);return n.hash="",n.search=n.search.slice(1).split("&").map(function(e){return e.split("=")}).filter(function(e){return t.every(function(t){return!t.test(e[0])})}).map(function(e){return e.join("=")}).join("&"),n.toString()},hashParamName="_sw-precache",urlsToCacheKeys=new Map(precacheConfig.map(function(e){var t=e[0],n=e[1],r=new URL(t,self.location),a=createCacheKey(r,hashParamName,n,/\.\w{8}\./);return[r.toString(),a]}));function setOfCachedUrls(e){return e.keys().then(function(e){return e.map(function(e){return e.url})}).then(function(e){return new Set(e)})}self.addEventListener("install",function(e){e.waitUntil(caches.open(cacheName).then(function(e){return setOfCachedUrls(e).then(function(t){return Promise.all(Array.from(urlsToCacheKeys.values()).map(function(n){if(!t.has(n)){var r=new Request(n,{credentials:"same-origin"});return fetch(r).then(function(t){if(!t.ok)throw new Error("Request for "+n+" returned a response with status "+t.status);return cleanResponse(t).then(function(t){return e.put(n,t)})})}}))})}).then(function(){return self.skipWaiting()}))}),self.addEventListener("activate",function(e){var t=new Set(urlsToCacheKeys.values());e.waitUntil(caches.open(cacheName).then(function(e){return e.keys().then(function(n){return Promise.all(n.map(function(n){if(!t.has(n.url))return e.delete(n)}))})}).then(function(){return self.clients.claim()}))}),self.addEventListener("fetch",function(e){if("GET"===e.request.method){var t,n=stripIgnoredUrlParameters(e.request.url,ignoreUrlParametersMatching),r="index.html";(t=urlsToCacheKeys.has(n))||(n=addDirectoryIndex(n,r),t=urlsToCacheKeys.has(n));var a="/index.html";!t&&"navigate"===e.request.mode&&isPathWhitelisted(["^(?!\\/__).*"],e.request.url)&&(n=new URL(a,self.location).toString(),t=urlsToCacheKeys.has(n)),t&&e.respondWith(caches.open(cacheName).then(function(e){return e.match(urlsToCacheKeys.get(n)).then(function(e){if(e)return e;throw Error("The cached response that was expected is missing.")})}).catch(function(t){return console.warn('Couldn\'t serve response for "%s" from cache: %O',e.request.url,t),fetch(e.request)}))}}); \ No newline at end of file diff --git a/build/static/css/main.f5c22ef7.css b/build/static/css/main.f5c22ef7.css new file mode 100644 index 0000000..a3e26c9 --- /dev/null +++ b/build/static/css/main.f5c22ef7.css @@ -0,0 +1 @@ +body{font-family:Source Sans Pro,Trebuchet MS,Lucida Grande,Bitstream Vera Sans,Helvetica Neue,sans-serif;margin:0;text-align:center;color:#293c4b}h1{font-size:30px}img{margin:20px 0;max-width:200px} \ No newline at end of file diff --git a/build/static/js/main.85c4ab04.js b/build/static/js/main.85c4ab04.js new file mode 100644 index 0000000..e8edfb7 --- /dev/null +++ b/build/static/js/main.85c4ab04.js @@ -0,0 +1 @@ +!function(t){function r(n){if(e[n])return e[n].exports;var o=e[n]={i:n,l:!1,exports:{}};return t[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}var e={};r.m=t,r.c=e,r.d=function(t,e,n){r.o(t,e)||Object.defineProperty(t,e,{configurable:!1,enumerable:!0,get:n})},r.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(e,"a",e),e},r.o=function(t,r){return Object.prototype.hasOwnProperty.call(t,r)},r.p="/",r(r.s=0)}([function(t,r,e){t.exports=e(1)},function(t,r,e){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=e(2),o=(e.n(n),e(3)),a=(e.n(o),e(4));o.Main.embed(document.getElementById("root")),Object(a.a)()},function(t,r){},function(t,r){(function(){"use strict";function r(t){function r(r){return function(e){return t(r,e)}}return r.arity=2,r.func=t,r}function e(t){function r(r){return function(e){return function(n){return t(r,e,n)}}}return r.arity=3,r.func=t,r}function n(t){function r(r){return function(e){return function(n){return function(o){return t(r,e,n,o)}}}}return r.arity=4,r.func=t,r}function o(t){function r(r){return function(e){return function(n){return function(o){return function(a){return t(r,e,n,o,a)}}}}}return r.arity=5,r.func=t,r}function a(t){function r(r){return function(e){return function(n){return function(o){return function(a){return function(i){return t(r,e,n,o,a,i)}}}}}}return r.arity=6,r.func=t,r}function i(t){function r(r){return function(e){return function(n){return function(o){return function(a){return function(i){return function(u){return t(r,e,n,o,a,i,u)}}}}}}}return r.arity=7,r.func=t,r}function u(t){function r(r){return function(e){return function(n){return function(o){return function(a){return function(i){return function(u){return function(c){return t(r,e,n,o,a,i,u,c)}}}}}}}}return r.arity=8,r.func=t,r}function c(t){function r(r){return function(e){return function(n){return function(o){return function(a){return function(i){return function(u){return function(c){return function(l){return t(r,e,n,o,a,i,u,c,l)}}}}}}}}}return r.arity=9,r.func=t,r}function l(t,r,e){return 2===t.arity?t.func(r,e):t(r)(e)}function f(t,r,e,n){return 3===t.arity?t.func(r,e,n):t(r)(e)(n)}function _(t,r,e,n,o){return 4===t.arity?t.func(r,e,n,o):t(r)(e)(n)(o)}function s(t,r,e,n,o,a){return 5===t.arity?t.func(r,e,n,o,a):t(r)(e)(n)(o)(a)}var d=function(){function t(t,r){if(t<0||t>=j(r))throw new Error("Index "+t+" is out of range. Check the length of your array first or use getMaybe or getWithDefault.");return n(t,r)}function n(t,r){for(var e=r.height;e>0;e--){for(var n=t>>5*e;r.lengths[n]<=t;)n++;n>0&&(t-=r.lengths[n-1]),r=r.table[n]}return r.table[t]}function o(t,r,e){return t<0||j(e)<=t?e:a(t,r,e)}function a(t,r,e){if(e=I(e),0===e.height)e.table[t]=r;else{var n=J(t,e);n>0&&(t-=e.lengths[n-1]),e.table[n]=a(t,r,e.table[n])}return e}function i(t,r){return t<=0?G:u(r,Math.floor(Math.log(t)/Math.log($)),0,t)}function u(t,r,e,n){if(0===r){for(var o=new Array((n-e)%($+1)),a=0;a0?c[a-1]:0);return{ctor:"_Array",height:r,table:o,lengths:c}}function c(t){if("[]"===t.ctor)return G;for(var r=new Array($),e=[],n=0;"[]"!==t.ctor;)if(r[n]=t._0,t=t._1,++n===$){var o={ctor:"_Array",height:0,table:r};f(o,e),r=new Array($),n=0}if(n>0){var o={ctor:"_Array",height:0,table:r.splice(0,n)};f(o,e)}for(var a=0;a0&&f(e[a],e);var i=e[e.length-1];return i.height>0&&1===i.table.length?i.table[0]:i}function f(t,r){var e=t.height;if(r.length===e){var n={ctor:"_Array",height:e+1,table:[],lengths:[]};r.push(n)}r[e].table.push(t);var o=j(t);r[e].lengths.length>0&&(o+=r[e].lengths[r[e].lengths.length-1]),r[e].lengths.push(o),r[e].table.length===$&&(f(r[e],r),r[e]={ctor:"_Array",height:e+1,table:[],lengths:[]})}function _(t,r){var e=s(t,r);return null!==e?e:U(r,D(t,r.height))}function s(t,r){if(0===r.height){if(r.table.length<$){var e={ctor:"_Array",height:0,table:r.table.slice()};return e.table.push(t),e}return null}var n=s(t,M(r));if(null!==n){var e=I(r);return e.table[e.table.length-1]=n,e.lengths[e.lengths.length-1]++,e}if(r.table.length<$){var o=D(t,r.height-1),e=I(r);return e.table.push(o),e.lengths.push(e.lengths[e.lengths.length-1]+j(o)),e}return null}function d(t){return h(w.Nil,t)}function h(t,r){for(var e=r.table.length-1;e>=0;e--)t=0===r.height?w.Cons(r.table[e],t):h(t,r.table[e]);return t}function v(t,r){var e={ctor:"_Array",height:r.height,table:new Array(r.table.length)};r.height>0&&(e.lengths=r.lengths);for(var n=0;n0&&(n.lengths=r.lengths);for(var o=0;o0?r.lengths[n-1]:0),r.table[n]);if(0===n)return o;var e={ctor:"_Array",height:r.height,table:r.table.slice(0,n),lengths:r.lengths.slice(0,n)};return o.table.length>0&&(e.table[n]=o,e.lengths[n]=j(o)+(n>0?e.lengths[n-1]:0)),e}function T(t,r){if(0===t)return r;if(0===r.height){var e={ctor:"_Array",height:0};return e.table=r.table.slice(t,r.table.length+1),e}var n=J(t,r),o=T(t-(n>0?r.lengths[n-1]:0),r.table[n]);if(n===r.table.length-1)return o;var e={ctor:"_Array",height:r.height,table:r.table.slice(n,r.table.length+1),lengths:new Array(r.table.length-n)};e.table[0]=o;for(var a=0,i=0;i0){for(var n=j(e[0]),o=0;o0){var a=x(t,r);a>K&&(e=S(e[0],e[1],a))}return U(e[0],e[1])}function N(t,r){if(0===t.height&&0===r.height)return[t,r];if(1!==t.height||1!==r.height)if(t.height===r.height){t=I(t),r=I(r);var e=N(M(t),P(r));R(t,e[1]),E(r,e[0])}else if(t.height>r.height){t=I(t);var e=N(M(t),r);R(t,e[0]),r=F(e[1],e[1].height+1)}else{r=I(r);var e=N(t,P(r)),n=0===e[0].table.length?0:1,o=0===n?1:0;E(r,e[n]),t=F(e[o],e[o].height+1)}if(0===t.table.length||0===r.table.length)return[t,r];var a=x(t,r);return a<=K?[t,r]:S(t,r,a)}function R(t,r){var e=t.table.length-1;t.table[e]=r,t.lengths[e]=j(r),t.lengths[e]+=e>0?t.lengths[e-1]:0}function E(t,r){if(r.table.length>0){t.table[0]=r,t.lengths[0]=j(r);for(var e=j(t.table[0]),n=1;n0&&(e.lengths=new Array(r)),e}function S(t,r,e){for(var n=O(t.height,Math.min($,t.table.length+r.table.length-e)),o=O(t.height,n.table.length-(t.table.length+r.table.length-e)),a=0;A(t.table,r.table,a).table.length%$==0;)C(n.table,o.table,a,A(t.table,r.table,a)),C(n.lengths,o.lengths,a,A(t.lengths,r.lengths,a)),a++;for(var i=a,u=new O(t.height-1,0),c=0;a-i-(u.table.length>0?1:0)0)for(var _=u.lengths.length,s=_;s<_+f-c;s++)u.lengths[s]=j(u.table[s]),u.lengths[s]+=s>0?u.lengths[s-1]:0;c+=f,l.table.length<=f&&(a++,c=0),u.table.length===$&&(L(n,o,i,u),u=O(t.height-1,0),i++)}for(u.table.length>0&&(L(n,o,i,u),i++);a0&&(r.lengths=t.lengths.slice()),r}function j(t){return 0===t.height?t.table.length:t.lengths[t.lengths.length-1]}function J(t,r){for(var e=t>>5*r.height;r.lengths[e]<=t;)e++;return e}function D(t,r){return 0===r?{ctor:"_Array",height:0,table:[t]}:{ctor:"_Array",height:r,table:[D(t,r-1)],lengths:[1]}}function F(t,r){return r===t.height?t:{ctor:"_Array",height:r,table:[F(t,r-1)],lengths:[j(t)]}}function U(t,r){return{ctor:"_Array",height:t.height+1,table:[t,r],lengths:[j(t),j(t)+j(r)]}}function z(t){var r=new Array(j(t));return W(r,0,t),r}function W(t,r,e){for(var n=0;n0?i[u-1]:0);return{ctor:"_Array",height:r,table:a,lengths:i}}var $=32,K=2,G={ctor:"_Array",height:0,table:[]};return{empty:G,fromList:c,toList:d,initialize:r(i),append:r(B),push:r(_),slice:e(k),get:r(t),set:e(o),map:r(v),indexedMap:r(g),foldl:e(m),foldr:e(b),length:j,toJSArray:z,fromJSArray:q}}(),h=function(){function t(t,r){return t/r|0}function n(t,r){return t%r}function o(t,r){if(0===r)throw new Error("Cannot perform mod 0. Division by zero error.");var e=t%r,n=0===t?0:r>0?t>=0?e:e+r:-o(-t,-r);return n===r?0:n}function a(t,r){return Math.log(r)/Math.log(t)}function i(t){return-t}function u(t){return t<0?-t:t}function c(t,r){return v.cmp(t,r)<0?t:r}function l(t,r){return v.cmp(t,r)>0?t:r}function f(t,r,e){return v.cmp(e,t)<0?t:v.cmp(e,r)>0?r:e}function _(t,r){return{ctor:y[v.cmp(t,r)+1]}}function s(t,r){return t!==r}function d(t){return!t}function h(t){return t===1/0||t===-1/0}function g(t){return 0|t}function p(t){return t*Math.PI/180}function m(t){return 2*Math.PI*t}function b(t){var r=t._0,e=t._1;return v.Tuple2(r*Math.cos(e),r*Math.sin(e))}function k(t){var r=t._0,e=t._1;return v.Tuple2(Math.sqrt(r*r+e*e),Math.atan2(e,r))}var y=["LT","EQ","GT"];return{div:r(t),rem:r(n),mod:r(o),pi:Math.PI,e:Math.E,cos:Math.cos,sin:Math.sin,tan:Math.tan,acos:Math.acos,asin:Math.asin,atan:Math.atan,atan2:r(Math.atan2),degrees:p,turns:m,fromPolar:b,toPolar:k,sqrt:Math.sqrt,logBase:r(a),negate:i,abs:u,min:r(c),max:r(l),clamp:e(f),compare:r(_),xor:r(s),not:d,truncate:g,ceiling:Math.ceil,floor:Math.floor,round:Math.round,toFloat:function(t){return t},isNaN:isNaN,isInfinite:h}}(),v=function(){function t(t,r){for(var n,o=[],a=e(t,r,0,o);a&&(n=o.pop());)a=e(n.x,n.y,0,o);return a}function e(t,r,n,o){if(n>100)return o.push({x:t,y:r}),!0;if(t===r)return!0;if("object"!=typeof t){if("function"==typeof t)throw new Error('Trying to use `(==)` on functions. There is no way to know if functions are "the same" in the Elm sense. Read more about this at http://package.elm-lang.org/packages/elm-lang/core/latest/Basics#== which describes why it is this way and what the better version will look like.');return!1}if(null===t||null===r)return!1;if(t instanceof Date)return t.getTime()===r.getTime();if(!("ctor"in t)){for(var a in t)if(!e(t[a],r[a],n+1,o))return!1;return!0}if("RBNode_elm_builtin"!==t.ctor&&"RBEmpty_elm_builtin"!==t.ctor||(t=at(t),r=at(r)),"Set_elm_builtin"===t.ctor&&(t=_elm_lang$core$Set$toList(t),r=_elm_lang$core$Set$toList(r)),"::"===t.ctor){for(var i=t,u=r;"::"===i.ctor&&"::"===u.ctor;){if(!e(i._0,u._0,n+1,o))return!1;i=i._1,u=u._1}return i.ctor===u.ctor}if("_Array"===t.ctor){var c=d.toJSArray(t),l=d.toJSArray(r);if(c.length!==l.length)return!1;for(var f=0;f=1){if((a=n(t._0,r._0))!==p)return a;if(i>=2){if((a=n(t._1,r._1))!==p)return a;if(i>=3){if((a=n(t._2,r._2))!==p)return a;if(i>=4){if((a=n(t._3,r._3))!==p)return a;if(i>=5){if((a=n(t._4,r._4))!==p)return a;if(i>=6){if((a=n(t._5,r._5))!==p)return a;if(i>=7)throw new Error("Comparison error: cannot compare tuples with more than 6 elements.")}}}}}}return p}throw new Error("Comparison error: comparison is only defined on ints, floats, times, chars, strings, lists of comparable values, and tuples of comparable values.")}function o(t,r){return{ctor:"_Tuple2",_0:t,_1:r}}function a(t){return new String(t)}function i(t){return k++}function u(t,r){var e={};for(var n in t)e[n]=t[n];for(var n in r)e[n]=r[n];return e}function c(t,r){return{ctor:"::",_0:t,_1:r}}function l(t,r){if("string"==typeof t)return t+r;if("[]"===t.ctor)return r;var e=c(t._0,y),n=e;for(t=t._1;"[]"!==t.ctor;)n._1=c(t._0,y),t=t._1,n=n._1;return n._1=r,e}function f(t,r){return function(e){throw new Error("Ran into a `Debug.crash` in module `"+t+"` "+s(r)+"\nThe message provided by the code author is:\n\n "+e)}}function _(t,r,e){return function(n){throw new Error("Ran into a `Debug.crash` in module `"+t+"`\n\nThis was caused by the `case` expression "+s(r)+".\nOne of the branches ended with a crash and the following value got through:\n\n "+h(e)+"\n\nThe message provided by the code author is:\n\n "+n)}}function s(t){return t.start.line==t.end.line?"on line "+t.start.line:"between lines "+t.start.line+" and "+t.end.line}function h(t){var r=typeof t;if("function"===r)return"";if("boolean"===r)return t?"True":"False";if("number"===r)return t+"";if(t instanceof String)return"'"+v(t,!0)+"'";if("string"===r)return'"'+v(t,!1)+'"';if(null===t)return"null";if("object"===r&&"ctor"in t){var e=t.ctor.substring(0,5);if("_Tupl"===e){var n=[];for(var o in t)"ctor"!==o&&n.push(h(t[o]));return"("+n.join(",")+")"}if("_Task"===e)return"";if("_Array"===t.ctor){return"Array.fromList "+h(F(t))}if(""===t.ctor)return"";if("_Process"===t.ctor)return"";if("::"===t.ctor){var n="["+h(t._0);for(t=t._1;"::"===t.ctor;)n+=","+h(t._0),t=t._1;return n+"]"}if("[]"===t.ctor)return"[]";if("Set_elm_builtin"===t.ctor)return"Set.fromList "+h(_elm_lang$core$Set$toList(t));if("RBNode_elm_builtin"===t.ctor||"RBEmpty_elm_builtin"===t.ctor)return"Dict.fromList "+h(at(t));var n="";for(var a in t)if("ctor"!==a){var i=h(t[a]),u=i[0],c="{"===u||"("===u||"<"===u||'"'===u||i.indexOf(" ")<0;n+=" "+(c?i:"("+i+")")}return t.ctor+n}if("object"===r){if(t instanceof Date)return"<"+t.toString()+">";if(t.elm_web_socket)return"";var n=[];for(var o in t)n.push(o+" = "+h(t[o]));return 0===n.length?"{}":"{ "+n.join(", ")+" }"}return""}function v(t,r){var e=t.replace(/\\/g,"\\\\").replace(/\n/g,"\\n").replace(/\t/g,"\\t").replace(/\r/g,"\\r").replace(/\v/g,"\\v").replace(/\0/g,"\\0");return r?e.replace(/\'/g,"\\'"):e.replace(/\"/g,'\\"')}var g=-1,p=0,m=1,b={ctor:"_Tuple0"},k=0,y={ctor:"[]"};return{eq:t,cmp:n,Tuple0:b,Tuple2:o,chr:a,update:u,guid:i,append:r(l),crash:f,crashCase:_,toString:h}}(),g=(r(function(t,r){var e=r;return l(t,e._0,e._1)}),e(function(t,r,e){return t({ctor:"_Tuple2",_0:r,_1:e})}),e(function(t,r,e){return l(t,e,r)}),r(function(t,r){return t})),p=p||{};p["<|"]=r(function(t,r){return t(r)});var p=p||{};p["|>"]=r(function(t,r){return r(t)});var p=p||{};p[">>"]=e(function(t,r,e){return r(t(e))});var p=p||{};p["<<"]=e(function(t,r,e){return t(r(e))});var p=p||{};p["++"]=v.append;var m=v.toString,p=(h.isInfinite,h.isNaN,h.toFloat,h.ceiling,h.floor,h.truncate,h.round,h.not,h.xor,p||{});p["||"]=h.or;var p=p||{};p["&&"]=h.and;var b=(h.max,h.min,h.compare),p=p||{};p[">="]=h.ge;var p=p||{};p["<="]=h.le;var p=p||{};p[">"]=h.gt;var p=p||{};p["<"]=h.lt;var p=p||{};p["/="]=h.neq;var p=p||{};p["=="]=h.eq;var p=(h.e,h.pi,h.clamp,h.logBase,h.abs,h.negate,h.sqrt,h.atan2,h.atan,h.asin,h.acos,h.tan,h.sin,h.cos,p||{});p["^"]=h.exp;var p=p||{};p["%"]=h.mod;var p=(h.rem,p||{});p["//"]=h.div;var p=p||{};p["/"]=h.floatDiv;var p=p||{};p["*"]=h.mul;var p=p||{};p["-"]=h.sub;var p=p||{};p["+"]=h.add;var k=(h.toPolar,h.fromPolar,h.turns,h.degrees,r(function(t,r){var e=r;return"Just"===e.ctor?e._0:t}),{ctor:"Nothing"}),y=(r(function(t,r){var e=r;return"Just"===e.ctor?t(e._0):k}),function(t){return{ctor:"Just",_0:t}}),w=(r(function(t,r){var e=r;return"Just"===e.ctor?y(t(e._0)):k}),e(function(t,r,e){var n={ctor:"_Tuple2",_0:r,_1:e};return"_Tuple2"===n.ctor&&"Just"===n._0.ctor&&"Just"===n._1.ctor?y(l(t,n._0._0,n._1._0)):k}),n(function(t,r,e,n){var o={ctor:"_Tuple3",_0:r,_1:e,_2:n};return"_Tuple3"===o.ctor&&"Just"===o._0.ctor&&"Just"===o._1.ctor&&"Just"===o._2.ctor?y(f(t,o._0._0,o._1._0,o._2._0)):k}),o(function(t,r,e,n,o){var a={ctor:"_Tuple4",_0:r,_1:e,_2:n,_3:o};return"_Tuple4"===a.ctor&&"Just"===a._0.ctor&&"Just"===a._1.ctor&&"Just"===a._2.ctor&&"Just"===a._3.ctor?y(_(t,a._0._0,a._1._0,a._2._0,a._3._0)):k}),a(function(t,r,e,n,o,a){var i={ctor:"_Tuple5",_0:r,_1:e,_2:n,_3:o,_4:a};return"_Tuple5"===i.ctor&&"Just"===i._0.ctor&&"Just"===i._1.ctor&&"Just"===i._2.ctor&&"Just"===i._3.ctor&&"Just"===i._4.ctor?y(s(t,i._0._0,i._1._0,i._2._0,i._3._0,i._4._0)):k}),function(){function t(t,r){return{ctor:"::",_0:t,_1:r}}function i(r){for(var e=k,n=r.length;n--;)e=t(r[n],e);return e}function u(t){for(var r=[];"[]"!==t.ctor;)r.push(t._0),t=t._1;return r}function c(t,r,e){for(var n=u(e),o=r,a=n.length;a--;)o=l(t,n[a],o);return o}function d(t,r,e){for(var n=[];"[]"!==r.ctor&&"[]"!==e.ctor;)n.push(l(t,r._0,e._0)),r=r._1,e=e._1;return i(n)}function h(t,r,e,n){for(var o=[];"[]"!==r.ctor&&"[]"!==e.ctor&&"[]"!==n.ctor;)o.push(f(t,r._0,e._0,n._0)),r=r._1,e=e._1,n=n._1;return i(o)}function g(t,r,e,n,o){for(var a=[];"[]"!==r.ctor&&"[]"!==e.ctor&&"[]"!==n.ctor&&"[]"!==o.ctor;)a.push(_(t,r._0,e._0,n._0,o._0)),r=r._1,e=e._1,n=n._1,o=o._1;return i(a)}function p(t,r,e,n,o,a){for(var u=[];"[]"!==r.ctor&&"[]"!==e.ctor&&"[]"!==n.ctor&&"[]"!==o.ctor&&"[]"!==a.ctor;)u.push(s(t,r._0,e._0,n._0,o._0,a._0)),r=r._1,e=e._1,n=n._1,o=o._1,a=a._1;return i(u)}function m(t,r){return i(u(r).sort(function(r,e){return v.cmp(t(r),t(e))}))}function b(t,r){return i(u(r).sort(function(r,e){var n=t(r)(e).ctor;return"EQ"===n?0:"LT"===n?-1:1}))}var k={ctor:"[]"};return{Nil:k,Cons:t,cons:r(t),toArray:u,fromArray:i,foldr:e(c),map2:e(d),map3:n(h),map4:o(g),map5:a(p),sortBy:r(m),sortWith:r(b)}}()),T=(w.sortWith,w.sortBy,r(function(t,r){for(;;){if(v.cmp(t,0)<1)return r;var e=r;if("[]"===e.ctor)return r;var n=t-1,o=e._1;t=n,r=o}}),w.map5,w.map4,w.map3,w.map2),B=r(function(t,r){for(;;){var e=r;if("[]"===e.ctor)return!1;if(t(e._0))return!0;var n=t,o=e._1;t=n,r=o}}),N=(r(function(t,r){return!l(B,function(r){return!t(r)},r)}),w.foldr),R=e(function(t,r,e){for(;;){var n=e;if("[]"===n.ctor)return r;var o=t,a=l(t,n._0,r),i=n._1;t=o,r=a,e=i}}),E=function(t){return f(R,r(function(t,r){return r+1}),0,t)},x=(r(function(t,r){return l(B,function(r){return v.eq(r,t)},r)}),x||{});x["::"]=w.cons;var A=r(function(t,e){return f(N,r(function(r,e){return{ctor:"::",_0:t(r),_1:e}}),{ctor:"[]"},e)}),C=(r(function(t,e){var n=r(function(r,e){return t(r)?{ctor:"::",_0:r,_1:e}:e});return f(N,n,{ctor:"[]"},e)}),e(function(t,r,e){var n=t(r);return"Just"===n.ctor?{ctor:"::",_0:n._0,_1:e}:e})),L=(r(function(t,r){return f(N,C(t),{ctor:"[]"},r)}),function(t){return f(R,r(function(t,r){return{ctor:"::",_0:t,_1:r}}),{ctor:"[]"},t)}),O=(e(function(t,e,n){var o=r(function(r,e){var n=e;return"::"===n.ctor?{ctor:"::",_0:l(t,r,n._0),_1:e}:{ctor:"[]"}});return L(f(R,o,{ctor:"::",_0:e,_1:{ctor:"[]"}},n))}),r(function(t,e){return"[]"===e.ctor?t:f(N,r(function(t,r){return{ctor:"::",_0:t,_1:r}}),e,t)})),S=function(t){return f(N,O,{ctor:"[]"},t)},M=(r(function(t,r){return S(l(A,t,r))}),r(function(t,e){var n=r(function(r,e){var n=e,o=n._0,a=n._1;return t(r)?{ctor:"_Tuple2",_0:{ctor:"::",_0:r,_1:o},_1:a}:{ctor:"_Tuple2",_0:o,_1:{ctor:"::",_0:r,_1:a}}});return f(N,n,{ctor:"_Tuple2",_0:{ctor:"[]"},_1:{ctor:"[]"}},e)}),r(function(t,e){var n=e;if("[]"===n.ctor)return{ctor:"[]"};var o=r(function(r,e){return{ctor:"::",_0:t,_1:{ctor:"::",_0:r,_1:e}}}),a=f(N,o,{ctor:"[]"},n._1);return{ctor:"::",_0:n._0,_1:a}}),e(function(t,r,e){for(;;){if(v.cmp(t,0)<1)return e;var n=r;if("[]"===n.ctor)return e;var o=t-1,a=n._1,i={ctor:"::",_0:n._0,_1:e};t=o,r=a,e=i}})),P=r(function(t,r){return L(f(M,t,r,{ctor:"[]"}))}),I=e(function(t,r,e){if(v.cmp(r,0)<1)return{ctor:"[]"};var n={ctor:"_Tuple2",_0:r,_1:e};t:do{r:do{if("_Tuple2"!==n.ctor)break t;if("[]"===n._1.ctor)return e;if("::"!==n._1._1.ctor){if(1===n._0)break r;break t}switch(n._0){case 1:break r;case 2:return{ctor:"::",_0:n._1._0,_1:{ctor:"::",_0:n._1._1._0,_1:{ctor:"[]"}}};case 3:if("::"===n._1._1._1.ctor)return{ctor:"::",_0:n._1._0,_1:{ctor:"::",_0:n._1._1._0,_1:{ctor:"::",_0:n._1._1._1._0,_1:{ctor:"[]"}}}};break t;default:if("::"===n._1._1._1.ctor&&"::"===n._1._1._1._1.ctor){var o=n._1._1._1._0,a=n._1._1._0,i=n._1._0,u=n._1._1._1._1._0,c=n._1._1._1._1._1;return v.cmp(t,1e3)>0?{ctor:"::",_0:i,_1:{ctor:"::",_0:a,_1:{ctor:"::",_0:o,_1:{ctor:"::",_0:u,_1:l(P,r-4,c)}}}}:{ctor:"::",_0:i,_1:{ctor:"::",_0:a,_1:{ctor:"::",_0:o,_1:{ctor:"::",_0:u,_1:f(I,t+1,r-4,c)}}}}}break t}}while(!1);return{ctor:"::",_0:n._1._0,_1:{ctor:"[]"}}}while(!1);return e}),j=(r(function(t,r){return f(I,0,t,r)}),e(function(t,r,e){for(;;){if(v.cmp(r,0)<1)return t;var n={ctor:"::",_0:e,_1:t},o=r-1,a=e;t=n,r=o,e=a}})),J=(r(function(t,r){return f(j,{ctor:"[]"},t,r)}),e(function(t,r,e){for(;;){if(!(v.cmp(t,r)<1))return e;var n=t,o=r-1,a={ctor:"::",_0:r,_1:e};t=n,r=o,e=a}})),D=r(function(t,r){return f(J,t,r,{ctor:"[]"})}),F=(r(function(t,r){return f(T,t,l(D,0,E(r)-1),r)}),d.append,d.length,d.slice,d.set,r(function(t,r){return v.cmp(0,t)<1&&v.cmp(t,d.length(r))<0?y(l(d.get,t,r)):k}),d.push,d.empty,r(function(t,e){var n=r(function(r,e){return t(r)?l(d.push,r,e):e});return f(d.foldl,n,d.empty,e)}),d.foldr,d.foldl,d.indexedMap,d.map,d.toList),U=(d.fromList,d.initialize),z=(r(function(t,r){return l(U,t,g(r))}),function(){return{fromCode:function(t){return v.chr(String.fromCharCode(t))},toCode:function(t){return t.charCodeAt(0)},toUpper:function(t){return v.chr(t.toUpperCase())},toLower:function(t){return v.chr(t.toLowerCase())},toLocaleUpper:function(t){return v.chr(t.toLocaleUpperCase())},toLocaleLower:function(t){return v.chr(t.toLocaleLowerCase())}}}()),W=(z.fromCode,z.toCode),q=(z.toLocaleLower,z.toLocaleUpper,z.toLower,z.toUpper,e(function(t,r,e){var n=W(e);return v.cmp(n,W(t))>-1&&v.cmp(n,W(r))<1})),Q=(l(q,v.chr("A"),v.chr("Z")),l(q,v.chr("a"),v.chr("z")),l(q,v.chr("0"),v.chr("9")),l(q,v.chr("0"),v.chr("7")),function(){function t(t){return{ctor:"_Task_succeed",value:t}}function e(t){return{ctor:"_Task_fail",value:t}}function n(t){return{ctor:"_Task_nativeBinding",callback:t,cancel:null}}function o(t,r){return{ctor:"_Task_andThen",callback:t,task:r}}function a(t,r){return{ctor:"_Task_onError",callback:t,task:r}}function i(t){return{ctor:"_Task_receive",callback:t}}function u(t){var r={ctor:"_Process",id:v.guid(),root:t,stack:null,mailbox:[]};return h(r),r}function c(r){return n(function(e){e(t(u(r)))})}function l(t,r){t.mailbox.push(r),h(t)}function f(r,e){return n(function(n){l(r,e),n(t(v.Tuple0))})}function _(r){return n(function(e){var n=r.root;"_Task_nativeBinding"===n.ctor&&n.cancel&&n.cancel(),r.root=null,e(t(v.Tuple0))})}function s(r){return n(function(e){var n=setTimeout(function(){e(t(v.Tuple0))},r);return function(){clearTimeout(n)}})}function d(t,r){for(;t=0&&a.splice(r,1)}var a=[],i=A[t].converter,u=Q.succeed(null);return A[t].init=u,A[t].onEffects=e(r),{subscribe:n,unsubscribe:o}}function E(t,r){return B(t),A[t]={tag:"sub",subMap:L,converter:r,isForeign:!0},g(t)}function x(t,r){function n(t,r,e){for(var n=o(t,r,e),a=0;a0;)1&t&&(e+=r),t>>=1,r+=r;return e}function m(t,r,e){return e.slice(t,r)}function b(t,r){return t<1?"":r.slice(0,t)}function T(t,r){return t<1?"":r.slice(-t)}function B(t,r){return t<1?r:r.slice(t)}function N(t,r){return t<1?r:r.slice(0,-t)}function R(t,r,e){var n=(t-e.length)/2;return p(Math.ceil(n),r)+e+p(0|n,r)}function E(t,r,e){return e+p(t-e.length,r)}function x(t,r,e){return p(t-e.length,r)+e}function A(t){return t.trim()}function C(t){return t.replace(/^\s+/,"")}function L(t){return t.replace(/\s+$/,"")}function O(t){return w.fromArray(t.trim().split(/\s+/g))}function S(t){return w.fromArray(t.split(/\r\n|\r|\n/g))}function M(t){return t.toUpperCase()}function P(t){return t.toLowerCase()}function I(t,r){for(var e=r.length;e--;)if(t(v.chr(r[e])))return!0;return!1}function j(t,r){for(var e=r.length;e--;)if(!t(v.chr(r[e])))return!1;return!0}function J(t,r){return r.indexOf(t)>-1}function D(t,r){return 0===r.indexOf(t)}function F(t,r){return r.length>=t.length&&r.lastIndexOf(t)===r.length-t.length}function U(t,r){var e=t.length;if(e<1)return w.Nil;for(var n=0,o=[];(n=r.indexOf(t,n))>-1;)o.push(n),n+=e;return w.fromArray(o)}function z(t){var r=t.length;if(0===r)return W(t);var e=t[0];if("0"===e&&"x"===t[1]){for(var n=2;n"9"||e<"0"&&"-"!==e&&"+"!==e)return W(t);for(var n=1;n0?{ctor:"_Tuple2",_0:c,_1:f(o,r,e,u)}:{ctor:"_Tuple2",_0:s,_1:_(n,h,d,e,u)};var g=r,p=e,m={ctor:"_Tuple2",_0:s,_1:f(t,h,d,u)};r=g,e=p,a=m}}),l=f(it,c,{ctor:"_Tuple2",_0:at(a),_1:u},i),s=l._0,d=l._1;return f(R,r(function(r,e){var n=r;return f(t,n._0,n._1,e)}),d,s)}),n(function(t,r,e,n){return rt.crash(nt({ctor:"::",_0:"Internal red-black tree invariant violated, expected ",_1:{ctor:"::",_0:t,_1:{ctor:"::",_0:" and got ",_1:{ctor:"::",_0:m(r),_1:{ctor:"::",_0:"/",_1:{ctor:"::",_0:e,_1:{ctor:"::",_0:"/",_1:{ctor:"::",_0:n,_1:{ctor:"::",_0:"\nPlease report this bug to ",_1:{ctor:"[]"}}}}}}}}}}))})),ct=function(t){var r=t;t:do{if("RBNode_elm_builtin"===r.ctor){if("BBlack"===r._0.ctor)return!0;break t}if("LBBlack"===r._0.ctor)return!0;break t}while(!1);return!1},lt=r(function(t,r){for(;;){var e=r;if("RBEmpty_elm_builtin"===e.ctor)return t;var n=l(lt,t+1,e._4),o=e._3;t=n,r=o}}),ft=r(function(t,r){t:for(;;){var e=r;if("RBEmpty_elm_builtin"===e.ctor)return k;var n=l(b,t,e._1);switch(n.ctor){case"LT":var o=t,a=e._3;t=o,r=a;continue t;case"EQ":return y(e._2);default:var i=t,u=e._4;t=i,r=u;continue t}}}),_t=r(function(t,r){return"Just"===l(ft,t,r).ctor}),st=e(function(t,r,e){for(;;){var n=e;if("RBEmpty_elm_builtin"===n.ctor)return{ctor:"_Tuple2",_0:t,_1:r};var o=n._1,a=n._2,i=n._4;t=o,r=a,e=i}}),dt={ctor:"NBlack"},ht={ctor:"BBlack"},vt={ctor:"Black"},gt=function(t){var r=t;if("RBNode_elm_builtin"===r.ctor){var e=r._0;return v.eq(e,vt)||v.eq(e,ht)}return!0},pt={ctor:"Red"},mt=function(t){switch(t.ctor){case"Black":return ht;case"Red":return vt;case"NBlack":return pt;default:return rt.crash("Can't make a double black node more black!")}},bt=function(t){switch(t.ctor){case"BBlack":return vt;case"Black":return pt;case"Red":return dt;default:return rt.crash("Can't make a negative black node less black!")}},kt={ctor:"LBBlack"},yt={ctor:"LBlack"},wt=function(t){return{ctor:"RBEmpty_elm_builtin",_0:t}},Tt=wt(yt),Bt=o(function(t,r,e,n,o){return{ctor:"RBNode_elm_builtin",_0:t,_1:r,_2:e,_3:n,_4:o}}),Nt=function(t){var r=t;return"RBNode_elm_builtin"===r.ctor&&"Red"===r._0.ctor?s(Bt,vt,r._1,r._2,r._3,r._4):t},Rt=function(t){var r=t;return"RBNode_elm_builtin"===r.ctor?s(Bt,bt(r._0),r._1,r._2,r._3,r._4):wt(yt)},Et=function(t){return function(r){return function(e){return function(n){return function(o){return function(a){return function(i){return function(u){return function(c){return function(l){return function(f){return s(Bt,bt(t),n,o,s(Bt,vt,r,e,u,c),s(Bt,vt,a,i,l,f))}}}}}}}}}}},xt=function(t){var r=t;return"RBEmpty_elm_builtin"===r.ctor?wt(yt):s(Bt,vt,r._1,r._2,r._3,r._4)},At=function(t){var r=t;return"RBEmpty_elm_builtin"===r.ctor?rt.crash("can't make a Leaf red"):s(Bt,pt,r._1,r._2,r._3,r._4)},Ct=function(t){var r=t;t:do{r:do{e:do{n:do{o:do{a:do{i:do{if("RBNode_elm_builtin"!==r.ctor)break t;if("RBNode_elm_builtin"===r._3.ctor)if("RBNode_elm_builtin"===r._4.ctor)switch(r._3._0.ctor){case"Red":switch(r._4._0.ctor){case"Red":if("RBNode_elm_builtin"===r._3._3.ctor&&"Red"===r._3._3._0.ctor)break i;if("RBNode_elm_builtin"===r._3._4.ctor&&"Red"===r._3._4._0.ctor)break a;if("RBNode_elm_builtin"===r._4._3.ctor&&"Red"===r._4._3._0.ctor)break o;if("RBNode_elm_builtin"===r._4._4.ctor&&"Red"===r._4._4._0.ctor)break n;break t;case"NBlack":if("RBNode_elm_builtin"===r._3._3.ctor&&"Red"===r._3._3._0.ctor)break i;if("RBNode_elm_builtin"===r._3._4.ctor&&"Red"===r._3._4._0.ctor)break a;if("BBlack"===r._0.ctor&&"RBNode_elm_builtin"===r._4._3.ctor&&"Black"===r._4._3._0.ctor&&"RBNode_elm_builtin"===r._4._4.ctor&&"Black"===r._4._4._0.ctor)break e;break t;default:if("RBNode_elm_builtin"===r._3._3.ctor&&"Red"===r._3._3._0.ctor)break i;if("RBNode_elm_builtin"===r._3._4.ctor&&"Red"===r._3._4._0.ctor)break a;break t}case"NBlack":switch(r._4._0.ctor){case"Red":if("RBNode_elm_builtin"===r._4._3.ctor&&"Red"===r._4._3._0.ctor)break o;if("RBNode_elm_builtin"===r._4._4.ctor&&"Red"===r._4._4._0.ctor)break n;if("BBlack"===r._0.ctor&&"RBNode_elm_builtin"===r._3._3.ctor&&"Black"===r._3._3._0.ctor&&"RBNode_elm_builtin"===r._3._4.ctor&&"Black"===r._3._4._0.ctor)break r;break t;case"NBlack":if("BBlack"===r._0.ctor){if("RBNode_elm_builtin"===r._4._3.ctor&&"Black"===r._4._3._0.ctor&&"RBNode_elm_builtin"===r._4._4.ctor&&"Black"===r._4._4._0.ctor)break e;if("RBNode_elm_builtin"===r._3._3.ctor&&"Black"===r._3._3._0.ctor&&"RBNode_elm_builtin"===r._3._4.ctor&&"Black"===r._3._4._0.ctor)break r;break t}break t;default:if("BBlack"===r._0.ctor&&"RBNode_elm_builtin"===r._3._3.ctor&&"Black"===r._3._3._0.ctor&&"RBNode_elm_builtin"===r._3._4.ctor&&"Black"===r._3._4._0.ctor)break r;break t}default:switch(r._4._0.ctor){case"Red":if("RBNode_elm_builtin"===r._4._3.ctor&&"Red"===r._4._3._0.ctor)break o;if("RBNode_elm_builtin"===r._4._4.ctor&&"Red"===r._4._4._0.ctor)break n;break t;case"NBlack":if("BBlack"===r._0.ctor&&"RBNode_elm_builtin"===r._4._3.ctor&&"Black"===r._4._3._0.ctor&&"RBNode_elm_builtin"===r._4._4.ctor&&"Black"===r._4._4._0.ctor)break e;break t;default:break t}}else switch(r._3._0.ctor){case"Red":if("RBNode_elm_builtin"===r._3._3.ctor&&"Red"===r._3._3._0.ctor)break i;if("RBNode_elm_builtin"===r._3._4.ctor&&"Red"===r._3._4._0.ctor)break a;break t;case"NBlack":if("BBlack"===r._0.ctor&&"RBNode_elm_builtin"===r._3._3.ctor&&"Black"===r._3._3._0.ctor&&"RBNode_elm_builtin"===r._3._4.ctor&&"Black"===r._3._4._0.ctor)break r;break t;default:break t}else{if("RBNode_elm_builtin"!==r._4.ctor)break t;switch(r._4._0.ctor){case"Red":if("RBNode_elm_builtin"===r._4._3.ctor&&"Red"===r._4._3._0.ctor)break o;if("RBNode_elm_builtin"===r._4._4.ctor&&"Red"===r._4._4._0.ctor)break n;break t;case"NBlack":if("BBlack"===r._0.ctor&&"RBNode_elm_builtin"===r._4._3.ctor&&"Black"===r._4._3._0.ctor&&"RBNode_elm_builtin"===r._4._4.ctor&&"Black"===r._4._4._0.ctor)break e;break t;default:break t}}}while(!1);return Et(r._0)(r._3._3._1)(r._3._3._2)(r._3._1)(r._3._2)(r._1)(r._2)(r._3._3._3)(r._3._3._4)(r._3._4)(r._4)}while(!1);return Et(r._0)(r._3._1)(r._3._2)(r._3._4._1)(r._3._4._2)(r._1)(r._2)(r._3._3)(r._3._4._3)(r._3._4._4)(r._4)}while(!1);return Et(r._0)(r._1)(r._2)(r._4._3._1)(r._4._3._2)(r._4._1)(r._4._2)(r._3)(r._4._3._3)(r._4._3._4)(r._4._4)}while(!1);return Et(r._0)(r._1)(r._2)(r._4._1)(r._4._2)(r._4._4._1)(r._4._4._2)(r._3)(r._4._3)(r._4._4._3)(r._4._4._4)}while(!1);return s(Bt,vt,r._4._3._1,r._4._3._2,s(Bt,vt,r._1,r._2,r._3,r._4._3._3),s(Lt,vt,r._4._1,r._4._2,r._4._3._4,At(r._4._4)))}while(!1);return s(Bt,vt,r._3._4._1,r._3._4._2,s(Lt,vt,r._3._1,r._3._2,At(r._3._3),r._3._4._3),s(Bt,vt,r._1,r._2,r._3._4._4,r._4))}while(!1);return t},Lt=o(function(t,r,e,n,o){var a=s(Bt,t,r,e,n,o);return gt(a)?Ct(a):a}),Ot=o(function(t,r,e,n,o){return ct(n)||ct(o)?s(Lt,mt(t),r,e,Rt(n),Rt(o)):s(Bt,t,r,e,n,o)}),St=o(function(t,r,e,n,o){var a=o;return"RBEmpty_elm_builtin"===a.ctor?f(Mt,t,n,o):s(Ot,t,r,e,n,s(St,a._0,a._1,a._2,a._3,a._4))}),Mt=e(function(t,r,e){var n={ctor:"_Tuple2",_0:r,_1:e};if("RBEmpty_elm_builtin"!==n._0.ctor){if("RBEmpty_elm_builtin"===n._1.ctor){var o=n._1._0,a=n._0._0,i={ctor:"_Tuple3",_0:t,_1:a,_2:o};return"_Tuple3"===i.ctor&&"Black"===i._0.ctor&&"Red"===i._1.ctor&&"LBlack"===i._2.ctor?s(Bt,vt,n._0._1,n._0._2,n._0._3,n._0._4):_(ut,"Black/Red/LBlack",t,m(a),m(o))}var u=n._0._2,c=n._0._4,l=n._0._1,d=s(St,n._0._0,l,u,n._0._3,c),h=f(st,l,u,c),v=h._0,g=h._1;return s(Ot,t,v,g,d,e)}if("RBEmpty_elm_builtin"!==n._1.ctor){var p=n._1._0,b=n._0._0,k={ctor:"_Tuple3",_0:t,_1:b,_2:p};return"_Tuple3"===k.ctor&&"Black"===k._0.ctor&&"LBlack"===k._1.ctor&&"Red"===k._2.ctor?s(Bt,vt,n._1._1,n._1._2,n._1._3,n._1._4):_(ut,"Black/LBlack/Red",t,m(b),m(p))}switch(t.ctor){case"Red":return wt(yt);case"Black":return wt(kt);default:return rt.crash("cannot have bblack or nblack nodes at this point")}}),Pt=r(function(t,r){var e=r;if("RBEmpty_elm_builtin"===e.ctor)return wt(yt);var n=e._1;return s(Bt,e._0,n,l(t,n,e._2),l(Pt,t,e._3),l(Pt,t,e._4))}),It={ctor:"Same"},jt={ctor:"Remove"},Jt={ctor:"Insert"},Dt=e(function(t,r,e){var n=function(e){var o=e;if("RBEmpty_elm_builtin"===o.ctor){var a=r(k);return"Nothing"===a.ctor?{ctor:"_Tuple2",_0:It,_1:Tt}:{ctor:"_Tuple2",_0:Jt,_1:s(Bt,pt,t,a._0,Tt,Tt)}}var i=o._2,u=o._4,c=o._3,_=o._1,d=o._0;switch(l(b,t,_).ctor){case"EQ":var h=r(y(i));return"Nothing"===h.ctor?{ctor:"_Tuple2",_0:jt,_1:f(Mt,d,c,u)}:{ctor:"_Tuple2",_0:It,_1:s(Bt,d,_,h._0,c,u)};case"LT":var v=n(c),g=v._0,p=v._1;switch(g.ctor){case"Same":return{ctor:"_Tuple2",_0:It,_1:s(Bt,d,_,i,p,u)};case"Insert":return{ctor:"_Tuple2",_0:Jt,_1:s(Lt,d,_,i,p,u)};default:return{ctor:"_Tuple2",_0:jt,_1:s(Ot,d,_,i,p,u)}}default:var m=n(u),g=m._0,w=m._1;switch(g.ctor){case"Same":return{ctor:"_Tuple2",_0:It,_1:s(Bt,d,_,i,c,w)};case"Insert":return{ctor:"_Tuple2",_0:Jt,_1:s(Lt,d,_,i,c,w)};default:return{ctor:"_Tuple2",_0:jt,_1:s(Ot,d,_,i,c,w)}}}},o=n(e),a=o._0,i=o._1;switch(a.ctor){case"Same":return i;case"Insert":return Nt(i);default:return xt(i)}}),Ft=e(function(t,r,e){return f(Dt,t,g(y(r)),e)}),Ut=(r(function(t,r){return f(Ft,t,r,Tt)}),r(function(t,r){return f(it,Ft,r,t)}),r(function(t,r){var n=e(function(r,e,n){return l(t,r,e)?f(Ft,r,e,n):n});return f(it,n,Tt,r)})),zt=(r(function(t,e){return l(Ut,r(function(t,r){return l(_t,t,e)}),t)}),r(function(t,r){var n=e(function(r,e,n){var o=n,a=o._1,i=o._0;return l(t,r,e)?{ctor:"_Tuple2",_0:f(Ft,r,e,i),_1:a}:{ctor:"_Tuple2",_0:i,_1:f(Ft,r,e,a)}});return f(it,n,{ctor:"_Tuple2",_0:Tt,_1:Tt},r)}),r(function(t,r){return f(Dt,t,g(k),r)})),Wt=(r(function(t,r){return f(it,e(function(t,r,e){return l(zt,t,e)}),t,r)}),rt.crash,rt.log,function(){function t(t){return{ctor:"",tag:"succeed",msg:t}}function l(t){return{ctor:"",tag:"fail",msg:t}}function f(t){return{ctor:"",tag:t}}function _(t,r){return{ctor:"",tag:t,decoder:r}}function s(t){return{ctor:"",tag:"null",value:t}}function h(t,r){return{ctor:"",tag:"field",field:t,decoder:r}}function g(t,r){return{ctor:"",tag:"index",index:t,decoder:r}}function p(t){return{ctor:"",tag:"key-value",decoder:t}}function m(t,r){return{ctor:"",tag:"map-many",func:t,decoders:r}}function b(t,r){return{ctor:"",tag:"andThen",decoder:r,callback:t}}function T(t){return{ctor:"",tag:"oneOf",decoders:t}}function B(t,r){return m(t,[r])}function N(t,r,e){return m(t,[r,e])}function R(t,r,e,n){return m(t,[r,e,n])}function E(t,r,e,n,o){return m(t,[r,e,n,o])}function x(t,r,e,n,o,a){return m(t,[r,e,n,o,a])}function A(t,r,e,n,o,a,i){return m(t,[r,e,n,o,a,i])}function C(t,r,e,n,o,a,i,u){return m(t,[r,e,n,o,a,i,u])}function L(t,r,e,n,o,a,i,u,c){return m(t,[r,e,n,o,a,i,u,c])}function O(t){return{tag:"ok",value:t}}function S(t,r){return{tag:"primitive",type:t,value:r}}function M(t,r){return{tag:"index",index:t,rest:r}}function P(t,r){return{tag:"field",field:t,rest:r}}function M(t,r){return{tag:"index",index:t,rest:r}}function I(t){return{tag:"oneOf",problems:t}}function j(t){return{tag:"fail",msg:t}}function J(t){for(var r="_";t;)switch(t.tag){case"primitive":return"Expecting "+t.type+("_"===r?"":" at "+r)+" but instead got: "+D(t.value);case"index":r+="["+t.index+"]",t=t.rest;break;case"field":r+="."+t.field,t=t.rest;break;case"oneOf":for(var e=t.problems,n=0;n=r.length)return S("a longer array. Need index "+c+" but there are only "+r.length+" entries",r);var o=z(t.decoder,r[c]);return"ok"===o.tag?o:M(c,o);case"key-value":if("object"!=typeof r||null===r||r instanceof Array)return S("an object",r);var l=w.Nil;for(var f in r){var o=z(t.decoder,r[f]);if("ok"!==o.tag)return P(f,o);var _=v.Tuple2(f,o.value);l=w.Cons(_,l)}return O(l);case"map-many":for(var s=t.func,h=t.decoders,n=0;n0&&e.push(O("p-thunk",n,f)));case"tagger":for(var _=t.tagger,s=r.tagger,d=!1,h=t.node;"tagger"===h.type;)d=!0,"object"!=typeof _?_=[_,h.tagger]:_.push(h.tagger),h=h.node;for(var v=r.node;"tagger"===v.type;)d=!0,"object"!=typeof s?s=[s,v.tagger]:s.push(v.tagger),v=v.node;return d&&_.length!==s.length?void e.push(O("p-redraw",n,r)):((d?M(_,s):_===s)||e.push(O("p-tagger",n,s)),void S(h,v,e,n+1));case"text":if(t.text!==r.text)return void e.push(O("p-text",n,r.text));return;case"node":if(t.tag!==r.tag||t.namespace!==r.namespace)return void e.push(O("p-redraw",n,r));var g=P(t.facts,r.facts);return void 0!==g&&e.push(O("p-facts",n,g)),void I(t,r,e,n);case"keyed-node":if(t.tag!==r.tag||t.namespace!==r.namespace)return void e.push(O("p-redraw",n,r));var g=P(t.facts,r.facts);return void 0!==g&&e.push(O("p-facts",n,g)),void j(t,r,e,n);case"custom":if(t.impl!==r.impl)return void e.push(O("p-redraw",n,r));var g=P(t.facts,r.facts);void 0!==g&&e.push(O("p-facts",n,g));var p=r.impl.diff(t,r);if(p)return void e.push(O("p-custom",n,p));return}}}function M(t,r){for(var e=0;eu?e.push(O("p-remove-last",n,i-u)):i0||i.length>0||void 0!==C)&&e.push(O("p-reorder",n,{patches:o,inserts:i,endInserts:C}))}function J(t,r,e,n,o,a){var i=t[e];if(void 0===i)return i={tag:"insert",vnode:n,index:o,data:void 0},a.push({index:o,entry:i}),void(t[e]=i);if("remove"===i.tag){a.push({index:o,entry:i}),i.tag="move";var u=[];return S(i.vnode,n,u,i.index),i.index=o,void(i.data.data={patches:u,entry:i})}J(t,r,e+yt,n,o,a)}function D(t,r,e,n,o){var a=t[e];if(void 0===a){var i=O("p-remove",o,void 0);return r.push(i),void(t[e]={tag:"remove",vnode:n,index:o,data:i})}if("insert"===a.tag){a.tag="move";var u=[];S(n,a.vnode,u,o);var i=O("p-remove",o,{patches:u,entry:a});return void r.push(i)}D(t,r,e+yt,n,o)}function F(t,r,e,n){U(t,r,e,0,0,r.descendantsCount,n)}function U(t,r,e,n,o,a,i){for(var u=e[n],c=u.index;c===o;){var l=u.type;if("p-thunk"===l)F(t,r.node,u.data,i);else if("p-reorder"===l){u.domNode=t,u.eventNode=i;var f=u.data.patches;f.length>0&&U(t,r,f,0,o,a,i)}else if("p-remove"===l){u.domNode=t,u.eventNode=i;var _=u.data;if(void 0!==_){_.entry.data=t;var f=_.patches;f.length>0&&U(t,r,f,0,o,a,i)}}else u.domNode=t,u.eventNode=i;if(n++,!(u=e[n])||(c=u.index)>a)return n}switch(r.type){case"tagger":for(var s=r.node;"tagger"===s.type;)s=s.node;return U(t,s,e,n,o+1,a,t.elm_event_node_ref);case"node":for(var d=r.children,h=t.childNodes,v=0;va))return n;o=p}return n;case"keyed-node":for(var d=r.children,h=t.childNodes,v=0;va))return n;o=p}return n;case"text":case"thunk":throw new Error("should never traverse `text` or `thunk` nodes like this")}}function z(t,r,e,n){return 0===e.length?t:(F(t,r,e,n),W(t,e))}function W(t,r){for(var e=0;e"),new Error(t)}function ot(t,r,e,n){r.embed=function(r,e){for(;r.lastChild;)r.removeChild(r.lastChild);return $.initialize(n(t.init,e,r),t.update,t.subscriptions,at(r,t.view))},r.fullscreen=function(r){return $.initialize(n(t.init,r,document.body),t.update,t.subscriptions,at(document.body,t.view))}}function at(t,r){return function(e,n){var o={tagger:e,parent:void 0},a=r(n),i=B(a,o);return t.appendChild(i),it(i,r,a,o)}}function it(t,r,e,n){function o(){switch(i){case"NO_REQUEST":throw new Error("Unexpected draw callback.\nPlease report this to .");case"PENDING_REQUEST":Bt(o),i="EXTRA_REQUEST";var e=r(a),c=L(u,e);return t=z(t,u,c,n),void(u=e);case"EXTRA_REQUEST":return void(i="NO_REQUEST")}}var a,i="NO_REQUEST",u=e;return function(t){"NO_REQUEST"===i&&Bt(o),i="PENDING_REQUEST",a=t}}function ut(t,r,e,n){r.fullscreen=function(r){var o={doc:void 0};return $.initialize(n(t.init,r,document.body),t.update(ct(o)),t.subscriptions,lt(e,document.body,o,t.view,t.viewIn,t.viewOut))},r.embed=function(r,o){var a={doc:void 0};return $.initialize(n(t.init,o,r),t.update(ct(a)),t.subscriptions,lt(e,r,a,t.view,t.viewIn,t.viewOut))}}function ct(t){return Q.nativeBinding(function(r){var e=t.doc;if(e){var n=e.getElementsByClassName("debugger-sidebar-messages")[0];n&&(n.scrollTop=n.scrollHeight)}r(Q.succeed(v.Tuple0))})}function lt(t,r,e,n,o,a){return function(i,u){var c={tagger:i,parent:void 0},l={tagger:i,parent:void 0},f=n(u),_=B(f,c);r.appendChild(_);var s=it(_,n,f,c),d=o(u)._1,h=B(d,l);r.appendChild(h);var v=st(c,h,o),g=it(h,v,d,l),p=ft(u,a,l,r,t,e);return function(t){s(t),g(t),p(t)}}}function ft(t,r,e,n,o,a){var i,u;return function(t){if(t.isDebuggerOpen){if(!a.doc)return i=r(t),void(u=_t(o,a,i,e));kt=a.doc;var n=r(t),c=L(i,n);u=z(u,i,c,e),i=n,kt=document}}}function _t(t,r,e,n){function o(){r.doc=void 0,u.close()}var a=screen.width-900,i=screen.height-360,u=window.open("","","width=900,height=360,left="+a+",top="+i);kt=u.document,r.doc=kt,kt.title="Debugger - "+t,kt.body.style.margin="0",kt.body.style.padding="0";var c=B(e,n);return kt.body.appendChild(c),kt.addEventListener("keydown",function(t){t.metaKey&&82===t.which&&window.location.reload(),38===t.which&&(n.tagger({ctor:"Up"}),t.preventDefault()),40===t.which&&(n.tagger({ctor:"Down"}),t.preventDefault())}),window.addEventListener("unload",o),u.addEventListener("unload",function(){r.doc=void 0,window.removeEventListener("unload",o),n.tagger({ctor:"Close"})}),kt=document,c}function st(t,r,e){var n,o=vt(r),a="Normal",i=t.tagger,u=function(){};return function(r){var c=e(r),l=c._0.ctor;return t.tagger="Normal"===l?i:u,a!==l&&(dt("removeEventListener",o,a),dt("addEventListener",o,l),"Normal"===a&&(n=document.body.style.overflow,document.body.style.overflow="hidden"),"Normal"===l&&(document.body.style.overflow=n),a=l),c._1}}function dt(t,r,e){switch(e){case"Normal":return;case"Pause":return ht(t,r,Nt);case"Message":return ht(t,r,Rt)}}function ht(t,r,e){for(var n=0;n -Main \ No newline at end of file diff --git a/public/.DS_Store b/public/.DS_Store new file mode 100644 index 0000000..5008ddf Binary files /dev/null and b/public/.DS_Store differ diff --git a/public/favicon.ico b/public/favicon.ico new file mode 100644 index 0000000..d7057bd Binary files /dev/null and b/public/favicon.ico differ diff --git a/public/index.html b/public/index.html new file mode 100644 index 0000000..40cb71b --- /dev/null +++ b/public/index.html @@ -0,0 +1,22 @@ + + + + + + + + + + + Elm App + + + +
+ + diff --git a/public/manifest.json b/public/manifest.json new file mode 100644 index 0000000..9b7dc41 --- /dev/null +++ b/public/manifest.json @@ -0,0 +1,15 @@ +{ + "short_name": "Elm App", + "name": "Create Elm App Sample", + "icons": [ + { + "src": "favicon.ico", + "sizes": "192x192", + "type": "image/png" + } + ], + "start_url": "./index.html", + "display": "standalone", + "theme_color": "#000000", + "background_color": "#ffffff" +} diff --git a/public/place.png b/public/place.png new file mode 100644 index 0000000..af29809 Binary files /dev/null and b/public/place.png differ diff --git a/src/Main.elm b/src/Main.elm new file mode 100644 index 0000000..ea29322 --- /dev/null +++ b/src/Main.elm @@ -0,0 +1,59 @@ +module Main exposing (..) + +import Html exposing (Html, text, div, h1, h2, p, img) +import Html.Attributes exposing (src) + + +---- MODEL ---- + + +type alias Model = + {} + + +init : ( Model, Cmd Msg ) +init = + ( {}, Cmd.none ) + + + +---- UPDATE ---- + + +type Msg + = NoOp + + +update : Msg -> Model -> ( Model, Cmd Msg ) +update msg model = + ( model, Cmd.none ) + + + +---- VIEW ---- + + +view : Model -> Html Msg +view model = + div [] + [ img [ src "/place.png" ] [] + , h1 [] [ text "Prefer on Elm!" ] + , h2 [] [ text "This is the FTV" ] + , p [] [ text "*Flip Trough Movies (v1.0.0)" ] + + --, p [] [ text "- Currently just an image - but the imdb-api should be installed(.. ?), maybe" ] + ] + + + +---- PROGRAM ---- + + +main : Program Never Model Msg +main = + Html.program + { view = view + , init = init + , update = update + , subscriptions = always Sub.none + } diff --git a/main.js b/src/imdb.js similarity index 70% rename from main.js rename to src/imdb.js index f99bbad..e9758c6 100644 --- a/main.js +++ b/src/imdb.js @@ -1,10 +1,3 @@ - -// getTV stack groupPreference = - -// getTV call perspective = - -// groupPreference group overlay getTV = - const imdb = require('imdb-api'); diff --git a/src/index.js b/src/index.js new file mode 100644 index 0000000..3f79cf9 --- /dev/null +++ b/src/index.js @@ -0,0 +1,7 @@ +import './main.css'; +import { Main } from './Main.elm'; +import registerServiceWorker from './registerServiceWorker'; + +Main.embed(document.getElementById('root')); + +registerServiceWorker(); diff --git a/src/main.css b/src/main.css new file mode 100644 index 0000000..8613a5c --- /dev/null +++ b/src/main.css @@ -0,0 +1,17 @@ +body { + font-family: monospace; + margin: 0; + text-align: center; + color: #293c4b; +} + +h1 { + font-size: 30px; +} + +img { + margin-top: 20px; + max-width: 100%; + position: relative; +} + diff --git a/src/registerServiceWorker.js b/src/registerServiceWorker.js new file mode 100644 index 0000000..4a3ccf0 --- /dev/null +++ b/src/registerServiceWorker.js @@ -0,0 +1,108 @@ +// In production, we register a service worker to serve assets from local cache. + +// This lets the app load faster on subsequent visits in production, and gives +// it offline capabilities. However, it also means that developers (and users) +// will only see deployed updates on the "N+1" visit to a page, since previously +// cached resources are updated in the background. + +// To learn more about the benefits of this model, read https://goo.gl/KwvDNy. +// This link also includes instructions on opting out of this behavior. + +const isLocalhost = Boolean( + window.location.hostname === 'localhost' || + // [::1] is the IPv6 localhost address. + window.location.hostname === '[::1]' || + // 127.0.0.1/8 is considered localhost for IPv4. + window.location.hostname.match( + /^127(?:\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}$/ + ) +); + +export default function register() { + if (process.env.NODE_ENV === 'production' && 'serviceWorker' in navigator) { + // The URL constructor is available in all browsers that support SW. + const publicUrl = new URL(process.env.PUBLIC_URL, window.location); + if (publicUrl.origin !== window.location.origin) { + // Our service worker won't work if PUBLIC_URL is on a different origin + // from what our page is served on. This might happen if a CDN is used to + // serve assets; see https://github.com/facebookincubator/create-react-app/issues/2374 + return; + } + + window.addEventListener('load', () => { + const swUrl = `${process.env.PUBLIC_URL}/service-worker.js`; + + if (!isLocalhost) { + // Is not local host. Just register service worker + registerValidSW(swUrl); + } else { + // This is running on localhost. Lets check if a service worker still exists or not. + checkValidServiceWorker(swUrl); + } + }); + } +} + +function registerValidSW(swUrl) { + navigator.serviceWorker + .register(swUrl) + .then(registration => { + registration.onupdatefound = () => { + const installingWorker = registration.installing; + installingWorker.onstatechange = () => { + if (installingWorker.state === 'installed') { + if (navigator.serviceWorker.controller) { + // At this point, the old content will have been purged and + // the fresh content will have been added to the cache. + // It's the perfect time to display a "New content is + // available; please refresh." message in your web app. + console.log('New content is available; please refresh.'); + } else { + // At this point, everything has been precached. + // It's the perfect time to display a + // "Content is cached for offline use." message. + console.log('Content is cached for offline use.'); + } + } + }; + }; + }) + .catch(error => { + console.error('Error during service worker registration:', error); + }); +} + +function checkValidServiceWorker(swUrl) { + // Check if the service worker can be found. If it can't reload the page. + fetch(swUrl) + .then(response => { + // Ensure service worker exists, and that we really are getting a JS file. + if ( + response.status === 404 || + response.headers.get('content-type').indexOf('javascript') === -1 + ) { + // No service worker found. Probably a different app. Reload the page. + navigator.serviceWorker.ready.then(registration => { + registration.unregister().then(() => { + window.location.reload(); + }); + }); + } else { + // Service worker found. Proceed as normal. + registerValidSW(swUrl); + } + }) + .catch(() => { + console.log( + 'No internet connection found. App is running in offline mode.' + ); + }); +} + +export function unregister() { + if ('serviceWorker' in navigator) { + navigator.serviceWorker.ready.then(registration => { + registration.unregister(); + }); + } +} diff --git a/tests/Tests.elm b/tests/Tests.elm new file mode 100644 index 0000000..c98b1dd --- /dev/null +++ b/tests/Tests.elm @@ -0,0 +1,22 @@ +module Tests exposing (..) + +import Test exposing (..) +import Expect + + +-- Check out http://package.elm-lang.org/packages/elm-community/elm-test/latest to learn more about testing in Elm! + + +all : Test +all = + describe "A Test Suite" + [ test "Addition" <| + \_ -> + Expect.equal 10 (3 + 7) + , test "String.left" <| + \_ -> + Expect.equal "a" (String.left 1 "abcdefg") + , test "This test should fail" <| + \_ -> + Expect.fail "failed as expected!" + ] diff --git a/tests/elm-package.json b/tests/elm-package.json new file mode 100644 index 0000000..1e47e76 --- /dev/null +++ b/tests/elm-package.json @@ -0,0 +1,17 @@ +{ + "version": "1.0.0", + "summary": "Test Suites", + "repository": "https://github.com/user/project.git", + "license": "BSD3", + "source-directories": [ + ".", + "../src" + ], + "exposed-modules": [], + "dependencies": { + "elm-lang/core": "5.0.0 <= v < 6.0.0", + "elm-community/elm-test": "4.0.0 <= v < 5.0.0", + "elm-lang/html": "2.0.0 <= v < 3.0.0" + }, + "elm-version": "0.18.0 <= v < 0.19.0" +}