From a1800ca2b3d37f1ddfed51d1407fd6568eb1ff64 Mon Sep 17 00:00:00 2001 From: Ludwig Schubert Date: Fri, 4 Aug 2017 16:53:52 -0700 Subject: [PATCH] Design changes --- .eslintrc.json | 4 +- README.md | 19 + bin/render | 20 +- dist/components.js | 16380 +++++++++++++++- dist/components.js.map | 2 +- dist/template.js | 140 - dist/template.js.map | 1 - dist/transforms.js | 4577 +++++ dist/transforms.js.map | 1 + dist/webcomponents-lite.js | 191 + dist/webcomponents-lite.js.map | 1 + examples/article-test.html | 232 + examples/article.html | 28 +- package.json | 6 +- rollup.config.components.js | 38 - rollup.config.js | 46 + rollup.config.transforms.js | 39 - .../distill-favicon.base64 | 0 .../distill-favicon.png | Bin .../distill-favicon.svg | 0 src/{transforms => assets}/distill-logo.svg | 0 src/components.js | 3 +- src/components/d-abstract.js | 6 +- src/components/d-appendix.js | 15 +- src/components/d-article.js | 24 +- src/components/d-bibliography.js | 79 +- src/components/d-byline.js | 20 +- src/components/d-cite.js | 19 +- src/components/d-footnote.js | 6 +- src/components/d-front-matter.js | 26 +- src/components/d-references.js | 4 - src/components/d-title.js | 38 +- src/controller.js | 12 +- src/distill-components/distill-appendix.js | 12 +- src/distill-components/distill-footer.js | 53 + src/distill-components/distill-header.js | 57 +- src/distill-transforms/distill-appendix.js | 14 + src/distill-transforms/distill-footer.js | 8 + src/distill-transforms/distill-header.js | 8 + src/extractors/bibliography.js | 10 + src/extractors/citations.js | 5 + src/extractors/front-matter.js | 11 + src/front-matter.js | 39 +- src/helpers/bibtex.js | 33 + src/helpers/hover-box.js | 178 +- src/helpers/layout.js | 67 +- src/mixins/template.js | 15 +- src/styles/styles-article.css | 19 +- src/styles/styles-base.css | 51 +- src/styles/styles-layout.css | 245 +- src/styles/styles-print.css | 12 +- src/transforms.js | 53 + src/transforms/appendix.js | 89 - src/transforms/bibliography.js | 65 +- src/transforms/footer.js | 52 - src/transforms/header.js | 92 - src/transforms/html.js | 13 +- src/transforms/meta.js | 3 +- src/transforms/polyfills.js | 31 + src/transforms/typeset.js | 14 +- yarn.lock | 64 +- 61 files changed, 22197 insertions(+), 1093 deletions(-) delete mode 100644 dist/template.js delete mode 100644 dist/template.js.map create mode 100644 dist/transforms.js create mode 100644 dist/transforms.js.map create mode 100644 dist/webcomponents-lite.js create mode 100644 dist/webcomponents-lite.js.map create mode 100644 examples/article-test.html delete mode 100644 rollup.config.components.js create mode 100644 rollup.config.js delete mode 100644 rollup.config.transforms.js rename src/{transforms => assets}/distill-favicon.base64 (100%) rename src/{transforms => assets}/distill-favicon.png (100%) rename src/{transforms => assets}/distill-favicon.svg (100%) rename src/{transforms => assets}/distill-logo.svg (100%) create mode 100644 src/distill-components/distill-footer.js create mode 100644 src/distill-transforms/distill-appendix.js create mode 100644 src/distill-transforms/distill-footer.js create mode 100644 src/distill-transforms/distill-header.js create mode 100644 src/extractors/bibliography.js create mode 100644 src/extractors/citations.js create mode 100644 src/extractors/front-matter.js create mode 100644 src/helpers/bibtex.js delete mode 100644 src/transforms/appendix.js delete mode 100644 src/transforms/footer.js delete mode 100644 src/transforms/header.js create mode 100644 src/transforms/polyfills.js diff --git a/.eslintrc.json b/.eslintrc.json index 67510c9..49aaa43 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -15,6 +15,8 @@ "indent": [ "warn", 2 ], "linebreak-style": [ "error", "unix" ], "quotes": [ "warn", "single" ], - "semi": [ "warn", "always" ] + "semi": [ "warn", "always" ], + "no-extra-semi": [ "warn" ], + "no-debugger": [ "warn" ] } } diff --git a/README.md b/README.md index d2bc97c..249982d 100644 --- a/README.md +++ b/README.md @@ -7,3 +7,22 @@ Run `yarn start` to start a watching build rollup server. ## Testing Run `yarn test`. That's it. + + +## TODO: + +-[ ] auto detection/adding behavior + * title + * appendix + * footnote list ? +-[x] should work without distill-appendix +-[x] YML author without ":" should work? +-[ ] throw warning on
+-[ ] h numbering: + h2: position relative + a: position: absolute; + right: calc(100% + 16px); + /* text-align: right; */ + /* width: 80px; */ + /* font-size: 20px; */ + /* font-weight: 200; */ diff --git a/bin/render b/bin/render index 1270e81..e9ab46c 100755 --- a/bin/render +++ b/bin/render @@ -1,18 +1,20 @@ #!/usr/bin/env node -var fs = require("fs"), - jsdom = require("jsdom").jsdom, - serializeDocument = require("jsdom").serializeDocument, - distill = require("../dist/template.js"), - program = require('commander'); +const fs = require('fs'); +const jsdom = require('jsdom').jsdom; +const serialize = require('jsdom').serializeDocument; +const program = require('commander'); +const transforms = require('../dist/transforms.js'); program .version('0.0.1') .option('-i, --input ', 'path to input file.') .parse(process.argv); -let htmlString = fs.readFileSync(program.input, "utf8"); -var dom = jsdom(htmlString, {features: {ProcessExternalResources: false, FetchExternalResources: false}}); -distill.render(dom, {}); -let transformedHtml = serializeDocument(dom); +const htmlString = fs.readFileSync(program.input, 'utf8'); +const data = {}; +const dom = jsdom(htmlString, {features: {ProcessExternalResources: false, FetchExternalResources: false, runScripts: 'dangerously'}}); +transforms.render(dom, data); +transforms.distillify(dom, data); +const transformedHtml = serialize(dom); process.stdout.write(transformedHtml); diff --git a/dist/components.js b/dist/components.js index f678ef1..48566cf 100644 --- a/dist/components.js +++ b/dist/components.js @@ -1,96 +1,126 @@ -(function(){"use strict";function e(e){return`${e} { - width: auto; - margin-left: 24px; - margin-right: 24px; - box-sizing: border-box; +(function (global, factory) { + typeof exports === 'object' && typeof module !== 'undefined' ? factory() : + typeof define === 'function' && define.amd ? define(factory) : + (factory()); +}(this, (function () { 'use strict'; + +var base = "html {\n font-size: 20px;\n\tline-height: 1rem;\n\tfont-family: \"Libre Franklin\", \"Helvetica Neue\", sans-serif;\n text-size-adjust: 100%;\n -ms-text-size-adjust: 100%;\n -webkit-text-size-adjust: 100%;\n}\n\nbody {\n margin: 0;\n}\n\na {\n color: #004276;\n}\n\nfigure {\n margin: 0;\n}\n\ntable {\n\tborder-collapse: collapse;\n\tborder-spacing: 0;\n}\n\ntable th {\n\ttext-align: left;\n}\n\ntable thead {\n border-bottom: 1px solid rgba(0, 0, 0, 0.05);\n}\n\ntable thead th {\n padding-bottom: 0.5em;\n}\n\ntable tbody :first-child td {\n padding-top: 0.5em;\n}\n\npre {\n overflow: auto;\n max-width: 100%;\n}\n"; + +var layout = "@supports not (display: grid) {\n d-article,\n d-title,\n d-byline,\n d-appendix,\n distill-footer {\n display: block;\n padding: 8px;\n }\n}\n\nd-article,\nd-title,\nd-byline,\nd-appendix,\ndistill-footer {\n display: grid;\n justify-items: stretch;\n grid-template-columns: [start] 8px [margin-left-outset] 8px [margin-left] 1fr [body] 0px [page] 8px [body-outset] 0px [page-outset] 8px [end];\n}\n\n@media(min-width: 768px) {\n\n d-article,\n d-title,\n d-byline,\n d-appendix,\n distill-footer {\n grid-template-columns: [start] 32px [margin-left-outset] 32px [margin-left] 3fr [body] 32px [body-outset] 1fr [page] 32px [page-outset] 32px [end];\n }\n}\n\n@media(min-width: 1024px) {\n d-article,\n d-title,\n d-byline,\n d-appendix,\n distill-footer {\n grid-template-columns: [start] 1fr [margin-left-outset] 32px [margin-left] 672px [body] 32px [body-outset] 224px [page] 32px [page-outset] 1fr [end];\n }\n}\n\nd-appendix,\nd-article > d-title,\nd-article > d-title > d-byline,\nd-article > distill-footer {\n grid-column: start / end;\n}\n\n.l-body,\nd-article > * {\n grid-column: margin-left / body;\n}\n\n.l-page {\n grid-column: margin-left / page;\n}\n\n.l-body-outset {\n grid-column: margin-left-outset / body-outset;\n}\n\n.l-page-outset {\n grid-column: margin-left-outset / page-outset;\n}\n\n.l-screen {\n grid-column: start / end;\n}\n\n.l-screen-inset {\n grid-column: start / end;\n padding-left: 16px;\n padding-left: 16px;\n}\n\n\n/* Aside */\n\naside {\n grid-column: margin-left / body;\n}\n\n@media(min-width: 768px) {\n aside {\n grid-column: body-outset / page;\n font-size: 14px;\n line-height: 1.3;\n }\n}\n/*\n.l-body,\n.l-page,\n.l-middle,\nd-article > div,\nd-article > p,\nd-article > h1,\nd-article > h2,\nd-article > h3,\nd-article > h4,\nd-article > figure,\nd-article > ul,\nd-article > d-abstract,\nd-article > d-code,\nd-article > d-math,\nd-article > table,\nd-article section > div,\nd-article section > p,\nd-article section > h1,\nd-article section > h2,\nd-article section > h3,\nd-article section > h4,\nd-article section > figure,\nd-article section > ul,\nd-article section > d-abstract,\nd-article section > d-code,\nd-article section > d-math,\nd-article section > table {\n width: calc(100% - 32px);\n margin-left: 16px;\n margin-right: 16px;\n box-sizing: border-box;\n}\n\n.l-body-outset,\n.l-page-outset,\n.l-middle-outset {\n width: calc(100% - 16px);\n margin-left: 8px;\n margin-right: 8px;\n}\n\n.l-screen {\n margin-left: 0px;\n margin-right: 0px;\n width: 100%;\n background-color: #F8F8FC;\n border-top: 1px solid #E8E8EC;\n border-bottom: 1px solid #E8E8EC;\n}\n\n@media(min-width: 768px) {\n .l-body,\n d-article > div,\n d-article > p,\n d-article > h1,\n d-article > h2,\n d-article > h3,\n d-article > h4,\n d-article > figure,\n d-article > ul,\n d-article > d-abstract,\n d-article > d-code,\n d-article > d-math,\n d-article > d-math,\n d-article section > div,\n d-article section > p,\n d-article section > h1,\n d-article section > h2,\n d-article section > h3,\n d-article section > h4,\n d-article section > figure,\n d-article section > ul,\n d-article section > d-abstract,\n d-article section > d-code,\n d-article section > d-math,\n d-article section > table {\n margin-left: 64px;\n width: calc((100% - 2 * 64px - 3 * 16px)/4*3 + 2*16px );\n }\n\n .l-body-outset {\n margin-left: 32px;\n width: calc((100% - 2 * 64px - 3 * 16px)/4*3 + 2*16px + 64px );;\n }\n\n .l-middle,\n .l-middle-outset,\n .l-page {\n margin-left: 64px;\n margin-right: 64px;\n width: calc(100% - 2*64px);\n }\n\n .l-page-outset {\n margin-left: 32px;\n margin-right: 32px;\n width: calc(100% - 64px);\n }\n\n .margin {\n font-size: 14px;\n line-height: normal;\n clear: both;\n float: right;\n margin-top: 0;\n margin-left: 0;\n margin-right: 64px;\n width: calc((100% - 2 * 64px - 3 * 16px)/4);\n }\n}\n\n@media(min-width: 1024px) {\n .l-body,\n d-article > div,\n d-article > p,\n d-article > h2,\n d-article > h3,\n d-article > h4,\n d-article > figure,\n d-article > ul,\n d-article > d-abstract,\n d-article > d-code,\n d-article > d-math,\n d-article > table,\n d-article section > div,\n d-article section > p,\n d-article section > h2,\n d-article section > h3,\n d-article section > h4,\n d-article section > figure,\n d-article section > ul,\n d-article section > d-abstract,\n d-article section > d-code,\n d-article section > d-math,\n d-article section > table {\n margin-left: calc(50% - (1024px - 2*64px) / 2);\n width: 668px;\n }\n\n .l-body-outset {\n margin-left: calc((50% - (1024px - 2*64px) / 2) - 32px);\n width: calc(668px + 64px)\n }\n\n .l-middle,\n .l-middle-outset,\n .l-page {\n margin-left: calc(50% - (1024px - 2*64px) / 2);\n width: calc(100% - 2* (50% - (1024px - 2*64px) / 2));\n }\n\n .l-page-outset {\n margin-left: calc((50% - (1024px - 2*64px) / 2) - 32px);\n width: calc(100% - 2* (50% - (1024px - 2*64px) / 2) + 64px);\n }\n\n .margin {\n font-size: 14px;\n line-height: normal;\n clear: both;\n float: right;\n margin-top: 0;\n margin-left: 0;\n margin-right: calc(50% - (1024px - 2*64px) / 2);\n width: 206px;\n }\n\n\n /* Side */\n\n /*\n .side.l-body,\n d-article .side.l-body {\n clear: both;\n float: right;\n margin-top: 0;\n margin-left: 48px;\n margin-right: calc((100vw - 984px + 648px) / 2);\n width: calc(648px / 2 - 24px - 84px);\n }\n .side.l-body-outset,\n d-article .side.l-body-outset {\n clear: both;\n float: right;\n margin-top: 0;\n margin-left: 48px;\n margin-right: calc((100vw - 984px + 648px - 48px) / 2);\n width: calc(648px / 2 - 48px + 24px);\n }\n .side.l-middle,\n d-article .side.l-middle {\n clear: both;\n float: right;\n width: calc(456px - 84px);\n margin-left: 48px;\n margin-right: calc((100vw - 984px) / 2 + 168px);\n }\n .side.l-middle-outset,\n d-article .side.l-middle-outset {\n clear: both;\n float: right;\n width: 456px;\n margin-left: 48px;\n margin-right: calc((100vw - 984px) / 2 + 168px);\n }\n .side.l-page,\n d-article .side.l-page {\n clear: both;\n float: right;\n margin-left: 48px;\n width: calc(624px - 84px);\n margin-right: calc((100vw - 984px) / 2);\n }\n .side.l-page-outset,\n d-article .side.l-page-outset {\n clear: both;\n float: right;\n width: 624px;\n margin-right: calc((100vw - 984px) / 2);\n }\n}*/\n\n/* Rows and Columns */\n\n.row {\n display: flex;\n}\n.column {\n flex: 1;\n box-sizing: border-box;\n margin-right: 24px;\n margin-left: 24px;\n}\n.row > .column:first-of-type {\n margin-left: 0;\n}\n.row > .column:last-of-type {\n margin-right: 0;\n}\n"; + +var article = "\nd-article {\n color: rgba(0, 0, 0, 0.8);\n padding-top: 0;\n padding-bottom: 72px;\n overflow: hidden;\n font-size: 14px;\n line-height: 1.6em;\n /*border-top: 1px solid rgba(0, 0, 0, 0.2);*/\n}\n@media(min-width: 768px) {\n d-article {\n font-size: 16px;\n }\n}\n@media(min-width: 1024px) {\n d-article {\n font-size: 18px;\n }\n}\n\n/* H2 */\n\nd-article h2 {\n font-weight: 600;\n font-size: 26px;\n line-height: 1.25em;\n margin-top: 16px;\n margin-bottom: 24px;\n padding-bottom: 24px;\n border-bottom: 1px solid rgba(0, 0, 0, 0.1);\n}\n@media(min-width: 1024px) {\n d-article h2 {\n margin-top: 2em;\n font-size: 32px;\n }\n}\nd-article h1 + h2 {\n font-weight: 300;\n font-size: 20px;\n line-height: 1.4em;\n margin-top: 8px;\n font-style: normal;\n}\n@media(min-width: 1080px) {\n .centered h1 + h2 {\n text-align: center;\n }\n d-article h1 + h2 {\n margin-top: 12px;\n font-size: 32px;\n }\n}\n\n/* H3 */\n\nd-article h3 {\n font-weight: 600;\n font-size: 20px;\n line-height: 1.4em;\n margin-top: 36px;\n margin-bottom: 18px;\n font-style: italic;\n}\nd-article h1 + h3 {\n margin-top: 48px;\n}\n@media(min-width: 1024px) {\n d-article h3 {\n font-size: 26px;\n }\n}\n\n/* H4 */\n\nd-article h4 {\n font-weight: 600;\n text-transform: uppercase;\n font-size: 14px;\n line-height: 1.4em;\n}\nd-article a {\n color: inherit;\n}\nd-article p,\nd-article ul,\nd-article ol {\n margin-bottom: 24px;\n}\nd-article p b,\nd-article ul b,\nd-article ol b {\n -webkit-font-smoothing: antialiased;\n}\nd-article a {\n border-bottom: 1px solid rgba(0, 0, 0, 0.4);\n text-decoration: none;\n}\nd-article a:hover {\n border-bottom: 1px solid rgba(0, 0, 0, 0.8);\n}\nd-article .link {\n text-decoration: underline;\n cursor: pointer;\n}\nd-article ul,\nd-article ol {\n padding-left: 24px;\n}\nd-article li {\n margin-bottom: 24px;\n margin-left: 0;\n padding-left: 0;\n}\nd-article pre {\n font-size: 14px;\n margin-bottom: 20px;\n}\nd-article hr {\n border: none;\n border-bottom: 1px solid rgba(0, 0, 0, 0.2);\n margin-top: 60px;\n margin-bottom: 60px;\n}\nd-article section {\n margin-top: 60px;\n margin-bottom: 60px;\n}\n\n/* Figure */\n\nd-article figure {\n position: relative;\n margin-top: 30px;\n margin-bottom: 30px;\n}\n@media(min-width: 1024px) {\n d-article figure {\n margin-top: 48px;\n margin-bottom: 48px;\n }\n}\nd-article figure img {\n width: 100%;\n}\nd-article figure svg text,\nd-article figure svg tspan {\n}\nd-article figure figcaption {\n color: rgba(0, 0, 0, 0.6);\n font-size: 12px;\n line-height: 1.5em;\n}\n@media(min-width: 1024px) {\n d-article figure figcaption {\n font-size: 13px;\n }\n}\nd-article figure.external img {\n background: white;\n border: 1px solid rgba(0, 0, 0, 0.1);\n box-shadow: 0 1px 8px rgba(0, 0, 0, 0.1);\n padding: 18px;\n box-sizing: border-box;\n}\nd-article figure figcaption a {\n color: rgba(0, 0, 0, 0.6);\n}\n/*d-article figure figcaption::before {\n position: relative;\n display: block;\n top: -20px;\n content: \"\";\n width: 25px;\n border-top: 1px solid rgba(0, 0, 0, 0.3);\n}*/\nd-article span.equation-mimic {\n font-family: georgia;\n font-size: 115%;\n font-style: italic;\n}\nd-article figure figcaption b {\n font-weight: 600;\n color: rgba(0, 0, 0, 1.0);\n}\nd-article > d-code,\nd-article section > d-code {\n display: block;\n}\nd-article > d-math[block],\nd-article section > d-math[block] {\n display: block;\n}\nd-article .citation {\n color: #668;\n cursor: pointer;\n}\nd-include {\n width: auto;\n display: block;\n}\n"; + +var print = "@media print {\n\n @page {\n size: 8in 11in;\n @bottom-right {\n content: counter(page) \" of \" counter(pages);\n }\n }\n\n html {\n /* no general margins -- CSS Grid takes care of those */\n }\n\n p, code {\n page-break-inside: avoid;\n }\n\n h2, h3 {\n page-break-after: avoid;\n }\n\n d-header {\n visibility: hidden;\n }\n\n d-footer {\n display: none!important;\n }\n\n}\n"; + +var katexCSS = "@font-face{font-family:KaTeX_AMS;src:url(fonts/KaTeX_AMS-Regular.eot);src:url(fonts/KaTeX_AMS-Regular.eot#iefix) format('embedded-opentype'),url(fonts/KaTeX_AMS-Regular.woff2) format('woff2'),url(fonts/KaTeX_AMS-Regular.woff) format('woff'),url(fonts/KaTeX_AMS-Regular.ttf) format('truetype');font-weight:400;font-style:normal}@font-face{font-family:KaTeX_Caligraphic;src:url(fonts/KaTeX_Caligraphic-Bold.eot);src:url(fonts/KaTeX_Caligraphic-Bold.eot#iefix) format('embedded-opentype'),url(fonts/KaTeX_Caligraphic-Bold.woff2) format('woff2'),url(fonts/KaTeX_Caligraphic-Bold.woff) format('woff'),url(fonts/KaTeX_Caligraphic-Bold.ttf) format('truetype');font-weight:700;font-style:normal}@font-face{font-family:KaTeX_Caligraphic;src:url(fonts/KaTeX_Caligraphic-Regular.eot);src:url(fonts/KaTeX_Caligraphic-Regular.eot#iefix) format('embedded-opentype'),url(fonts/KaTeX_Caligraphic-Regular.woff2) format('woff2'),url(fonts/KaTeX_Caligraphic-Regular.woff) format('woff'),url(fonts/KaTeX_Caligraphic-Regular.ttf) format('truetype');font-weight:400;font-style:normal}@font-face{font-family:KaTeX_Fraktur;src:url(fonts/KaTeX_Fraktur-Bold.eot);src:url(fonts/KaTeX_Fraktur-Bold.eot#iefix) format('embedded-opentype'),url(fonts/KaTeX_Fraktur-Bold.woff2) format('woff2'),url(fonts/KaTeX_Fraktur-Bold.woff) format('woff'),url(fonts/KaTeX_Fraktur-Bold.ttf) format('truetype');font-weight:700;font-style:normal}@font-face{font-family:KaTeX_Fraktur;src:url(fonts/KaTeX_Fraktur-Regular.eot);src:url(fonts/KaTeX_Fraktur-Regular.eot#iefix) format('embedded-opentype'),url(fonts/KaTeX_Fraktur-Regular.woff2) format('woff2'),url(fonts/KaTeX_Fraktur-Regular.woff) format('woff'),url(fonts/KaTeX_Fraktur-Regular.ttf) format('truetype');font-weight:400;font-style:normal}@font-face{font-family:KaTeX_Main;src:url(fonts/KaTeX_Main-Bold.eot);src:url(fonts/KaTeX_Main-Bold.eot#iefix) format('embedded-opentype'),url(fonts/KaTeX_Main-Bold.woff2) format('woff2'),url(fonts/KaTeX_Main-Bold.woff) format('woff'),url(fonts/KaTeX_Main-Bold.ttf) format('truetype');font-weight:700;font-style:normal}@font-face{font-family:KaTeX_Main;src:url(fonts/KaTeX_Main-Italic.eot);src:url(fonts/KaTeX_Main-Italic.eot#iefix) format('embedded-opentype'),url(fonts/KaTeX_Main-Italic.woff2) format('woff2'),url(fonts/KaTeX_Main-Italic.woff) format('woff'),url(fonts/KaTeX_Main-Italic.ttf) format('truetype');font-weight:400;font-style:italic}@font-face{font-family:KaTeX_Main;src:url(fonts/KaTeX_Main-Regular.eot);src:url(fonts/KaTeX_Main-Regular.eot#iefix) format('embedded-opentype'),url(fonts/KaTeX_Main-Regular.woff2) format('woff2'),url(fonts/KaTeX_Main-Regular.woff) format('woff'),url(fonts/KaTeX_Main-Regular.ttf) format('truetype');font-weight:400;font-style:normal}@font-face{font-family:KaTeX_Math;src:url(fonts/KaTeX_Math-Italic.eot);src:url(fonts/KaTeX_Math-Italic.eot#iefix) format('embedded-opentype'),url(fonts/KaTeX_Math-Italic.woff2) format('woff2'),url(fonts/KaTeX_Math-Italic.woff) format('woff'),url(fonts/KaTeX_Math-Italic.ttf) format('truetype');font-weight:400;font-style:italic}@font-face{font-family:KaTeX_SansSerif;src:url(fonts/KaTeX_SansSerif-Regular.eot);src:url(fonts/KaTeX_SansSerif-Regular.eot#iefix) format('embedded-opentype'),url(fonts/KaTeX_SansSerif-Regular.woff2) format('woff2'),url(fonts/KaTeX_SansSerif-Regular.woff) format('woff'),url(fonts/KaTeX_SansSerif-Regular.ttf) format('truetype');font-weight:400;font-style:normal}@font-face{font-family:KaTeX_Script;src:url(fonts/KaTeX_Script-Regular.eot);src:url(fonts/KaTeX_Script-Regular.eot#iefix) format('embedded-opentype'),url(fonts/KaTeX_Script-Regular.woff2) format('woff2'),url(fonts/KaTeX_Script-Regular.woff) format('woff'),url(fonts/KaTeX_Script-Regular.ttf) format('truetype');font-weight:400;font-style:normal}@font-face{font-family:KaTeX_Size1;src:url(fonts/KaTeX_Size1-Regular.eot);src:url(fonts/KaTeX_Size1-Regular.eot#iefix) format('embedded-opentype'),url(fonts/KaTeX_Size1-Regular.woff2) format('woff2'),url(fonts/KaTeX_Size1-Regular.woff) format('woff'),url(fonts/KaTeX_Size1-Regular.ttf) format('truetype');font-weight:400;font-style:normal}@font-face{font-family:KaTeX_Size2;src:url(fonts/KaTeX_Size2-Regular.eot);src:url(fonts/KaTeX_Size2-Regular.eot#iefix) format('embedded-opentype'),url(fonts/KaTeX_Size2-Regular.woff2) format('woff2'),url(fonts/KaTeX_Size2-Regular.woff) format('woff'),url(fonts/KaTeX_Size2-Regular.ttf) format('truetype');font-weight:400;font-style:normal}@font-face{font-family:KaTeX_Size3;src:url(fonts/KaTeX_Size3-Regular.eot);src:url(fonts/KaTeX_Size3-Regular.eot#iefix) format('embedded-opentype'),url(fonts/KaTeX_Size3-Regular.woff2) format('woff2'),url(fonts/KaTeX_Size3-Regular.woff) format('woff'),url(fonts/KaTeX_Size3-Regular.ttf) format('truetype');font-weight:400;font-style:normal}@font-face{font-family:KaTeX_Size4;src:url(fonts/KaTeX_Size4-Regular.eot);src:url(fonts/KaTeX_Size4-Regular.eot#iefix) format('embedded-opentype'),url(fonts/KaTeX_Size4-Regular.woff2) format('woff2'),url(fonts/KaTeX_Size4-Regular.woff) format('woff'),url(fonts/KaTeX_Size4-Regular.ttf) format('truetype');font-weight:400;font-style:normal}@font-face{font-family:KaTeX_Typewriter;src:url(fonts/KaTeX_Typewriter-Regular.eot);src:url(fonts/KaTeX_Typewriter-Regular.eot#iefix) format('embedded-opentype'),url(fonts/KaTeX_Typewriter-Regular.woff2) format('woff2'),url(fonts/KaTeX_Typewriter-Regular.woff) format('woff'),url(fonts/KaTeX_Typewriter-Regular.ttf) format('truetype');font-weight:400;font-style:normal}.katex-display{display:block;margin:1em 0;text-align:center}.katex-display>.katex{display:inline-block;text-align:initial}.katex{font:400 1.21em KaTeX_Main,Times New Roman,serif;line-height:1.2;white-space:nowrap;text-indent:0}.katex .katex-html{display:inline-block}.katex .katex-mathml{position:absolute;clip:rect(1px,1px,1px,1px);padding:0;border:0;height:1px;width:1px;overflow:hidden}.katex .base,.katex .strut{display:inline-block}.katex .mathrm{font-style:normal}.katex .textit{font-style:italic}.katex .mathit{font-family:KaTeX_Math;font-style:italic}.katex .mathbf{font-family:KaTeX_Main;font-weight:700}.katex .amsrm,.katex .mathbb{font-family:KaTeX_AMS}.katex .mathcal{font-family:KaTeX_Caligraphic}.katex .mathfrak{font-family:KaTeX_Fraktur}.katex .mathtt{font-family:KaTeX_Typewriter}.katex .mathscr{font-family:KaTeX_Script}.katex .mathsf{font-family:KaTeX_SansSerif}.katex .mainit{font-family:KaTeX_Main;font-style:italic}.katex .mord+.mop{margin-left:.16667em}.katex .mord+.mbin{margin-left:.22222em}.katex .mord+.mrel{margin-left:.27778em}.katex .mop+.mop,.katex .mop+.mord,.katex .mord+.minner{margin-left:.16667em}.katex .mop+.mrel{margin-left:.27778em}.katex .mop+.minner{margin-left:.16667em}.katex .mbin+.minner,.katex .mbin+.mop,.katex .mbin+.mopen,.katex .mbin+.mord{margin-left:.22222em}.katex .mrel+.minner,.katex .mrel+.mop,.katex .mrel+.mopen,.katex .mrel+.mord{margin-left:.27778em}.katex .mclose+.mop{margin-left:.16667em}.katex .mclose+.mbin{margin-left:.22222em}.katex .mclose+.mrel{margin-left:.27778em}.katex .mclose+.minner,.katex .minner+.mop,.katex .minner+.mord,.katex .mpunct+.mclose,.katex .mpunct+.minner,.katex .mpunct+.mop,.katex .mpunct+.mopen,.katex .mpunct+.mord,.katex .mpunct+.mpunct,.katex .mpunct+.mrel{margin-left:.16667em}.katex .minner+.mbin{margin-left:.22222em}.katex .minner+.mrel{margin-left:.27778em}.katex .minner+.minner,.katex .minner+.mopen,.katex .minner+.mpunct{margin-left:.16667em}.katex .mbin.mtight,.katex .mclose.mtight,.katex .minner.mtight,.katex .mop.mtight,.katex .mopen.mtight,.katex .mord.mtight,.katex .mpunct.mtight,.katex .mrel.mtight{margin-left:0}.katex .mclose+.mop.mtight,.katex .minner+.mop.mtight,.katex .mop+.mop.mtight,.katex .mop+.mord.mtight,.katex .mord+.mop.mtight{margin-left:.16667em}.katex .reset-textstyle.textstyle{font-size:1em}.katex .reset-textstyle.scriptstyle{font-size:.7em}.katex .reset-textstyle.scriptscriptstyle{font-size:.5em}.katex .reset-scriptstyle.textstyle{font-size:1.42857em}.katex .reset-scriptstyle.scriptstyle{font-size:1em}.katex .reset-scriptstyle.scriptscriptstyle{font-size:.71429em}.katex .reset-scriptscriptstyle.textstyle{font-size:2em}.katex .reset-scriptscriptstyle.scriptstyle{font-size:1.4em}.katex .reset-scriptscriptstyle.scriptscriptstyle{font-size:1em}.katex .style-wrap{position:relative}.katex .vlist{display:inline-block}.katex .vlist>span{display:block;height:0;position:relative}.katex .vlist>span>span{display:inline-block}.katex .vlist .baseline-fix{display:inline-table;table-layout:fixed}.katex .msupsub{text-align:left}.katex .mfrac>span>span{text-align:center}.katex .mfrac .frac-line{width:100%}.katex .mfrac .frac-line:before{border-bottom-style:solid;border-bottom-width:1px;content:\"\";display:block}.katex .mfrac .frac-line:after{border-bottom-style:solid;border-bottom-width:.04em;content:\"\";display:block;margin-top:-1px}.katex .mspace{display:inline-block}.katex .mspace.negativethinspace{margin-left:-.16667em}.katex .mspace.thinspace{width:.16667em}.katex .mspace.negativemediumspace{margin-left:-.22222em}.katex .mspace.mediumspace{width:.22222em}.katex .mspace.thickspace{width:.27778em}.katex .mspace.sixmuspace{width:.333333em}.katex .mspace.eightmuspace{width:.444444em}.katex .mspace.enspace{width:.5em}.katex .mspace.twelvemuspace{width:.666667em}.katex .mspace.quad{width:1em}.katex .mspace.qquad{width:2em}.katex .llap,.katex .rlap{width:0;position:relative}.katex .llap>.inner,.katex .rlap>.inner{position:absolute}.katex .llap>.fix,.katex .rlap>.fix{display:inline-block}.katex .llap>.inner{right:0}.katex .rlap>.inner{left:0}.katex .katex-logo .a{font-size:.75em;margin-left:-.32em;position:relative;top:-.2em}.katex .katex-logo .t{margin-left:-.23em}.katex .katex-logo .e{margin-left:-.1667em;position:relative;top:.2155em}.katex .katex-logo .x{margin-left:-.125em}.katex .rule{display:inline-block;border:0 solid;position:relative}.katex .overline .overline-line,.katex .underline .underline-line{width:100%}.katex .overline .overline-line:before,.katex .underline .underline-line:before{border-bottom-style:solid;border-bottom-width:1px;content:\"\";display:block}.katex .overline .overline-line:after,.katex .underline .underline-line:after{border-bottom-style:solid;border-bottom-width:.04em;content:\"\";display:block;margin-top:-1px}.katex .sqrt>.sqrt-sign{position:relative}.katex .sqrt .sqrt-line{width:100%}.katex .sqrt .sqrt-line:before{border-bottom-style:solid;border-bottom-width:1px;content:\"\";display:block}.katex .sqrt .sqrt-line:after{border-bottom-style:solid;border-bottom-width:.04em;content:\"\";display:block;margin-top:-1px}.katex .sqrt>.root{margin-left:.27777778em;margin-right:-.55555556em}.katex .fontsize-ensurer,.katex .sizing{display:inline-block}.katex .fontsize-ensurer.reset-size1.size1,.katex .sizing.reset-size1.size1{font-size:1em}.katex .fontsize-ensurer.reset-size1.size2,.katex .sizing.reset-size1.size2{font-size:1.4em}.katex .fontsize-ensurer.reset-size1.size3,.katex .sizing.reset-size1.size3{font-size:1.6em}.katex .fontsize-ensurer.reset-size1.size4,.katex .sizing.reset-size1.size4{font-size:1.8em}.katex .fontsize-ensurer.reset-size1.size5,.katex .sizing.reset-size1.size5{font-size:2em}.katex .fontsize-ensurer.reset-size1.size6,.katex .sizing.reset-size1.size6{font-size:2.4em}.katex .fontsize-ensurer.reset-size1.size7,.katex .sizing.reset-size1.size7{font-size:2.88em}.katex .fontsize-ensurer.reset-size1.size8,.katex .sizing.reset-size1.size8{font-size:3.46em}.katex .fontsize-ensurer.reset-size1.size9,.katex .sizing.reset-size1.size9{font-size:4.14em}.katex .fontsize-ensurer.reset-size1.size10,.katex .sizing.reset-size1.size10{font-size:4.98em}.katex .fontsize-ensurer.reset-size2.size1,.katex .sizing.reset-size2.size1{font-size:.71428571em}.katex .fontsize-ensurer.reset-size2.size2,.katex .sizing.reset-size2.size2{font-size:1em}.katex .fontsize-ensurer.reset-size2.size3,.katex .sizing.reset-size2.size3{font-size:1.14285714em}.katex .fontsize-ensurer.reset-size2.size4,.katex .sizing.reset-size2.size4{font-size:1.28571429em}.katex .fontsize-ensurer.reset-size2.size5,.katex .sizing.reset-size2.size5{font-size:1.42857143em}.katex .fontsize-ensurer.reset-size2.size6,.katex .sizing.reset-size2.size6{font-size:1.71428571em}.katex .fontsize-ensurer.reset-size2.size7,.katex .sizing.reset-size2.size7{font-size:2.05714286em}.katex .fontsize-ensurer.reset-size2.size8,.katex .sizing.reset-size2.size8{font-size:2.47142857em}.katex .fontsize-ensurer.reset-size2.size9,.katex .sizing.reset-size2.size9{font-size:2.95714286em}.katex .fontsize-ensurer.reset-size2.size10,.katex .sizing.reset-size2.size10{font-size:3.55714286em}.katex .fontsize-ensurer.reset-size3.size1,.katex .sizing.reset-size3.size1{font-size:.625em}.katex .fontsize-ensurer.reset-size3.size2,.katex .sizing.reset-size3.size2{font-size:.875em}.katex .fontsize-ensurer.reset-size3.size3,.katex .sizing.reset-size3.size3{font-size:1em}.katex .fontsize-ensurer.reset-size3.size4,.katex .sizing.reset-size3.size4{font-size:1.125em}.katex .fontsize-ensurer.reset-size3.size5,.katex .sizing.reset-size3.size5{font-size:1.25em}.katex .fontsize-ensurer.reset-size3.size6,.katex .sizing.reset-size3.size6{font-size:1.5em}.katex .fontsize-ensurer.reset-size3.size7,.katex .sizing.reset-size3.size7{font-size:1.8em}.katex .fontsize-ensurer.reset-size3.size8,.katex .sizing.reset-size3.size8{font-size:2.1625em}.katex .fontsize-ensurer.reset-size3.size9,.katex .sizing.reset-size3.size9{font-size:2.5875em}.katex .fontsize-ensurer.reset-size3.size10,.katex .sizing.reset-size3.size10{font-size:3.1125em}.katex .fontsize-ensurer.reset-size4.size1,.katex .sizing.reset-size4.size1{font-size:.55555556em}.katex .fontsize-ensurer.reset-size4.size2,.katex .sizing.reset-size4.size2{font-size:.77777778em}.katex .fontsize-ensurer.reset-size4.size3,.katex .sizing.reset-size4.size3{font-size:.88888889em}.katex .fontsize-ensurer.reset-size4.size4,.katex .sizing.reset-size4.size4{font-size:1em}.katex .fontsize-ensurer.reset-size4.size5,.katex .sizing.reset-size4.size5{font-size:1.11111111em}.katex .fontsize-ensurer.reset-size4.size6,.katex .sizing.reset-size4.size6{font-size:1.33333333em}.katex .fontsize-ensurer.reset-size4.size7,.katex .sizing.reset-size4.size7{font-size:1.6em}.katex .fontsize-ensurer.reset-size4.size8,.katex .sizing.reset-size4.size8{font-size:1.92222222em}.katex .fontsize-ensurer.reset-size4.size9,.katex .sizing.reset-size4.size9{font-size:2.3em}.katex .fontsize-ensurer.reset-size4.size10,.katex .sizing.reset-size4.size10{font-size:2.76666667em}.katex .fontsize-ensurer.reset-size5.size1,.katex .sizing.reset-size5.size1{font-size:.5em}.katex .fontsize-ensurer.reset-size5.size2,.katex .sizing.reset-size5.size2{font-size:.7em}.katex .fontsize-ensurer.reset-size5.size3,.katex .sizing.reset-size5.size3{font-size:.8em}.katex .fontsize-ensurer.reset-size5.size4,.katex .sizing.reset-size5.size4{font-size:.9em}.katex .fontsize-ensurer.reset-size5.size5,.katex .sizing.reset-size5.size5{font-size:1em}.katex .fontsize-ensurer.reset-size5.size6,.katex .sizing.reset-size5.size6{font-size:1.2em}.katex .fontsize-ensurer.reset-size5.size7,.katex .sizing.reset-size5.size7{font-size:1.44em}.katex .fontsize-ensurer.reset-size5.size8,.katex .sizing.reset-size5.size8{font-size:1.73em}.katex .fontsize-ensurer.reset-size5.size9,.katex .sizing.reset-size5.size9{font-size:2.07em}.katex .fontsize-ensurer.reset-size5.size10,.katex .sizing.reset-size5.size10{font-size:2.49em}.katex .fontsize-ensurer.reset-size6.size1,.katex .sizing.reset-size6.size1{font-size:.41666667em}.katex .fontsize-ensurer.reset-size6.size2,.katex .sizing.reset-size6.size2{font-size:.58333333em}.katex .fontsize-ensurer.reset-size6.size3,.katex .sizing.reset-size6.size3{font-size:.66666667em}.katex .fontsize-ensurer.reset-size6.size4,.katex .sizing.reset-size6.size4{font-size:.75em}.katex .fontsize-ensurer.reset-size6.size5,.katex .sizing.reset-size6.size5{font-size:.83333333em}.katex .fontsize-ensurer.reset-size6.size6,.katex .sizing.reset-size6.size6{font-size:1em}.katex .fontsize-ensurer.reset-size6.size7,.katex .sizing.reset-size6.size7{font-size:1.2em}.katex .fontsize-ensurer.reset-size6.size8,.katex .sizing.reset-size6.size8{font-size:1.44166667em}.katex .fontsize-ensurer.reset-size6.size9,.katex .sizing.reset-size6.size9{font-size:1.725em}.katex .fontsize-ensurer.reset-size6.size10,.katex .sizing.reset-size6.size10{font-size:2.075em}.katex .fontsize-ensurer.reset-size7.size1,.katex .sizing.reset-size7.size1{font-size:.34722222em}.katex .fontsize-ensurer.reset-size7.size2,.katex .sizing.reset-size7.size2{font-size:.48611111em}.katex .fontsize-ensurer.reset-size7.size3,.katex .sizing.reset-size7.size3{font-size:.55555556em}.katex .fontsize-ensurer.reset-size7.size4,.katex .sizing.reset-size7.size4{font-size:.625em}.katex .fontsize-ensurer.reset-size7.size5,.katex .sizing.reset-size7.size5{font-size:.69444444em}.katex .fontsize-ensurer.reset-size7.size6,.katex .sizing.reset-size7.size6{font-size:.83333333em}.katex .fontsize-ensurer.reset-size7.size7,.katex .sizing.reset-size7.size7{font-size:1em}.katex .fontsize-ensurer.reset-size7.size8,.katex .sizing.reset-size7.size8{font-size:1.20138889em}.katex .fontsize-ensurer.reset-size7.size9,.katex .sizing.reset-size7.size9{font-size:1.4375em}.katex .fontsize-ensurer.reset-size7.size10,.katex .sizing.reset-size7.size10{font-size:1.72916667em}.katex .fontsize-ensurer.reset-size8.size1,.katex .sizing.reset-size8.size1{font-size:.28901734em}.katex .fontsize-ensurer.reset-size8.size2,.katex .sizing.reset-size8.size2{font-size:.40462428em}.katex .fontsize-ensurer.reset-size8.size3,.katex .sizing.reset-size8.size3{font-size:.46242775em}.katex .fontsize-ensurer.reset-size8.size4,.katex .sizing.reset-size8.size4{font-size:.52023121em}.katex .fontsize-ensurer.reset-size8.size5,.katex .sizing.reset-size8.size5{font-size:.57803468em}.katex .fontsize-ensurer.reset-size8.size6,.katex .sizing.reset-size8.size6{font-size:.69364162em}.katex .fontsize-ensurer.reset-size8.size7,.katex .sizing.reset-size8.size7{font-size:.83236994em}.katex .fontsize-ensurer.reset-size8.size8,.katex .sizing.reset-size8.size8{font-size:1em}.katex .fontsize-ensurer.reset-size8.size9,.katex .sizing.reset-size8.size9{font-size:1.19653179em}.katex .fontsize-ensurer.reset-size8.size10,.katex .sizing.reset-size8.size10{font-size:1.43930636em}.katex .fontsize-ensurer.reset-size9.size1,.katex .sizing.reset-size9.size1{font-size:.24154589em}.katex .fontsize-ensurer.reset-size9.size2,.katex .sizing.reset-size9.size2{font-size:.33816425em}.katex .fontsize-ensurer.reset-size9.size3,.katex .sizing.reset-size9.size3{font-size:.38647343em}.katex .fontsize-ensurer.reset-size9.size4,.katex .sizing.reset-size9.size4{font-size:.43478261em}.katex .fontsize-ensurer.reset-size9.size5,.katex .sizing.reset-size9.size5{font-size:.48309179em}.katex .fontsize-ensurer.reset-size9.size6,.katex .sizing.reset-size9.size6{font-size:.57971014em}.katex .fontsize-ensurer.reset-size9.size7,.katex .sizing.reset-size9.size7{font-size:.69565217em}.katex .fontsize-ensurer.reset-size9.size8,.katex .sizing.reset-size9.size8{font-size:.83574879em}.katex .fontsize-ensurer.reset-size9.size9,.katex .sizing.reset-size9.size9{font-size:1em}.katex .fontsize-ensurer.reset-size9.size10,.katex .sizing.reset-size9.size10{font-size:1.20289855em}.katex .fontsize-ensurer.reset-size10.size1,.katex .sizing.reset-size10.size1{font-size:.20080321em}.katex .fontsize-ensurer.reset-size10.size2,.katex .sizing.reset-size10.size2{font-size:.2811245em}.katex .fontsize-ensurer.reset-size10.size3,.katex .sizing.reset-size10.size3{font-size:.32128514em}.katex .fontsize-ensurer.reset-size10.size4,.katex .sizing.reset-size10.size4{font-size:.36144578em}.katex .fontsize-ensurer.reset-size10.size5,.katex .sizing.reset-size10.size5{font-size:.40160643em}.katex .fontsize-ensurer.reset-size10.size6,.katex .sizing.reset-size10.size6{font-size:.48192771em}.katex .fontsize-ensurer.reset-size10.size7,.katex .sizing.reset-size10.size7{font-size:.57831325em}.katex .fontsize-ensurer.reset-size10.size8,.katex .sizing.reset-size10.size8{font-size:.69477912em}.katex .fontsize-ensurer.reset-size10.size9,.katex .sizing.reset-size10.size9{font-size:.8313253em}.katex .fontsize-ensurer.reset-size10.size10,.katex .sizing.reset-size10.size10{font-size:1em}.katex .delimsizing.size1{font-family:KaTeX_Size1}.katex .delimsizing.size2{font-family:KaTeX_Size2}.katex .delimsizing.size3{font-family:KaTeX_Size3}.katex .delimsizing.size4{font-family:KaTeX_Size4}.katex .delimsizing.mult .delim-size1>span{font-family:KaTeX_Size1}.katex .delimsizing.mult .delim-size4>span{font-family:KaTeX_Size4}.katex .nulldelimiter{display:inline-block;width:.12em}.katex .op-symbol{position:relative}.katex .op-symbol.small-op{font-family:KaTeX_Size1}.katex .op-symbol.large-op{font-family:KaTeX_Size2}.katex .accent>.vlist>span,.katex .op-limits>.vlist>span{text-align:center}.katex .accent .accent-body>span{width:0}.katex .accent .accent-body.accent-vec>span{position:relative;left:.326em}.katex .mtable .vertical-separator{display:inline-block;margin:0 -.025em;border-right:.05em solid #000}.katex .mtable .arraycolsep{display:inline-block}.katex .mtable .col-align-c>.vlist{text-align:center}.katex .mtable .col-align-l>.vlist{text-align:left}.katex .mtable .col-align-r>.vlist{text-align:right}"; + +let s = document.createElement('style'); +s.textContent = base + layout + print + article + katexCSS; +document.querySelector('head').appendChild(s); + +/*global ShadyCSS*/ + +const Template = (name, templateString, useShadow = true) => { + + return (superclass) => { + + const template = document.createElement('template'); + template.innerHTML = templateString; + + if (useShadow && 'ShadyCSS' in window) { + ShadyCSS.prepareTemplate(template, name); } - @media(min-width: 768px) { - ${e} { - margin-left: 72px; - margin-right: 72px; + + return class extends superclass { + + static get is() { return name; } + + constructor() { + super(); + + this.clone = document.importNode(template.content, true); + if (useShadow) { + this.attachShadow({mode: 'open'}); + this.shadowRoot.appendChild(this.clone); + } } - } - @media(min-width: 1080px) { - ${e} { - width: 984px; - margin-left: auto; - margin-right: auto; + + connectedCallback() { + if (useShadow) { + if ('ShadyCSS' in window) { + ShadyCSS.styleElement(this); + } + } else { + this.insertBefore(this.clone, this.firstChild); + } } + + get root() { + if (useShadow) { + return this.shadowRoot; + } else { + return this; + } + } + + /* TODO: Are we using these? Should we even? */ + $(query) { + return this.root.querySelector(query); + } + + $$(query) { + return this.root.querySelectorAll(query); + } + }; + }; +}; + +// const marginSmall = 16; +// const marginLarge = 3 * marginSmall; +// const margin = marginSmall + marginLarge; +// const gutter = marginSmall; +// const outsetAmount = margin / 2; +// const numCols = 4; +// const numGutters = numCols - 1; +// const columnWidth = (768 - 2 * marginLarge - numGutters * gutter) / numCols; +// +// const screenwidth = 768; +// const pageWidth = screenwidth - 2 * marginLarge; +// const bodyWidth = pageWidth - columnWidth - gutter; + +function body(selector) { + return `${selector} { + grid-column: margin-left / body; } - `}function t(e,i,n,a){function s(t){return e(t=new Date(+t)),t}return s.floor=s,s.ceil=function(t){return e(t=new Date(t-1)),i(t,1),e(t),t},s.round=function(e){var t=s(e),i=s.ceil(e);return e-t=t)for(;e(t),!n(t);)t.setTime(t-1)},function(e,t){if(e>=e)if(0>t)for(;0>=++t;)for(;i(e,-1),!n(e););else for(;0<=--t;)for(;i(e,1),!n(e););})},n&&(s.count=function(t,i){return fi.setTime(+t),yi.setTime(+i),e(fi),e(yi),li(n(fi,yi))},s.every=function(e){return e=li(e),isFinite(e)&&0e.y){var t=new Date(-1,e.m,e.d,e.H,e.M,e.S,e.L);return t.setFullYear(e.y),t}return new Date(e.y,e.m,e.d,e.H,e.M,e.S,e.L)}function o(e){if(0<=e.y&&100>e.y){var t=new Date(Date.UTC(-1,e.m,e.d,e.H,e.M,e.S,e.L));return t.setUTCFullYear(e.y),t}return new Date(Date.UTC(e.y,e.m,e.d,e.H,e.M,e.S,e.L))}function l(e){return{y:e,m:0,d:1,H:0,M:0,S:0,L:0}}function d(e){function t(e,t){return function(a){var s=[],r=-1,i=0,o=e.length,n,l,d;for(a instanceof Date||(a=new Date(+a));++r=n)return-1;if(o=t.charCodeAt(r++),37===o){if(o=t.charAt(r++),l=xe[o in Vi?t.charAt(r++):o],!l||0>(s=l(e,a,s)))return-1;}else if(o!=a.charCodeAt(s++))return-1}return s}var a=e.dateTime,s=e.date,p=e.time,u=e.periods,T=e.days,S=e.shortDays,D=e.months,re=e.shortMonths,oe=c(u),le=m(u),de=c(T),pe=m(T),ue=c(S),ce=m(S),me=c(D),ge=m(D),he=c(re),fe=m(re),d={a:function(e){return S[e.getDay()]},A:function(e){return T[e.getDay()]},b:function(e){return re[e.getMonth()]},B:function(e){return D[e.getMonth()]},c:null,d:_,e:_,H:q,I:R,j:E,L:L,m:F,M:I,p:function(e){return u[+(12<=e.getHours())]},S:O,U:X,w:K,W:U,x:null,X:null,y:P,Y:B,Z:j,"%":se},ye={a:function(e){return S[e.getUTCDay()]},A:function(e){return T[e.getUTCDay()]},b:function(e){return re[e.getUTCMonth()]},B:function(e){return D[e.getUTCMonth()]},c:null,d:H,e:H,H:Y,I:G,j:W,L:V,m:$,M:J,p:function(e){return u[+(12<=e.getUTCHours())]},S:Z,U:Q,w:ee,W:te,x:null,X:null,y:ie,Y:ne,Z:ae,"%":se},xe={a:function(e,t,a){var i=ue.exec(t.slice(a));return i?(e.w=ce[i[0].toLowerCase()],a+i[0].length):-1},A:function(e,t,a){var i=de.exec(t.slice(a));return i?(e.w=pe[i[0].toLowerCase()],a+i[0].length):-1},b:function(e,t,a){var i=he.exec(t.slice(a));return i?(e.m=fe[i[0].toLowerCase()],a+i[0].length):-1},B:function(e,t,a){var i=me.exec(t.slice(a));return i?(e.m=ge[i[0].toLowerCase()],a+i[0].length):-1},c:function(e,t,s){return n(e,a,t,s)},d:k,e:k,H:w,I:w,j:v,L:M,m:b,M:A,p:function(e,t,a){var i=oe.exec(t.slice(a));return i?(e.p=le[i[0].toLowerCase()],a+i[0].length):-1},S:C,U:h,w:g,W:f,x:function(e,t,a){return n(e,s,t,a)},X:function(e,t,a){return n(e,p,t,a)},y:x,Y:y,Z:z,"%":N};return d.x=t(s,d),d.X=t(p,d),d.c=t(a,d),ye.x=t(s,ye),ye.X=t(p,ye),ye.c=t(a,ye),{format:function(e){var i=t(e+="",d);return i.toString=function(){return e},i},parse:function(e){var t=i(e+="",r);return t.toString=function(){return e},t},utcFormat:function(e){var i=t(e+="",ye);return i.toString=function(){return e},i},utcParse:function(e){var t=i(e,o);return t.toString=function(){return e},t}}}function u(e,t,i){var n=0>e?"-":"",a=(n?-e:e)+"",s=a.length;return n+(s{if(e=e.trim(),-1!=e.indexOf(","))var i=e.split(",")[0].trim(),n=e.split(",")[1];else var i=e.split(" ").slice(-1)[0].trim(),n=e.split(" ").slice(0,-1).join(" ");var a="";return void 0!=n&&(a=n.trim().split(" ").map((e)=>e.trim()[0]),a=a.join(".")+"."),t.replace("${F}",n).replace("${L}",i).replace("${I}",a)});if(1[${n||"link"}]`}return""}function de(e,t){return"doi"in e?`${t?"
":""} DOI: ${e.doi}`:""}function pe(e){if(e){var t=""+e.title+" ";return t+=le(e)+"
",t+=re(e,"${L}, ${I}",", "," and "),t+=e.year||e.date?", "+(e.year||e.date)+". ":". ",t+=oe(e),t+=de(e),t}return"?"}function ue(e){if(e){var t="";t+=""+e.title+"",t+=le(e),t+="
";var i=re(e,"${I} ${L}",", ")+".",n=oe(e).trim()+" "+e.year+". "+de(e,!0);return t+=(i+n).length"+n,t}return"?"}function ce(e){var t=600i),t=t.replace(/{\\([a-zA-Z])}/g,(e,t)=>t),n.entryTags[e]=t}n.entryTags.type=n.entryType,t.set(n.citationKey,n.entryTags)}return t}function ye(e){return` -
- ${e.authors.map((e)=>`
- ${e.personalURL?`${e.name}`:`
${e.name}
`} - ${e.affiliationURL?`${e.affiliation}`:`
${e.affiliation}
`} -
`).join("\n")} -
-
-
${e.publishedMonth}. ${e.publishedDay}
-
${e.publishedYear}
-
- -
Citation:
-
${e.concatenatedAuthors}, ${e.publishedYear}
-
- `}function xe(e){return"undefined"==typeof e||null===e}function ze(e,t){Error.call(this),this.name="YAMLException",this.reason=e,this.mark=t,this.message=(this.reason||"(unknown reason)")+(this.mark?" "+this.mark.toString():""),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack||""}function be(e,t,i,n,a){this.name=e,this.buffer=t,this.position=i,this.line=n,this.column=a}function ke(e){var t={};return null!==e&&Object.keys(e).forEach(function(i){e[i].forEach(function(e){t[e+""]=i})}),t}function ve(e,t,i){var n=[];return e.include.forEach(function(e){i=ve(e,t,i)}),e[t].forEach(function(e){i.forEach(function(t,i){t.tag===e.tag&&t.kind===e.kind&&n.push(i)}),i.push(e)}),i.filter(function(e,t){return-1===n.indexOf(t)})}function we(){function e(e){t[e.kind][e.tag]=t.fallback[e.tag]=e}var t={scalar:{},sequence:{},mapping:{},fallback:{}},i,n;for(i=0,n=arguments.length;i=e||65<=e&&70>=e||97<=e&&102>=e}function Ae(e){return 48<=e&&55>=e}function Ce(e){return 48<=e&&57>=e}function Me(e){if(null===e)return!1;try{var t=ba.parse("("+e+")",{range:!0});return"Program"!==t.type||1!==t.body.length||"ExpressionStatement"!==t.body[0].type||"FunctionExpression"!==t.body[0].expression.type?!1:!0}catch(e){return!1}}function Ne(e){var t="("+e+")",i=ba.parse(t,{range:!0}),n=[],a;if("Program"!==i.type||1!==i.body.length||"ExpressionStatement"!==i.body[0].type||"FunctionExpression"!==i.body[0].expression.type)throw new Error("Failed to resolve function");return i.body[0].expression.params.forEach(function(e){n.push(e.name)}),a=i.body[0].expression.body.range,new Function(n,t.slice(a[0]+1,a[1]-1))}function _e(e){return e.toString()}function qe(e){return"[object Function]"===Object.prototype.toString.call(e)}function Re(e){return 10===e||13===e}function Ee(e){return 9===e||32===e}function Le(e){return 9===e||32===e||10===e||13===e}function Fe(e){return 44===e||91===e||93===e||123===e||125===e}function Ie(e){var t;return 48<=e&&57>=e?e-48:(t=32|e,97<=t&&102>=t?t-97+10:-1)}function Oe(e){return 120===e?2:117===e?4:85===e?8:0}function De(e){return 48<=e&&57>=e?e-48:-1}function Xe(e){return 48===e?"\0":97===e?"\x07":98===e?"\b":116===e?"\t":9===e?"\t":110===e?"\n":118===e?"\x0B":102===e?"\f":114===e?"\r":101===e?"\x1B":32===e?" ":34===e?"\"":47===e?"/":92===e?"\\":78===e?"\x85":95===e?"\xA0":76===e?"\u2028":80===e?"\u2029":""}function Ke(e){return 65535>=e?ai(e):ai((e-65536>>10)+55296,(1023&e-65536)+56320)}function Ue(e,t){this.input=e,this.filename=t.filename||null,this.schema=t.schema||Ma,this.onWarning=t.onWarning||null,this.legacy=t.legacy||!1,this.json=t.json||!1,this.listener=t.listener||null,this.implicitTypes=this.schema.compiledImplicit,this.typeMap=this.schema.compiledTypeMap,this.length=e.length,this.position=0,this.line=0,this.lineStart=0,this.lineIndent=0,this.documents=[]}function Pe(e,t){return new Sa(t,new Aa(e.filename,e.input,e.position,e.line,e.position-e.lineStart))}function Be(e,t){throw Pe(e,t)}function je(e,t){e.onWarning&&e.onWarning.call(null,Pe(e,t))}function He(e,t,i,n){var a,s,r,o;if(t=r||Be(e,"expected valid JSON character");else Oa.test(o)&&Be(e,"the stream contains non-printable characters");e.result+=o}}function Ye(e,t,i,n){var a,s,r,o;for(Ta.isObject(i)||Be(e,"cannot merge mappings; the provided source object is unacceptable"),a=Object.keys(i),(r=0,o=a.length);r=t){d=!0,m=e.input.charCodeAt(e.position);continue}else{e.position=l,e.line=p,e.lineStart=u,e.lineIndent=c;break}d&&(He(e,o,l,!1),Je(e,e.line-p),o=l=e.position,d=!1),Ee(m)||(l=e.position+1),m=e.input.charCodeAt(++e.position)}return!(He(e,o,l,!1),!e.result)||(e.kind=n,e.result=a,!1)}function Qe(e,t){var i,n,a;if(i=e.input.charCodeAt(e.position),39!==i)return!1;for(e.kind="scalar",e.result="",e.position++,n=a=e.position;0!==(i=e.input.charCodeAt(e.position));)if(39!==i)Re(i)?(He(e,n,a,!0),Je(e,Ve(e,!1,t)),n=a=e.position):e.position===e.lineStart&&$e(e)?Be(e,"unexpected end of the document within a single quoted scalar"):(e.position++,a=e.position);else if(He(e,n,e.position,!0),i=e.input.charCodeAt(++e.position),39===i)n=e.position,e.position++,a=e.position;else return!0;Be(e,"unexpected end of the stream within a single quoted scalar")}function et(e,t){var i,n,a,s,r,o;if(o=e.input.charCodeAt(e.position),34!==o)return!1;for(e.kind="scalar",e.result="",e.position++,i=n=e.position;0!==(o=e.input.charCodeAt(e.position));){if(34===o)return He(e,i,e.position,!0),e.position++,!0;if(92===o){if(He(e,i,e.position,!0),o=e.input.charCodeAt(++e.position),Re(o))Ve(e,!1,t);else if(256>o&&Pa[o])e.result+=Ba[o],e.position++;else if(0<(r=Oe(o))){for(a=r,s=0;0s&&(s=e.lineIndent),Re(u)){r++;continue}if(e.lineIndentt)&&0!==l)Be(e,"bad indentation of a sequence entry");else if(e.lineIndentt)&&(lt(e,t,Ea,!0,m)&&(p?l=e.result:d=e.result),!p&&(Ge(e,s,r,o,l,d,g,h),o=l=d=null),Ve(e,!0,-1),f=e.input.charCodeAt(e.position)),e.lineIndent>t&&0!==f)Be(e,"bad indentation of a mapping entry");else if(e.lineIndentt?s=1:e.lineIndent===t?s=0:e.lineIndentt?s=1:e.lineIndent===t?s=0:e.lineIndent tag; it should be \""+m.kind+"\", not \""+e.kind+"\""),m.resolve(e.result)?(e.result=m.construct(e.result),null!==e.anchor&&(e.anchorMap[e.anchor]=e.result)):Be(e,"cannot resolve a node with !<"+e.tag+"> explicit tag")):Be(e,"unknown tag !<"+e.tag+">");return null!==e.listener&&e.listener("close",e),null!==e.tag||null!==e.anchor||o}function dt(e){var t=e.position,n=!1,a,s,r,o;for(e.version=null,e.checkLineBreaks=e.legacy,e.tagMap={},e.anchorMap={};0!==(o=e.input.charCodeAt(e.position))&&(Ve(e,!0,-1),o=e.input.charCodeAt(e.position),!(0s.length&&Be(e,"directive name must not be less than one character in length");0!==o;){for(;Ee(o);)o=e.input.charCodeAt(++e.position);if(35===o){do o=e.input.charCodeAt(++e.position);while(0!=o&&!Re(o));break}if(Re(o))break;for(a=e.position;0!==o&&!Le(o);)o=e.input.charCodeAt(++e.position);r.push(e.input.slice(a,e.position))}0!==o&&We(e),Na.call(i,s)?i[s](e,s,r):je(e,"unknown document directive \""+s+"\"")}return Ve(e,!0,-1),0===e.lineIndent&&45===e.input.charCodeAt(e.position)&&45===e.input.charCodeAt(e.position+1)&&45===e.input.charCodeAt(e.position+2)?(e.position+=3,Ve(e,!0,-1)):n&&Be(e,"directives end mark is expected"),lt(e,e.lineIndent-1,Ea,!1,!0),Ve(e,!0,-1),e.checkLineBreaks&&Da.test(e.input.slice(t,e.position))&&je(e,"non-ASCII line breaks are interpreted as content"),e.documents.push(e.result),e.position===e.lineStart&&$e(e)?void(46===e.input.charCodeAt(e.position)&&(e.position+=3,Ve(e,!0,-1))):void(e.position=e)i="x",n=2;else if(65535>=e)i="u",n=4;else if(4294967295>=e)i="U",n=8;else throw new Ya("code point within a string may not be greater than 0xFFFFFFFF");return"\\"+i+Ha.repeat("0",n-t.length)+t}function ht(e){this.schema=e.schema||Ga,this.indent=ni(1,e.indent||2),this.skipInvalid=e.skipInvalid||!1,this.flowLevel=Ha.isNothing(e.flowLevel)?-1:e.flowLevel,this.styleMap=mt(this.schema,e.styles||null),this.sortKeys=e.sortKeys||!1,this.lineWidth=e.lineWidth||80,this.noRefs=e.noRefs||!1,this.noCompatMode=e.noCompatMode||!1,this.condenseFlow=e.condenseFlow||!1,this.implicitTypes=this.schema.compiledImplicit,this.explicitTypes=this.schema.compiledExplicit,this.tag=null,this.result="",this.duplicates=[],this.usedDuplicates=null}function ft(e,t){for(var i=Ha.repeat(" ",t),n=0,a=-1,s="",r=e.length,o;n=e||161<=e&&55295>=e&&8232!==e&&8233!==e||57344<=e&&65533>=e&&65279!==e||65536<=e&&1114111>=e}function kt(e){return bt(e)&&65279!==e&&e!==rs&&e!==cs&&e!==ms&&e!==hs&&e!==ys&&e!==ls&&e!==ts}function vt(e){return bt(e)&&65279!==e&&!zt(e)&&e!==os&&e!==ps&&e!==ls&&e!==rs&&e!==cs&&e!==ms&&e!==hs&&e!==ys&&e!==ts&&e!==ns&&e!==ss&&e!==Qa&&e!==fs&&e!==ds&&e!==as&&e!==es&&e!==is&&e!==us&&e!==gs}function wt(e,t,n,a,s){var r=!1,o=!1,l=-1!==a,d=-1,p=vt(e.charCodeAt(0))&&!zt(e.charCodeAt(e.length-1)),u,i;if(t)for(u=0;ua&&" "!==e[d+1],d=u);else if(!bt(i))return Ts;p=p&&kt(i)}o=o||l&&u-d-1>a&&" "!==e[d+1]}return r||o?" "===e[0]&&9=e.flowLevel;switch(wt(t,o,e.indent,r,a)){case bs:return t;case ks:return"'"+t.replace(/'/g,"''")+"'";case vs:return"|"+St(t,e.indent)+At(ft(t,s));case ws:return">"+St(t,e.indent)+At(ft(Ct(t,r),s));case Ts:return"\""+Nt(t,r)+"\"";default:throw new Ya("impossible error: invalid scalar style");}}()}function St(e,t){var i=" "===e[0]?t+"":"",n="\n"===e[e.length-1],a=n&&("\n"===e[e.length-2]||"\n"===e),s=a?"+":n?"":"-";return i+s+"\n"}function At(e){return"\n"===e[e.length-1]?e.slice(0,-1):e}function Ct(e,t){for(var i=/(\n+)([^\n]*)/g,n=function(){var n=e.indexOf("\n");return n=-1===n?e.length:n,i.lastIndex=n,Mt(e.slice(0,n),t)}(),a="\n"===e[0]||" "===e[0],s,r;r=i.exec(e);){var o=r[1],l=r[2];s=" "===l[0],n+=o+(a||s||""===l?"":"\n")+Mt(l,t),a=s}return n}function Mt(e,t){if(""===e||" "===e[0])return e;for(var i=/ [^ ]/g,n=0,a=0,s=0,r="",o,l;o=i.exec(e);)s=o.index,s-n>t&&(l=a>n?a:s,r+="\n"+e.slice(n,l),n=l+1),a=s;return r+="\n",r+=e.length-n>t&&a>n?e.slice(n,a)+"\n"+e.slice(a+1):e.slice(n),r.slice(1)}function Nt(e){for(var t="",n=0,i,a;n tag resolver accepts not \""+l+"\" style");e.dump=n}return!0}return!1}function Ft(e,t,i,n,a,s){e.tag=null,e.dump=i,Lt(e,i,!1)||Lt(e,i,!0);var r=Wa.call(e.dump);n&&(n=0>e.flowLevel||e.flowLevel>t);var o="[object Object]"===r||"[object Array]"===r,l,d;if(o&&(l=e.duplicates.indexOf(i),d=-1!==l),(null!==e.tag&&"?"!==e.tag||d||2!==e.indent&&0 "+e.dump)}return!0}function It(e,t){var i=[],n=[],a,s;for(Ot(e,i,n),a=0,s=n.length;aUpdates and Corrections -

View all changes to this article since it was first published. If you see mistakes or want to suggest changes, please create an issue on GitHub.

+function page(selector) { + return `${selector} { + grid-column: margin-left / page; + } + `; +} -

Reuse

-

Diagrams and text are licensed under Creative Commons Attribution CC-BY 2.0 with the source available on GitHub, unless noted otherwise. The figures that have been reused from other sources don’t fall under this license and can be recognized by a note in their caption: “Figure from …”.

- -

Citation

-

For attribution in academic contexts, please cite this work as

-
${e.concatenatedAuthors}, "${e.title}", Distill, ${e.publishedYear}.
-

BibTeX citation

-
@article{${e.slug},
-  author = {${e.bibtexAuthors}},
-  title = {${e.title}},
-  journal = {Distill},
-  year = {${e.publishedYear}},
-  note = {${e.url}}
-  }
- `}var ni=Math.max,ai=String.fromCharCode,si=Number.POSITIVE_INFINITY,ri=Number.NEGATIVE_INFINITY,oi=Math.min,li=Math.floor,di="@font-face{font-family:KaTeX_AMS;src:url(fonts/KaTeX_AMS-Regular.eot);src:url(fonts/KaTeX_AMS-Regular.eot#iefix) format('embedded-opentype'),url(fonts/KaTeX_AMS-Regular.woff2) format('woff2'),url(fonts/KaTeX_AMS-Regular.woff) format('woff'),url(fonts/KaTeX_AMS-Regular.ttf) format('truetype');font-weight:400;font-style:normal}@font-face{font-family:KaTeX_Caligraphic;src:url(fonts/KaTeX_Caligraphic-Bold.eot);src:url(fonts/KaTeX_Caligraphic-Bold.eot#iefix) format('embedded-opentype'),url(fonts/KaTeX_Caligraphic-Bold.woff2) format('woff2'),url(fonts/KaTeX_Caligraphic-Bold.woff) format('woff'),url(fonts/KaTeX_Caligraphic-Bold.ttf) format('truetype');font-weight:700;font-style:normal}@font-face{font-family:KaTeX_Caligraphic;src:url(fonts/KaTeX_Caligraphic-Regular.eot);src:url(fonts/KaTeX_Caligraphic-Regular.eot#iefix) format('embedded-opentype'),url(fonts/KaTeX_Caligraphic-Regular.woff2) format('woff2'),url(fonts/KaTeX_Caligraphic-Regular.woff) format('woff'),url(fonts/KaTeX_Caligraphic-Regular.ttf) format('truetype');font-weight:400;font-style:normal}@font-face{font-family:KaTeX_Fraktur;src:url(fonts/KaTeX_Fraktur-Bold.eot);src:url(fonts/KaTeX_Fraktur-Bold.eot#iefix) format('embedded-opentype'),url(fonts/KaTeX_Fraktur-Bold.woff2) format('woff2'),url(fonts/KaTeX_Fraktur-Bold.woff) format('woff'),url(fonts/KaTeX_Fraktur-Bold.ttf) format('truetype');font-weight:700;font-style:normal}@font-face{font-family:KaTeX_Fraktur;src:url(fonts/KaTeX_Fraktur-Regular.eot);src:url(fonts/KaTeX_Fraktur-Regular.eot#iefix) format('embedded-opentype'),url(fonts/KaTeX_Fraktur-Regular.woff2) format('woff2'),url(fonts/KaTeX_Fraktur-Regular.woff) format('woff'),url(fonts/KaTeX_Fraktur-Regular.ttf) format('truetype');font-weight:400;font-style:normal}@font-face{font-family:KaTeX_Main;src:url(fonts/KaTeX_Main-Bold.eot);src:url(fonts/KaTeX_Main-Bold.eot#iefix) format('embedded-opentype'),url(fonts/KaTeX_Main-Bold.woff2) format('woff2'),url(fonts/KaTeX_Main-Bold.woff) format('woff'),url(fonts/KaTeX_Main-Bold.ttf) format('truetype');font-weight:700;font-style:normal}@font-face{font-family:KaTeX_Main;src:url(fonts/KaTeX_Main-Italic.eot);src:url(fonts/KaTeX_Main-Italic.eot#iefix) format('embedded-opentype'),url(fonts/KaTeX_Main-Italic.woff2) format('woff2'),url(fonts/KaTeX_Main-Italic.woff) format('woff'),url(fonts/KaTeX_Main-Italic.ttf) format('truetype');font-weight:400;font-style:italic}@font-face{font-family:KaTeX_Main;src:url(fonts/KaTeX_Main-Regular.eot);src:url(fonts/KaTeX_Main-Regular.eot#iefix) format('embedded-opentype'),url(fonts/KaTeX_Main-Regular.woff2) format('woff2'),url(fonts/KaTeX_Main-Regular.woff) format('woff'),url(fonts/KaTeX_Main-Regular.ttf) format('truetype');font-weight:400;font-style:normal}@font-face{font-family:KaTeX_Math;src:url(fonts/KaTeX_Math-Italic.eot);src:url(fonts/KaTeX_Math-Italic.eot#iefix) format('embedded-opentype'),url(fonts/KaTeX_Math-Italic.woff2) format('woff2'),url(fonts/KaTeX_Math-Italic.woff) format('woff'),url(fonts/KaTeX_Math-Italic.ttf) format('truetype');font-weight:400;font-style:italic}@font-face{font-family:KaTeX_SansSerif;src:url(fonts/KaTeX_SansSerif-Regular.eot);src:url(fonts/KaTeX_SansSerif-Regular.eot#iefix) format('embedded-opentype'),url(fonts/KaTeX_SansSerif-Regular.woff2) format('woff2'),url(fonts/KaTeX_SansSerif-Regular.woff) format('woff'),url(fonts/KaTeX_SansSerif-Regular.ttf) format('truetype');font-weight:400;font-style:normal}@font-face{font-family:KaTeX_Script;src:url(fonts/KaTeX_Script-Regular.eot);src:url(fonts/KaTeX_Script-Regular.eot#iefix) format('embedded-opentype'),url(fonts/KaTeX_Script-Regular.woff2) format('woff2'),url(fonts/KaTeX_Script-Regular.woff) format('woff'),url(fonts/KaTeX_Script-Regular.ttf) format('truetype');font-weight:400;font-style:normal}@font-face{font-family:KaTeX_Size1;src:url(fonts/KaTeX_Size1-Regular.eot);src:url(fonts/KaTeX_Size1-Regular.eot#iefix) format('embedded-opentype'),url(fonts/KaTeX_Size1-Regular.woff2) format('woff2'),url(fonts/KaTeX_Size1-Regular.woff) format('woff'),url(fonts/KaTeX_Size1-Regular.ttf) format('truetype');font-weight:400;font-style:normal}@font-face{font-family:KaTeX_Size2;src:url(fonts/KaTeX_Size2-Regular.eot);src:url(fonts/KaTeX_Size2-Regular.eot#iefix) format('embedded-opentype'),url(fonts/KaTeX_Size2-Regular.woff2) format('woff2'),url(fonts/KaTeX_Size2-Regular.woff) format('woff'),url(fonts/KaTeX_Size2-Regular.ttf) format('truetype');font-weight:400;font-style:normal}@font-face{font-family:KaTeX_Size3;src:url(fonts/KaTeX_Size3-Regular.eot);src:url(fonts/KaTeX_Size3-Regular.eot#iefix) format('embedded-opentype'),url(fonts/KaTeX_Size3-Regular.woff2) format('woff2'),url(fonts/KaTeX_Size3-Regular.woff) format('woff'),url(fonts/KaTeX_Size3-Regular.ttf) format('truetype');font-weight:400;font-style:normal}@font-face{font-family:KaTeX_Size4;src:url(fonts/KaTeX_Size4-Regular.eot);src:url(fonts/KaTeX_Size4-Regular.eot#iefix) format('embedded-opentype'),url(fonts/KaTeX_Size4-Regular.woff2) format('woff2'),url(fonts/KaTeX_Size4-Regular.woff) format('woff'),url(fonts/KaTeX_Size4-Regular.ttf) format('truetype');font-weight:400;font-style:normal}@font-face{font-family:KaTeX_Typewriter;src:url(fonts/KaTeX_Typewriter-Regular.eot);src:url(fonts/KaTeX_Typewriter-Regular.eot#iefix) format('embedded-opentype'),url(fonts/KaTeX_Typewriter-Regular.woff2) format('woff2'),url(fonts/KaTeX_Typewriter-Regular.woff) format('woff'),url(fonts/KaTeX_Typewriter-Regular.ttf) format('truetype');font-weight:400;font-style:normal}.katex-display{display:block;margin:1em 0;text-align:center}.katex-display>.katex{display:inline-block;text-align:initial}.katex{font:400 1.21em KaTeX_Main,Times New Roman,serif;line-height:1.2;white-space:nowrap;text-indent:0}.katex .katex-html{display:inline-block}.katex .katex-mathml{position:absolute;clip:rect(1px,1px,1px,1px);padding:0;border:0;height:1px;width:1px;overflow:hidden}.katex .base,.katex .strut{display:inline-block}.katex .mathrm{font-style:normal}.katex .textit{font-style:italic}.katex .mathit{font-family:KaTeX_Math;font-style:italic}.katex .mathbf{font-family:KaTeX_Main;font-weight:700}.katex .amsrm,.katex .mathbb{font-family:KaTeX_AMS}.katex .mathcal{font-family:KaTeX_Caligraphic}.katex .mathfrak{font-family:KaTeX_Fraktur}.katex .mathtt{font-family:KaTeX_Typewriter}.katex .mathscr{font-family:KaTeX_Script}.katex .mathsf{font-family:KaTeX_SansSerif}.katex .mainit{font-family:KaTeX_Main;font-style:italic}.katex .mord+.mop{margin-left:.16667em}.katex .mord+.mbin{margin-left:.22222em}.katex .mord+.mrel{margin-left:.27778em}.katex .mop+.mop,.katex .mop+.mord,.katex .mord+.minner{margin-left:.16667em}.katex .mop+.mrel{margin-left:.27778em}.katex .mop+.minner{margin-left:.16667em}.katex .mbin+.minner,.katex .mbin+.mop,.katex .mbin+.mopen,.katex .mbin+.mord{margin-left:.22222em}.katex .mrel+.minner,.katex .mrel+.mop,.katex .mrel+.mopen,.katex .mrel+.mord{margin-left:.27778em}.katex .mclose+.mop{margin-left:.16667em}.katex .mclose+.mbin{margin-left:.22222em}.katex .mclose+.mrel{margin-left:.27778em}.katex .mclose+.minner,.katex .minner+.mop,.katex .minner+.mord,.katex .mpunct+.mclose,.katex .mpunct+.minner,.katex .mpunct+.mop,.katex .mpunct+.mopen,.katex .mpunct+.mord,.katex .mpunct+.mpunct,.katex .mpunct+.mrel{margin-left:.16667em}.katex .minner+.mbin{margin-left:.22222em}.katex .minner+.mrel{margin-left:.27778em}.katex .minner+.minner,.katex .minner+.mopen,.katex .minner+.mpunct{margin-left:.16667em}.katex .mbin.mtight,.katex .mclose.mtight,.katex .minner.mtight,.katex .mop.mtight,.katex .mopen.mtight,.katex .mord.mtight,.katex .mpunct.mtight,.katex .mrel.mtight{margin-left:0}.katex .mclose+.mop.mtight,.katex .minner+.mop.mtight,.katex .mop+.mop.mtight,.katex .mop+.mord.mtight,.katex .mord+.mop.mtight{margin-left:.16667em}.katex .reset-textstyle.textstyle{font-size:1em}.katex .reset-textstyle.scriptstyle{font-size:.7em}.katex .reset-textstyle.scriptscriptstyle{font-size:.5em}.katex .reset-scriptstyle.textstyle{font-size:1.42857em}.katex .reset-scriptstyle.scriptstyle{font-size:1em}.katex .reset-scriptstyle.scriptscriptstyle{font-size:.71429em}.katex .reset-scriptscriptstyle.textstyle{font-size:2em}.katex .reset-scriptscriptstyle.scriptstyle{font-size:1.4em}.katex .reset-scriptscriptstyle.scriptscriptstyle{font-size:1em}.katex .style-wrap{position:relative}.katex .vlist{display:inline-block}.katex .vlist>span{display:block;height:0;position:relative}.katex .vlist>span>span{display:inline-block}.katex .vlist .baseline-fix{display:inline-table;table-layout:fixed}.katex .msupsub{text-align:left}.katex .mfrac>span>span{text-align:center}.katex .mfrac .frac-line{width:100%}.katex .mfrac .frac-line:before{border-bottom-style:solid;border-bottom-width:1px;content:\"\";display:block}.katex .mfrac .frac-line:after{border-bottom-style:solid;border-bottom-width:.04em;content:\"\";display:block;margin-top:-1px}.katex .mspace{display:inline-block}.katex .mspace.negativethinspace{margin-left:-.16667em}.katex .mspace.thinspace{width:.16667em}.katex .mspace.negativemediumspace{margin-left:-.22222em}.katex .mspace.mediumspace{width:.22222em}.katex .mspace.thickspace{width:.27778em}.katex .mspace.sixmuspace{width:.333333em}.katex .mspace.eightmuspace{width:.444444em}.katex .mspace.enspace{width:.5em}.katex .mspace.twelvemuspace{width:.666667em}.katex .mspace.quad{width:1em}.katex .mspace.qquad{width:2em}.katex .llap,.katex .rlap{width:0;position:relative}.katex .llap>.inner,.katex .rlap>.inner{position:absolute}.katex .llap>.fix,.katex .rlap>.fix{display:inline-block}.katex .llap>.inner{right:0}.katex .rlap>.inner{left:0}.katex .katex-logo .a{font-size:.75em;margin-left:-.32em;position:relative;top:-.2em}.katex .katex-logo .t{margin-left:-.23em}.katex .katex-logo .e{margin-left:-.1667em;position:relative;top:.2155em}.katex .katex-logo .x{margin-left:-.125em}.katex .rule{display:inline-block;border:0 solid;position:relative}.katex .overline .overline-line,.katex .underline .underline-line{width:100%}.katex .overline .overline-line:before,.katex .underline .underline-line:before{border-bottom-style:solid;border-bottom-width:1px;content:\"\";display:block}.katex .overline .overline-line:after,.katex .underline .underline-line:after{border-bottom-style:solid;border-bottom-width:.04em;content:\"\";display:block;margin-top:-1px}.katex .sqrt>.sqrt-sign{position:relative}.katex .sqrt .sqrt-line{width:100%}.katex .sqrt .sqrt-line:before{border-bottom-style:solid;border-bottom-width:1px;content:\"\";display:block}.katex .sqrt .sqrt-line:after{border-bottom-style:solid;border-bottom-width:.04em;content:\"\";display:block;margin-top:-1px}.katex .sqrt>.root{margin-left:.27777778em;margin-right:-.55555556em}.katex .fontsize-ensurer,.katex .sizing{display:inline-block}.katex .fontsize-ensurer.reset-size1.size1,.katex .sizing.reset-size1.size1{font-size:1em}.katex .fontsize-ensurer.reset-size1.size2,.katex .sizing.reset-size1.size2{font-size:1.4em}.katex .fontsize-ensurer.reset-size1.size3,.katex .sizing.reset-size1.size3{font-size:1.6em}.katex .fontsize-ensurer.reset-size1.size4,.katex .sizing.reset-size1.size4{font-size:1.8em}.katex .fontsize-ensurer.reset-size1.size5,.katex .sizing.reset-size1.size5{font-size:2em}.katex .fontsize-ensurer.reset-size1.size6,.katex .sizing.reset-size1.size6{font-size:2.4em}.katex .fontsize-ensurer.reset-size1.size7,.katex .sizing.reset-size1.size7{font-size:2.88em}.katex .fontsize-ensurer.reset-size1.size8,.katex .sizing.reset-size1.size8{font-size:3.46em}.katex .fontsize-ensurer.reset-size1.size9,.katex .sizing.reset-size1.size9{font-size:4.14em}.katex .fontsize-ensurer.reset-size1.size10,.katex .sizing.reset-size1.size10{font-size:4.98em}.katex .fontsize-ensurer.reset-size2.size1,.katex .sizing.reset-size2.size1{font-size:.71428571em}.katex .fontsize-ensurer.reset-size2.size2,.katex .sizing.reset-size2.size2{font-size:1em}.katex .fontsize-ensurer.reset-size2.size3,.katex .sizing.reset-size2.size3{font-size:1.14285714em}.katex .fontsize-ensurer.reset-size2.size4,.katex .sizing.reset-size2.size4{font-size:1.28571429em}.katex .fontsize-ensurer.reset-size2.size5,.katex .sizing.reset-size2.size5{font-size:1.42857143em}.katex .fontsize-ensurer.reset-size2.size6,.katex .sizing.reset-size2.size6{font-size:1.71428571em}.katex .fontsize-ensurer.reset-size2.size7,.katex .sizing.reset-size2.size7{font-size:2.05714286em}.katex .fontsize-ensurer.reset-size2.size8,.katex .sizing.reset-size2.size8{font-size:2.47142857em}.katex .fontsize-ensurer.reset-size2.size9,.katex .sizing.reset-size2.size9{font-size:2.95714286em}.katex .fontsize-ensurer.reset-size2.size10,.katex .sizing.reset-size2.size10{font-size:3.55714286em}.katex .fontsize-ensurer.reset-size3.size1,.katex .sizing.reset-size3.size1{font-size:.625em}.katex .fontsize-ensurer.reset-size3.size2,.katex .sizing.reset-size3.size2{font-size:.875em}.katex .fontsize-ensurer.reset-size3.size3,.katex .sizing.reset-size3.size3{font-size:1em}.katex .fontsize-ensurer.reset-size3.size4,.katex .sizing.reset-size3.size4{font-size:1.125em}.katex .fontsize-ensurer.reset-size3.size5,.katex .sizing.reset-size3.size5{font-size:1.25em}.katex .fontsize-ensurer.reset-size3.size6,.katex .sizing.reset-size3.size6{font-size:1.5em}.katex .fontsize-ensurer.reset-size3.size7,.katex .sizing.reset-size3.size7{font-size:1.8em}.katex .fontsize-ensurer.reset-size3.size8,.katex .sizing.reset-size3.size8{font-size:2.1625em}.katex .fontsize-ensurer.reset-size3.size9,.katex .sizing.reset-size3.size9{font-size:2.5875em}.katex .fontsize-ensurer.reset-size3.size10,.katex .sizing.reset-size3.size10{font-size:3.1125em}.katex .fontsize-ensurer.reset-size4.size1,.katex .sizing.reset-size4.size1{font-size:.55555556em}.katex .fontsize-ensurer.reset-size4.size2,.katex .sizing.reset-size4.size2{font-size:.77777778em}.katex .fontsize-ensurer.reset-size4.size3,.katex .sizing.reset-size4.size3{font-size:.88888889em}.katex .fontsize-ensurer.reset-size4.size4,.katex .sizing.reset-size4.size4{font-size:1em}.katex .fontsize-ensurer.reset-size4.size5,.katex .sizing.reset-size4.size5{font-size:1.11111111em}.katex .fontsize-ensurer.reset-size4.size6,.katex .sizing.reset-size4.size6{font-size:1.33333333em}.katex .fontsize-ensurer.reset-size4.size7,.katex .sizing.reset-size4.size7{font-size:1.6em}.katex .fontsize-ensurer.reset-size4.size8,.katex .sizing.reset-size4.size8{font-size:1.92222222em}.katex .fontsize-ensurer.reset-size4.size9,.katex .sizing.reset-size4.size9{font-size:2.3em}.katex .fontsize-ensurer.reset-size4.size10,.katex .sizing.reset-size4.size10{font-size:2.76666667em}.katex .fontsize-ensurer.reset-size5.size1,.katex .sizing.reset-size5.size1{font-size:.5em}.katex .fontsize-ensurer.reset-size5.size2,.katex .sizing.reset-size5.size2{font-size:.7em}.katex .fontsize-ensurer.reset-size5.size3,.katex .sizing.reset-size5.size3{font-size:.8em}.katex .fontsize-ensurer.reset-size5.size4,.katex .sizing.reset-size5.size4{font-size:.9em}.katex .fontsize-ensurer.reset-size5.size5,.katex .sizing.reset-size5.size5{font-size:1em}.katex .fontsize-ensurer.reset-size5.size6,.katex .sizing.reset-size5.size6{font-size:1.2em}.katex .fontsize-ensurer.reset-size5.size7,.katex .sizing.reset-size5.size7{font-size:1.44em}.katex .fontsize-ensurer.reset-size5.size8,.katex .sizing.reset-size5.size8{font-size:1.73em}.katex .fontsize-ensurer.reset-size5.size9,.katex .sizing.reset-size5.size9{font-size:2.07em}.katex .fontsize-ensurer.reset-size5.size10,.katex .sizing.reset-size5.size10{font-size:2.49em}.katex .fontsize-ensurer.reset-size6.size1,.katex .sizing.reset-size6.size1{font-size:.41666667em}.katex .fontsize-ensurer.reset-size6.size2,.katex .sizing.reset-size6.size2{font-size:.58333333em}.katex .fontsize-ensurer.reset-size6.size3,.katex .sizing.reset-size6.size3{font-size:.66666667em}.katex .fontsize-ensurer.reset-size6.size4,.katex .sizing.reset-size6.size4{font-size:.75em}.katex .fontsize-ensurer.reset-size6.size5,.katex .sizing.reset-size6.size5{font-size:.83333333em}.katex .fontsize-ensurer.reset-size6.size6,.katex .sizing.reset-size6.size6{font-size:1em}.katex .fontsize-ensurer.reset-size6.size7,.katex .sizing.reset-size6.size7{font-size:1.2em}.katex .fontsize-ensurer.reset-size6.size8,.katex .sizing.reset-size6.size8{font-size:1.44166667em}.katex .fontsize-ensurer.reset-size6.size9,.katex .sizing.reset-size6.size9{font-size:1.725em}.katex .fontsize-ensurer.reset-size6.size10,.katex .sizing.reset-size6.size10{font-size:2.075em}.katex .fontsize-ensurer.reset-size7.size1,.katex .sizing.reset-size7.size1{font-size:.34722222em}.katex .fontsize-ensurer.reset-size7.size2,.katex .sizing.reset-size7.size2{font-size:.48611111em}.katex .fontsize-ensurer.reset-size7.size3,.katex .sizing.reset-size7.size3{font-size:.55555556em}.katex .fontsize-ensurer.reset-size7.size4,.katex .sizing.reset-size7.size4{font-size:.625em}.katex .fontsize-ensurer.reset-size7.size5,.katex .sizing.reset-size7.size5{font-size:.69444444em}.katex .fontsize-ensurer.reset-size7.size6,.katex .sizing.reset-size7.size6{font-size:.83333333em}.katex .fontsize-ensurer.reset-size7.size7,.katex .sizing.reset-size7.size7{font-size:1em}.katex .fontsize-ensurer.reset-size7.size8,.katex .sizing.reset-size7.size8{font-size:1.20138889em}.katex .fontsize-ensurer.reset-size7.size9,.katex .sizing.reset-size7.size9{font-size:1.4375em}.katex .fontsize-ensurer.reset-size7.size10,.katex .sizing.reset-size7.size10{font-size:1.72916667em}.katex .fontsize-ensurer.reset-size8.size1,.katex .sizing.reset-size8.size1{font-size:.28901734em}.katex .fontsize-ensurer.reset-size8.size2,.katex .sizing.reset-size8.size2{font-size:.40462428em}.katex .fontsize-ensurer.reset-size8.size3,.katex .sizing.reset-size8.size3{font-size:.46242775em}.katex .fontsize-ensurer.reset-size8.size4,.katex .sizing.reset-size8.size4{font-size:.52023121em}.katex .fontsize-ensurer.reset-size8.size5,.katex .sizing.reset-size8.size5{font-size:.57803468em}.katex .fontsize-ensurer.reset-size8.size6,.katex .sizing.reset-size8.size6{font-size:.69364162em}.katex .fontsize-ensurer.reset-size8.size7,.katex .sizing.reset-size8.size7{font-size:.83236994em}.katex .fontsize-ensurer.reset-size8.size8,.katex .sizing.reset-size8.size8{font-size:1em}.katex .fontsize-ensurer.reset-size8.size9,.katex .sizing.reset-size8.size9{font-size:1.19653179em}.katex .fontsize-ensurer.reset-size8.size10,.katex .sizing.reset-size8.size10{font-size:1.43930636em}.katex .fontsize-ensurer.reset-size9.size1,.katex .sizing.reset-size9.size1{font-size:.24154589em}.katex .fontsize-ensurer.reset-size9.size2,.katex .sizing.reset-size9.size2{font-size:.33816425em}.katex .fontsize-ensurer.reset-size9.size3,.katex .sizing.reset-size9.size3{font-size:.38647343em}.katex .fontsize-ensurer.reset-size9.size4,.katex .sizing.reset-size9.size4{font-size:.43478261em}.katex .fontsize-ensurer.reset-size9.size5,.katex .sizing.reset-size9.size5{font-size:.48309179em}.katex .fontsize-ensurer.reset-size9.size6,.katex .sizing.reset-size9.size6{font-size:.57971014em}.katex .fontsize-ensurer.reset-size9.size7,.katex .sizing.reset-size9.size7{font-size:.69565217em}.katex .fontsize-ensurer.reset-size9.size8,.katex .sizing.reset-size9.size8{font-size:.83574879em}.katex .fontsize-ensurer.reset-size9.size9,.katex .sizing.reset-size9.size9{font-size:1em}.katex .fontsize-ensurer.reset-size9.size10,.katex .sizing.reset-size9.size10{font-size:1.20289855em}.katex .fontsize-ensurer.reset-size10.size1,.katex .sizing.reset-size10.size1{font-size:.20080321em}.katex .fontsize-ensurer.reset-size10.size2,.katex .sizing.reset-size10.size2{font-size:.2811245em}.katex .fontsize-ensurer.reset-size10.size3,.katex .sizing.reset-size10.size3{font-size:.32128514em}.katex .fontsize-ensurer.reset-size10.size4,.katex .sizing.reset-size10.size4{font-size:.36144578em}.katex .fontsize-ensurer.reset-size10.size5,.katex .sizing.reset-size10.size5{font-size:.40160643em}.katex .fontsize-ensurer.reset-size10.size6,.katex .sizing.reset-size10.size6{font-size:.48192771em}.katex .fontsize-ensurer.reset-size10.size7,.katex .sizing.reset-size10.size7{font-size:.57831325em}.katex .fontsize-ensurer.reset-size10.size8,.katex .sizing.reset-size10.size8{font-size:.69477912em}.katex .fontsize-ensurer.reset-size10.size9,.katex .sizing.reset-size10.size9{font-size:.8313253em}.katex .fontsize-ensurer.reset-size10.size10,.katex .sizing.reset-size10.size10{font-size:1em}.katex .delimsizing.size1{font-family:KaTeX_Size1}.katex .delimsizing.size2{font-family:KaTeX_Size2}.katex .delimsizing.size3{font-family:KaTeX_Size3}.katex .delimsizing.size4{font-family:KaTeX_Size4}.katex .delimsizing.mult .delim-size1>span{font-family:KaTeX_Size1}.katex .delimsizing.mult .delim-size4>span{font-family:KaTeX_Size4}.katex .nulldelimiter{display:inline-block;width:.12em}.katex .op-symbol{position:relative}.katex .op-symbol.small-op{font-family:KaTeX_Size1}.katex .op-symbol.large-op{font-family:KaTeX_Size2}.katex .accent>.vlist>span,.katex .op-limits>.vlist>span{text-align:center}.katex .accent .accent-body>span{width:0}.katex .accent .accent-body.accent-vec>span{position:relative;left:.326em}.katex .mtable .vertical-separator{display:inline-block;margin:0 -.025em;border-right:.05em solid #000}.katex .mtable .arraycolsep{display:inline-block}.katex .mtable .col-align-c>.vlist{text-align:center}.katex .mtable .col-align-l>.vlist{text-align:left}.katex .mtable .col-align-r>.vlist{text-align:right}";let pi=document.createElement("style");pi.textContent="html {\n font-size: 20px;\n\tline-height: 1rem;\n\t/*font-family: -apple-system, BlinkMacSystemFont, \"Segoe UI\", \"Roboto\", \"Helvetica Neue\", sans-serif;*/\n\tfont-family: \"Libre Franklin\", \"Helvetica Neue\", sans-serif;\n -ms-text-size-adjust: 100%;\n -webkit-text-size-adjust: 100%;\n text-size-adjust: 100%;\n}\n\nbody {\n margin: 0;\n /*background-color: hsl(223, 9%, 25%);*/\n}\n\na {\n color: #004276;\n}\n\nfigure {\n margin: 0;\n}\n\ntable {\n\tborder-collapse: collapse;\n\tborder-spacing: 0;\n}\n\ntable th {\n\ttext-align: left;\n}\n\ntable thead {\n border-bottom: 1px solid rgba(0, 0, 0, 0.05);\n}\ntable thead th {\n padding-bottom: 0.5em;\n}\ntable tbody :first-child td {\n padding-top: 0.5em;\n}\n\n/*\nhtml, body, div, span, applet, object, iframe,\nh1, h2, h3, h4, h5, h6, p, blockquote, pre,\na, abbr, acronym, address, big, cite, code,\ndel, dfn, em, img, ins, kbd, q, s, samp,\nsmall, strike, strong, sub, sup, tt, var,\nb, u, i, center,\ndl, dt, dd, ol, ul, li,\nfieldset, form, label, legend,\ntable, caption, tbody, tfoot, thead, tr, th, td,\narticle, aside, canvas, details, embed,\nfigure, figcaption, footer, header, hgroup,\nmenu, nav, output, ruby, section, summary,\ntime, mark, audio, video {\n\tmargin: 0;\n\tpadding: 0;\n\tborder: 0;\n\tfont-size: 100%;\n\tfont: inherit;\n\tvertical-align: baseline;\n}\narticle, aside, details, figcaption, figure,\nfooter, header, hgroup, menu, nav, section {\n\tdisplay: block;\n}\nbody {\n\tline-height: 1;\n}\nol, ul {\n\tlist-style: none;\n}\nblockquote, q {\n\tquotes: none;\n}\nblockquote:before, blockquote:after,\nq:before, q:after {\n\tcontent: '';\n\tcontent: none;\n}\ntable {\n\tborder-collapse: collapse;\n\tborder-spacing: 0;\n}*/\n"+"/*\n Column: 60px\n Gutter: 24px\n\n Body: 648px\n - 8 columns\n - 7 gutters\n Middle: 816px\n Page: 984px\n - 12 columns\n - 11 gutters\n*/\n\n.l-body,\n.l-body-outset,\n.l-page,\n.l-page-outset,\n.l-middle,\n.l-middle-outset,\nd-article > div,\nd-article > p,\nd-article > h1,\nd-article > h2,\nd-article > h3,\nd-article > h4,\nd-article > figure,\nd-article > ul,\nd-article > d-abstract,\nd-article > d-code,\nd-article > d-math,\nd-article > table,\nd-article section > div,\nd-article section > p,\nd-article section > h1,\nd-article section > h2,\nd-article section > h3,\nd-article section > h4,\nd-article section > figure,\nd-article section > ul,\nd-article section > d-abstract,\nd-article section > d-code,\nd-article section > d-math,\nd-article section > table, {\n width: auto;\n margin-left: 24px;\n margin-right: 24px;\n box-sizing: border-box;\n}\n\n@media(min-width: 768px) {\n .l-body,\n .l-body-outset,\n .l-page,\n .l-page-outset,\n .l-middle,\n .l-middle-outset,\n d-article > div,\n d-article > p,\n d-article > h1,\n d-article > h2,\n d-article > h3,\n d-article > h4,\n d-article > figure,\n d-article > ul,\n d-article > d-abstract,\n d-article > d-code,\n d-article > d-math,\n d-article > d-math,\n d-article section > div,\n d-article section > p,\n d-article section > h1,\n d-article section > h2,\n d-article section > h3,\n d-article section > h4,\n d-article section > figure,\n d-article section > ul,\n d-article section > d-abstract,\n d-article section > d-code,\n d-article section > d-math,\n d-article section > table {\n margin-left: 72px;\n margin-right: 72px;\n }\n}\n\n@media(min-width: 1080px) {\n .l-body,\n d-article > div,\n d-article > p,\n d-article > h2,\n d-article > h3,\n d-article > h4,\n d-article > figure,\n d-article > ul,\n d-article > d-abstract,\n d-article > d-code,\n d-article > d-math,\n d-article > table,\n d-article section > div,\n d-article section > p,\n d-article section > h2,\n d-article section > h3,\n d-article section > h4,\n d-article section > figure,\n d-article section > ul,\n d-article section > d-abstract,\n d-article section > d-code,\n d-article section > d-math,\n d-article section > table {\n margin-left: calc(50% - 984px / 2);\n width: 648px;\n }\n .l-body-outset,\n d-article .l-body-outset {\n margin-left: calc(50% - 984px / 2 - 96px/2);\n width: calc(648px + 96px);\n }\n .l-middle,\n d-article .l-middle {\n width: 816px;\n margin-left: calc(50% - 984px / 2);\n margin-right: auto;\n }\n .l-middle-outset,\n d-article .l-middle-outset {\n width: calc(816px + 96px);\n margin-left: calc(50% - 984px / 2 - 48px);\n margin-right: auto;\n }\n d-article > h1,\n d-article section > h1,\n .l-page,\n d-article .l-page,\n d-article.centered .l-page {\n width: 984px;\n margin-left: auto;\n margin-right: auto;\n }\n .l-page-outset,\n d-article .l-page-outset,\n d-article.centered .l-page-outset {\n width: 1080px;\n margin-left: auto;\n margin-right: auto;\n }\n .l-screen,\n d-article .l-screen,\n d-article.centered .l-screen {\n margin-left: auto;\n margin-right: auto;\n width: auto;\n }\n .l-screen-inset,\n d-article .l-screen-inset,\n d-article.centered .l-screen-inset {\n margin-left: 24px;\n margin-right: 24px;\n width: auto;\n }\n .l-gutter,\n d-article .l-gutter {\n clear: both;\n float: right;\n margin-top: 0;\n margin-left: 24px;\n margin-right: calc((100vw - 984px) / 2 + 168px);\n width: calc((984px - 648px) / 2 - 24px);\n }\n\n /* Side */\n .side.l-body,\n d-article .side.l-body {\n clear: both;\n float: right;\n margin-top: 0;\n margin-left: 48px;\n margin-right: calc((100vw - 984px + 648px) / 2);\n width: calc(648px / 2 - 24px - 84px);\n }\n .side.l-body-outset,\n d-article .side.l-body-outset {\n clear: both;\n float: right;\n margin-top: 0;\n margin-left: 48px;\n margin-right: calc((100vw - 984px + 648px - 48px) / 2);\n width: calc(648px / 2 - 48px + 24px);\n }\n .side.l-middle,\n d-article .side.l-middle {\n clear: both;\n float: right;\n width: calc(456px - 84px);\n margin-left: 48px;\n margin-right: calc((100vw - 984px) / 2 + 168px);\n }\n .side.l-middle-outset,\n d-article .side.l-middle-outset {\n clear: both;\n float: right;\n width: 456px;\n margin-left: 48px;\n margin-right: calc((100vw - 984px) / 2 + 168px);\n }\n .side.l-page,\n d-article .side.l-page {\n clear: both;\n float: right;\n margin-left: 48px;\n width: calc(624px - 84px);\n margin-right: calc((100vw - 984px) / 2);\n }\n .side.l-page-outset,\n d-article .side.l-page-outset {\n clear: both;\n float: right;\n width: 624px;\n margin-right: calc((100vw - 984px) / 2);\n }\n}\n\n\n/* Rows and Columns */\n\n.row {\n display: flex;\n}\n.column {\n flex: 1;\n box-sizing: border-box;\n margin-right: 24px;\n margin-left: 24px;\n}\n.row > .column:first-of-type {\n margin-left: 0;\n}\n.row > .column:last-of-type {\n margin-right: 0;\n}\n"+"\n@media print {\n @page {\n size: 8in 11in;\n }\n html {\n }\n p, code {\n page-break-inside: avoid;\n }\n h2, h3 {\n page-break-after: avoid;\n }\n d-header {\n visibility: hidden;\n }\n d-footer {\n display: none!important;\n }\n}\n"+"d-article {\n display: block;\n color: rgba(0, 0, 0, 0.8);\n padding-top: 36px;\n padding-bottom: 72px;\n overflow: hidden;\n font-size: 16px;\n line-height: 1.6em;\n border-top: 1px solid rgba(0, 0, 0, 0.2);\n}\n@media(min-width: 1024px) {\n d-article {\n font-size: 18px;\n }\n}\n\n/* H2 */\n\nd-article h2 {\n font-weight: 400;\n font-size: 26px;\n line-height: 1.25em;\n margin-top: 36px;\n margin-bottom: 24px;\n padding-bottom: 24px;\n border-bottom: 1px solid rgba(0, 0, 0, 0.1);\n}\n@media(min-width: 1024px) {\n d-article h2 {\n margin-top: 2em;\n font-size: 32px;\n }\n}\nd-article h1 + h2 {\n font-weight: 300;\n font-size: 20px;\n line-height: 1.4em;\n margin-top: 8px;\n font-style: normal;\n}\n@media(min-width: 1080px) {\n .centered h1 + h2 {\n text-align: center;\n }\n d-article h1 + h2 {\n margin-top: 12px;\n font-size: 32px;\n }\n}\n\n/* H3 */\n\nd-article h3 {\n font-weight: 400;\n font-size: 20px;\n line-height: 1.4em;\n margin-top: 36px;\n margin-bottom: 18px;\n font-style: italic;\n}\nd-article h1 + h3 {\n margin-top: 48px;\n}\n@media(min-width: 1024px) {\n d-article h3 {\n font-size: 26px;\n }\n}\n\n/* H4 */\n\nd-article h4 {\n font-weight: 600;\n text-transform: uppercase;\n font-size: 14px;\n line-height: 1.4em;\n}\nd-article a {\n color: inherit;\n}\nd-article p,\nd-article ul,\nd-article ol {\n margin-bottom: 24px;\n}\nd-article p b,\nd-article ul b,\nd-article ol b {\n -webkit-font-smoothing: antialiased;\n}\nd-article a {\n border-bottom: 1px solid rgba(0, 0, 0, 0.4);\n text-decoration: none;\n}\nd-article a:hover {\n border-bottom: 1px solid rgba(0, 0, 0, 0.8);\n}\nd-article .link {\n text-decoration: underline;\n cursor: pointer;\n}\nd-article ul,\nd-article ol {\n padding-left: 24px;\n}\nd-article li {\n margin-bottom: 24px;\n margin-left: 0;\n padding-left: 0;\n}\nd-article pre {\n font-size: 14px;\n margin-bottom: 20px;\n}\nd-article hr {\n border: none;\n border-bottom: 1px solid rgba(0, 0, 0, 0.2);\n margin-top: 60px;\n margin-bottom: 60px;\n}\nd-article section {\n margin-top: 60px;\n margin-bottom: 60px;\n}\n\n/* Figure */\n\nd-article figure {\n position: relative;\n margin-top: 30px;\n margin-bottom: 30px;\n}\n@media(min-width: 1024px) {\n d-article figure {\n margin-top: 48px;\n margin-bottom: 48px;\n }\n}\nd-article figure img {\n width: 100%;\n}\nd-article figure svg text,\nd-article figure svg tspan {\n}\nd-article figure figcaption {\n color: rgba(0, 0, 0, 0.6);\n font-size: 12px;\n line-height: 1.5em;\n}\n@media(min-width: 1024px) {\n d-article figure figcaption {\n font-size: 13px;\n }\n}\nd-article figure.external img {\n background: white;\n border: 1px solid rgba(0, 0, 0, 0.1);\n box-shadow: 0 1px 8px rgba(0, 0, 0, 0.1);\n padding: 18px;\n box-sizing: border-box;\n}\nd-article figure figcaption a {\n color: rgba(0, 0, 0, 0.6);\n}\n/*d-article figure figcaption::before {\n position: relative;\n display: block;\n top: -20px;\n content: \"\";\n width: 25px;\n border-top: 1px solid rgba(0, 0, 0, 0.3);\n}*/\nd-article span.equation-mimic {\n font-family: georgia;\n font-size: 115%;\n font-style: italic;\n}\nd-article figure figcaption b {\n font-weight: 600;\n color: rgba(0, 0, 0, 1.0);\n}\nd-article > d-code,\nd-article section > d-code {\n display: block;\n}\nd-article > d-math[block],\nd-article section > d-math[block] {\n display: block;\n}\nd-article .citation {\n color: #668;\n cursor: pointer;\n}\nd-include {\n width: auto;\n display: block;\n}\n"+di,document.querySelector("head").appendChild(pi);const s=(e,t,i=!0)=>{const n=document.createElement("template");return n.innerHTML=t,i&&"ShadyCSS"in window&&ShadyCSS.prepareTemplate(n,e),(t)=>{return class extends t{static get is(){return e}constructor(){super(),this.clone=document.importNode(n.content,!0),i&&(this.attachShadow({mode:"open"}),this.shadowRoot.appendChild(this.clone))}connectedCallback(){i?"ShadyCSS"in window&&ShadyCSS.styleElement(this):this.insertBefore(this.clone,this.firstChild)}get root(){return i?this.shadowRoot:this}$(e){return this.root.querySelector(e)}$$(e){return this.root.querySelectorAll(e)}}}},ui=s("d-abstract",` +const T = Template('d-abstract', ` -`,!1);class T extends ui(HTMLElement){}const ci=s("d-acknowledgements",` + + +`); + +class Abstract extends T(HTMLElement) { + +} + +const T$1 = Template('d-acknowledgements', ` -`);class mi extends ci(HTMLElement){}const gi=s("d-appendix",` +`); + +class Acknowledgements extends T$1(HTMLElement) { + +} + +const T$2 = Template('d-appendix', ` -
- +
+
-`);class hi extends gi(HTMLElement){}var fi=new Date,yi=new Date,xi=t(function(){},function(e,t){e.setTime(+e+t)},function(e,t){return t-e});xi.every=function(e){return e=li(e),isFinite(e)&&0t&&(t+=ki),e.setTime(li((+e-t)/ki)*ki+t)},function(e,t){e.setTime(+e+t*ki)},function(e,t){return(t-e)/ki},function(e){return e.getHours()}),Ci=t(function(e){e.setHours(0,0,0,0)},function(e,t){e.setDate(e.getDate()+t)},function(e,t){return(t-e-(t.getTimezoneOffset()-e.getTimezoneOffset())*bi)/vi},function(e){return e.getDate()-1}),Mi=n(0),Ni=n(1),_i=n(2),qi=n(3),Ri=n(4),Ei=n(5),Li=n(6),Fi=t(function(e){e.setDate(1),e.setHours(0,0,0,0)},function(e,t){e.setMonth(e.getMonth()+t)},function(e,t){return t.getMonth()-e.getMonth()+12*(t.getFullYear()-e.getFullYear())},function(e){return e.getMonth()}),Ii=t(function(e){e.setMonth(0,1),e.setHours(0,0,0,0)},function(e,t){e.setFullYear(e.getFullYear()+t)},function(e,t){return t.getFullYear()-e.getFullYear()},function(e){return e.getFullYear()});Ii.every=function(e){return isFinite(e=li(e))&&010>e?"0"+e:e,dn=en("%a, %d %b %Y %H:%M:%S %Z"),pn=["Jan","Feb","March","April","May","June","July","Aug","Sept","Oct","Nov","Dec"];class un{constructor(e="",t="",i="",n=""){this.name=e,this.personalURL=t,this.affiliation=i,this.affiliationURL=n}get firstName(){const e=this.name.split(" ");return e.slice(0,e.length-1).join(" ")}get lastName(){const e=this.name.split(" ");return e[e.length-1]}}class cn{constructor(){this.title="",this.description="",this.authors=[],this.bibliography=new Map,this.citations=[],this.journal={}}mergeFromYMLFrontmatter(e){this.title=e.title,this.publishedDate=new Date(e.published),this.description=e.description;const t=e.authors.map((t,i)=>[t,e.affiliations[i]]);this.authors=t.map(([e,t])=>{const i=Object.keys(e)[0],n=new un(i);return"object"==typeof e&&(n.personalURL=e[i]),n.affiliation=Object.keys(t)[0],"object"==typeof t&&(n.affiliationURL=t[n.affiliation]),n})}set url(e){this._url=e}get url(){if(this._url)return this._url;return this.distillPath&&this.journal.url?this.journal.url+"/"+this.distillPath:this.journal.url?this.journal.url:void 0}get githubUrl(){return"https://github.com/"+this.githubPath}set previewURL(e){this._previewURL=e}get previewURL(){return this._previewURL?this._previewURL:this.url+"/thumbnail.jpg"}get publishedDateRFC(){return dn(this.publishedDate)}get updatedDateRFC(){return dn(this.updatedDate)}get publishedYear(){return this.publishedDate.getFullYear()}get publishedMonth(){return pn[this.publishedDate.getMonth()]}get publishedDay(){return this.publishedDate.getDate()}get publishedMonthPadded(){return ln(this.publishedDate.getMonth()+1)}get publishedDayPadded(){return ln(this.publishedDate.getDate())}get updatedDateRFC(){}get concatenatedAuthors(){if(2{return e.lastName+", "+e.firstName}).join(" and ")}get slug(){let e="";return this.authors.length&&(e+=this.authors[0].lastName.toLowerCase(),e+=this.publishedYear,e+=this.title.split(" ")[0].toLowerCase()),e||"Untitled"}}class mn{constructor(e){this.div=e,this.visible=!1,this.bindDivEvents(e),mn.box_map[e.id]=this}}mn.box_map={},mn.get_box=function(e){return e in mn.box_map?mn.box_map[e]:new mn(e)},mn.prototype.show=function(e){for(var t in this.visible=!0,this.div.setAttribute("style",ce(e)),mn.box_map){var i=mn.box_map[t];i!=this&&i.hide()}},mn.prototype.showAtNode=function(e){var t=e.getBoundingClientRect();this.show([t.right,t.bottom])},mn.prototype.hide=function(){this.visible=!1,this.div&&this.div.setAttribute("style","display:none"),this.timeout&&clearTimeout(this.timeout)},mn.prototype.stopTimeout=function(){this.timeout&&clearTimeout(this.timeout)},mn.prototype.extendTimeout=function(e){var t=this;this.stopTimeout(),this.timeout=setTimeout(function(){t.hide()}.bind(this),e)},mn.prototype.bind=function(t){"string"==typeof t&&(t=document.querySelector(t)),t.addEventListener("mouseover",function(){this.visible||this.showAtNode(t),this.stopTimeout()}.bind(this)),t.addEventListener("mouseout",function(){this.extendTimeout(250)}.bind(this)),t.addEventListener("touchstart",function(i){this.visible?this.hide():this.showAtNode(t),i.stopPropagation()}.bind(this),{passive:!0})},mn.prototype.bindDivEvents=function(e){this.div.addEventListener("mouseover",function(){this.visible||this.showAtNode(e),this.stopTimeout()}.bind(this)),this.div.addEventListener("mouseout",function(){this.extendTimeout(250)}.bind(this)),this.div.addEventListener("touchstart",function(t){t.stopPropagation()},{passive:!0}),document.body.addEventListener("touchstart",function(){this.hide()}.bind(this),{passive:!0})};const gn=s("d-cite",` +`, true); + +class Appendix extends T$2(HTMLElement) { + +} + +var t0 = new Date; +var t1 = new Date; + +function newInterval(floori, offseti, count, field) { + + function interval(date) { + return floori(date = new Date(+date)), date; + } + + interval.floor = interval; + + interval.ceil = function(date) { + return floori(date = new Date(date - 1)), offseti(date, 1), floori(date), date; + }; + + interval.round = function(date) { + var d0 = interval(date), + d1 = interval.ceil(date); + return date - d0 < d1 - date ? d0 : d1; + }; + + interval.offset = function(date, step) { + return offseti(date = new Date(+date), step == null ? 1 : Math.floor(step)), date; + }; + + interval.range = function(start, stop, step) { + var range = []; + start = interval.ceil(start); + step = step == null ? 1 : Math.floor(step); + if (!(start < stop) || !(step > 0)) return range; // also handles Invalid Date + do range.push(new Date(+start)); while (offseti(start, step), floori(start), start < stop) + return range; + }; + + interval.filter = function(test) { + return newInterval(function(date) { + if (date >= date) while (floori(date), !test(date)) date.setTime(date - 1); + }, function(date, step) { + if (date >= date) { + if (step < 0) while (++step <= 0) { + while (offseti(date, -1), !test(date)) {} // eslint-disable-line no-empty + } else while (--step >= 0) { + while (offseti(date, +1), !test(date)) {} // eslint-disable-line no-empty + } + } + }); + }; + + if (count) { + interval.count = function(start, end) { + t0.setTime(+start), t1.setTime(+end); + floori(t0), floori(t1); + return Math.floor(count(t0, t1)); + }; + + interval.every = function(step) { + step = Math.floor(step); + return !isFinite(step) || !(step > 0) ? null + : !(step > 1) ? interval + : interval.filter(field + ? function(d) { return field(d) % step === 0; } + : function(d) { return interval.count(0, d) % step === 0; }); + }; + } + + return interval; +} + +var millisecond = newInterval(function() { + // noop +}, function(date, step) { + date.setTime(+date + step); +}, function(start, end) { + return end - start; +}); + +// An optimized implementation for this simple case. +millisecond.every = function(k) { + k = Math.floor(k); + if (!isFinite(k) || !(k > 0)) return null; + if (!(k > 1)) return millisecond; + return newInterval(function(date) { + date.setTime(Math.floor(date / k) * k); + }, function(date, step) { + date.setTime(+date + step * k); + }, function(start, end) { + return (end - start) / k; + }); +}; + +var durationSecond = 1e3; +var durationMinute = 6e4; +var durationHour = 36e5; +var durationDay = 864e5; +var durationWeek = 6048e5; + +var second = newInterval(function(date) { + date.setTime(Math.floor(date / durationSecond) * durationSecond); +}, function(date, step) { + date.setTime(+date + step * durationSecond); +}, function(start, end) { + return (end - start) / durationSecond; +}, function(date) { + return date.getUTCSeconds(); +}); + +var minute = newInterval(function(date) { + date.setTime(Math.floor(date / durationMinute) * durationMinute); +}, function(date, step) { + date.setTime(+date + step * durationMinute); +}, function(start, end) { + return (end - start) / durationMinute; +}, function(date) { + return date.getMinutes(); +}); + +var hour = newInterval(function(date) { + var offset = date.getTimezoneOffset() * durationMinute % durationHour; + if (offset < 0) offset += durationHour; + date.setTime(Math.floor((+date - offset) / durationHour) * durationHour + offset); +}, function(date, step) { + date.setTime(+date + step * durationHour); +}, function(start, end) { + return (end - start) / durationHour; +}, function(date) { + return date.getHours(); +}); + +var day = newInterval(function(date) { + date.setHours(0, 0, 0, 0); +}, function(date, step) { + date.setDate(date.getDate() + step); +}, function(start, end) { + return (end - start - (end.getTimezoneOffset() - start.getTimezoneOffset()) * durationMinute) / durationDay; +}, function(date) { + return date.getDate() - 1; +}); + +function weekday(i) { + return newInterval(function(date) { + date.setDate(date.getDate() - (date.getDay() + 7 - i) % 7); + date.setHours(0, 0, 0, 0); + }, function(date, step) { + date.setDate(date.getDate() + step * 7); + }, function(start, end) { + return (end - start - (end.getTimezoneOffset() - start.getTimezoneOffset()) * durationMinute) / durationWeek; + }); +} + +var sunday = weekday(0); +var monday = weekday(1); +var tuesday = weekday(2); +var wednesday = weekday(3); +var thursday = weekday(4); +var friday = weekday(5); +var saturday = weekday(6); + +var month = newInterval(function(date) { + date.setDate(1); + date.setHours(0, 0, 0, 0); +}, function(date, step) { + date.setMonth(date.getMonth() + step); +}, function(start, end) { + return end.getMonth() - start.getMonth() + (end.getFullYear() - start.getFullYear()) * 12; +}, function(date) { + return date.getMonth(); +}); + +var year = newInterval(function(date) { + date.setMonth(0, 1); + date.setHours(0, 0, 0, 0); +}, function(date, step) { + date.setFullYear(date.getFullYear() + step); +}, function(start, end) { + return end.getFullYear() - start.getFullYear(); +}, function(date) { + return date.getFullYear(); +}); + +// An optimized implementation for this simple case. +year.every = function(k) { + return !isFinite(k = Math.floor(k)) || !(k > 0) ? null : newInterval(function(date) { + date.setFullYear(Math.floor(date.getFullYear() / k) * k); + date.setMonth(0, 1); + date.setHours(0, 0, 0, 0); + }, function(date, step) { + date.setFullYear(date.getFullYear() + step * k); + }); +}; + +var utcMinute = newInterval(function(date) { + date.setUTCSeconds(0, 0); +}, function(date, step) { + date.setTime(+date + step * durationMinute); +}, function(start, end) { + return (end - start) / durationMinute; +}, function(date) { + return date.getUTCMinutes(); +}); + +var utcHour = newInterval(function(date) { + date.setUTCMinutes(0, 0, 0); +}, function(date, step) { + date.setTime(+date + step * durationHour); +}, function(start, end) { + return (end - start) / durationHour; +}, function(date) { + return date.getUTCHours(); +}); + +var utcDay = newInterval(function(date) { + date.setUTCHours(0, 0, 0, 0); +}, function(date, step) { + date.setUTCDate(date.getUTCDate() + step); +}, function(start, end) { + return (end - start) / durationDay; +}, function(date) { + return date.getUTCDate() - 1; +}); + +function utcWeekday(i) { + return newInterval(function(date) { + date.setUTCDate(date.getUTCDate() - (date.getUTCDay() + 7 - i) % 7); + date.setUTCHours(0, 0, 0, 0); + }, function(date, step) { + date.setUTCDate(date.getUTCDate() + step * 7); + }, function(start, end) { + return (end - start) / durationWeek; + }); +} + +var utcSunday = utcWeekday(0); +var utcMonday = utcWeekday(1); +var utcTuesday = utcWeekday(2); +var utcWednesday = utcWeekday(3); +var utcThursday = utcWeekday(4); +var utcFriday = utcWeekday(5); +var utcSaturday = utcWeekday(6); + +var utcMonth = newInterval(function(date) { + date.setUTCDate(1); + date.setUTCHours(0, 0, 0, 0); +}, function(date, step) { + date.setUTCMonth(date.getUTCMonth() + step); +}, function(start, end) { + return end.getUTCMonth() - start.getUTCMonth() + (end.getUTCFullYear() - start.getUTCFullYear()) * 12; +}, function(date) { + return date.getUTCMonth(); +}); + +var utcYear = newInterval(function(date) { + date.setUTCMonth(0, 1); + date.setUTCHours(0, 0, 0, 0); +}, function(date, step) { + date.setUTCFullYear(date.getUTCFullYear() + step); +}, function(start, end) { + return end.getUTCFullYear() - start.getUTCFullYear(); +}, function(date) { + return date.getUTCFullYear(); +}); + +// An optimized implementation for this simple case. +utcYear.every = function(k) { + return !isFinite(k = Math.floor(k)) || !(k > 0) ? null : newInterval(function(date) { + date.setUTCFullYear(Math.floor(date.getUTCFullYear() / k) * k); + date.setUTCMonth(0, 1); + date.setUTCHours(0, 0, 0, 0); + }, function(date, step) { + date.setUTCFullYear(date.getUTCFullYear() + step * k); + }); +}; + +function localDate(d) { + if (0 <= d.y && d.y < 100) { + var date = new Date(-1, d.m, d.d, d.H, d.M, d.S, d.L); + date.setFullYear(d.y); + return date; + } + return new Date(d.y, d.m, d.d, d.H, d.M, d.S, d.L); +} + +function utcDate(d) { + if (0 <= d.y && d.y < 100) { + var date = new Date(Date.UTC(-1, d.m, d.d, d.H, d.M, d.S, d.L)); + date.setUTCFullYear(d.y); + return date; + } + return new Date(Date.UTC(d.y, d.m, d.d, d.H, d.M, d.S, d.L)); +} + +function newYear(y) { + return {y: y, m: 0, d: 1, H: 0, M: 0, S: 0, L: 0}; +} + +function formatLocale(locale) { + var locale_dateTime = locale.dateTime, + locale_date = locale.date, + locale_time = locale.time, + locale_periods = locale.periods, + locale_weekdays = locale.days, + locale_shortWeekdays = locale.shortDays, + locale_months = locale.months, + locale_shortMonths = locale.shortMonths; + + var periodRe = formatRe(locale_periods), + periodLookup = formatLookup(locale_periods), + weekdayRe = formatRe(locale_weekdays), + weekdayLookup = formatLookup(locale_weekdays), + shortWeekdayRe = formatRe(locale_shortWeekdays), + shortWeekdayLookup = formatLookup(locale_shortWeekdays), + monthRe = formatRe(locale_months), + monthLookup = formatLookup(locale_months), + shortMonthRe = formatRe(locale_shortMonths), + shortMonthLookup = formatLookup(locale_shortMonths); + + var formats = { + "a": formatShortWeekday, + "A": formatWeekday, + "b": formatShortMonth, + "B": formatMonth, + "c": null, + "d": formatDayOfMonth, + "e": formatDayOfMonth, + "H": formatHour24, + "I": formatHour12, + "j": formatDayOfYear, + "L": formatMilliseconds, + "m": formatMonthNumber, + "M": formatMinutes, + "p": formatPeriod, + "S": formatSeconds, + "U": formatWeekNumberSunday, + "w": formatWeekdayNumber, + "W": formatWeekNumberMonday, + "x": null, + "X": null, + "y": formatYear, + "Y": formatFullYear, + "Z": formatZone, + "%": formatLiteralPercent + }; + + var utcFormats = { + "a": formatUTCShortWeekday, + "A": formatUTCWeekday, + "b": formatUTCShortMonth, + "B": formatUTCMonth, + "c": null, + "d": formatUTCDayOfMonth, + "e": formatUTCDayOfMonth, + "H": formatUTCHour24, + "I": formatUTCHour12, + "j": formatUTCDayOfYear, + "L": formatUTCMilliseconds, + "m": formatUTCMonthNumber, + "M": formatUTCMinutes, + "p": formatUTCPeriod, + "S": formatUTCSeconds, + "U": formatUTCWeekNumberSunday, + "w": formatUTCWeekdayNumber, + "W": formatUTCWeekNumberMonday, + "x": null, + "X": null, + "y": formatUTCYear, + "Y": formatUTCFullYear, + "Z": formatUTCZone, + "%": formatLiteralPercent + }; + + var parses = { + "a": parseShortWeekday, + "A": parseWeekday, + "b": parseShortMonth, + "B": parseMonth, + "c": parseLocaleDateTime, + "d": parseDayOfMonth, + "e": parseDayOfMonth, + "H": parseHour24, + "I": parseHour24, + "j": parseDayOfYear, + "L": parseMilliseconds, + "m": parseMonthNumber, + "M": parseMinutes, + "p": parsePeriod, + "S": parseSeconds, + "U": parseWeekNumberSunday, + "w": parseWeekdayNumber, + "W": parseWeekNumberMonday, + "x": parseLocaleDate, + "X": parseLocaleTime, + "y": parseYear, + "Y": parseFullYear, + "Z": parseZone, + "%": parseLiteralPercent + }; + + // These recursive directive definitions must be deferred. + formats.x = newFormat(locale_date, formats); + formats.X = newFormat(locale_time, formats); + formats.c = newFormat(locale_dateTime, formats); + utcFormats.x = newFormat(locale_date, utcFormats); + utcFormats.X = newFormat(locale_time, utcFormats); + utcFormats.c = newFormat(locale_dateTime, utcFormats); + + function newFormat(specifier, formats) { + return function(date) { + var string = [], + i = -1, + j = 0, + n = specifier.length, + c, + pad, + format; + + if (!(date instanceof Date)) date = new Date(+date); + + while (++i < n) { + if (specifier.charCodeAt(i) === 37) { + string.push(specifier.slice(j, i)); + if ((pad = pads[c = specifier.charAt(++i)]) != null) c = specifier.charAt(++i); + else pad = c === "e" ? " " : "0"; + if (format = formats[c]) c = format(date, pad); + string.push(c); + j = i + 1; + } + } + + string.push(specifier.slice(j, i)); + return string.join(""); + }; + } + + function newParse(specifier, newDate) { + return function(string) { + var d = newYear(1900), + i = parseSpecifier(d, specifier, string += "", 0); + if (i != string.length) return null; + + // The am-pm flag is 0 for AM, and 1 for PM. + if ("p" in d) d.H = d.H % 12 + d.p * 12; + + // Convert day-of-week and week-of-year to day-of-year. + if ("W" in d || "U" in d) { + if (!("w" in d)) d.w = "W" in d ? 1 : 0; + var day$$1 = "Z" in d ? utcDate(newYear(d.y)).getUTCDay() : newDate(newYear(d.y)).getDay(); + d.m = 0; + d.d = "W" in d ? (d.w + 6) % 7 + d.W * 7 - (day$$1 + 5) % 7 : d.w + d.U * 7 - (day$$1 + 6) % 7; + } + + // If a time zone is specified, all fields are interpreted as UTC and then + // offset according to the specified time zone. + if ("Z" in d) { + d.H += d.Z / 100 | 0; + d.M += d.Z % 100; + return utcDate(d); + } + + // Otherwise, all fields are in local time. + return newDate(d); + }; + } + + function parseSpecifier(d, specifier, string, j) { + var i = 0, + n = specifier.length, + m = string.length, + c, + parse; + + while (i < n) { + if (j >= m) return -1; + c = specifier.charCodeAt(i++); + if (c === 37) { + c = specifier.charAt(i++); + parse = parses[c in pads ? specifier.charAt(i++) : c]; + if (!parse || ((j = parse(d, string, j)) < 0)) return -1; + } else if (c != string.charCodeAt(j++)) { + return -1; + } + } + + return j; + } + + function parsePeriod(d, string, i) { + var n = periodRe.exec(string.slice(i)); + return n ? (d.p = periodLookup[n[0].toLowerCase()], i + n[0].length) : -1; + } + + function parseShortWeekday(d, string, i) { + var n = shortWeekdayRe.exec(string.slice(i)); + return n ? (d.w = shortWeekdayLookup[n[0].toLowerCase()], i + n[0].length) : -1; + } + + function parseWeekday(d, string, i) { + var n = weekdayRe.exec(string.slice(i)); + return n ? (d.w = weekdayLookup[n[0].toLowerCase()], i + n[0].length) : -1; + } + + function parseShortMonth(d, string, i) { + var n = shortMonthRe.exec(string.slice(i)); + return n ? (d.m = shortMonthLookup[n[0].toLowerCase()], i + n[0].length) : -1; + } + + function parseMonth(d, string, i) { + var n = monthRe.exec(string.slice(i)); + return n ? (d.m = monthLookup[n[0].toLowerCase()], i + n[0].length) : -1; + } + + function parseLocaleDateTime(d, string, i) { + return parseSpecifier(d, locale_dateTime, string, i); + } + + function parseLocaleDate(d, string, i) { + return parseSpecifier(d, locale_date, string, i); + } + + function parseLocaleTime(d, string, i) { + return parseSpecifier(d, locale_time, string, i); + } + + function formatShortWeekday(d) { + return locale_shortWeekdays[d.getDay()]; + } + + function formatWeekday(d) { + return locale_weekdays[d.getDay()]; + } + + function formatShortMonth(d) { + return locale_shortMonths[d.getMonth()]; + } + + function formatMonth(d) { + return locale_months[d.getMonth()]; + } + + function formatPeriod(d) { + return locale_periods[+(d.getHours() >= 12)]; + } + + function formatUTCShortWeekday(d) { + return locale_shortWeekdays[d.getUTCDay()]; + } + + function formatUTCWeekday(d) { + return locale_weekdays[d.getUTCDay()]; + } + + function formatUTCShortMonth(d) { + return locale_shortMonths[d.getUTCMonth()]; + } + + function formatUTCMonth(d) { + return locale_months[d.getUTCMonth()]; + } + + function formatUTCPeriod(d) { + return locale_periods[+(d.getUTCHours() >= 12)]; + } + + return { + format: function(specifier) { + var f = newFormat(specifier += "", formats); + f.toString = function() { return specifier; }; + return f; + }, + parse: function(specifier) { + var p = newParse(specifier += "", localDate); + p.toString = function() { return specifier; }; + return p; + }, + utcFormat: function(specifier) { + var f = newFormat(specifier += "", utcFormats); + f.toString = function() { return specifier; }; + return f; + }, + utcParse: function(specifier) { + var p = newParse(specifier, utcDate); + p.toString = function() { return specifier; }; + return p; + } + }; +} + +var pads = {"-": "", "_": " ", "0": "0"}; +var numberRe = /^\s*\d+/; +var percentRe = /^%/; +var requoteRe = /[\\\^\$\*\+\?\|\[\]\(\)\.\{\}]/g; + +function pad(value, fill, width) { + var sign = value < 0 ? "-" : "", + string = (sign ? -value : value) + "", + length = string.length; + return sign + (length < width ? new Array(width - length + 1).join(fill) + string : string); +} + +function requote(s) { + return s.replace(requoteRe, "\\$&"); +} + +function formatRe(names) { + return new RegExp("^(?:" + names.map(requote).join("|") + ")", "i"); +} + +function formatLookup(names) { + var map = {}, i = -1, n = names.length; + while (++i < n) map[names[i].toLowerCase()] = i; + return map; +} + +function parseWeekdayNumber(d, string, i) { + var n = numberRe.exec(string.slice(i, i + 1)); + return n ? (d.w = +n[0], i + n[0].length) : -1; +} + +function parseWeekNumberSunday(d, string, i) { + var n = numberRe.exec(string.slice(i)); + return n ? (d.U = +n[0], i + n[0].length) : -1; +} + +function parseWeekNumberMonday(d, string, i) { + var n = numberRe.exec(string.slice(i)); + return n ? (d.W = +n[0], i + n[0].length) : -1; +} + +function parseFullYear(d, string, i) { + var n = numberRe.exec(string.slice(i, i + 4)); + return n ? (d.y = +n[0], i + n[0].length) : -1; +} + +function parseYear(d, string, i) { + var n = numberRe.exec(string.slice(i, i + 2)); + return n ? (d.y = +n[0] + (+n[0] > 68 ? 1900 : 2000), i + n[0].length) : -1; +} + +function parseZone(d, string, i) { + var n = /^(Z)|([+-]\d\d)(?:\:?(\d\d))?/.exec(string.slice(i, i + 6)); + return n ? (d.Z = n[1] ? 0 : -(n[2] + (n[3] || "00")), i + n[0].length) : -1; +} + +function parseMonthNumber(d, string, i) { + var n = numberRe.exec(string.slice(i, i + 2)); + return n ? (d.m = n[0] - 1, i + n[0].length) : -1; +} + +function parseDayOfMonth(d, string, i) { + var n = numberRe.exec(string.slice(i, i + 2)); + return n ? (d.d = +n[0], i + n[0].length) : -1; +} + +function parseDayOfYear(d, string, i) { + var n = numberRe.exec(string.slice(i, i + 3)); + return n ? (d.m = 0, d.d = +n[0], i + n[0].length) : -1; +} + +function parseHour24(d, string, i) { + var n = numberRe.exec(string.slice(i, i + 2)); + return n ? (d.H = +n[0], i + n[0].length) : -1; +} + +function parseMinutes(d, string, i) { + var n = numberRe.exec(string.slice(i, i + 2)); + return n ? (d.M = +n[0], i + n[0].length) : -1; +} + +function parseSeconds(d, string, i) { + var n = numberRe.exec(string.slice(i, i + 2)); + return n ? (d.S = +n[0], i + n[0].length) : -1; +} + +function parseMilliseconds(d, string, i) { + var n = numberRe.exec(string.slice(i, i + 3)); + return n ? (d.L = +n[0], i + n[0].length) : -1; +} + +function parseLiteralPercent(d, string, i) { + var n = percentRe.exec(string.slice(i, i + 1)); + return n ? i + n[0].length : -1; +} + +function formatDayOfMonth(d, p) { + return pad(d.getDate(), p, 2); +} + +function formatHour24(d, p) { + return pad(d.getHours(), p, 2); +} + +function formatHour12(d, p) { + return pad(d.getHours() % 12 || 12, p, 2); +} + +function formatDayOfYear(d, p) { + return pad(1 + day.count(year(d), d), p, 3); +} + +function formatMilliseconds(d, p) { + return pad(d.getMilliseconds(), p, 3); +} + +function formatMonthNumber(d, p) { + return pad(d.getMonth() + 1, p, 2); +} + +function formatMinutes(d, p) { + return pad(d.getMinutes(), p, 2); +} + +function formatSeconds(d, p) { + return pad(d.getSeconds(), p, 2); +} + +function formatWeekNumberSunday(d, p) { + return pad(sunday.count(year(d), d), p, 2); +} + +function formatWeekdayNumber(d) { + return d.getDay(); +} + +function formatWeekNumberMonday(d, p) { + return pad(monday.count(year(d), d), p, 2); +} + +function formatYear(d, p) { + return pad(d.getFullYear() % 100, p, 2); +} + +function formatFullYear(d, p) { + return pad(d.getFullYear() % 10000, p, 4); +} + +function formatZone(d) { + var z = d.getTimezoneOffset(); + return (z > 0 ? "-" : (z *= -1, "+")) + + pad(z / 60 | 0, "0", 2) + + pad(z % 60, "0", 2); +} + +function formatUTCDayOfMonth(d, p) { + return pad(d.getUTCDate(), p, 2); +} + +function formatUTCHour24(d, p) { + return pad(d.getUTCHours(), p, 2); +} + +function formatUTCHour12(d, p) { + return pad(d.getUTCHours() % 12 || 12, p, 2); +} + +function formatUTCDayOfYear(d, p) { + return pad(1 + utcDay.count(utcYear(d), d), p, 3); +} + +function formatUTCMilliseconds(d, p) { + return pad(d.getUTCMilliseconds(), p, 3); +} + +function formatUTCMonthNumber(d, p) { + return pad(d.getUTCMonth() + 1, p, 2); +} + +function formatUTCMinutes(d, p) { + return pad(d.getUTCMinutes(), p, 2); +} + +function formatUTCSeconds(d, p) { + return pad(d.getUTCSeconds(), p, 2); +} + +function formatUTCWeekNumberSunday(d, p) { + return pad(utcSunday.count(utcYear(d), d), p, 2); +} + +function formatUTCWeekdayNumber(d) { + return d.getUTCDay(); +} + +function formatUTCWeekNumberMonday(d, p) { + return pad(utcMonday.count(utcYear(d), d), p, 2); +} + +function formatUTCYear(d, p) { + return pad(d.getUTCFullYear() % 100, p, 2); +} + +function formatUTCFullYear(d, p) { + return pad(d.getUTCFullYear() % 10000, p, 4); +} + +function formatUTCZone() { + return "+0000"; +} + +function formatLiteralPercent() { + return "%"; +} + +var locale$1; +var timeFormat; +var timeParse; +var utcFormat; +var utcParse; + +defaultLocale({ + dateTime: "%x, %X", + date: "%-m/%-d/%Y", + time: "%-I:%M:%S %p", + periods: ["AM", "PM"], + days: ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"], + shortDays: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"], + months: ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"], + shortMonths: ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"] +}); + +function defaultLocale(definition) { + locale$1 = formatLocale(definition); + timeFormat = locale$1.format; + timeParse = locale$1.parse; + utcFormat = locale$1.utcFormat; + utcParse = locale$1.utcParse; + return locale$1; +} + +var isoSpecifier = "%Y-%m-%dT%H:%M:%S.%LZ"; + +function formatIsoNative(date) { + return date.toISOString(); +} + +var formatIso = Date.prototype.toISOString + ? formatIsoNative + : utcFormat(isoSpecifier); + +function parseIsoNative(string) { + var date = new Date(string); + return isNaN(date) ? null : date; +} + +var parseIso = +new Date("2000-01-01T00:00:00.000Z") + ? parseIsoNative + : utcParse(isoSpecifier); + +const zeroPad = n => n < 10 ? '0' + n : n; +const RFC = timeFormat('%a, %d %b %Y %H:%M:%S %Z'); +const months = ['Jan', 'Feb', 'March', 'April', 'May', 'June', 'July', 'Aug', 'Sept', 'Oct', 'Nov', 'Dec']; + +class Author { + + constructor(name='', personalURL='', affiliation='', affiliationURL='') { + this.name = name; // "Chris Olah" + this.personalURL = personalURL; // "https://colah.github.io" + this.affiliation = affiliation; // "Google Brain" + this.affiliationURL = affiliationURL; // "https://g.co/brain" + } + + // "Chris" + get firstName() { + const names = this.name.split(' '); + return names.slice(0, names.length - 1).join(' '); + } + + // "Olah" + get lastName() { + const names = this.name.split(' '); + return names[names.length -1]; + } +} + +class FrontMatter { + constructor() { + this.title = ''; // "Attention and Augmented Recurrent Neural Networks" + this.description = ''; // "A visual overview of neural attention..." + this.authors = []; // Array of Author(s) + + this.bibliography = new Map(); + // { + // "gregor2015draw": { + // "title": "DRAW: A recurrent neural network for image generation", + // "author": "Gregor, Karol and Danihelka, Ivo and Graves, Alex and Rezende, Danilo Jimenez and Wierstra, Daan", + // "journal": "arXiv preprint arXiv:1502.04623", + // "year": "2015", + // "url": "https://arxiv.org/pdf/1502.04623.pdf", + // "type": "article" + // }, + // } + + // Citation keys should be listed in the order that they are appear in the document. + // Each key refers to a key in the bibliography dictionary. + this.citations = []; // [ "gregor2015draw", "mercier2011humans" ] + + + // + // Assigned from posts.csv + // + + // publishedDate: 2016-09-08T07:00:00.000Z, + // tags: [ 'rnn' ], + // distillPath: '2016/augmented-rnns', + // githubPath: 'distillpub/post--augmented-rnns', + // doiSuffix: 1, + + // + // Assigned from journal + // + this.journal = {}; + // journal: { + // "title": "Distill", + // "full_title": "Distill", + // "abbrev_title": "Distill", + // "url": "http://distill.pub", + // "doi": "10.23915/distill", + // "publisherName": "Distill Working Group", + // "publisherEmail": "admin@distill.pub", + // "issn": "2476-0757", + // "editors": [...], + // "committee": [...] + // } + // volume: 1, + // issue: 9, + this.publishedDate = new Date(); + + // + // Assigned from publishing process + // + + // githubCompareUpdatesUrl: 'https://github.com/distillpub/post--augmented-rnns/compare/1596e094d8943d2dc0ea445d92071129c6419c59...3bd9209e0c24d020f87cf6152dcecc6017cbc193', + // updatedDate: 2017-03-21T07:13:16.000Z, + // doi: '10.23915/distill.00001', + + } + + // Example: + // title: Demo Title Attention and Augmented Recurrent Neural Networks + // published: Jan 10, 2017 + // authors: + // - Chris Olah: + // - Shan Carter: http://shancarter.com + // affiliations: + // - Google Brain: + // - Google Brain: http://g.co/brain + + mergeFromYMLFrontmatter(data) { + this.title = data.title; + this.publishedDate = new Date(data.published); + this.description = data.description; + const zipped = data.authors.map( (author, index) => [author, data.affiliations[index]]); + this.authors = zipped.map( ([authorEntry, affiliationEntry]) => { + const author = new Author(); + + // try to get name and personal url + switch (typeof authorEntry) { + case 'object': + author.name = Object.keys(authorEntry)[0]; + author.personalURL = authorEntry[author.name]; + break; + case 'string': + author.name = authorEntry; + break; + default: + throw new Error('Invalid type in frontmatter author field: ' + authorEntry); + } + + // try to get affiliation name and affiliation url + switch (typeof affiliationEntry) { + case 'object': + author.affiliation = Object.keys(affiliationEntry)[0]; + author.affiliationURL = affiliationEntry[author.affiliation]; + break; + case 'string': + author.affiliation = affiliationEntry; + break; + default: + throw new Error('Invalid type in frontmatter affiliation field: ' + affiliationEntry); + } + + return author; + }); + } + + // + // Computed Properties + // + + // 'http://distill.pub/2016/augmented-rnns', + set url(value) { + this._url = value; + } + get url() { + if (this._url) { + return this._url; + } else if (this.distillPath && this.journal.url) { + return this.journal.url + '/' + this.distillPath; + } else if (this.journal.url) { + return this.journal.url; + } + } + + // 'https://github.com/distillpub/post--augmented-rnns', + get githubUrl() { + return 'https://github.com/' + this.githubPath; + } + + // TODO resolve differences in naming of URL/Url/url. + // 'http://distill.pub/2016/augmented-rnns/thumbnail.jpg', + set previewURL(value) { + this._previewURL = value; + } + get previewURL() { + return this._previewURL ? this._previewURL : this.url + '/thumbnail.jpg'; + } + + // 'Thu, 08 Sep 2016 00:00:00 -0700', + get publishedDateRFC() { + return RFC(this.publishedDate); + } + + // 'Thu, 08 Sep 2016 00:00:00 -0700', + get updatedDateRFC() { + return RFC(this.updatedDate); + } + + // 2016, + get publishedYear() { + return this.publishedDate.getFullYear(); + } + + // 'Sept', + get publishedMonth() { + return months[this.publishedDate.getMonth()]; + } + + // 8, + get publishedDay() { + return this.publishedDate.getDate(); + } + + // '09', + get publishedMonthPadded() { + return zeroPad(this.publishedDate.getMonth() + 1); + } + + // '08', + get publishedDayPadded() { + return zeroPad(this.publishedDate.getDate()); + } + + // 'Olah & Carter', + get concatenatedAuthors() { + if (this.authors.length > 2) { + return this.authors[0].lastName + ', et al.'; + } else if (this.authors.length === 2) { + return this.authors[0].lastName + ' & ' + this.authors[1].lastName; + } else if (this.authors.length === 1) { + return this.authors[0].lastName; + } + } + + // 'Olah, Chris and Carter, Shan', + get bibtexAuthors() { + return this.authors.map(author => { + return author.lastName + ', ' + author.firstName; + }).join(' and '); + } + + // 'olah2016attention' + get slug() { + let slug = ''; + if (this.authors.length) { + slug += this.authors[0].lastName.toLowerCase(); + slug += this.publishedYear; + slug += this.title.split(' ')[0].toLowerCase(); + } + return slug || 'Untitled'; + } + + get bibliographyEntries() { + return new Map(this.citations.map( citationKey => { + const entry = this.bibliography.get(citationKey); + return [citationKey, entry]; + })); + } + +} + +function author_string(ent, template, sep, finalSep){ + var names = ent.author.split(' and '); + let name_strings = names.map(name => { + name = name.trim(); + if (name.indexOf(',') != -1){ + var last = name.split(',')[0].trim(); + var firsts = name.split(',')[1]; + } else { + var last = name.split(' ').slice(-1)[0].trim(); + var firsts = name.split(' ').slice(0,-1).join(' '); + } + var initials = ''; + if (firsts != undefined) { + initials = firsts.trim().split(' ').map(s => s.trim()[0]); + initials = initials.join('.')+'.'; + } + return template.replace('${F}', firsts) + .replace('${L}', last) + .replace('${I}', initials); + }); + if (names.length > 1) { + var str = name_strings.slice(0, names.length-1).join(sep); + str += (finalSep || sep) + name_strings[names.length-1]; + return str; + } else { + return name_strings[0]; + } +} + +function venue_string(ent) { + var cite = (ent.journal || ent.booktitle || ''); + if ('volume' in ent){ + var issue = ent.issue || ent.number; + issue = (issue != undefined)? '('+issue+')' : ''; + cite += ', Vol ' + ent.volume + issue; + } + if ('pages' in ent){ + cite += ', pp. ' + ent.pages; + } + if (cite != '') cite += '. '; + if ('publisher' in ent){ + cite += ent.publisher; + if (cite[cite.length-1] != '.') cite += '.'; + } + return cite; +} + +function link_string(ent){ + if ('url' in ent){ + var url = ent.url; + var arxiv_match = (/arxiv\.org\/abs\/([0-9\.]*)/).exec(url); + if (arxiv_match != null){ + url = `http://arxiv.org/pdf/${arxiv_match[1]}.pdf`; + } + + if (url.slice(-4) == '.pdf'){ + var label = 'PDF'; + } else if (url.slice(-5) == '.html') { + var label = 'HTML'; + } + return `  [${label||'link'}]`; + }/* else if ("doi" in ent){ + return `  [DOI]`; + }*/ else { + return ''; + } +} +function doi_string(ent, new_line){ + if ('doi' in ent) { + return `${new_line?'
':''} DOI: ${ent.doi}`; + } else { + return ''; + } +} + +function bibliography_cite(ent, fancy){ + if (ent){ + var cite = '' + ent.title + ' '; + cite += link_string(ent) + '
'; + cite += author_string(ent, '${L}, ${I}', ', ', ' and '); + if (ent.year || ent.date){ + cite += ', ' + (ent.year || ent.date) + '. '; + } else { + cite += '. '; + } + cite += venue_string(ent); + cite += doi_string(ent); + return cite; + /*var cite = author_string(ent, "${L}, ${I}", ", ", " and "); + if (ent.year || ent.date){ + cite += ", " + (ent.year || ent.date) + ". " + } else { + cite += ". " + } + cite += "" + ent.title + ". "; + cite += venue_string(ent); + cite += doi_string(ent); + cite += link_string(ent); + return cite*/ + } else { + return '?'; + } +} + +function hover_cite(ent){ + if (ent){ + var cite = ''; + cite += '' + ent.title + ''; + cite += link_string(ent); + cite += '
'; + + var a_str = author_string(ent, '${I} ${L}', ', ') + '.'; + var v_str = venue_string(ent).trim() + ' ' + ent.year + '. ' + doi_string(ent, true); + + if ((a_str+v_str).length < Math.min(40, ent.title.length)) { + cite += a_str + ' ' + v_str; + } else { + cite += a_str + '
' + v_str; + } + return cite; + } else { + return '?'; + } +} + + +//https://scholar.google.com/scholar?q=allintitle%3ADocument+author%3Aolah + +function make_hover_css(pos) { + const pretty = window.innerWidth > 600; + const padding = pretty? 18 : 12; + const outer_padding = pretty ? 18 : 0; + const bbox = document.querySelector('body').getBoundingClientRect(); + let left = pos[0] - bbox.left, top = pos[1] - bbox.top; + let width = Math.min(window.innerWidth-2*outer_padding, 648); + left = Math.min(left, window.innerWidth-width-outer_padding); + width = width - 2 * padding; + return (`position: absolute; + background-color: #FFF; + opacity: 0.95; + max-width: ${width}px; + top: ${top}px; + left: ${left}px; + border: 1px solid rgba(0, 0, 0, 0.25); + padding: ${padding}px; + border-radius: ${pretty? 3 : 0}px; + box-shadow: 0px 2px 10px 2px rgba(0, 0, 0, 0.2); + z-index: ${1e6};`); +} + +class HoverBox { + + constructor(contentHTML, triggerElement) { + this.visible = false; + // div hold teh contents of the box that will become visible + this.div = contentHTML; + this.bindDivEvents(this.div); + // triggerElement holds the element that needs to be hovered etc to show contents + this.triggerElement = triggerElement; + this.bindTriggerEvents(this.triggerElement); + this.hide(); + } + + bindDivEvents(node) { + // For mice, same behavior as hovering on links + this.div.addEventListener('mouseover', () => { + if (!this.visible) this.showAtNode(node); + this.stopTimeout(); + }); + this.div.addEventListener('mouseout', () => { + this.extendTimeout(250); + }); + // Don't trigger body touchstart event when touching within box + this.div.addEventListener('touchstart', (event) => { + event.stopPropagation(); + }, {passive: true}); + // Close box when touching outside box + document.body.addEventListener('touchstart', () => { + this.hide(); + }, {passive: true}); + } + + bindTriggerEvents(node) { + node.addEventListener('mouseover', () => { + if (!this.visible) { + this.showAtNode(node); + } + this.stopTimeout(); + }); + + node.addEventListener('mouseout', () => { + this.extendTimeout(250); + }); + + node.addEventListener('touchstart', (event) => { + if (this.visible) { + this.hide(); + } else { + this.showAtNode(node); + } + // Don't trigger body touchstart event when touching link + event.stopPropagation(); + }, {passive: true}); + } + + show(position) { + this.visible = true; + const css = make_hover_css(position); + this.div.setAttribute('style', css ); + } + + showAtNode(node) { + const bbox = node.getBoundingClientRect(); + this.show([bbox.right, bbox.bottom]); + } + + hide() { + this.visible = false; + this.div.setAttribute('style', 'display:none'); + this.stopTimeout(); + } + + stopTimeout() { + if (this.timeout) { + clearTimeout(this.timeout); + } + } + + extendTimeout(time) { + this.stopTimeout(); + this.timeout = setTimeout(() => { + this.hide(); + }, time); + } + +} + +const T$4 = Template('d-cite', ` -